@runeya/runeya 2.0.80 → 2.0.81
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/index.js +1 -1
- package/package.json +1 -1
- package/{src-6PAM4JRF.js → src-J5NMLOGO.js} +22 -10
- package/src-J5NMLOGO.js.map +1 -0
- package/src-6PAM4JRF.js.map +0 -1
package/index.js
CHANGED
|
@@ -279,7 +279,7 @@ async function main() {
|
|
|
279
279
|
ensureNodeBinOnPath();
|
|
280
280
|
await ensureUserBinsOnPath();
|
|
281
281
|
if (!isPullEnv) stampConsole();
|
|
282
|
-
const { createLocalServer, pullEnv, PullEnvError, registerInstance } = await import("./src-
|
|
282
|
+
const { createLocalServer, pullEnv, PullEnvError, registerInstance } = await import("./src-J5NMLOGO.js");
|
|
283
283
|
if (isPullEnv) {
|
|
284
284
|
if (!serviceArg) {
|
|
285
285
|
console.error("Error: --service (-s) is required with --pull-env");
|
package/package.json
CHANGED
|
@@ -358,7 +358,10 @@ var apiKeyStore = new ApiKeyStore();
|
|
|
358
358
|
// ../server/src/trpc/trpc.ts
|
|
359
359
|
function createContext({ req }) {
|
|
360
360
|
return {
|
|
361
|
-
authorization: req.headers.authorization ?? null
|
|
361
|
+
authorization: req.headers.authorization ?? null,
|
|
362
|
+
// L'adresse de la socket, et non `req.ip` : celle-ci ne dépend d'aucun
|
|
363
|
+
// en-tête, donc d'aucune valeur qu'un appelant distant puisse forger.
|
|
364
|
+
remoteAddress: req.socket.remoteAddress ?? null
|
|
362
365
|
};
|
|
363
366
|
}
|
|
364
367
|
var t = initTRPC.context().meta().create({
|
|
@@ -403,6 +406,12 @@ var authMiddleware = t.middleware(async ({ ctx, next }) => {
|
|
|
403
406
|
return next({ ctx: { ...ctx, callerType: "app", apiKey: null } });
|
|
404
407
|
});
|
|
405
408
|
var protectedProcedure = t.procedure.use(authMiddleware);
|
|
409
|
+
var LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
410
|
+
function requireLoopback(ctx) {
|
|
411
|
+
if (!ctx.remoteAddress || !LOOPBACK.has(ctx.remoteAddress)) {
|
|
412
|
+
throw new TRPCError({ code: "FORBIDDEN", message: "This route only answers the local machine." });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
406
415
|
function requireServiceAction(ctx, serviceId, action) {
|
|
407
416
|
if (ctx.callerType !== "api") return;
|
|
408
417
|
const perm = ctx.apiKey.scopes.services.find((p) => p.serviceId === serviceId);
|
|
@@ -583,7 +592,7 @@ function requireDesktop() {
|
|
|
583
592
|
}
|
|
584
593
|
var appUpdateRouter = router({
|
|
585
594
|
/** De quoi la mise à jour a besoin, et ce que la machine en offre. */
|
|
586
|
-
prerequisites:
|
|
595
|
+
prerequisites: publicProcedure.output(
|
|
587
596
|
z2.object({
|
|
588
597
|
fromDesktop: z2.boolean(),
|
|
589
598
|
nodeVersion: z2.string(),
|
|
@@ -592,7 +601,8 @@ var appUpdateRouter = router({
|
|
|
592
601
|
globalPrefix: z2.string().nullable(),
|
|
593
602
|
ready: z2.boolean()
|
|
594
603
|
})
|
|
595
|
-
).query(async () => {
|
|
604
|
+
).query(async ({ ctx }) => {
|
|
605
|
+
requireLoopback(ctx);
|
|
596
606
|
const npmPath = resolveNpm();
|
|
597
607
|
const npmVersion = await probeVersion(npmPath, ["--version"]);
|
|
598
608
|
const globalPrefix = npmVersion ? await probeVersion(npmPath, ["prefix", "-g"]) : null;
|
|
@@ -612,13 +622,14 @@ var appUpdateRouter = router({
|
|
|
612
622
|
* `npm` refuse (droits sur le préfixe, réseau, registre privé), son message
|
|
613
623
|
* est la seule chose qui dit à l'utilisateur quoi faire.
|
|
614
624
|
*/
|
|
615
|
-
install:
|
|
625
|
+
install: publicProcedure.output(
|
|
616
626
|
z2.object({
|
|
617
627
|
ok: z2.boolean(),
|
|
618
628
|
output: z2.string(),
|
|
619
629
|
installedVersion: z2.string().nullable()
|
|
620
630
|
})
|
|
621
|
-
).mutation(async () => {
|
|
631
|
+
).mutation(async ({ ctx }) => {
|
|
632
|
+
requireLoopback(ctx);
|
|
622
633
|
requireDesktop();
|
|
623
634
|
const npmPath = resolveNpm();
|
|
624
635
|
try {
|
|
@@ -643,7 +654,8 @@ var appUpdateRouter = router({
|
|
|
643
654
|
* quelques instants — le démarrage réessaie déjà sur EADDRINUSE, c'est ce qui
|
|
644
655
|
* rend ce relais possible sans temporisation ici.
|
|
645
656
|
*/
|
|
646
|
-
restart:
|
|
657
|
+
restart: publicProcedure.output(z2.object({ restarting: z2.literal(true), version: z2.string() })).mutation(({ ctx }) => {
|
|
658
|
+
requireLoopback(ctx);
|
|
647
659
|
requireDesktop();
|
|
648
660
|
const child = spawn(process.execPath, process.argv.slice(1), {
|
|
649
661
|
detached: true,
|
|
@@ -4611,7 +4623,7 @@ import { networkInterfaces } from "os";
|
|
|
4611
4623
|
import { readFile as readFile10, writeFile as writeFile10, rename as rename10, mkdir as mkdir10 } from "fs/promises";
|
|
4612
4624
|
import { join as join11 } from "path";
|
|
4613
4625
|
import { z as z10 } from "zod";
|
|
4614
|
-
var
|
|
4626
|
+
var LOOPBACK2 = "127.0.0.1";
|
|
4615
4627
|
var ANY = "0.0.0.0";
|
|
4616
4628
|
var NETWORK_FILE = "network.json";
|
|
4617
4629
|
var NetworkFileSchema = z10.object({
|
|
@@ -4707,7 +4719,7 @@ async function rebind(host, previousHost) {
|
|
|
4707
4719
|
}
|
|
4708
4720
|
async function applyPersistedLanMode() {
|
|
4709
4721
|
if (env.RUNEYA_LAN_PROXY) return;
|
|
4710
|
-
if (env.HOST !==
|
|
4722
|
+
if (env.HOST !== LOOPBACK2 && env.HOST !== "localhost") return;
|
|
4711
4723
|
if (!await readPersisted()) return;
|
|
4712
4724
|
setHost(ANY, true);
|
|
4713
4725
|
console.log("[server] LAN mode: activ\xE9 par les r\xE9glages \u2014 \xE9coute sur 0.0.0.0");
|
|
@@ -4715,7 +4727,7 @@ async function applyPersistedLanMode() {
|
|
|
4715
4727
|
async function setLanMode(enabled) {
|
|
4716
4728
|
await writePersisted(enabled);
|
|
4717
4729
|
const previousHost = env.HOST;
|
|
4718
|
-
const host = enabled ? ANY :
|
|
4730
|
+
const host = enabled ? ANY : LOOPBACK2;
|
|
4719
4731
|
setHost(host, enabled);
|
|
4720
4732
|
if (host !== previousHost) await rebind(host, previousHost);
|
|
4721
4733
|
console.log(`[server] LAN mode: ${enabled ? "activ\xE9" : "d\xE9sactiv\xE9"} \u2014 \xE9coute sur ${host}`);
|
|
@@ -18207,4 +18219,4 @@ export {
|
|
|
18207
18219
|
pullEnv,
|
|
18208
18220
|
registerInstance
|
|
18209
18221
|
};
|
|
18210
|
-
//# sourceMappingURL=src-
|
|
18222
|
+
//# sourceMappingURL=src-J5NMLOGO.js.map
|