diff --git a/LunaTranslator/LunaTranslator/myutils/proxy.py b/LunaTranslator/LunaTranslator/myutils/proxy.py index c787bdeb..ebde48db 100644 --- a/LunaTranslator/LunaTranslator/myutils/proxy.py +++ b/LunaTranslator/LunaTranslator/myutils/proxy.py @@ -22,11 +22,7 @@ def _getproxy(): def getproxy(pair=None): - if ( - pair is None - or ("useproxy" not in globalconfig[pair[0]][pair[1]]) - or globalconfig[pair[0]][pair[1]]["useproxy"] - ): + if pair is None or globalconfig[pair[0]][pair[1]].get("useproxy", True): return _getproxy() else: return {"https": None, "http": None} diff --git a/LunaTranslator/LunaTranslator/translator/basetranslator.py b/LunaTranslator/LunaTranslator/translator/basetranslator.py index 5eda042c..79a79ede 100644 --- a/LunaTranslator/LunaTranslator/translator/basetranslator.py +++ b/LunaTranslator/LunaTranslator/translator/basetranslator.py @@ -88,6 +88,8 @@ class basetrans(commonbase): using_gpt_dict = False def level2init(self): + if self.transtype == "offline": + globalconfig["fanyi"][self.typename]["useproxy"] = False self.multiapikeycurrentidx = -1 self.queue = PriorityQueue() self.sqlqueue = None