Skip to content

Commit b3b0fca

Browse files
committed
feat: add Vision module
- Added new Vision module - Updated contract API routes and controllers to include Vision-related endpoints - Updated package dependencies for @remnawave/xtls-sdk and @remnawave/xtls-sdk-nestjs
1 parent 1d4d9a6 commit b3b0fca

23 files changed

+352
-27
lines changed

.github/workflows/build-dev.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build & Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
send-tg-msg:
10+
name: Send TG message
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@v2
15+
16+
- name: Send Telegram message
17+
uses: proDreams/actions-telegram-notifier@main
18+
with:
19+
token: ${{ secrets.TELEGRAM_TOKEN }}
20+
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
21+
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
22+
status: pending
23+
notify_fields: 'repo_with_tag,commit,workflow'
24+
title: 'Building docker image.'
25+
26+
build-docker-image:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v2
34+
35+
- name: Setup Node
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: '22.x'
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v2
42+
43+
- name: Login to Docker Hub
44+
uses: docker/login-action@v2
45+
with:
46+
username: ${{ secrets.DOCKERHUB_USERNAME }}
47+
password: ${{ secrets.DOCKERHUB_TOKEN }}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v3
51+
with:
52+
context: .
53+
platforms: linux/amd64
54+
push: true
55+
tags: |
56+
remnawave/node:dev
57+
58+
send-finish-tg-msg:
59+
name: Send TG message
60+
needs: [build-docker-image]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout source code
64+
uses: actions/checkout@v2
65+
66+
- name: Send Telegram message
67+
uses: proDreams/actions-telegram-notifier@main
68+
with:
69+
token: ${{ secrets.TELEGRAM_TOKEN }}
70+
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
71+
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
72+
status: ${{ job.status }}
73+
notify_fields: 'repo_with_tag,commit,workflow'
74+
title: 'Build Dev finished.'
75+
76+
notify-on-error:
77+
runs-on: ubuntu-latest
78+
needs: [build-docker-image]
79+
if: failure()
80+
steps:
81+
- name: Checkout source code
82+
uses: actions/checkout@v2
83+
84+
- name: Send error notification
85+
uses: proDreams/actions-telegram-notifier@main
86+
with:
87+
token: ${{ secrets.TELEGRAM_TOKEN }}
88+
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
89+
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
90+
status: failure
91+
notify_fields: 'repo_with_tag,commit,workflow'
92+
title: 'Build Dev failed.'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './handler';
22
export * from './stats';
3+
export * from './vision';
34
export * from './xray';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const VISION_CONTROLLER = 'vision' as const;
2+
3+
export const VISION_ROUTES = {
4+
BLOCK_IP: 'block-ip',
5+
UNBLOCK_IP: 'unblock-ip',
6+
} as const;

libs/contract/api/routes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ export const REST_API = {
2323
GET_INBOUND_USERS_COUNT: `${ROOT}/${CONTROLLERS.HANDLER_CONTROLLER}/${CONTROLLERS.HANDLER_ROUTES.GET_INBOUND_USERS_COUNT}`,
2424
GET_INBOUND_USERS: `${ROOT}/${CONTROLLERS.HANDLER_CONTROLLER}/${CONTROLLERS.HANDLER_ROUTES.GET_INBOUND_USERS}`,
2525
},
26+
VISION: {
27+
UNBLOCK_IP: `${ROOT}/${CONTROLLERS.VISION_CONTROLLER}/${CONTROLLERS.VISION_ROUTES.UNBLOCK_IP}`,
28+
BLOCK_IP: `${ROOT}/${CONTROLLERS.VISION_CONTROLLER}/${CONTROLLERS.VISION_ROUTES.BLOCK_IP}`,
29+
},
2630
} as const;

libs/contract/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './handler';
22
export * from './stats';
3+
export * from './vision';
34
export * from './xray';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { z } from 'zod';
2+
3+
import { REST_API } from '../../api';
4+
5+
export namespace BlockIpCommand {
6+
export const url = REST_API.VISION.BLOCK_IP;
7+
8+
export const RequestSchema = z.object({
9+
ip: z.string(),
10+
username: z.string(),
11+
});
12+
13+
export type Request = z.infer<typeof RequestSchema>;
14+
15+
export const ResponseSchema = z.object({
16+
response: z.object({
17+
success: z.boolean(),
18+
error: z.string().nullable(),
19+
}),
20+
});
21+
22+
export type Response = z.infer<typeof ResponseSchema>;
23+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './block-ip.command';
2+
export * from './unblock-ip.command';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { z } from 'zod';
2+
3+
import { REST_API } from '../../api';
4+
5+
export namespace UnblockIpCommand {
6+
export const url = REST_API.VISION.UNBLOCK_IP;
7+
8+
export const RequestSchema = z.object({
9+
ip: z.string(),
10+
username: z.string(),
11+
});
12+
13+
export type Request = z.infer<typeof RequestSchema>;
14+
15+
export const ResponseSchema = z.object({
16+
response: z.object({
17+
success: z.boolean(),
18+
error: z.string().nullable(),
19+
}),
20+
});
21+
22+
export type Response = z.infer<typeof ResponseSchema>;
23+
}

package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
},
2828
"dependencies": {
2929
"@cjs-exporter/execa": "9.5.2",
30-
"@nestjs/common": "11.0.6",
30+
"@nestjs/common": "11.0.10",
3131
"@nestjs/config": "4.0.0",
32-
"@nestjs/core": "11.0.6",
32+
"@nestjs/core": "11.0.10",
3333
"@nestjs/jwt": "11.0.0",
3434
"@nestjs/passport": "11.0.5",
35-
"@nestjs/platform-express": "11.0.6",
36-
"@remnawave/xtls-sdk": "0.1.0",
37-
"@remnawave/xtls-sdk-nestjs": "0.2.0",
35+
"@nestjs/platform-express": "11.0.10",
36+
"@remnawave/xtls-sdk": "0.1.2",
37+
"@remnawave/xtls-sdk-nestjs": "0.2.1",
3838
"enhanced-ms": "^3.0.0",
3939
"helmet": "^7.1.0",
4040
"husky": "9.0.11",

0 commit comments

Comments
 (0)