Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proxy #127

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,11 @@ def loder(master: LanchLauncher):

config_migrate()

if AppConfig.DATA.proxy_http.get() != "":
os.environ["HTTP_PROXY"] = AppConfig.DATA.proxy_http.get()
if AppConfig.DATA.proxy_https.get() != "":
os.environ["HTTPS_PROXY"] = AppConfig.DATA.proxy_https.get()
if AppConfig.DATA.proxy_socks.get() != "":
os.environ["SOCKS_PROXY"] = AppConfig.DATA.proxy_socks.get()
if AppConfig.DATA.dmm_proxy_http.get() != "":
DgpSessionV2.PROXY["http"] = AppConfig.DATA.dmm_proxy_http.get()
if AppConfig.DATA.dmm_proxy_https.get() != "":
DgpSessionV2.PROXY["https"] = AppConfig.DATA.dmm_proxy_https.get()
if AppConfig.DATA.dmm_proxy_socks.get() != "":
DgpSessionV2.PROXY["socks"] = AppConfig.DATA.dmm_proxy_socks.get()
if AppConfig.DATA.proxy_all.get() != "":
os.environ["ALL_PROXY"] = AppConfig.DATA.proxy_all.get()
if AppConfig.DATA.dmm_proxy_all.get() != "":
DgpSessionV2.PROXY["http"] = AppConfig.DATA.dmm_proxy_all.get()
DgpSessionV2.PROXY["https"] = AppConfig.DATA.dmm_proxy_all.get()

ctk.set_default_color_theme(str(AssetsPathConfig.THEMES.joinpath(AppConfig.DATA.theme.get()).with_suffix(".json")))
ctk.set_appearance_mode(AppConfig.DATA.appearance_mode.get())
Expand Down
8 changes: 2 additions & 6 deletions DMMGamePlayerFastLauncher/models/setting_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ class SettingData(VariableBase):
last_version: StringVar = field(default_factory=lambda: StringVar(value="v0.0.0")) # field(default_factory=lambda: StringVar(value=Env.VERSION))
dmm_game_player_program_folder: PathVar = field(default_factory=lambda: PathVar(value=Env.DEFAULT_DMM_GAME_PLAYER_PROGURAM_FOLDER))
dmm_game_player_data_folder: PathVar = field(default_factory=lambda: PathVar(value=Env.DEFAULT_DMM_GAME_PLAYER_DATA_FOLDER))
proxy_http: StringVar = field(default_factory=StringVar)
proxy_https: StringVar = field(default_factory=StringVar)
proxy_socks: StringVar = field(default_factory=StringVar)
dmm_proxy_http: StringVar = field(default_factory=StringVar)
dmm_proxy_https: StringVar = field(default_factory=StringVar)
dmm_proxy_socks: StringVar = field(default_factory=StringVar)
proxy_all: StringVar = field(default_factory=StringVar)
dmm_proxy_all: StringVar = field(default_factory=StringVar)
lang: StringVar = field(default_factory=lambda: StringVar(value=get_default_locale()[0]))
theme: StringVar = field(default_factory=lambda: StringVar(value="blue"))
appearance_mode: StringVar = field(default_factory=lambda: StringVar(value="dark"))
Expand Down
11 changes: 4 additions & 7 deletions DMMGamePlayerFastLauncher/tab/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ def create(self):
OptionMenuComponent(self, text=i18n.t("app.setting.theme"), values=self.theme, variable=self.data.theme).create()
OptionMenuComponent(self, text=i18n.t("app.setting.appearance"), values=["light", "dark", "system"], variable=self.data.appearance_mode).create()

EntryComponent(self, text=i18n.t("app.setting.proxy_http"), variable=self.data.proxy_http).create()
EntryComponent(self, text=i18n.t("app.setting.proxy_https"), variable=self.data.proxy_https).create()
EntryComponent(self, text=i18n.t("app.setting.proxy_socks"), variable=self.data.proxy_socks).create()

EntryComponent(self, text=i18n.t("app.setting.dmm_proxy_http"), variable=self.data.dmm_proxy_http).create()
EntryComponent(self, text=i18n.t("app.setting.dmm_proxy_https"), variable=self.data.dmm_proxy_https).create()
EntryComponent(self, text=i18n.t("app.setting.dmm_proxy_socks"), variable=self.data.dmm_proxy_socks).create()
text = i18n.t("app.setting.proxy_all")
EntryComponent(self, text=text, tooltip=i18n.t("app.setting.proxy_all_tooltip"), variable=self.data.proxy_all).create()
text = i18n.t("app.setting.dmm_proxy_all")
EntryComponent(self, text=text, tooltip=i18n.t("app.setting.dmm_proxy_all_tooltip"), variable=self.data.dmm_proxy_all).create()

PaddingComponent(self, height=5).create()
CTkLabel(self, text=i18n.t("app.setting.window_scaling")).pack(anchor=ctk.W)
Expand Down
22 changes: 15 additions & 7 deletions assets/i18n/app.en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,21 @@ en_US:
theme: Theme
appearance: Appearance

proxy_http: HTTP Proxy
proxy_https: HTTPS Proxy
proxy_socks: SOCKS Proxy

dmm_proxy_http: DMM HTTP Proxy
dmm_proxy_https: DMM HTTPS Proxy
dmm_proxy_socks: DMM SOCKS Proxy
proxy_all: Proxy
proxy_all_tooltip: |-
Set up the game's proxy.
Example: http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

dmm_proxy_all: DMM Proxy
dmm_proxy_all_tooltip: |-
Set up DMM's proxy.
Example: http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

window_scaling: Window Scaling
debug_window: Show Debug Window
Expand Down
22 changes: 15 additions & 7 deletions assets/i18n/app.ja_JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,21 @@ ja_JP:
theme: テーマ
appearance: 外観

proxy_http: HTTPプロキシ
proxy_https: HTTPSプロキシ
proxy_socks: SOCKSプロキシ

dmm_proxy_http: DMM HTTPプロキシ
dmm_proxy_https: DMM HTTPSプロキシ
dmm_proxy_socks: DMM SOCKSプロキシ
proxy_all: プロキシ
proxy_all_tooltip: |-
ゲームのプロキシを設定します。
例: http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

dmm_proxy_all: DMM プロキシ
dmm_proxy_all_tooltip: |-
DMMのプロキシを設定します。
例: http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

window_scaling: ウィンドウの拡大率
debug_window: デバッグウィンドウを表示する
Expand Down
22 changes: 15 additions & 7 deletions assets/i18n/app.zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,21 @@ zh_CN:
theme: 主题
appearance: 外观

proxy_http: HTTP 代理
proxy_https: HTTPS 代理
proxy_socks: SOCKS 代理

dmm_proxy_http: DMM HTTP 代理
dmm_proxy_https: DMM HTTPS 代理
dmm_proxy_socks: DMM SOCKS 代理
proxy_all: 代理
proxy_all_tooltip: |-
设置游戏的代理。
例子:http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

dmm_proxy_all: DMM 代理
dmm_proxy_all_tooltip: |-
设置 DMM 的代理。
例子:http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

window_scaling: 窐口缩放比例
debug_window: 显示调试窗口
Expand Down
22 changes: 15 additions & 7 deletions assets/i18n/app.zh_TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,21 @@ zh_TW:
theme: 主題
appearance: 外貌

proxy_http: HTTP 代理
proxy_https: HTTPS 代理
proxy_socks: SOCKS 代理

dmm_proxy_http: DMM HTTP 代理
dmm_proxy_https: DMM HTTPS 代理
dmm_proxy_socks: DMM SOCKS 代理
proxy_all: 代理
proxy_all_tooltip: |-
設定遊戲的代理。
例子:http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

dmm_proxy_all: DMM 代理
dmm_proxy_all_tooltip: |-
設定 DMM 的代理。
例子:http://127.0.0.1:80
https://127.0.0.1:443
socks5://127.0.0.1:1080
socks5://user:pass@127.0.0.1:1080

window_scaling: 窐口縮放比例
debug_window: 顯示除錯窗口
Expand Down