Skip to content

Commit 054b4b3

Browse files
committed
feat: add subpage config support for external squads
1 parent 7db72a9 commit 054b4b3

28 files changed

+251
-5
lines changed

libs/contract/api/controllers/subscriptions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ export const SUBSCRIPTIONS_ROUTES = {
88
SHORT_UUID: (shortUuid: string) => `by-short-uuid/${shortUuid}`,
99
SHORT_UUID_RAW: (shortUuid: string) => `by-short-uuid/${shortUuid}/raw`,
1010
},
11+
SUBPAGE: {
12+
GET_CONFIG: (shortUuid: string) => `subppage-config/${shortUuid}`,
13+
},
1114
} as const;

libs/contract/api/routes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ export const REST_API = {
276276
shortUuid,
277277
)}`,
278278
},
279+
SUBPAGE: {
280+
GET_CONFIG: (shortUuid: string) =>
281+
`${ROOT}/${CONTROLLERS.SUBSCRIPTIONS_CONTROLLER}/${CONTROLLERS.SUBSCRIPTIONS_ROUTES.SUBPAGE.GET_CONFIG(
282+
shortUuid,
283+
)}`,
284+
},
279285
},
280286
CONFIG_PROFILES: {
281287
GET: `${ROOT}/${CONTROLLERS.CONFIG_PROFILES_CONTROLLER}/${CONTROLLERS.CONFIG_PROFILES_ROUTES.GET}`,

libs/contract/commands/external-squads/update-external-squad.command.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export namespace UpdateExternalSquadCommand {
4545
responseHeaders: ExternalSquadResponseHeadersSchema.optional(),
4646
hwidSettings: z.optional(z.nullable(HwidSettingsSchema)),
4747
customRemarks: z.optional(z.nullable(CustomRemarksSchema)),
48+
subpageConfigUuid: z.optional(z.nullable(z.string().uuid())),
4849
});
4950

5051
export type Request = z.infer<typeof RequestSchema>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './get-all-subscriptions.command';
22
export * from './get-by';
3+
export * from './subpage';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { z } from 'zod';
2+
3+
import { REST_API, SUBSCRIPTIONS_ROUTES } from '../../../api';
4+
import { getEndpointDetails } from '../../../constants';
5+
6+
export namespace GetSubpageConfigByShortUuidCommand {
7+
export const url = REST_API.SUBSCRIPTIONS.SUBPAGE.GET_CONFIG;
8+
export const TSQ_url = url(':shortUuid');
9+
10+
export const endpointDetails = getEndpointDetails(
11+
SUBSCRIPTIONS_ROUTES.SUBPAGE.GET_CONFIG(':shortUuid'),
12+
'get',
13+
'Get Subpage Config by Short UUID',
14+
);
15+
16+
export const RequestSchema = z.object({
17+
shortUuid: z.string(),
18+
});
19+
20+
export type Request = z.infer<typeof RequestSchema>;
21+
22+
export const RequestBodySchema = z.object({
23+
requestHeaders: z.record(z.string(), z.string()),
24+
});
25+
26+
export type RequestBody = z.infer<typeof RequestBodySchema>;
27+
28+
export const ResponseSchema = z.object({
29+
response: z.object({
30+
subpageConfigUuid: z.string().uuid().nullable(),
31+
webpageAllowed: z.boolean(),
32+
}),
33+
});
34+
35+
export type Response = z.infer<typeof ResponseSchema>;
36+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './get-subpage-config-by-shortuuid.command';

libs/contract/models/external-squad.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const ExternalSquadSchema = z.object({
2828
responseHeaders: ExternalSquadResponseHeadersSchema,
2929
hwidSettings: z.nullable(HwidSettingsSchema),
3030
customRemarks: z.nullable(CustomRemarksSchema),
31+
subpageConfigUuid: z.nullable(z.string().uuid()),
3132

3233
createdAt: z
3334
.string()

libs/contract/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@remnawave/backend-contract",
3-
"version": "2.3.55",
3+
"version": "2.3.58",
44
"public": true,
55
"license": "AGPL-3.0-only",
66
"description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const APP_CONFIG_ROUTE_LEADING_PATH = '/assets/.app-config-v2.json' as const;
2+
export const APP_CONFIG_ROUTE_WO_LEADING_PATH = 'assets/.app-config-v2.json' as const;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './app-config.constant';
12
export * from './subscription-page-config';

0 commit comments

Comments
 (0)