From d0e909939b62b6d9afcc4910e88c04d9c54f8bd1 Mon Sep 17 00:00:00 2001 From: triwinds Date: Sun, 26 Mar 2023 16:06:25 +0800 Subject: [PATCH 01/15] specify dns server for aria2 only if DoH is enabled --- module/downloader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/downloader.py b/module/downloader.py index 67f8f4e..0773e33 100644 --- a/module/downloader.py +++ b/module/downloader.py @@ -39,8 +39,9 @@ def init_aria2(): '--rpc-secret', '123456', '--log', 'aria2.log', '--log-level=info', f'--stop-with-process={os.getpid()}'] if config.setting.download.disableAria2Ipv6: cli.append('--disable-ipv6=true') - cli.append('--async-dns-server=223.5.5.5,119.29.29.29') - else: + if config.setting.network.useDoh: + cli.append('--async-dns-server=223.5.5.5,119.29.29.29') + elif config.setting.network.useDoh: cli.append('--async-dns-server=2400:3200::1,2402:4e00::,223.5.5.5,119.29.29.29') logger.info(f'aria2 cli: {cli}') aria2_process = subprocess.Popen(cli, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT, startupinfo=st_inf) From 3603f9afcbafdd1bfcd51fb1e061c67d2d1fa3a5 Mon Sep 17 00:00:00 2001 From: triwinds Date: Wed, 29 Mar 2023 00:23:06 +0800 Subject: [PATCH 02/15] update ua in durable_cache_session --- utils/network.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/network.py b/utils/network.py index a418c43..c751e34 100644 --- a/utils/network.py +++ b/utils/network.py @@ -41,6 +41,7 @@ def get_durable_cache_session(): global _durable_cache_session if not _durable_cache_session: _durable_cache_session = requests_cache.CachedSession(cache_control=True) + _durable_cache_session.headers.update({'User-Agent': user_agent}) _durable_cache_session.mount('https://cdn.jsdelivr.net', HTTPAdapter(max_retries=5)) _durable_cache_session.mount('https://nsarchive.e6ex.com', HTTPAdapter(max_retries=5)) origin_get = _durable_cache_session.get From 19861b917676558221b2cc432b73b4302284931f Mon Sep 17 00:00:00 2001 From: triwinds Date: Tue, 11 Apr 2023 21:22:55 +0800 Subject: [PATCH 03/15] show yuzu commit logs --- api/yuzu_api.py | 9 +++++++++ module/yuzu.py | 26 +++++++++++++++++++++++++- vue/src/pages/Yuzu.vue | 32 +++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/api/yuzu_api.py b/api/yuzu_api.py index 2c42817..3ccdd48 100644 --- a/api/yuzu_api.py +++ b/api/yuzu_api.py @@ -99,3 +99,12 @@ def get_all_yuzu_release_versions(): return success_response(get_all_yuzu_release_versions(config.yuzu.branch)) except Exception as e: return exception_response(e) + + +@eel.expose +def get_yuzu_commit_logs(): + from module.yuzu import get_yuzu_commit_logs + try: + return success_response(get_yuzu_commit_logs()) + except Exception as e: + return exception_response(e) diff --git a/module/yuzu.py b/module/yuzu.py index 7924dd5..e3b3818 100644 --- a/module/yuzu.py +++ b/module/yuzu.py @@ -274,6 +274,29 @@ def update_yuzu_path(new_yuzu_path: str): dump_config() +def get_yuzu_commit_logs(): + from utils.network import request_github_api + resp = request_github_api('https://api.github.com/repos/yuzu-emu/yuzu/commits') + markdown = '# Recent commits of yuzu-emu/yuzu\n\n' + last_date = '' + for commit_info in resp: + commit_date = commit_info['commit']['author']['date'].split('T')[0] + if last_date != commit_date: + markdown += f'## {commit_date}\n\n' + last_date = commit_date + msg: str = commit_info['commit']['message'] + lines = msg.splitlines() + if len(lines) > 1: + content = '\n\n'.join(lines[1:]) + markdown += f"""
{lines[0]} +{content} +
\n\n""" + else: + markdown += f' - {lines[0]}\n\n' + # print(markdown) + return markdown + + if __name__ == '__main__': # install_yuzu('1220', 'mainline') # install_firmware_to_yuzu() @@ -281,7 +304,8 @@ def update_yuzu_path(new_yuzu_path: str): # print(detect_yuzu_version()) # print(get_yuzu_user_path().joinpath(r'nand\system\Contents\registered')) # open_yuzu_keys_folder() - print(get_yuzu_load_path()) + # print(get_yuzu_load_path()) # from utils.common import decode_yuzu_path # test_str = r'D:/Yuzu/user\'/\x65b0\x5efa\x6587\x4ef6\x5939/' # print(decode_yuzu_path(test_str)) + get_yuzu_commit_logs() diff --git a/vue/src/pages/Yuzu.vue b/vue/src/pages/Yuzu.vue index 4c4385a..c30d22a 100644 --- a/vue/src/pages/Yuzu.vue +++ b/vue/src/pages/Yuzu.vue @@ -61,6 +61,19 @@ {{ latestYuzuVersion }} + + + + @@ -131,16 +144,23 @@