fix(ui): use &action= in hub proxy URL and resolve element IDs in note()
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-25 02:42:37
Commitfd8d4cfa
Parents970cf729
Changed files
src/ui.html+4−2■■■■■
src/ui_html.h+4−2■■■■■
2 files+8−4
Diff
src/ui.html+4−2■■■■■
index 5598c79..f981268 100644
--- a/src/ui.html
+++ b/src/ui.html
@@ -187,8 +187,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||
187187 * Calling /plugins?plugin= on the node returns the discovery list, not us. */
188188 var HUB=q.get('plugin')||'';
189189 function url(action,extra){
190- return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_codex_login')+
191- '?action='+encodeURIComponent(action)+
190+ return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&action=':'/plugin_codex_login?action=')+
191+ encodeURIComponent(action)+
192192 (extra?('&'+extra):'')+
193193 (acct?'&account='+encodeURIComponent(acct):'')+
194194 (node?'&node='+encodeURIComponent(node):'')+
@@ -212,6 +212,8 @@ function toast(msg){
212212 clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);
213213 }
214214 function note(el,msg,kind){
215+ if(typeof el==='string')el=$(el);
216+ if(!el)return;
215217 el.textContent=msg||'';
216218 el.className='note'+(msg?' show '+(kind||''):'');
217219 }
src/ui_html.h+4−2■■■■■
index 45614df..8b1ac79 100644
--- a/src/ui_html.h
+++ b/src/ui_html.h
@@ -192,8 +192,8 @@ static const char *UI_HTML =
192192 " * Calling /plugins?plugin= on the node returns the discovery list, not us. */\n"
193193 "var HUB=q.get('plugin')||'';\n"
194194 "function url(action,extra){\n"
195- " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_codex_login')+\n"
196- " '?action='+encodeURIComponent(action)+\n"
195+ " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&action=':'/plugin_codex_login?action=')+\n"
196+ " encodeURIComponent(action)+\n"
197197 " (extra?('&'+extra):'')+\n"
198198 " (acct?'&account='+encodeURIComponent(acct):'')+\n"
199199 " (node?'&node='+encodeURIComponent(node):'')+\n"
@@ -217,6 +217,8 @@ static const char *UI_HTML =
217217 " clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);\n"
218218 "}\n"
219219 "function note(el,msg,kind){\n"
220+ " if(typeof el==='string')el=$(el);\n"
221+ " if(!el)return;\n"
220222 " el.textContent=msg||'';\n"
221223 " el.className='note'+(msg?' show '+(kind||''):'');\n"
222224 "}\n"
223225
src/ui.html+4−2■■■■■
index 5598c79..f981268 100644index 5598c79..f981268 100644
--- a/src/ui.html--- a/src/ui.html
+++ b/src/ui.html+++ b/src/ui.html
@@ -187,8 +187,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||@@ -187,8 +187,8 @@ var pwd=q.get('pwd')||(node&&localStorage.getItem('bot_pwd_'+node))||
187 * Calling /plugins?plugin= on the node returns the discovery list, not us. */187 * Calling /plugins?plugin= on the node returns the discovery list, not us. */
188 var HUB=q.get('plugin')||'';188 var HUB=q.get('plugin')||'';
189 function url(action,extra){189 function url(action,extra){
190- return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_codex_login')+190+ return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&action=':'/plugin_codex_login?action=')+
191- '?action='+encodeURIComponent(action)+191+ encodeURIComponent(action)+
192 (extra?('&'+extra):'')+192 (extra?('&'+extra):'')+
193 (acct?'&account='+encodeURIComponent(acct):'')+193 (acct?'&account='+encodeURIComponent(acct):'')+
194 (node?'&node='+encodeURIComponent(node):'')+194 (node?'&node='+encodeURIComponent(node):'')+
@@ -212,6 +212,8 @@ function toast(msg){@@ -212,6 +212,8 @@ function toast(msg){
212 clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);212 clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);
213 }213 }
214 function note(el,msg,kind){214 function note(el,msg,kind){
215+ if(typeof el==='string')el=$(el);
216+ if(!el)return;
215 el.textContent=msg||'';217 el.textContent=msg||'';
216 el.className='note'+(msg?' show '+(kind||''):'');218 el.className='note'+(msg?' show '+(kind||''):'');
217 }219 }
src/ui_html.h+4−2■■■■■
index 45614df..8b1ac79 100644index 45614df..8b1ac79 100644
--- a/src/ui_html.h--- a/src/ui_html.h
+++ b/src/ui_html.h+++ b/src/ui_html.h
@@ -192,8 +192,8 @@ static const char *UI_HTML =@@ -192,8 +192,8 @@ static const char *UI_HTML =
192 " * Calling /plugins?plugin= on the node returns the discovery list, not us. */\n"192 " * Calling /plugins?plugin= on the node returns the discovery list, not us. */\n"
193 "var HUB=q.get('plugin')||'';\n"193 "var HUB=q.get('plugin')||'';\n"
194 "function url(action,extra){\n"194 "function url(action,extra){\n"
195- " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB):'/plugin_codex_login')+\n"195+ " return (HUB?'/plugins?plugin='+encodeURIComponent(HUB)+'&action=':'/plugin_codex_login?action=')+\n"
196- " '?action='+encodeURIComponent(action)+\n"196+ " encodeURIComponent(action)+\n"
197 " (extra?('&'+extra):'')+\n"197 " (extra?('&'+extra):'')+\n"
198 " (acct?'&account='+encodeURIComponent(acct):'')+\n"198 " (acct?'&account='+encodeURIComponent(acct):'')+\n"
199 " (node?'&node='+encodeURIComponent(node):'')+\n"199 " (node?'&node='+encodeURIComponent(node):'')+\n"
@@ -217,6 +217,8 @@ static const char *UI_HTML =@@ -217,6 +217,8 @@ static const char *UI_HTML =
217 " clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);\n"217 " clearTimeout(t._t);t._t=setTimeout(function(){t.classList.remove('show');},2200);\n"
218 "}\n"218 "}\n"
219 "function note(el,msg,kind){\n"219 "function note(el,msg,kind){\n"
220+ " if(typeof el==='string')el=$(el);\n"
221+ " if(!el)return;\n"
220 " el.textContent=msg||'';\n"222 " el.textContent=msg||'';\n"
221 " el.className='note'+(msg?' show '+(kind||''):'');\n"223 " el.className='note'+(msg?' show '+(kind||''):'');\n"
222 "}\n"224 "}\n"
223225