nixamp 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +103 -103
- package/package.json +1 -1
- package/src/server.ts +108 -108
- package/web/dist/sw.js +1 -1
package/dist/server.js
CHANGED
|
@@ -1001,109 +1001,6 @@ export function createHandler(engine, options) {
|
|
|
1001
1001
|
json(response, 404, { error: "no such endpoint" });
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
// --- the name other people see ---------------------------------------
|
|
1005
|
-
//
|
|
1006
|
-
// Separate from the address on purpose. The address is a credential and
|
|
1007
|
-
// a way to reach somebody; publishing it in a directory listing or an
|
|
1008
|
-
// invite would be publishing what they log in with.
|
|
1009
|
-
if (path === "/api/v1/me/handle" && options.handles) {
|
|
1010
|
-
const handles = options.handles;
|
|
1011
|
-
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
1012
|
-
if (who === null) {
|
|
1013
|
-
json(response, 401, { error: "not signed in" });
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
if (request.method === "GET") {
|
|
1017
|
-
json(response, 200, { handle: await handles.of(who.id) });
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
if (request.method === "PUT" || request.method === "POST") {
|
|
1021
|
-
let body;
|
|
1022
|
-
try {
|
|
1023
|
-
body = JSON.parse(await readBody(request));
|
|
1024
|
-
}
|
|
1025
|
-
catch {
|
|
1026
|
-
json(response, 400, { error: "bad JSON" });
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
const claimed = await handles.claim(who.id, body.handle);
|
|
1030
|
-
if (claimed.error) {
|
|
1031
|
-
json(response, 409, { error: claimed.error });
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
json(response, 200, { handle: claimed.handle });
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
json(response, 405, { error: "GET or PUT" });
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
// --- the servers this account runs ----------------------------------
|
|
1041
|
-
//
|
|
1042
|
-
// Kept against the account rather than the machine, so the list reads the
|
|
1043
|
-
// same from the CLI, the PWA and the desktop app -- which is the whole
|
|
1044
|
-
// point: a share link in a terminal you closed is a server you have lost.
|
|
1045
|
-
if ((path === "/api/v1/servers" || path.startsWith("/api/v1/servers/")) && options.servers) {
|
|
1046
|
-
const servers = options.servers;
|
|
1047
|
-
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
1048
|
-
if (who === null) {
|
|
1049
|
-
json(response, 401, { error: "not signed in" });
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
if (path === "/api/v1/servers" && request.method === "GET") {
|
|
1053
|
-
json(response, 200, { servers: await servers.list(who.id) });
|
|
1054
|
-
return;
|
|
1055
|
-
}
|
|
1056
|
-
if (path === "/api/v1/servers" && request.method === "POST") {
|
|
1057
|
-
let body;
|
|
1058
|
-
try {
|
|
1059
|
-
body = JSON.parse(await readBody(request));
|
|
1060
|
-
}
|
|
1061
|
-
catch {
|
|
1062
|
-
json(response, 400, { error: "bad JSON" });
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
const made = await servers.add(who, {
|
|
1066
|
-
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1067
|
-
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1068
|
-
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1069
|
-
});
|
|
1070
|
-
if (made === null) {
|
|
1071
|
-
json(response, 422, { error: "that needs an http or https address" });
|
|
1072
|
-
return;
|
|
1073
|
-
}
|
|
1074
|
-
json(response, 201, { server: made });
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
const id = path.slice("/api/v1/servers/".length);
|
|
1078
|
-
if (id && request.method === "DELETE") {
|
|
1079
|
-
const gone = await servers.remove(who.id, id);
|
|
1080
|
-
json(response, gone ? 200 : 404, gone ? { ok: true } : { error: "no such server" });
|
|
1081
|
-
return;
|
|
1082
|
-
}
|
|
1083
|
-
if (id && (request.method === "PATCH" || request.method === "PUT")) {
|
|
1084
|
-
let body;
|
|
1085
|
-
try {
|
|
1086
|
-
body = JSON.parse(await readBody(request));
|
|
1087
|
-
}
|
|
1088
|
-
catch {
|
|
1089
|
-
json(response, 400, { error: "bad JSON" });
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
const changed = await servers.update(who.id, id, {
|
|
1093
|
-
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1094
|
-
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1095
|
-
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1096
|
-
});
|
|
1097
|
-
if (changed === null) {
|
|
1098
|
-
json(response, 404, { error: "no such server, or a bad address" });
|
|
1099
|
-
return;
|
|
1100
|
-
}
|
|
1101
|
-
json(response, 200, { server: changed });
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
json(response, 405, { error: "GET, POST, PATCH or DELETE" });
|
|
1105
|
-
return;
|
|
1106
|
-
}
|
|
1107
1004
|
// --- tokens a person made on purpose --------------------------------
|
|
1108
1005
|
if (path === "/api/v1/auth/tokens" || path.startsWith("/api/v1/auth/tokens/")) {
|
|
1109
1006
|
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
@@ -1220,6 +1117,109 @@ export function createHandler(engine, options) {
|
|
|
1220
1117
|
response.end(JSON.stringify({ account: result.account, token }));
|
|
1221
1118
|
return;
|
|
1222
1119
|
}
|
|
1120
|
+
// --- the name other people see ---------------------------------------
|
|
1121
|
+
//
|
|
1122
|
+
// Separate from the address on purpose. The address is a credential and
|
|
1123
|
+
// a way to reach somebody; publishing it in a directory listing or an
|
|
1124
|
+
// invite would be publishing what they log in with.
|
|
1125
|
+
if (path === "/api/v1/me/handle" && options.handles && options.accounts) {
|
|
1126
|
+
const handles = options.handles;
|
|
1127
|
+
const who = await options.accounts.whoIs(tokenFrom(request.headers));
|
|
1128
|
+
if (who === null) {
|
|
1129
|
+
json(response, 401, { error: "not signed in" });
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
if (request.method === "GET") {
|
|
1133
|
+
json(response, 200, { handle: await handles.of(who.id) });
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (request.method === "PUT" || request.method === "POST") {
|
|
1137
|
+
let body;
|
|
1138
|
+
try {
|
|
1139
|
+
body = JSON.parse(await readBody(request));
|
|
1140
|
+
}
|
|
1141
|
+
catch {
|
|
1142
|
+
json(response, 400, { error: "bad JSON" });
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
const claimed = await handles.claim(who.id, body.handle);
|
|
1146
|
+
if (claimed.error) {
|
|
1147
|
+
json(response, 409, { error: claimed.error });
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
json(response, 200, { handle: claimed.handle });
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
json(response, 405, { error: "GET or PUT" });
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
// --- the servers this account runs ----------------------------------
|
|
1157
|
+
//
|
|
1158
|
+
// Kept against the account rather than the machine, so the list reads the
|
|
1159
|
+
// same from the CLI, the PWA and the desktop app -- which is the whole
|
|
1160
|
+
// point: a share link in a terminal you closed is a server you have lost.
|
|
1161
|
+
if ((path === "/api/v1/servers" || path.startsWith("/api/v1/servers/")) && options.servers && options.accounts) {
|
|
1162
|
+
const servers = options.servers;
|
|
1163
|
+
const who = await options.accounts.whoIs(tokenFrom(request.headers));
|
|
1164
|
+
if (who === null) {
|
|
1165
|
+
json(response, 401, { error: "not signed in" });
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
if (path === "/api/v1/servers" && request.method === "GET") {
|
|
1169
|
+
json(response, 200, { servers: await servers.list(who.id) });
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (path === "/api/v1/servers" && request.method === "POST") {
|
|
1173
|
+
let body;
|
|
1174
|
+
try {
|
|
1175
|
+
body = JSON.parse(await readBody(request));
|
|
1176
|
+
}
|
|
1177
|
+
catch {
|
|
1178
|
+
json(response, 400, { error: "bad JSON" });
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
const made = await servers.add(who, {
|
|
1182
|
+
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1183
|
+
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1184
|
+
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1185
|
+
});
|
|
1186
|
+
if (made === null) {
|
|
1187
|
+
json(response, 422, { error: "that needs an http or https address" });
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
json(response, 201, { server: made });
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
const id = path.slice("/api/v1/servers/".length);
|
|
1194
|
+
if (id && request.method === "DELETE") {
|
|
1195
|
+
const gone = await servers.remove(who.id, id);
|
|
1196
|
+
json(response, gone ? 200 : 404, gone ? { ok: true } : { error: "no such server" });
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
if (id && (request.method === "PATCH" || request.method === "PUT")) {
|
|
1200
|
+
let body;
|
|
1201
|
+
try {
|
|
1202
|
+
body = JSON.parse(await readBody(request));
|
|
1203
|
+
}
|
|
1204
|
+
catch {
|
|
1205
|
+
json(response, 400, { error: "bad JSON" });
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const changed = await servers.update(who.id, id, {
|
|
1209
|
+
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1210
|
+
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1211
|
+
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1212
|
+
});
|
|
1213
|
+
if (changed === null) {
|
|
1214
|
+
json(response, 404, { error: "no such server, or a bad address" });
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
json(response, 200, { server: changed });
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
json(response, 405, { error: "GET, POST, PATCH or DELETE" });
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
1223
|
// --- open directories somebody found -----------------------------------
|
|
1224
1224
|
//
|
|
1225
1225
|
// Its own list, not the stream directory: that one is what is playing now,
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -1267,114 +1267,6 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
1267
1267
|
return;
|
|
1268
1268
|
}
|
|
1269
1269
|
|
|
1270
|
-
// --- the name other people see ---------------------------------------
|
|
1271
|
-
//
|
|
1272
|
-
// Separate from the address on purpose. The address is a credential and
|
|
1273
|
-
// a way to reach somebody; publishing it in a directory listing or an
|
|
1274
|
-
// invite would be publishing what they log in with.
|
|
1275
|
-
if (path === "/api/v1/me/handle" && options.handles) {
|
|
1276
|
-
const handles = options.handles;
|
|
1277
|
-
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
1278
|
-
if (who === null) {
|
|
1279
|
-
json(response, 401, { error: "not signed in" });
|
|
1280
|
-
return;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
if (request.method === "GET") {
|
|
1284
|
-
json(response, 200, { handle: await handles.of(who.id) });
|
|
1285
|
-
return;
|
|
1286
|
-
}
|
|
1287
|
-
if (request.method === "PUT" || request.method === "POST") {
|
|
1288
|
-
let body: { handle?: unknown };
|
|
1289
|
-
try {
|
|
1290
|
-
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1291
|
-
} catch {
|
|
1292
|
-
json(response, 400, { error: "bad JSON" });
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
const claimed = await handles.claim(who.id, body.handle);
|
|
1296
|
-
if (claimed.error) {
|
|
1297
|
-
json(response, 409, { error: claimed.error });
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
json(response, 200, { handle: claimed.handle });
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
json(response, 405, { error: "GET or PUT" });
|
|
1304
|
-
return;
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
// --- the servers this account runs ----------------------------------
|
|
1308
|
-
//
|
|
1309
|
-
// Kept against the account rather than the machine, so the list reads the
|
|
1310
|
-
// same from the CLI, the PWA and the desktop app -- which is the whole
|
|
1311
|
-
// point: a share link in a terminal you closed is a server you have lost.
|
|
1312
|
-
if ((path === "/api/v1/servers" || path.startsWith("/api/v1/servers/")) && options.servers) {
|
|
1313
|
-
const servers = options.servers;
|
|
1314
|
-
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
1315
|
-
if (who === null) {
|
|
1316
|
-
json(response, 401, { error: "not signed in" });
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
if (path === "/api/v1/servers" && request.method === "GET") {
|
|
1321
|
-
json(response, 200, { servers: await servers.list(who.id) });
|
|
1322
|
-
return;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
if (path === "/api/v1/servers" && request.method === "POST") {
|
|
1326
|
-
let body: { name?: unknown; url?: unknown; key?: unknown };
|
|
1327
|
-
try {
|
|
1328
|
-
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1329
|
-
} catch {
|
|
1330
|
-
json(response, 400, { error: "bad JSON" });
|
|
1331
|
-
return;
|
|
1332
|
-
}
|
|
1333
|
-
const made = await servers.add(who, {
|
|
1334
|
-
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1335
|
-
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1336
|
-
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1337
|
-
});
|
|
1338
|
-
if (made === null) {
|
|
1339
|
-
json(response, 422, { error: "that needs an http or https address" });
|
|
1340
|
-
return;
|
|
1341
|
-
}
|
|
1342
|
-
json(response, 201, { server: made });
|
|
1343
|
-
return;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
const id = path.slice("/api/v1/servers/".length);
|
|
1347
|
-
if (id && request.method === "DELETE") {
|
|
1348
|
-
const gone = await servers.remove(who.id, id);
|
|
1349
|
-
json(response, gone ? 200 : 404, gone ? { ok: true } : { error: "no such server" });
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
if (id && (request.method === "PATCH" || request.method === "PUT")) {
|
|
1354
|
-
let body: { name?: unknown; url?: unknown; key?: unknown };
|
|
1355
|
-
try {
|
|
1356
|
-
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1357
|
-
} catch {
|
|
1358
|
-
json(response, 400, { error: "bad JSON" });
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
const changed = await servers.update(who.id, id, {
|
|
1362
|
-
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1363
|
-
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1364
|
-
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1365
|
-
});
|
|
1366
|
-
if (changed === null) {
|
|
1367
|
-
json(response, 404, { error: "no such server, or a bad address" });
|
|
1368
|
-
return;
|
|
1369
|
-
}
|
|
1370
|
-
json(response, 200, { server: changed });
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
json(response, 405, { error: "GET, POST, PATCH or DELETE" });
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
1270
|
// --- tokens a person made on purpose --------------------------------
|
|
1379
1271
|
if (path === "/api/v1/auth/tokens" || path.startsWith("/api/v1/auth/tokens/")) {
|
|
1380
1272
|
const who = await accounts.whoIs(tokenFrom(request.headers));
|
|
@@ -1501,6 +1393,114 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
1501
1393
|
return;
|
|
1502
1394
|
}
|
|
1503
1395
|
|
|
1396
|
+
// --- the name other people see ---------------------------------------
|
|
1397
|
+
//
|
|
1398
|
+
// Separate from the address on purpose. The address is a credential and
|
|
1399
|
+
// a way to reach somebody; publishing it in a directory listing or an
|
|
1400
|
+
// invite would be publishing what they log in with.
|
|
1401
|
+
if (path === "/api/v1/me/handle" && options.handles && options.accounts) {
|
|
1402
|
+
const handles = options.handles;
|
|
1403
|
+
const who = await options.accounts.whoIs(tokenFrom(request.headers));
|
|
1404
|
+
if (who === null) {
|
|
1405
|
+
json(response, 401, { error: "not signed in" });
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
if (request.method === "GET") {
|
|
1410
|
+
json(response, 200, { handle: await handles.of(who.id) });
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
if (request.method === "PUT" || request.method === "POST") {
|
|
1414
|
+
let body: { handle?: unknown };
|
|
1415
|
+
try {
|
|
1416
|
+
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1417
|
+
} catch {
|
|
1418
|
+
json(response, 400, { error: "bad JSON" });
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
const claimed = await handles.claim(who.id, body.handle);
|
|
1422
|
+
if (claimed.error) {
|
|
1423
|
+
json(response, 409, { error: claimed.error });
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
json(response, 200, { handle: claimed.handle });
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
json(response, 405, { error: "GET or PUT" });
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
// --- the servers this account runs ----------------------------------
|
|
1434
|
+
//
|
|
1435
|
+
// Kept against the account rather than the machine, so the list reads the
|
|
1436
|
+
// same from the CLI, the PWA and the desktop app -- which is the whole
|
|
1437
|
+
// point: a share link in a terminal you closed is a server you have lost.
|
|
1438
|
+
if ((path === "/api/v1/servers" || path.startsWith("/api/v1/servers/")) && options.servers && options.accounts) {
|
|
1439
|
+
const servers = options.servers;
|
|
1440
|
+
const who = await options.accounts.whoIs(tokenFrom(request.headers));
|
|
1441
|
+
if (who === null) {
|
|
1442
|
+
json(response, 401, { error: "not signed in" });
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
if (path === "/api/v1/servers" && request.method === "GET") {
|
|
1447
|
+
json(response, 200, { servers: await servers.list(who.id) });
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
if (path === "/api/v1/servers" && request.method === "POST") {
|
|
1452
|
+
let body: { name?: unknown; url?: unknown; key?: unknown };
|
|
1453
|
+
try {
|
|
1454
|
+
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1455
|
+
} catch {
|
|
1456
|
+
json(response, 400, { error: "bad JSON" });
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
const made = await servers.add(who, {
|
|
1460
|
+
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1461
|
+
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1462
|
+
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1463
|
+
});
|
|
1464
|
+
if (made === null) {
|
|
1465
|
+
json(response, 422, { error: "that needs an http or https address" });
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
json(response, 201, { server: made });
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
const id = path.slice("/api/v1/servers/".length);
|
|
1473
|
+
if (id && request.method === "DELETE") {
|
|
1474
|
+
const gone = await servers.remove(who.id, id);
|
|
1475
|
+
json(response, gone ? 200 : 404, gone ? { ok: true } : { error: "no such server" });
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
if (id && (request.method === "PATCH" || request.method === "PUT")) {
|
|
1480
|
+
let body: { name?: unknown; url?: unknown; key?: unknown };
|
|
1481
|
+
try {
|
|
1482
|
+
body = JSON.parse(await readBody(request)) as typeof body;
|
|
1483
|
+
} catch {
|
|
1484
|
+
json(response, 400, { error: "bad JSON" });
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
const changed = await servers.update(who.id, id, {
|
|
1488
|
+
...(typeof body.name === "string" ? { name: body.name } : {}),
|
|
1489
|
+
...(typeof body.url === "string" ? { url: body.url } : {}),
|
|
1490
|
+
...(typeof body.key === "string" ? { key: body.key } : {}),
|
|
1491
|
+
});
|
|
1492
|
+
if (changed === null) {
|
|
1493
|
+
json(response, 404, { error: "no such server, or a bad address" });
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
json(response, 200, { server: changed });
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
json(response, 405, { error: "GET, POST, PATCH or DELETE" });
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
1504
|
// --- open directories somebody found -----------------------------------
|
|
1505
1505
|
//
|
|
1506
1506
|
// Its own list, not the stream directory: that one is what is playing now,
|
package/web/dist/sw.js
CHANGED