SOURCE / PINNED RELEASE
Made of little things.
Powder Tool V600Billion
- Release
- 142767edcab8…
- Author-recorded commit
- 6d92971effd0…
- License
- LICENSE
- Author’s source reference
- nostr://npub1fllw8kw0thjj55wds0uugcnp5kej2nfxd36eruq39d56wwz8r44q5q78wj/wss%3A%2F%2Fgit.napplet.soy%2F/powder-toy
Archive hash verified: ed7d6a8ea7083197…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
/**
* Who plays: the Nappelin account the host has signed in, as the game sees it.
*
* The web build logs in by reading two inputs in #PowderSessionInfo when it
* starts (upstream src/client/AuthUserEmscripten.cpp). Filling them from the
* host's identity means a signed-in player is signed in in the game too, with
* no password: the key never leaves the host, and every save, vote and
* comment is signed there.
*/
import * as host from './napplet.js';
import { stableId, usernameFor } from './server/names.js';
export async function currentSession() {
const pubkey = await host.publicKey();
if (!pubkey) return null;
const profile = await host.profile();
return { pubkey, profile, username: usernameFor(pubkey, profile), userId: stableId(pubkey) };
}
export function writeSessionInfo(session) {
document.getElementById('PowderSessionInfo')?.remove();
const form = document.createElement('form');
form.id = 'PowderSessionInfo';
form.hidden = true;
for (const [name, value] of [['Username', session.username], ['SessionKey', 'nappelin']]) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = name;
input.value = value;
form.append(input);
}
document.body.append(form);
}
