Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsuk1ko committed Aug 16, 2024
0 parents commit d1cf4a7
Show file tree
Hide file tree
Showing 24 changed files with 767 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
*.lockb binary diff=lockb
47 changes: 47 additions & 0 deletions .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy to Pages

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'src/**'
- 'public/**'
- 'index.html'
- 'package.json'
- 'vite.config.ts'
- '.github/workflows/pages-deploy.yml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install Dependencies
run: bun i
- name: Build
run: bun build-only
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './dist'
deploy:
needs: build
runs-on: ubuntu-latest
concurrency:
group: 'pages'
cancel-in-progress: true
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 140,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"useTabs": false,
"tabWidth": 2,
"semi": true
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 神代綺凛

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# MAA Resource Updater

无需依赖任何第三方软件,纯靠浏览器工作的 [MAA 资源文件](https://github.com/arkntools/maa-resource-updater) 更新器

仅支持:Chrome ≥ 86, Edge ≥ 86, Opera ≥ 72

## 原理

[isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) + [File System API](https://developer.mozilla.org/zh-CN/docs/Web/API/File_System_API)

## 首次使用 Tips

如果你本地的资源已经最新,那么可以直接点击“仅 clone / pull”,后续有更新时再用增量更新即可
Binary file added bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// <reference lib="webworker" />
/// <reference types="@types/wicg-file-system-access" />
/// <reference types="vite/client" />
/// <reference types="vite-plugin-comlink/client" />
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MAA Resource Updater</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions node/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module '@isomorphic-git/cors-proxy/middleware' {
export default function corsProxy(): any;
}
16 changes: 16 additions & 0 deletions node/proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createServer } from 'http';
import Express from 'express';
import gitCorsProxy from '@isomorphic-git/cors-proxy/middleware';

export const startProxy = () => {
try {
const app = Express();
app.use(gitCorsProxy());
app.on('error', console.error);
const server = createServer(app);
server.on('error', () => {});
server.listen(9999, () => {
console.log('Git CORS proxy started');
});
} catch {}
};
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "maa-resource-updater",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force"
},
"dependencies": {
"@isomorphic-git/lightning-fs": "^4.6.0",
"@vueuse/core": "^11.0.0",
"buffer": "^6.0.3",
"isomorphic-git": "^1.27.1",
"sass": "^1.77.8",
"vue": "^3.4.38"
},
"devDependencies": {
"@isomorphic-git/cors-proxy": "^2.7.1",
"@tsconfig/node18": "^18.2.4",
"@types/express": "^4.17.21",
"@types/node": "^18.19.44",
"@types/wicg-file-system-access": "^2023.10.5",
"@vitejs/plugin-vue": "^5.1.2",
"@vue/tsconfig": "^0.5.1",
"express": "^4.19.2",
"npm-run-all2": "^6.2.2",
"typescript": "^5.5.4",
"vite": "^5.4.1",
"vite-plugin-comlink": "^5.0.1",
"vue-tsc": "^2.0.29"
}
}
Binary file added public/favicon.ico
Binary file not shown.
Loading

0 comments on commit d1cf4a7

Please sign in to comment.