Accept 16-character subscription secrets for gateway presence
This commit is contained in:
@@ -27,7 +27,7 @@ function subscriptionSecret(subscriptionUrl) {
|
||||
pathSegments.at(-1),
|
||||
]
|
||||
.map((value) => String(value || '').trim())
|
||||
.filter((value) => value.length >= 24);
|
||||
.filter((value) => value.length >= 16);
|
||||
if (!candidates.length) return '';
|
||||
|
||||
url.hash = '';
|
||||
|
||||
@@ -52,6 +52,13 @@ test('Gateway presence is authenticated by the shared subscription secret', asyn
|
||||
nonce,
|
||||
}).available, false);
|
||||
|
||||
assert.equal(buildGatewayPresence({
|
||||
appMode: 'gateway',
|
||||
subscriptionUrl: 'https://subscription.example/0123456789abcdef',
|
||||
gatewayId: 'gateway-1',
|
||||
nonce,
|
||||
}).available, true);
|
||||
|
||||
const sharedPublicValue = 'https://public.example/sing-box-configuration-v1';
|
||||
const firstUrl = `${subscriptionUrl}?redirect=${encodeURIComponent(sharedPublicValue)}`;
|
||||
const secondUrl = `https://subscription.example/fedcba9876543210fedcba9876543210?redirect=${encodeURIComponent(sharedPublicValue)}`;
|
||||
|
||||
Reference in New Issue
Block a user