-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 487be12
Showing
7 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Auto Upload | ||
|
||
on: | ||
schedule: | ||
# 每天凌晨4点执行 (UTC+8) | ||
- cron: '0 20 * * *' | ||
workflow_dispatch: # 允许手动触发 | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Run upload script | ||
env: | ||
API: ${{ secrets.API }} | ||
run: node dist/index.cjs | ||
|
||
- name: Push result.json | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
# 克隆目标仓库 | ||
git clone https://${{ secrets.PAT }}@github.com/KarinJS/files.git temp_repo | ||
# 复制并提交result.json | ||
cp result.json temp_repo/ | ||
cd temp_repo | ||
git add result.json | ||
git commit -m "chore: update result.json [skip ci]" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore | ||
|
||
# Logs | ||
|
||
logs | ||
_.log | ||
npm-debug.log_ | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Caches | ||
|
||
.cache | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
|
||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json | ||
|
||
# Runtime data | ||
|
||
pids | ||
_.pid | ||
_.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
|
||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
|
||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
|
||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
|
||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
|
||
bower_components | ||
|
||
# node-waf configuration | ||
|
||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
|
||
build/Release | ||
|
||
# Dependency directories | ||
|
||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
|
||
web_modules/ | ||
|
||
# TypeScript cache | ||
|
||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
|
||
.npm | ||
|
||
# Optional eslint cache | ||
|
||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
|
||
.stylelintcache | ||
|
||
# Microbundle cache | ||
|
||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
|
||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
|
||
*.tgz | ||
|
||
# Yarn Integrity file | ||
|
||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
|
||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
|
||
.parcel-cache | ||
|
||
# Next.js build output | ||
|
||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
|
||
.nuxt | ||
|
||
# Gatsby files | ||
|
||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
|
||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
|
||
# public | ||
|
||
# vuepress build output | ||
|
||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
|
||
.temp | ||
|
||
# Docusaurus cache and generated files | ||
|
||
.docusaurus | ||
|
||
# Serverless directories | ||
|
||
.serverless/ | ||
|
||
# FuseBox cache | ||
|
||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
|
||
.dynamodb/ | ||
|
||
# TernJS port file | ||
|
||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
|
||
.vscode-test | ||
|
||
# yarn v2 | ||
|
||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# IntelliJ based IDEs | ||
.idea | ||
|
||
# Finder (MacOS) folder config | ||
.DS_Store | ||
src/index.ts | ||
src/upload.ts | ||
pnpm-lock.yaml | ||
result.json | ||
tsconfig.json | ||
tsup.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"use strict";var w=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var T=(t,s,n,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let e of b(s))!j.call(t,e)&&e!==n&&l(t,e,{get:()=>s[e],enumerable:!(r=x(s,e))||r.enumerable});return t};var a=(t,s,n)=>(n=t!=null?w(S(t)):{},T(s||!t||!t.__esModule?l(n,"default",{value:t,enumerable:!0}):n,t));var c=a(require("fs"),1),f=a(require("crypto"),1);var y=a(require("fs"),1),g=a(require("axios"),1),L=async t=>{let s={object_key:t,file_type:"jpg",is_avatar:!0,content_type:"image/png"};return(await g.default.post(process.env.API,s)).data},d=async(t,s)=>{let n=await L(t),r=Object.keys(n)[0],e=n[r],o=y.default.createReadStream(s);return await g.default.put(r,o,{headers:{"Content-Type":e["Content-Type"],"x-obs-acl":e["x-obs-acl"],Host:e.Host},maxBodyLength:1/0,maxContentLength:1/0}),e["cdn-img-addr"]};var m=a(require("axios"),1),u=t=>{let s=f.default.createHash("md5"),n=c.default.readFileSync(t,"utf-8");return s.update(n),s.digest("hex")},H=()=>JSON.parse(c.default.readFileSync("./list.json","utf-8")),k=async()=>{let t={},{data:s}=await m.default.get("https://raw.githubusercontent.com/KarinJS/files/refs/heads/main/result.json"),n=H(),r=u(n[0].path),e=await d(r,n[0].path);t[r]={...n[0],url:e,time:Date.now()},n.shift(),await Promise.all(n.map(async o=>{let i=u(o.path),p=s[i];if(p&&(await m.default.head(p.url)).status===200){t[i]=p;return}let h=await d(i,o.path);t[i]={...o,url:h,time:Date.now()}})),c.default.writeFileSync("./result.json",JSON.stringify(t,null,2)),console.log(`\u{1F389} \u4E0A\u4F20\u6210\u529F \u5171 ${Object.keys(t).length} \u4E2A\u6587\u4EF6`)};k(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"type": "image", | ||
"name": "karinQQ群", | ||
"path": "./static/2025-01-17_qq-group.jpg" | ||
}, | ||
{ | ||
"type": "font", | ||
"name": "HarmonyOS_Sans_SC_Black.ttf", | ||
"path": "./static/2025-01-17_HarmonyOS_Sans_SC_Black.ttf" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "karin-static", | ||
"module": "index.ts", | ||
"type": "module", | ||
"dependencies": { | ||
"axios": "^1.7.9" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest", | ||
"tsup": "^8.3.5" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup src/index.ts --format cjs --minify" | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.