mirror of
https://github.com/Coldsmiles/infstarweb.git
synced 2026-04-23 02:30:41 +08:00
feat: initialize Vue application with main components and styles
- Added App.vue as the main application component with a structured layout. - Created main.js to bootstrap the Vue application and mount it to the DOM. - Introduced styles.css for global styling, including responsive design and theming. - Removed outdated HTML files (stats.html, towns.html) and Python script (statsprocess.py) as part of the migration to a new Vue-based architecture. - Added Vite configuration (vite.config.js) for building the Vue application.
This commit is contained in:
68
.github/copilot-instructions.md
vendored
68
.github/copilot-instructions.md
vendored
@@ -1,68 +0,0 @@
|
||||
# Project Guidelines
|
||||
|
||||
## Code Style
|
||||
- This repo is framework-free: plain HTML + CSS + vanilla JavaScript — no frameworks, modules, or build tooling.
|
||||
- Keep existing naming style: `camelCase` for JS functions/variables and descriptive DOM ids/classes (for example `fetchCrowdfunding`, `setupMobileMenu`, `#players-grid`).
|
||||
- Preserve current formatting patterns: 4-space indentation in HTML/CSS, simple function-based JS.
|
||||
- Shared JS utilities use the global-object pattern (e.g. `DataUtils` in `js/data_utils.js`) — do not convert to ES modules.
|
||||
- Reuse shared tokens in `css/style.css` (`:root` variables such as `--bg-color`, `--accent-color`) instead of introducing new ad-hoc styles.
|
||||
- Keep page-local style overrides scoped to their page blocks; avoid broad visual refactors unless explicitly requested.
|
||||
- Keep user-facing copy in Chinese unless the surrounding section is already English.
|
||||
|
||||
## Architecture
|
||||
- Public pages are static entry points:
|
||||
- `index.html` + `js/script.js`: landing page, sponsors, fundraising progress, live server status.
|
||||
- `sponsor.html` + `js/sponsor_script.js`: donation total, sponsor list, search/filter, donation modal.
|
||||
- `stats.html` + `js/stats_script.js`: player leaderboard + searchable player cards + modal details.
|
||||
- `join.html` + `js/join_script.js`: 4-step wizard (convention → agree → device → tutorial). Uses `js/marked.min.js` to render `data/convention.md` as HTML.
|
||||
- `facilities.html` + `js/facilities_script.js`: searchable/filterable catalog of server facilities from `data/facilities.json`. Supports Bilibili video embeds (BV IDs) in notes.
|
||||
- `doc.html`, `map.html`, `photo.html`: iframe wrappers (navbar + fullscreen iframe to external hosts). No page-specific JS beyond `js/components.js`.
|
||||
- Shared utilities:
|
||||
- `js/components.js`: injected into `#navbar-component` / `#footer-component`, handles mobile menu & current-link highlighting.
|
||||
- `js/data_utils.js`: `DataUtils.parseSponsorsText()` and `DataUtils.buildSponsorTotals()` — used by both `index.html` and `sponsor.html`.
|
||||
- Shared visual system lives in `css/style.css`; page-specific styles live in `css/pages/` (`join.css`, `facilities.css`, `sponsor.css`, `stats.css`).
|
||||
- Every page includes `<script type="application/ld+json">` Schema.org metadata and full OG/Twitter Card meta tags.
|
||||
- Data flow for stats:
|
||||
1. `statsprocess.py` fetches raw player JSON files and writes normalized outputs to `stats/`.
|
||||
2. It generates `stats/summary.json` consumed by `stats_script.js` via `fetch('stats/summary.json')`.
|
||||
3. `stats_script.js` lazy-loads `stats/{uuid}.json` when opening player details.
|
||||
|
||||
## Build and Test
|
||||
- No package manager/build step exists in this workspace.
|
||||
- Local static preview:
|
||||
- `python3 -m http.server 8000`
|
||||
- open `http://localhost:8000/`
|
||||
- Regenerate player summary data:
|
||||
- `python3 statsprocess.py` (requires `STATS_BASE_URL`, `STATS_USER`, `STATS_PASS` env vars for remote authentication).
|
||||
- Python script dependencies are runtime imports in `statsprocess.py` (not pinned): `requests`, `tqdm`.
|
||||
- CI/CD: `.github/workflows/deploy.yml` runs `statsprocess.py` then deploys to GitHub Pages on push to `main`, daily cron, or manual dispatch. Secrets live in GitHub Actions — never commit credentials.
|
||||
|
||||
## Data Contracts
|
||||
- `data/sponsors.txt`: comma-separated fields (`name, project, amount, [date]`), parsed by `DataUtils.parseSponsorsText()`.
|
||||
- `data/fund_progress.txt`: line-parsed by frontend scripts.
|
||||
- `data/facilities.json`: array of `{title, intro, type, dimension, status, coordinates:{x,y,z}, contributors:[], instructions:[{type,content}], notes:[{type,content}]}`. Notes with `type:"video"` use Bilibili BV IDs.
|
||||
- `data/convention.md`: Markdown server rules, rendered via marked.js in join wizard.
|
||||
- `stats/summary.json` and `stats/{uuid}.json`: generated by `statsprocess.py` — do not hand-edit.
|
||||
|
||||
## Project Conventions
|
||||
- Prefer progressive enhancement with `DOMContentLoaded` initializers (all page scripts and `components.js`).
|
||||
- Keep network fetch paths relative for local assets.
|
||||
- For unavailable remote APIs, follow existing behavior: log errors and render fallback text instead of throwing.
|
||||
- Iframe wrapper pages (`doc.html`, `map.html`, `photo.html`) share an identical pattern: navbar + inline-styled fullscreen iframe. Follow this pattern for new external-embed pages.
|
||||
- Do not introduce bundlers/framework migrations unless explicitly requested.
|
||||
|
||||
## Integration Points
|
||||
- External APIs/services:
|
||||
- Server status: `https://api.mcstatus.io/v2/status/java/mcpure.lunadeer.cn`
|
||||
- Avatars: `https://minotar.net/...` and `https://crafatar.com/...`
|
||||
- Player name resolution in pipeline: Ashcon + Mojang Session APIs (`statsprocess.py`).
|
||||
- Stats source endpoint: authenticated, URL in `STATS_BASE_URL` secret.
|
||||
- External iframe hosts: `schema.lunadeer.cn` (docs), `mcmap.lunadeer.cn` (map), `mcphoto.lunadeer.cn` (photo).
|
||||
- Navbar external links are centralized in `js/components.js`.
|
||||
- External assets: Google Fonts, Font Awesome (CDN), Bilibili embeds (facilities notes).
|
||||
|
||||
## Security
|
||||
- Treat player UUID/name datasets in `stats/` as production content; avoid destructive bulk edits.
|
||||
- Preserve SEO/verification metadata in page `<head>` blocks unless a task explicitly targets SEO.
|
||||
- Avoid adding secrets/tokens to repository files; keep any future credentials out of static HTML/JS.
|
||||
- Frontend rendering uses `innerHTML` with fetched txt/json content in several views; keep those data sources trusted or sanitize before accepting untrusted input.
|
||||
42
.github/workflows/deploy.yml
vendored
42
.github/workflows/deploy.yml
vendored
@@ -4,8 +4,7 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
schedule:
|
||||
# Every days at 04:00 UTC
|
||||
- cron: "0 4 */1 * *"
|
||||
- cron: "0 4 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -24,35 +23,37 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install frontend dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: pip install requests tqdm
|
||||
|
||||
- name: Run statsprocess.py
|
||||
- name: Update player stats
|
||||
env:
|
||||
STATS_BASE_URL: ${{ secrets.STATS_BASE_URL }}
|
||||
STATS_USER: ${{ secrets.STATS_USER }}
|
||||
STATS_PASS: ${{ secrets.STATS_PASS }}
|
||||
run: python statsprocess.py
|
||||
run: python scripts/statsprocess.py
|
||||
|
||||
- name: Prepare Pages artifact
|
||||
run: |
|
||||
mkdir -p _site
|
||||
rsync -a --delete \
|
||||
--exclude '.git/' \
|
||||
--exclude '.github/' \
|
||||
--exclude 'README.md' \
|
||||
--exclude 'statsprocess.py' \
|
||||
./ ./_site/
|
||||
- name: Build site
|
||||
run: npm run build
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./_site
|
||||
path: ./dist
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
@@ -71,7 +72,6 @@ jobs:
|
||||
if: success()
|
||||
steps:
|
||||
- name: Submit URLs to IndexNow
|
||||
if: ${{ env.INDEXNOW_KEY != '' }}
|
||||
env:
|
||||
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
|
||||
run: |
|
||||
@@ -79,6 +79,7 @@ jobs:
|
||||
echo "INDEXNOW_KEY not set, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HOST="bailuyuan.lunadeer.cn"
|
||||
curl -s -X POST "https://api.indexnow.org/indexnow" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -87,15 +88,8 @@ jobs:
|
||||
\"key\": \"${INDEXNOW_KEY}\",
|
||||
\"keyLocation\": \"https://${HOST}/${INDEXNOW_KEY}.txt\",
|
||||
\"urlList\": [
|
||||
\"https://${HOST}/\",
|
||||
\"https://${HOST}/sponsor.html\",
|
||||
\"https://${HOST}/stats.html\",
|
||||
\"https://${HOST}/join.html\",
|
||||
\"https://${HOST}/facilities.html\",
|
||||
\"https://${HOST}/doc.html\",
|
||||
\"https://${HOST}/map.html\",
|
||||
\"https://${HOST}/photo.html\"
|
||||
\"https://${HOST}/\"
|
||||
]
|
||||
}"
|
||||
echo ""
|
||||
echo "IndexNow notification sent."
|
||||
echo "IndexNow notification sent."
|
||||
Reference in New Issue
Block a user