Skip to content

Commit

Permalink
Merge branch 'dev' of gozargah:Gozargah/Marzban into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Oct 15, 2024
2 parents 9b6e830 + cc4a6dc commit cfd3026
Show file tree
Hide file tree
Showing 58 changed files with 248 additions and 201 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ UVICORN_PORT = 8000
# UVICORN_SSL_CERTFILE = "/var/lib/marzban/certs/example.com/fullchain.pem"
# UVICORN_SSL_KEYFILE = "/var/lib/marzban/certs/example.com/key.pem"

# DASHBOARD_PATH = "/dashboard/"

# XRAY_JSON = "xray_config.json"
# XRAY_SUBSCRIPTION_URL_PREFIX = "https://example.com"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Build project
working-directory: ./app/dashboard
run: VITE_BASE_API=/api/ npm run build --if-present -- --outDir build --base '/dashboard/'
run: VITE_BASE_API=/api/ npm run build --if-present -- --outDir build --assetsDir statics

- name: Create 404.html
working-directory: ./app/dashboard
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Build project
working-directory: ./app/dashboard
run: VITE_BASE_API=/api/ npm run build --if-present -- --outDir build --base '/dashboard/'
run: VITE_BASE_API=/api/ npm run build --if-present -- --outDir build --assetsDir statics

- name: Create 404.html
working-directory: ./app/dashboard
Expand Down
17 changes: 11 additions & 6 deletions app/dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
from pathlib import Path

from app import app
from config import DEBUG, VITE_BASE_API
from config import DEBUG, VITE_BASE_API, DASHBOARD_PATH
from fastapi.staticfiles import StaticFiles

path = '/dashboard/'
base_dir = Path(__file__).parent
build_dir = base_dir / 'build'
statics_dir = build_dir / 'statics'


def build():
proc = subprocess.Popen(
['npm', 'run', 'build', '--', '--base', path, '--outDir', build_dir],
['npm', 'run', 'build', '--', '--outDir', build_dir, '--assetsDir', 'statics'],
env={**os.environ, 'VITE_BASE_API': VITE_BASE_API},
cwd=base_dir
)
Expand All @@ -27,7 +27,7 @@ def build():

def run_dev():
proc = subprocess.Popen(
['npm', 'run', 'dev', '--', '--host', '0.0.0.0', '--base', path, '--clearScreen', 'false'],
['npm', 'run', 'dev', '--', '--host', '0.0.0.0', '--clearScreen', 'false', '--base', os.path.join(DASHBOARD_PATH, '')],
env={**os.environ, 'VITE_BASE_API': VITE_BASE_API},
cwd=base_dir
)
Expand All @@ -40,15 +40,20 @@ def run_build():
build()

app.mount(
path,
DASHBOARD_PATH,
StaticFiles(directory=build_dir, html=True),
name="dashboard"
)
app.mount(
'/statics/',
StaticFiles(directory=statics_dir, html=True),
name="statics"
)


@app.on_event("startup")
def startup():
if DEBUG is True:
if DEBUG:
run_dev()
else:
run_build()
22 changes: 11 additions & 11 deletions app/dashboard/build/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@
<link
rel="apple-touch-icon"
sizes="180x180"
href="/dashboard/favicon/apple-touch-icon.png"
href="/statics/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/dashboard/favicon/favicon-32x32.png"
href="/statics/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/dashboard/favicon/favicon-16x16.png"
href="/statics/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/dashboard/favicon/site.webmanifest" />
<link rel="manifest" href="/statics/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/dashboard/favicon/safari-pinned-tab.svg"
href="/statics/favicon/safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="shortcut icon" href="/dashboard/favicon/favicon.ico" />
<link rel="shortcut icon" href="/statics/favicon/favicon.ico" />
<meta name="apple-mobile-web-app-title" content="Marzban" />
<meta name="application-name" content="Marzban" />
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="msapplication-config" content="/statics/favicon/browserconfig.xml" />
<meta name="theme-color" content="#3B81F6" />
<script type="module" crossorigin src="/dashboard/assets/index.de0b6a8b.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.108888cb.js">
<link rel="stylesheet" href="/dashboard/assets/index.876adee7.css">
<script type="module" crossorigin src="/statics/index.8d48a3d3.js"></script>
<link rel="modulepreload" crossorigin href="/statics/vendor.3f3f0bc0.js">
<link rel="stylesheet" href="/statics/index.9b97897c.css">
</head>
<body>
<div id="root"></div>

</body>
</html>
</html>
6 changes: 0 additions & 6 deletions app/dashboard/build/assets/index.876adee7.css

This file was deleted.

14 changes: 0 additions & 14 deletions app/dashboard/build/assets/index.de0b6a8b.js

This file was deleted.

22 changes: 11 additions & 11 deletions app/dashboard/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@
<link
rel="apple-touch-icon"
sizes="180x180"
href="/dashboard/favicon/apple-touch-icon.png"
href="/statics/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/dashboard/favicon/favicon-32x32.png"
href="/statics/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/dashboard/favicon/favicon-16x16.png"
href="/statics/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/dashboard/favicon/site.webmanifest" />
<link rel="manifest" href="/statics/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/dashboard/favicon/safari-pinned-tab.svg"
href="/statics/favicon/safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="shortcut icon" href="/dashboard/favicon/favicon.ico" />
<link rel="shortcut icon" href="/statics/favicon/favicon.ico" />
<meta name="apple-mobile-web-app-title" content="Marzban" />
<meta name="application-name" content="Marzban" />
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="msapplication-config" content="/statics/favicon/browserconfig.xml" />
<meta name="theme-color" content="#3B81F6" />
<script type="module" crossorigin src="/dashboard/assets/index.de0b6a8b.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.108888cb.js">
<link rel="stylesheet" href="/dashboard/assets/index.876adee7.css">
<script type="module" crossorigin src="/statics/index.8d48a3d3.js"></script>
<link rel="modulepreload" crossorigin href="/statics/vendor.3f3f0bc0.js">
<link rel="stylesheet" href="/statics/index.9b97897c.css">
</head>
<body>
<div id="root"></div>

</body>
</html>
</html>
File renamed without changes.
14 changes: 14 additions & 0 deletions app/dashboard/build/statics/index.8d48a3d3.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions app/dashboard/build/statics/index.9b97897c.css

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions app/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
href="/statics/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon/favicon-32x32.png"
href="/statics/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon/favicon-16x16.png"
href="/statics/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/favicon/site.webmanifest" />
<link rel="manifest" href="/statics/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/favicon/safari-pinned-tab.svg"
href="/statics/favicon/safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="shortcut icon" href="/favicon/favicon.ico" />
<link rel="shortcut icon" href="/statics/favicon/favicon.ico" />
<meta name="apple-mobile-web-app-title" content="Marzban" />
<meta name="application-name" content="Marzban" />
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="msapplication-config" content="/statics/favicon/browserconfig.xml" />
<meta name="theme-color" content="#3B81F6" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
</html>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"hostsDialog.fragment.info": "Correct pattern: length,interval,packets",
"hostsDialog.fragment.info.attention": "Attention: currently, this feature only supported in streisand >= 1.6.12 and v2rayNG >= 1.8.16 (custom config)",
"hostsDialog.fragment.info.examples": "Examples:",
"hostsDialog.noise": "Noise pattern",
"hostsDialog.noise.info": "Correct pattern: packets,delay",
"hostsDialog.noise.info.attention": "Attention: currently, this feature only supported in streisand >= 1.6.32 and v2rayNG >= 1.8.39 (custom config)",
"hostsDialog.noise.info.examples": "Examples:",
"hostsDialog.host": "Request Host",
"hostsDialog.host.info": "By default, if a request host is set in the Xray config, this host is used. However, you can set a custom request host here if needed.",
"hostsDialog.host.multiHost": "To set multiple addresses, separate them with <badge>,</badge> Each time an address is chosen randomly.",
Expand Down Expand Up @@ -184,4 +188,4 @@
"usersTable.noUserMatched": "It seems there is no user matched with what you are looking for",
"usersTable.status": "status",
"usersTable.total": "Total"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"hostsDialog.fragment.info": "length,interval,packet (e.g. 10-100,100-200,tlshello)",
"hostsDialog.fragment.info.attention": "توجه: در حال حاضر، این ویژگی فقط در streisand >= 1.6.12 و v2rayNG >= 1.8.16 (پیکربندی سفارشی) پشتیبانی می شود",
"hostsDialog.fragment.info.examples": "نمونه ها:",
"hostsDialog.noise": "الگو نویز",
"hostsDialog.noise.info": "packet,delay (e.g. rand:10-20,100-200)",
"hostsDialog.noise.info.attention": "توجه: در حال حاضر، این ویژگی فقط در streisand >= 1.6.32 و v2rayNG >= 1.8.39 (پیکربندی سفارشی) پشتیبانی می شود",
"hostsDialog.noise.info.examples": "نمونه ها:",

"hostsDialog.host": "هاست درخواست",
"hostsDialog.host.info": "به‌طور پیش‌فرض، اگر هاست درخواستی در پیکربندی *** تنظیم شده باشد، این هاست استفاده می‌شود. اما می‌توانید یک هاست درخواستی متفاوت در اینجا قرار دهید.",
"hostsDialog.host.multiHost": "برای تنظیم چند آدرس، با <badge>,</badge> از هم جدا کنید. هر دفعه آدرسی به صورت تصادفی قرار داده می‌شود.",
Expand Down Expand Up @@ -189,4 +194,4 @@
"usersTable.noUserMatched": "به‌نظر میرسه کاربری که جستجو کردید، وجود ندارد",
"usersTable.status": "وضعیت",
"usersTable.total": "مجموع"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"hostsDialog.fragment.info": "length,interval,packet (e.g. 10-100,100-200,tlshello)",
"hostsDialog.fragment.info.attention": "Attention: currently, this feature only supported in streisand >= 1.6.12 and v2rayNG >= 1.8.16 (custom config)",
"hostsDialog.fragment.info.examples": "Examples:",
"hostsDialog.noise": "Шумовой паттерн",
"hostsDialog.noise.info": "packet,delay (e.g. rand:10-20,100-200)",
"hostsDialog.noise.info.attention": "Attention: currently, this feature only supported in streisand >= 1.6.32 and v2rayNG >= 1.8.39 (custom config)",
"hostsDialog.noise.info.examples": "Examples:",
"hostsDialog.host": "Host",
"hostsDialog.host.info": "По умолчанию, если в конфигурации XRAY задан запрашиваемый хост, то он и будет использоваться. Однако, если необходимо, вы можете установить здесь пользовательский запрашиваемый хост.",
"hostsDialog.host.multiHost": "Чтобы установить несколько адресов, разделяйте их с помощью <badge>,</badge>. Каждый раз будет выбран случайный адрес.",
Expand Down Expand Up @@ -184,4 +188,4 @@
"usersTable.noUserMatched": "Похоже, нет пользователя, соответствующего вашему запросу",
"usersTable.status": "Статус",
"usersTable.total": "Всего"
}
}
Loading

0 comments on commit cfd3026

Please sign in to comment.