Skip to content

Commit

Permalink
添加源仓库url导入方式 (#11)
Browse files Browse the repository at this point in the history
* feat. 添加源仓库导入方式

* add ci

* fix ci

* fix ci

* fix ci

* fix: 源仓库导入修复

* fix url

* fix 源仓库书源导入

* Update source.ux

fix 源仓库导入
  • Loading branch information
kongqi404 authored Nov 8, 2024
1 parent 89ec630 commit 8aceb28
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: git submodule init && git submodule update
- run: npm i
- run: npm run build

- name: upload artifact
uses: actions/upload-artifact@v4
with:
path: dist/*.rpk
11 changes: 6 additions & 5 deletions src/pages/source/source.ux
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<div class="col">
<div class="card {{ activedInput==='sourceUrl' ? 'active' : 'inactive'}}" @click="activeInput('sourceUrl')">
<text class="card-btn-text">
{{ sourceUrl === "" ? "请输入链接/9位传输码" : sourceUrl }}
{{ sourceUrl === "" ? "请输入9位传输码/源仓库id" : sourceUrl }}
</text>
</div>
<div class="card justify-center" @click="submitUrl">
Expand Down Expand Up @@ -260,16 +260,17 @@ export default {
this.importing = true
this.toast("正在导入,请稍候")
let url
if (this.sourceUrl.startsWith("http://") || this.sourceUrl.startsWith("https://")) {
url = this.sourceUrl
if (!isNaN(parseFloat(this.sourceUrl)) && isFinite(this.sourceUrl)) {
url = `https://www.yckceo.com/yuedu/shuyuan/json/id/${this.sourceUrl}.json`
} else if (this.sourceUrl.length === 9) {
url = `https://t.doruo.cn/${this.sourceUrl}`
} else {
this.toast("请输入正确的链接/9位传输码")
this.toast("请输入正确的9位传输码/源仓库id")
return
}

fetch(url)
fetch(url,{retry:100})
.then((res) => {
if (typeof res.data === "string") {
try {
Expand Down Expand Up @@ -367,4 +368,4 @@ export default {
.active {
border: 3px solid white;
}
</style>
</style>

0 comments on commit 8aceb28

Please sign in to comment.