vibes
This commit is contained in:
+6
-2
@@ -77,17 +77,21 @@ export const api = {
|
||||
market: () => call('GET', '/market', { auth: false }),
|
||||
register: (name) => call('POST', '/register', { json: { name }, auth: false }),
|
||||
me: (key) => call('GET', '/me', { key }),
|
||||
// Signing in with an access key: like me(), and the server records the login.
|
||||
login: (key) => call('POST', '/login', { key }),
|
||||
ships: () => call('GET', '/ships'),
|
||||
assemble: (source) => call('POST', '/assemble', { body: source, type: 'text/plain', auth: false }),
|
||||
// Launch a docked ship, flying the program in code slot `slot`.
|
||||
launch: (id, slot) => call('POST', `/ships/${id}/launch`, { json: { slot } }),
|
||||
scrap: (id) => call('POST', `/ships/${id}/scrap`),
|
||||
slots: () => call('GET', '/slots'),
|
||||
slot: (n) => call('GET', `/slots/${n}`),
|
||||
saveSlot: (n, name, source) => call('PUT', `/slots/${n}`, { json: { name, source } }),
|
||||
deleteSlot: (n) => call('DELETE', `/slots/${n}`),
|
||||
setUplink: (id, bytes) => call('PUT', `/ships/${id}/uplink`, { body: bytes, type: 'application/octet-stream' }),
|
||||
async downlink(id) {
|
||||
const res = await call('GET', `/ships/${id}/downlink`, { raw: true });
|
||||
downlinkDays: async (id) => (await call('GET', `/ships/${id}/downlinks`)).days,
|
||||
async downlink(id, day) {
|
||||
const res = await call('GET', `/ships/${id}/downlink${day == null ? '' : `?day=${day}`}`, { raw: true });
|
||||
return {
|
||||
bytes: new Uint8Array(await res.arrayBuffer()),
|
||||
day: Number(res.headers.get('X-Downlink-Day')),
|
||||
|
||||
Reference in New Issue
Block a user