Adopt @simpleworkjs/frontend's messages/modal/validate modules

Same swap as sso-manager-node/jump-host: vendored app.util.actionMessage/
actionConfirm replaced by @simpleworkjs/frontend's app.messages.action/
confirm (real HTML-escaping, toast fallback); vendored val.js replaced by
the package's app.validate.js.

proxy's host/target/hostname validation rules (mirrored from the backend's
utils/hostname_validate.js — wildcard DNS patterns, not something other
apps need) move to public/js/app.js, registered via $.validateSettings,
since they're proxy-specific and don't belong in the shared package's
generic rule set (eq/user/password/ip).

app.api/app.auth/app.pubsub/app.socket in app-base.js are untouched, same
reasoning as sso-manager-node's PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 13:39:01 -04:00
parent e770bbb41f
commit 0a659428dd
12 changed files with 122 additions and 295 deletions
+4 -4
View File
@@ -63,7 +63,7 @@
$(document).ready(function(){
app.api.get('user/me', function(error, data){
if(error) return app.util.actionMessage(error, $('#profile-card'), 'danger');
if(error) return app.messages.action(error, $('#profile-card'), 'danger');
renderProfile(data);
});
});
@@ -170,7 +170,7 @@
function tableAJAX(){
app.apiToken.list(function(error, data){
if(error) return app.util.actionMessage(error, $.scope.apiTokenCard.$this, 'danger');
if(error) return app.messages.action(error, $.scope.apiTokenCard.$this, 'danger');
$.scope.apiTokenCard.empty();
(data.results || []).forEach(function(token){
$.scope.apiTokenCard.push(processToken(token));
@@ -181,7 +181,7 @@
function revokeToken(id, name, btn){
if(!confirm('Revoke API token "' + name + '"? It stops working immediately.')) return;
app.apiToken.remove({id: id}, function(error, data){
if(error) return app.util.actionMessage(error, $(btn).closest('.card'), 'danger');
if(error) return app.messages.action(error, $(btn).closest('.card'), 'danger');
$.scope.apiTokenCard.remove('id', id);
});
}
@@ -189,7 +189,7 @@
function rotateToken(id, name, btn){
if(!confirm('Rotate API token "' + name + '"? The old token stops working immediately.')) return;
app.apiToken.rotate({id: id}, function(error, data){
if(error) return app.util.actionMessage(error, $(btn).closest('.card'), 'danger');
if(error) return app.messages.action(error, $(btn).closest('.card'), 'danger');
showSecret(data.token);
tableAJAX();
});