fix(ui): use &action= separator when proxied through bot hub
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-18 08:05:06
Commitb5ec2c15
Parentsa5b03f06
Changed files
src/ui.html+2−2■■■■
src/ui_html.h+2−2■■■■
tests/run.sh+1−0■
3 files+5−4
Diff
src/ui.html+2−2■■■■
index 4a15f36..9d356fa 100644
--- a/src/ui.html
+++ b/src/ui.html
@@ -162,8 +162,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||
162162 var HUB=q.get('plugin')||'';
163163
164164 function url(action,extra){
165- return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_google_quota')+
166- '?action='+encodeURIComponent(action)+
165+ return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&':'/plugin_google_quota?')+
166+ 'action='+encodeURIComponent(action)+
167167 (extra?('&'+extra):'')+
168168 (node?'&node='+encodeURIComponent(node):'')+
169169 (sid?'&id='+encodeURIComponent(sid):'')+
src/ui_html.h+2−2■■■■
index 87a7ad6..e0c2767 100644
--- a/src/ui_html.h
+++ b/src/ui_html.h
@@ -167,8 +167,8 @@ static const char *UI_HTML =
167167 "var HUB=q.get('plugin')||'';\n"
168168 "\n"
169169 "function url(action,extra){\n"
170- " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_google_quota')+\n"
171- " '?action='+encodeURIComponent(action)+\n"
170+ " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&':'/plugin_google_quota?')+\n"
171+ " 'action='+encodeURIComponent(action)+\n"
172172 " (extra?('&'+extra):'')+\n"
173173 " (node?'&node='+encodeURIComponent(node):'')+\n"
174174 " (sid?'&id='+encodeURIComponent(sid):'')+\n"
tests/run.sh+1−0■
index 6de407f..fc73f17 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -181,6 +181,7 @@ check "HTML emits Content-Type text/html" "Content-Type: text/html" "$HTML"
181181 check "HTML includes bot theme prepaint" "bot_theme" "$HTML"
182182 check "HTML includes theme handoff" "sx-theme-request" "$HTML"
183183 check "HTML uses two-route API helper" "plugin_google_quota" "$HTML"
184+check "HTML hub proxy URL uses &action= separator" "'/plugins?plugin='+encodeURIComponent(HUB)+'&'" "$HTML"
184185 check "HTML hides theme toggle in embed mode" "embed-hide" "$HTML"
185186 check_not "HTML loads no CDN script" "<script src=" "$HTML"
186187 check_not "HTML references no external host script" "cdnjs" "$HTML"
187188
src/ui.html+2−2■■■■
index 4a15f36..9d356fa 100644index 4a15f36..9d356fa 100644
--- a/src/ui.html--- a/src/ui.html
+++ b/src/ui.html+++ b/src/ui.html
@@ -162,8 +162,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||@@ -162,8 +162,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||
162 var HUB=q.get('plugin')||'';162 var HUB=q.get('plugin')||'';
163 163
164 function url(action,extra){164 function url(action,extra){
165- return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_google_quota')+165+ return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&':'/plugin_google_quota?')+
166- '?action='+encodeURIComponent(action)+166+ 'action='+encodeURIComponent(action)+
167 (extra?('&'+extra):'')+167 (extra?('&'+extra):'')+
168 (node?'&node='+encodeURIComponent(node):'')+168 (node?'&node='+encodeURIComponent(node):'')+
169 (sid?'&id='+encodeURIComponent(sid):'')+169 (sid?'&id='+encodeURIComponent(sid):'')+
src/ui_html.h+2−2■■■■
index 87a7ad6..e0c2767 100644index 87a7ad6..e0c2767 100644
--- a/src/ui_html.h--- a/src/ui_html.h
+++ b/src/ui_html.h+++ b/src/ui_html.h
@@ -167,8 +167,8 @@ static const char *UI_HTML =@@ -167,8 +167,8 @@ static const char *UI_HTML =
167 "var HUB=q.get('plugin')||'';\n"167 "var HUB=q.get('plugin')||'';\n"
168 "\n"168 "\n"
169 "function url(action,extra){\n"169 "function url(action,extra){\n"
170- " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_google_quota')+\n"170+ " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&':'/plugin_google_quota?')+\n"
171- " '?action='+encodeURIComponent(action)+\n"171+ " 'action='+encodeURIComponent(action)+\n"
172 " (extra?('&'+extra):'')+\n"172 " (extra?('&'+extra):'')+\n"
173 " (node?'&node='+encodeURIComponent(node):'')+\n"173 " (node?'&node='+encodeURIComponent(node):'')+\n"
174 " (sid?'&id='+encodeURIComponent(sid):'')+\n"174 " (sid?'&id='+encodeURIComponent(sid):'')+\n"
tests/run.sh+1−0■
index 6de407f..fc73f17 100755index 6de407f..fc73f17 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -181,6 +181,7 @@ check "HTML emits Content-Type text/html" "Content-Type: text/html" "$HTML"@@ -181,6 +181,7 @@ check "HTML emits Content-Type text/html" "Content-Type: text/html" "$HTML"
181 check "HTML includes bot theme prepaint" "bot_theme" "$HTML"181 check "HTML includes bot theme prepaint" "bot_theme" "$HTML"
182 check "HTML includes theme handoff" "sx-theme-request" "$HTML"182 check "HTML includes theme handoff" "sx-theme-request" "$HTML"
183 check "HTML uses two-route API helper" "plugin_google_quota" "$HTML"183 check "HTML uses two-route API helper" "plugin_google_quota" "$HTML"
184+check "HTML hub proxy URL uses &action= separator" "'/plugins?plugin='+encodeURIComponent(HUB)+'&'" "$HTML"
184 check "HTML hides theme toggle in embed mode" "embed-hide" "$HTML"185 check "HTML hides theme toggle in embed mode" "embed-hide" "$HTML"
185 check_not "HTML loads no CDN script" "<script src=" "$HTML"186 check_not "HTML loads no CDN script" "<script src=" "$HTML"
186 check_not "HTML references no external host script" "cdnjs" "$HTML"187 check_not "HTML references no external host script" "cdnjs" "$HTML"
187188