From e900699adf011870ba6bc7dbdad3c2ddad58faa9 Mon Sep 17 00:00:00 2001 From: KirillDE Date: Sun, 13 Apr 2025 12:03:10 +0200 Subject: [PATCH 1/2] local storage parameters to skip the confirmation dialog and adjust the rate limiter --- README.md | 12 ++++++++++++ creator-plugin-bannergress.user.js | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ecf3571..4666ec6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,19 @@ This plugin syncs missions from the mission creator website to Bannergress. It d The source file creator-plugin-bannergress.user.js can directly be used as plugin in Tampermonkey or IITC button, no compilation required. +## Power-users +Usually the default settings are fine for 99% of use cases, but some users want more. +Adding following to the local storage will skip the confirmation and set the delay between uploads to 500ms: + +| key | value | +|-------------------------------|-------| +| bannergress-skip-confirmation | 1 | +| bannergress-sync-delay | 500 | + +*Caution! These changes may increase the load to the mission creator servers and result unknown restrictions!* + ## Known limitations * The plugin does not sync mission status for missions which have been permanently deleted, since they are not in the user list anymore. * The plugin does not sync mission details when mission details are available in Bannergress. + diff --git a/creator-plugin-bannergress.user.js b/creator-plugin-bannergress.user.js index 1639be2..029b6cb 100644 --- a/creator-plugin-bannergress.user.js +++ b/creator-plugin-bannergress.user.js @@ -90,7 +90,9 @@ try { ui.progress(`Requesting missions for banner ${slug}...`); const missionIds = await getMissionIds(slug); - if (await ui.confirm(`Sync ${missionIds.length} missions with ${bannergressTitle}?`)) { + const skipConfirmation = window.localStorage.getItem("bannergress-skip-confirmation"); + const confirmed = (skipConfirmation === "true" || skipConfirmation === "1") || await ui.confirm(`Sync ${missionIds.length} missions with ${bannergressTitle}?`); + if (confirmed) { ui.progress("Logging in..."); const user = await getUser(); await refreshMissions(ui, user, missionIds); @@ -129,7 +131,12 @@ async function rateLimit(ui) { ui.progress(`Waiting for next step...`); await rateLimiter; - rateLimiter = sleep(1000); + let delay = parseInt(window.localStorage.getItem("bannergress-sync-delay") || "1000", 10); + if (isNaN(delay) || delay < 0) { + console.warn("[Bannergress Plugin] Invalid bannergress-sync-delay, falling back to 1000ms"); + delay = 1000; + } + rateLimiter = sleep(delay); } From 797823759c4c6eeaa6d9941b734df535317a491d Mon Sep 17 00:00:00 2001 From: KirillDE Date: Sun, 13 Apr 2025 20:20:48 +0200 Subject: [PATCH 2/2] increased plugin version --- creator-plugin-bannergress.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creator-plugin-bannergress.user.js b/creator-plugin-bannergress.user.js index 029b6cb..dfacfda 100644 --- a/creator-plugin-bannergress.user.js +++ b/creator-plugin-bannergress.user.js @@ -4,7 +4,7 @@ // @author The Bannergress team // @match https://missions.ingress.com/* // @match https://bannergress.com/* -// @version 1.1 +// @version 1.2 // @namespace https://github.com/bannergress/creator-plugin // @updateURL https://bannergress.com/creator-plugin-bannergress.user.js // @downloadURL https://bannergress.com/creator-plugin-bannergress.user.js