From 632c077c3d472cced8cd728f9a03673daaefdf97 Mon Sep 17 00:00:00 2001 From: kanasimi Date: Wed, 13 Dec 2023 05:58:39 +0800 Subject: [PATCH] fix https://github.com/lovelyCARDINAL/mgp-cewbot/issues/10 --- wiki configuration.sample.js | 1 + wiki loader.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/wiki configuration.sample.js b/wiki configuration.sample.js index 915f671..1cf793f 100644 --- a/wiki configuration.sample.js +++ b/wiki configuration.sample.js @@ -36,6 +36,7 @@ login_options_for_project.zhmoegirl = { // 移動端網址的防火牆允許的單位時間內請求數較多,故使用mzh.moegirl.org.cn運行機器人能夠降低撞上防火牆的機率。 API_URL : 'https://mzh.moegirl.org.cn/api.php', site_name : 'zhmoegirl', + user_agent : 'customized user agent', user_name : 'Main account name@bot name', // 設定頁面與記錄頁面所參考的使用者名稱。 @see "wiki loader.js" // user_name_referenced : '', diff --git a/wiki loader.js b/wiki loader.js index ba9f28f..3002cad 100644 --- a/wiki loader.js +++ b/wiki loader.js @@ -218,6 +218,10 @@ function login_options_of_API_URL(API_URL) { // console.trace(login_options); } + if (login_options.user_agent) { + CeL.get_URL.default_user_agent = login_options.user_agent; + } + return login_options; }