@dominevo/series-scraper-core 0.0.90 → 0.0.92
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/controllers/notifications.controller.d.ts +4 -11
- package/dist/controllers/notifications.controller.js +7 -5
- package/dist/controllers/settings.controller.d.ts +3 -3
- package/dist/controllers/settings.controller.js +6 -4
- package/dist/controllers/sites.controller.d.ts +5 -53
- package/dist/controllers/sites.controller.js +47 -14
- package/dist/controllers/table.controller.js +2 -1
- package/dist/controllers/vpn.controller.d.ts +5 -0
- package/dist/controllers/vpn.controller.js +35 -3
- package/dist/docker-layout/secret-layout.js +19 -7
- package/dist/ports/secret-store.d.ts +2 -0
- package/dist/ports/secret-store.js +2 -0
- package/dist/repositories/settings.repository.d.ts +5 -0
- package/dist/repositories/settings.repository.js +15 -1
- package/dist/repositories/sites.repository.d.ts +6 -1
- package/dist/repositories/sites.repository.js +34 -5
- package/dist/repositories/webhook.repository.d.ts +3 -0
- package/dist/repositories/webhook.repository.js +13 -4
- package/dist/scraper.module.js +2 -0
- package/dist/services/captcha.service.js +1 -1
- package/dist/services/download.service.js +1 -1
- package/dist/services/egress/egress-context.d.ts +4 -0
- package/dist/services/egress/egress-input.d.ts +15 -2
- package/dist/services/egress/egress-input.js +32 -3
- package/dist/services/egress/leak-guard.d.ts +5 -1
- package/dist/services/plugin-settings.service.d.ts +2 -0
- package/dist/services/plugin-settings.service.js +16 -3
- package/dist/services/secret-migration.service.d.ts +22 -0
- package/dist/services/secret-migration.service.js +48 -0
- package/dist/services/secret-views.d.ts +56 -0
- package/dist/services/secret-views.js +120 -0
- package/dist/services/vpn.service.d.ts +9 -2
- package/dist/services/vpn.service.js +38 -9
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ var VpnService_1;
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.VpnService = void 0;
|
|
17
17
|
exports.errorWithCause = errorWithCause;
|
|
18
|
+
exports.isHomeByDesign = isHomeByDesign;
|
|
18
19
|
const common_1 = require("@nestjs/common");
|
|
19
20
|
const tokens_1 = require("../ports/tokens");
|
|
20
21
|
const logger_1 = require("../ports/logger");
|
|
@@ -90,6 +91,7 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
90
91
|
this.directAgent = new undici_1.Agent();
|
|
91
92
|
this.tunnels = new Map();
|
|
92
93
|
this.leakFlagged = new Map();
|
|
94
|
+
this.homeWarned = new Set();
|
|
93
95
|
/** The last leak-check answer per exit. Absent means unknown: nothing has compared its IP yet. */
|
|
94
96
|
this.verdicts = new Map();
|
|
95
97
|
this.leakGuardActive = false;
|
|
@@ -180,6 +182,7 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
180
182
|
type: h.egress.type,
|
|
181
183
|
ready: h.ready,
|
|
182
184
|
error: h.error,
|
|
185
|
+
verdict: this.verdictOf(h.egress.id),
|
|
183
186
|
}));
|
|
184
187
|
return {
|
|
185
188
|
strictMode: this.settings.strictMode,
|
|
@@ -202,16 +205,16 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
202
205
|
* that produced its link. A pinned exit that is gone or not ready fails the
|
|
203
206
|
* download: it never falls back to the routed or direct network.
|
|
204
207
|
*/
|
|
205
|
-
getDispatcherForExit(egressId) {
|
|
208
|
+
getDispatcherForExit(egressId, purpose) {
|
|
206
209
|
// An entry override beats a pinned link exit: precedence is override > pin > rules.
|
|
207
210
|
const id = egress_context_1.egressContext.current()?.egressId ?? egressId;
|
|
208
211
|
const waiting = this.waitingFor('pinned download');
|
|
209
212
|
if (waiting)
|
|
210
213
|
throw waiting;
|
|
211
|
-
const handle = this.effective(this.exits.get(id));
|
|
214
|
+
const handle = this.effective(this.exits.get(id), purpose);
|
|
212
215
|
if (handle?.ready)
|
|
213
216
|
return handle.dispatcher;
|
|
214
|
-
throw this.pinnedError(id, 'pinned download');
|
|
217
|
+
throw this.pinnedError(id, 'pinned download', purpose);
|
|
215
218
|
}
|
|
216
219
|
/** HTTP proxy URL on 127.0.0.1 for ffmpeg `-http_proxy`; undefined only for an explicit direct exit or no chain. */
|
|
217
220
|
getFfmpegProxyUrl(url, egressId) {
|
|
@@ -391,6 +394,12 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
391
394
|
}
|
|
392
395
|
}
|
|
393
396
|
this.exits = next;
|
|
397
|
+
for (const handle of next.values()) {
|
|
398
|
+
if (!isHomeByDesign(handle.egress) || this.homeWarned.has(handle.egress.id))
|
|
399
|
+
continue;
|
|
400
|
+
this.homeWarned.add(handle.egress.id);
|
|
401
|
+
this.logger.warn(`Exit "${handle.egress.name}" uses the home connection on purpose: it serves hoster link resolution and captcha only (media downloads always go through the VPN) and is exempt from the leak check`);
|
|
402
|
+
}
|
|
394
403
|
for (const id of [...this.leakFlagged.keys()])
|
|
395
404
|
if (!next.has(id))
|
|
396
405
|
this.leakFlagged.delete(id);
|
|
@@ -407,6 +416,11 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
407
416
|
const id = handle.egress.id;
|
|
408
417
|
if (!handle.ready)
|
|
409
418
|
return handle;
|
|
419
|
+
if (isHomeByDesign(handle.egress)) {
|
|
420
|
+
// The home connection is this exit's purpose: the leak guard never takes it out of service.
|
|
421
|
+
this.leakFlagged.delete(id);
|
|
422
|
+
return handle;
|
|
423
|
+
}
|
|
410
424
|
const flagged = this.leakFlagged.get(id);
|
|
411
425
|
if (flagged)
|
|
412
426
|
return { ...handle, ready: false, error: flagged };
|
|
@@ -460,8 +474,8 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
460
474
|
ids.add(settings.captchaFallbackEgressId);
|
|
461
475
|
return [...ids];
|
|
462
476
|
}
|
|
463
|
-
pinnedError(egressId, host) {
|
|
464
|
-
const handle = this.effective(this.exits.get(egressId));
|
|
477
|
+
pinnedError(egressId, host, purpose) {
|
|
478
|
+
const handle = this.effective(this.exits.get(egressId), purpose);
|
|
465
479
|
return new egress_router_1.EgressNotReadyError(egressId, handle?.egress.name ?? egressId, host, handle ? handle.error ?? 'not ready' : 'exit no longer exists');
|
|
466
480
|
}
|
|
467
481
|
/** The exit that serves `url`: the pinned one, else the one routing picks. Undefined = direct (no chain). */
|
|
@@ -702,12 +716,17 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
702
716
|
for (const handle of targets) {
|
|
703
717
|
const id = handle.egress.id;
|
|
704
718
|
const exitIp = await this.lookupEgressIp({ kind: 'exit', egressId: id });
|
|
705
|
-
const
|
|
719
|
+
const raw = (0, leak_guard_1.evaluateLeak)({ exitIp, directIp });
|
|
720
|
+
// A home-connection exit reporting the direct IP is what the operator asked for.
|
|
721
|
+
const verdict = raw === 'leak' && isHomeByDesign(handle.egress) ? 'home' : raw;
|
|
706
722
|
// A failed lookup says nothing: it never revokes a verdict a check already gave, and it
|
|
707
723
|
// never grants one. A host that requires an exit therefore stays closed until one answers.
|
|
708
724
|
if (verdict !== 'unknown')
|
|
709
725
|
this.verdicts.set(id, verdict);
|
|
710
|
-
if (verdict === '
|
|
726
|
+
if (verdict === 'home') {
|
|
727
|
+
this.leakFlagged.delete(id);
|
|
728
|
+
}
|
|
729
|
+
else if (verdict === 'leak' && !this.leakFlagged.has(id)) {
|
|
711
730
|
const reason = 'leak guard: this exit reports the same egress IP as the direct network';
|
|
712
731
|
this.leakFlagged.set(id, reason);
|
|
713
732
|
this.markNotReady(id, reason);
|
|
@@ -734,7 +753,13 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
734
753
|
* An exit as a request may use it. On a host that requires an exit, a VPN exit serves only
|
|
735
754
|
* after the leak check has compared its IP with the direct one and found them different.
|
|
736
755
|
*/
|
|
737
|
-
effective(handle) {
|
|
756
|
+
effective(handle, purpose) {
|
|
757
|
+
if (handle && isHomeByDesign(handle.egress)) {
|
|
758
|
+
// The home connection serves hoster link resolution and captcha and nothing else, on every host, gate or not.
|
|
759
|
+
if ((purpose ?? egress_context_1.egressContext.current()?.purpose) === 'hoster-resolution')
|
|
760
|
+
return handle;
|
|
761
|
+
return { ...handle, ready: false, error: 'this exit uses the home connection on purpose and serves hoster link resolution and captcha only' };
|
|
762
|
+
}
|
|
738
763
|
if (!handle || !this.gate.required || handle.egress.type === 'direct' || !handle.ready)
|
|
739
764
|
return handle;
|
|
740
765
|
if (this.verdictOf(handle.egress.id) === 'ok')
|
|
@@ -761,7 +786,7 @@ let VpnService = VpnService_1 = class VpnService {
|
|
|
761
786
|
if (!handle.ready)
|
|
762
787
|
return { open: false, reason: `the default exit "${handle.egress.name}" is not ready: ${handle.error ?? 'unknown reason'}` };
|
|
763
788
|
const verdict = this.verdictOf(id);
|
|
764
|
-
if (verdict === 'leak')
|
|
789
|
+
if (verdict === 'leak' || verdict === 'home')
|
|
765
790
|
return { open: false, reason: `the default exit "${handle.egress.name}" leaks: it reports the direct IP` };
|
|
766
791
|
if (verdict === 'unknown')
|
|
767
792
|
return { open: false, reason: `the leak check has not yet confirmed the default exit "${handle.egress.name}"` };
|
|
@@ -824,3 +849,7 @@ exports.VpnService = VpnService = VpnService_1 = __decorate([
|
|
|
824
849
|
__metadata("design:paramtypes", [vpn_providers_repository_1.VpnProvidersRepository,
|
|
825
850
|
vpn_settings_repository_1.VpnSettingsRepository, Object, Object, egress_gate_1.EgressGate])
|
|
826
851
|
], VpnService);
|
|
852
|
+
/** The operator ran this exit on the home connection on purpose (hoster link resolution and captcha only). */
|
|
853
|
+
function isHomeByDesign(egress) {
|
|
854
|
+
return egress.type !== 'direct' && egress.type !== 'wireguard' && egress.homeIpByDesign === true;
|
|
855
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -278,6 +278,13 @@ export interface ProxyEgress extends EgressBase {
|
|
|
278
278
|
port: number;
|
|
279
279
|
username?: string;
|
|
280
280
|
password?: string;
|
|
281
|
+
/**
|
|
282
|
+
* An operator decision: this exit leaves with the home connection ON PURPOSE, and serves
|
|
283
|
+
* hoster link resolution and captcha only (media downloads always go through the VPN). The leak guard
|
|
284
|
+
* expects the direct IP from it, and no other request may use it.
|
|
285
|
+
* Allowed only on the captcha fallback exit, never on the default or a rule's exit.
|
|
286
|
+
*/
|
|
287
|
+
homeIpByDesign?: boolean;
|
|
281
288
|
}
|
|
282
289
|
/** NordVPN helper input: a country or a server hostname, resolved through api.nordvpn.com. */
|
|
283
290
|
export interface NordTarget {
|
package/package.json
CHANGED