Use submodule for admin assets

This commit is contained in:
xboard
2026-03-11 04:52:06 +08:00
parent b340652b4d
commit 448ddecb56
19 changed files with 71 additions and 78587 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "public/assets/admin"]
path = public/assets/admin
url = https://github.com/cedar2025/xboard-admin-dist.git
+2 -1
View File
@@ -25,7 +25,8 @@ RUN echo "Attempting to clone branch: ${BRANCH_NAME} from ${REPO_URL} with CACHE
rm -rf ./* && \
rm -rf .git && \
git config --global --add safe.directory /www && \
git clone --depth 1 --branch ${BRANCH_NAME} ${REPO_URL} .
git clone --depth 1 --branch ${BRANCH_NAME} ${REPO_URL} . && \
git submodule update --init --recursive --force
COPY .docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+1
View File
@@ -3,6 +3,7 @@
rm -rf composer.phar
wget https://github.com/composer/composer/releases/latest/download/composer.phar -O composer.phar
php composer.phar install -vvv
git submodule update --init --recursive --force
php artisan xboard:install
if [ -f "/etc/init.d/bt" ] || [ -f "/.dockerenv" ]; then
Submodule public/assets/admin added at 01bd0b3749
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-32
View File
@@ -1,32 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/images/favicon.svg" />
<link rel="icon" type="image/png" href="/images/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shadcn Admin</title>
<meta
name="description"
content="Admin Dashboard UI built with Shadcn and Vite."
/>
<script>
window.settings = {
base_url: 'http://127.0.0.1:8000',
title: 'Xboard',
version: '1.0.0',
logo: 'https://xboard.io/i6mages/logo.png',
secure_path: '/afbced4e',
}
</script>
<script src="./locales/en-US.js"></script>
<script src="./locales/zh-CN.js"></script>
<script src="./locales/ko-KR.js"></script>
<script type="module" crossorigin src="./assets/index.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index.css">
<link rel="stylesheet" crossorigin href="./assets/vendor.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+63 -6
View File
@@ -14,12 +14,69 @@
secure_path: "{{ $secure_path }}",
};
</script>
<script type="module" crossorigin src="/assets/admin/assets/index.js"></script>
<link rel="stylesheet" crossorigin href="/assets/admin/assets/index.css" />
<link rel="stylesheet" crossorigin href="/assets/admin/assets/vendor.css">
<script src="/assets/admin/locales/en-US.js"></script>
<script src="/assets/admin/locales/zh-CN.js"></script>
<script src="/assets/admin/locales/ko-KR.js"></script>
@php
$manifestPath = public_path('assets/admin/manifest.json');
$manifest = file_exists($manifestPath) ? json_decode(file_get_contents($manifestPath), true) : null;
$entry = is_array($manifest) ? ($manifest['index.html'] ?? null) : null;
$scripts = [];
$styles = [];
$locales = [];
if (is_array($entry)) {
$visited = [];
$collectAssets = function ($chunkName) use (&$collectAssets, &$manifest, &$visited, &$scripts, &$styles) {
if (isset($visited[$chunkName]) || !isset($manifest[$chunkName]) || !is_array($manifest[$chunkName])) {
return;
}
$visited[$chunkName] = true;
$chunk = $manifest[$chunkName];
if (!empty($chunk['css']) && is_array($chunk['css'])) {
foreach ($chunk['css'] as $cssFile) {
$styles[$cssFile] = $cssFile;
}
}
if (!empty($chunk['imports']) && is_array($chunk['imports'])) {
foreach ($chunk['imports'] as $import) {
$collectAssets($import);
}
}
if (!empty($chunk['isEntry']) && !empty($chunk['file'])) {
$scripts[$chunk['file']] = $chunk['file'];
}
};
$collectAssets('index.html');
}
foreach (glob(public_path('assets/admin/locales/*.js')) ?: [] as $localeFile) {
$locales[] = 'locales/' . basename($localeFile);
}
sort($locales);
@endphp
@if($entry && count($scripts) > 0)
@foreach($styles as $css)
<link rel="stylesheet" crossorigin href="/assets/admin/{{ $css }}" />
@endforeach
@foreach($locales as $locale)
<script src="/assets/admin/{{ $locale }}"></script>
@endforeach
@foreach($scripts as $js)
<script type="module" crossorigin src="/assets/admin/{{ $js }}"></script>
@endforeach
@else
{{-- Fallback: hardcoded paths for backward compatibility --}}
<script type="module" crossorigin src="/assets/admin/assets/index.js"></script>
<link rel="stylesheet" crossorigin href="/assets/admin/assets/index.css" />
<link rel="stylesheet" crossorigin href="/assets/admin/assets/vendor.css">
<script src="/assets/admin/locales/en-US.js"></script>
<script src="/assets/admin/locales/zh-CN.js"></script>
<script src="/assets/admin/locales/ko-KR.js"></script>
@endif
</head>
<body>
+1
View File
@@ -15,6 +15,7 @@ git fetch --all && git reset --hard origin/master && git pull origin master
rm -rf composer.lock composer.phar
wget https://github.com/composer/composer/releases/latest/download/composer.phar -O composer.phar
php composer.phar update -vvv
git submodule update --init --recursive --force
php artisan xboard:update
if [ -f "/etc/init.d/bt" ] || [ -f "/.dockerenv" ]; then