Spaces:
Sleeping
Sleeping
Download backend/scripts/admin.cjs from kishankrish19/Chat: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/scripts/admin.cjs
- Command line
-
hf download hf://spaces/kishankrish19/Chat/backend/scripts/admin.cjs
-
curl -L -o admin.cjs https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/scripts/admin.cjs
760 Bytes
| // Local operator command. Never exposed through HTTP; no default password. | |
| require('dotenv').config({quiet:true}); | |
| const {Store}=require('../dist/core/store'); | |
| const email=process.argv[2]?.trim().toLowerCase(); | |
| if(!email){console.error('Usage: npm run admin -- existing-account@example.com');process.exit(1);} | |
| const store=new Store(); | |
| try { | |
| const user=store.list('users').find(u=>u.email===email); | |
| if(!user)throw new Error('Register this account first, then run this command on the server.'); | |
| store.put('users',{...user,account_type:'admin'}); | |
| console.log('Administrator role granted to the existing account. Sign in again to refresh the interface.'); | |
| } catch(error){console.error(error.message);process.exitCode=1;} | |
| finally{store.onModuleDestroy();} | |