d6956395c8
Rename the whole project from CommGate to gsmnode and re-skin every surface onto the new signal-green + ink design system (Space Grotesk / IBM Plex Sans / JetBrains Mono, flat surfaces, two-arrow routing mark, lowercase gsm+node wordmark). - Web App + API panel: rewrite token layer, gn-* utilities, data-gsm-theme, new logo/favicon assets; both builds verified. - Phone App (Flutter): green theme, new mark/wordmark widgets, adaptive launcher icons; rename Android applicationId/package to app.gsmnode.phone; bump AGP to 8.6.0 and google_fonts to 8.1.0; debug APK build verified. - API Server (Go): panel routes, User-Agent, health service id, branding. - Home Assistant Plugin: rename integration domain sms_gateway to gsmnode (folder, DOMAIN, services, entity ids, classes); py_compile verified. - Update all READMEs; add .gitignore (excludes Design/, build artifacts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
// Creates a user in the PocketBase "users" collection to log in with.
|
|
//
|
|
// Usage (PowerShell):
|
|
// $env:POCKETBASE_URL="http://10.2.1.10:8028"
|
|
// $env:PB_ADMIN_EMAIL="admin@example.com"
|
|
// $env:PB_ADMIN_PASSWORD="admin-password"
|
|
// node scripts/create-user.mjs user@example.com "user-password" "Display Name"
|
|
|
|
const BASE = (process.env.POCKETBASE_URL || "http://10.2.1.10:8028").replace(/\/$/, "");
|
|
const EMAIL = process.env.PB_ADMIN_EMAIL;
|
|
const PASSWORD = process.env.PB_ADMIN_PASSWORD;
|
|
|
|
const [, , userEmail, userPassword, userName] = process.argv;
|
|
|
|
if (!EMAIL || !PASSWORD) {
|
|
console.error("Set PB_ADMIN_EMAIL and PB_ADMIN_PASSWORD environment variables.");
|
|
process.exit(1);
|
|
}
|
|
if (!userEmail || !userPassword) {
|
|
console.error('Usage: node scripts/create-user.mjs <email> <password> ["name"]');
|
|
process.exit(1);
|
|
}
|
|
|
|
async function api(method, path, body, token) {
|
|
const res = await fetch(BASE + path, {
|
|
method,
|
|
headers: { "Content-Type": "application/json", ...(token ? { Authorization: token } : {}) },
|
|
body: body ? JSON.stringify(body) : undefined,
|
|
});
|
|
const text = await res.text();
|
|
const json = text ? JSON.parse(text) : null;
|
|
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${json?.message || text}`);
|
|
return json;
|
|
}
|
|
|
|
const auth = await api("POST", "/api/collections/_superusers/auth-with-password", {
|
|
identity: EMAIL,
|
|
password: PASSWORD,
|
|
});
|
|
|
|
const user = await api("POST", "/api/collections/users/records", {
|
|
email: userEmail,
|
|
password: userPassword,
|
|
passwordConfirm: userPassword,
|
|
name: userName || "",
|
|
emailVisibility: true,
|
|
verified: true,
|
|
}, auth.token);
|
|
|
|
console.log(`Created user ${user.email} (id: ${user.id}).`);
|