feat(dashboard): enhance dashboard settings UI and add item management scripts
- Updated the dashboard settings partial to include a semi-transparent background for better visibility. - Introduced a new script for validating the syntax of dashboard item scripts, ensuring better error handling and diagnostics. - Added a comprehensive JavaScript file for managing dashboard items, including fetching, rendering, editing, and deleting items. - Implemented various utility functions for handling alerts, rewards, and modal interactions within the item management interface. - Created temporary scripts for debugging and parsing errors in item scripts, aiding in development and maintenance.
This commit is contained in:
20
tmp_acorn.js
Normal file
20
tmp_acorn.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const fs = require('fs'); const acorn = require('acorn');
|
||||
const path = '/home/shni/amayo/amayo/src/server/views/partials/dashboard/dashboard_items.ejs';
|
||||
const s = fs.readFileSync(path,'utf8');
|
||||
const m = s.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
||||
if(!m){ console.error('NO_SCRIPT'); process.exit(2);} const src = m[1];
|
||||
try{
|
||||
acorn.parse(src, {ecmaVersion:2020});
|
||||
console.log('ACORN OK');
|
||||
}catch(err){
|
||||
console.error('ACORN ERR', err.message);
|
||||
if(err.loc){
|
||||
const lines = src.split('\n');
|
||||
const L = err.loc.line; const C = err.loc.column;
|
||||
console.error('at line', L, 'col', C);
|
||||
const start = Math.max(0, L-4); const end = Math.min(lines.length, L+2);
|
||||
for(let i=start;i<end;i++){
|
||||
const n = i+1; console.error((n===L? '>' : ' ') + n.toString().padStart(4,' ') + '| ' + lines[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user