@threadbase-sh/streamer 1.52.6 → 1.53.1
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/cli.cjs +13 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -134200,21 +134200,16 @@ var authMiddleware = (deps) => async (c, next) => {
|
|
|
134200
134200
|
await next();
|
|
134201
134201
|
return;
|
|
134202
134202
|
}
|
|
134203
|
-
|
|
134204
|
-
if (isLocalRequest(remoteAddr)) {
|
|
134205
|
-
await next();
|
|
134206
|
-
return;
|
|
134207
|
-
}
|
|
134208
|
-
}
|
|
134203
|
+
const loopbackOwner = deps.localNoAuth && isLocalRequest(remoteAddr);
|
|
134209
134204
|
const authorization = c.req.header("authorization");
|
|
134210
134205
|
const bearer = authorization?.startsWith("Bearer ") ? authorization.slice(7) : void 0;
|
|
134211
134206
|
const queryKey = c.req.query("key") ?? void 0;
|
|
134212
134207
|
const presented = bearer ?? queryKey;
|
|
134213
|
-
if (!presented) {
|
|
134208
|
+
if (!presented && !loopbackOwner) {
|
|
134214
134209
|
return c.json({ error: "Unauthorized" }, 401);
|
|
134215
134210
|
}
|
|
134216
134211
|
let principal = null;
|
|
134217
|
-
const device = deps.devicesRepo()?.authenticate(presented) ?? null;
|
|
134212
|
+
const device = presented ? deps.devicesRepo()?.authenticate(presented) ?? null : null;
|
|
134218
134213
|
if (device) {
|
|
134219
134214
|
principal = {
|
|
134220
134215
|
kind: "device",
|
|
@@ -134225,7 +134220,9 @@ var authMiddleware = (deps) => async (c, next) => {
|
|
|
134225
134220
|
deps.devicesRepo()?.touch(device.device_id);
|
|
134226
134221
|
} catch {
|
|
134227
134222
|
}
|
|
134228
|
-
} else if (validateApiKey(presented, deps.apiKey)) {
|
|
134223
|
+
} else if (presented && validateApiKey(presented, deps.apiKey)) {
|
|
134224
|
+
principal = legacyPrincipal();
|
|
134225
|
+
} else if (loopbackOwner) {
|
|
134229
134226
|
principal = legacyPrincipal();
|
|
134230
134227
|
}
|
|
134231
134228
|
if (!principal) {
|
|
@@ -151891,9 +151888,15 @@ function getSortValue(s3, key) {
|
|
|
151891
151888
|
case "projectName":
|
|
151892
151889
|
return s3.projectName;
|
|
151893
151890
|
case "status":
|
|
151894
|
-
return s3
|
|
151891
|
+
return statusSortValue(s3);
|
|
151895
151892
|
}
|
|
151896
151893
|
}
|
|
151894
|
+
function statusSortValue(s3) {
|
|
151895
|
+
const rank = s3.status === "idle" ? 1 : 0;
|
|
151896
|
+
const activeAt = Date.parse(s3.lastActivityAt ?? s3.startedAt);
|
|
151897
|
+
const recency = String(1e15 - (Number.isNaN(activeAt) ? 0 : activeAt)).padStart(16, "0");
|
|
151898
|
+
return `${rank}:${recency}`;
|
|
151899
|
+
}
|
|
151897
151900
|
function compareValues(a, b2) {
|
|
151898
151901
|
if (a === void 0 && b2 === void 0) return 0;
|
|
151899
151902
|
if (a === void 0) return 1;
|