mirror of
https://github.com/aljazceru/pubky-core.git
synced 2025-12-18 22:44:24 +01:00
* first draft * config2 for the time being * more refactoring * write default config if it doesnt exist * added relays to config * some refactor * proper bootstrap nodes and relay config validation * small comments * rename module * renamings * turn listen_ports to listen_socket * connected config with homeserver * cleaned up old config * cleaned up config_old * removed old config.example.toml * cleanup tryfrom conversions * removed dirs-next * review cleanup * extracted default config to its own toml file * use hostname_validator for rfc1123 domain verification * Domain struct * fmt * small config restructure * use SignupMode in config and moved it to config dir * moved and simplified lmdb * save to switch branches * lots done already * missin lock file * pkarr config * constants * app context * used context in more places * made homeserver independant * testing feature * added datadirmock * getting the hang about testing * fixed homeserver core tests * added HandleHolder * make the homeserver tasks stop when its dropped * make server handles optional * properly cleanup all background tasks * moved logs * fixed config default toml * fmt, clippy * moved stuff around * lots of moving and readme * fixed pkarr republisher tests * removed docs from include * fixed and refactored testnet * make simple_testnet work * httprelay shutdown * different testnets * fixing tests1 * fixing tests * fixing more tests * unified pkarr versions * fixed config with bootstrap nodes and relays * split up test_republish_on_signin to prevent timing issues * fixed all tests in e2e? * fixed multi publisher tests * fixed pubky-client readme * fixed testnet readme * added better errors * admin error * fixed tests * format * clippy * cllippy * fixed testnet ports * fixed client future issue * improved testnet * fixed cache_size pkarr relay issue * small improvements * fixed low prio dns record * removed fixed testnet test due to port conflicts * fixed browserify issues * fmt * clippy * changed wait for testnet hs admin * fixed docs clippy issues * added comments * moved icann_domain * renamed datadirs * implemented default for MockDataDir * renamed run() to start() * removed unwraps * fmt * fixed rename test * cleaned up admin trace * added santity values for periodic backup conf and user keys republisher * fmt * fmt * fixed readme lint * removed println * fixed admin server edge to anyhow * added ipv6 support * removed unnecessary expects * renamed testnet * fmt * renamed me * changed import * fmt
24 lines
882 B
JavaScript
24 lines
882 B
JavaScript
|
|
/**
|
|
* Util to request a signup token from the given homeserver as admin.
|
|
*
|
|
* @param {Client} client - An instance of your client.
|
|
* @param {string} homeserver_address - The homeserver's public key (as a domain-like string).
|
|
* @param {string} [adminPassword="admin"] - The admin password (defaults to "admin").
|
|
* @returns {Promise<string>} - The signup token.
|
|
* @throws Will throw an error if the request fails.
|
|
*/
|
|
export async function createSignupToken(client, homeserver_address ="localhost:6288", adminPassword = "admin") {
|
|
const adminUrl = `http://${homeserver_address}/admin/generate_signup_token`;
|
|
const response = await client.fetch(adminUrl, {
|
|
method: "GET",
|
|
headers: {
|
|
"X-Admin-Password": adminPassword,
|
|
},
|
|
});
|
|
if (!response.ok) {
|
|
throw new Error(`Failed to get signup token: ${response.statusText}`);
|
|
}
|
|
|
|
return response.text();
|
|
} |