mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b8a977d67d
7
.github/workflows/web.yml
vendored
7
.github/workflows/web.yml
vendored
@ -49,15 +49,10 @@ jobs:
|
|||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
- name: Build and move files
|
- name: Build and move files
|
||||||
|
- working-directory: $GITHUB_WORKSPACE/modules/web
|
||||||
run: |
|
run: |
|
||||||
rm -rf $GITHUB_WORKSPACE/app/src/main/assets/web/source
|
|
||||||
rm -rf $GITHUB_WORKSPACE/app/src/main/assets/web/bookshelf
|
|
||||||
rm -rf $GITHUB_WORKSPACE/app/src/main/assets/web/vue
|
|
||||||
mkdir $GITHUB_WORKSPACE/app/src/main/assets/web/vue
|
|
||||||
cd $GITHUB_WORKSPACE/modules/web
|
|
||||||
pnpm i
|
pnpm i
|
||||||
pnpm build
|
pnpm build
|
||||||
mv -f ./dist/* $GITHUB_WORKSPACE/app/src/main/assets/web/vue/
|
|
||||||
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
|
version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
|
||||||
echo "APP_VER=$version" >> $GITHUB_ENV
|
echo "APP_VER=$version" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import io.legado.app.databinding.FragmentWebViewLoginBinding
|
|||||||
import io.legado.app.help.http.CookieStore
|
import io.legado.app.help.http.CookieStore
|
||||||
import io.legado.app.lib.theme.accentColor
|
import io.legado.app.lib.theme.accentColor
|
||||||
import io.legado.app.utils.gone
|
import io.legado.app.utils.gone
|
||||||
|
import io.legado.app.utils.NetworkUtils
|
||||||
import io.legado.app.utils.snackbar
|
import io.legado.app.utils.snackbar
|
||||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ class WebViewLoginFragment : BaseFragment(R.layout.fragment_web_view_login) {
|
|||||||
binding.titleBar.snackbar(R.string.check_host_cookie)
|
binding.titleBar.snackbar(R.string.check_host_cookie)
|
||||||
viewModel.source?.let { source ->
|
viewModel.source?.let { source ->
|
||||||
source.loginUrl?.let {
|
source.loginUrl?.let {
|
||||||
binding.webView.loadUrl(it, source.getHeaderMap(true))
|
val absoluteUrl = NetworkUtils.getAbsoluteURL(source.getKey(), it)
|
||||||
|
binding.webView.loadUrl(absoluteUrl, source.getHeaderMap(true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
"name": "legado-web",
|
"name": "legado-web",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16",
|
"node": ">=16",
|
||||||
"pnpm": ">=8"
|
"pnpm": ">=8"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build && node scripts/sync.js",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
|
28
modules/web/scripts/sync.js
Normal file
28
modules/web/scripts/sync.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { URL } from "node:url";
|
||||||
|
import fs from "node:fs";
|
||||||
|
|
||||||
|
const LEGADO_ASSETS_WEB_VUE_DIR = new URL("../../../app/src/main/assets/web/vue", import.meta.url)
|
||||||
|
const VUE_DIST_DIR = new URL("../dist", import.meta.url)
|
||||||
|
|
||||||
|
console.log("> delete", LEGADO_ASSETS_WEB_VUE_DIR.pathname)
|
||||||
|
// 删除
|
||||||
|
fs.rm(LEGADO_ASSETS_WEB_VUE_DIR, {
|
||||||
|
force: true,
|
||||||
|
recursive: true
|
||||||
|
}, (error) => {
|
||||||
|
if (error) console.log(error);
|
||||||
|
console.log("> mkdir", LEGADO_ASSETS_WEB_VUE_DIR.pathname);
|
||||||
|
fs.mkdir(LEGADO_ASSETS_WEB_VUE_DIR, error => {
|
||||||
|
if (error) return console.error(error)
|
||||||
|
console.log("> cp dist files")
|
||||||
|
fs.cp(VUE_DIST_DIR, LEGADO_ASSETS_WEB_VUE_DIR, {
|
||||||
|
recursive: true
|
||||||
|
}, (error) => {
|
||||||
|
if (error) {
|
||||||
|
console.warn("> cp error, you may copy files yourshelf");
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
console.log("> cp success")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
@ -1,4 +1,4 @@
|
|||||||
import { resolve } from "path";
|
import { fileURLToPath, URL } from "node:url";
|
||||||
import { defineConfig, splitVendorChunkPlugin } from "vite";
|
import { defineConfig, splitVendorChunkPlugin } from "vite";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import Icons from "unplugin-icons/vite";
|
import Icons from "unplugin-icons/vite";
|
||||||
@ -47,9 +47,9 @@ export default ({ mode }) =>
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": resolve(__dirname, "./src"),
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
"@api": resolve(__dirname, "./src/api"),
|
"@api": fileURLToPath(new URL("./src/api", import.meta.url)),
|
||||||
"@utils": resolve(__dirname, "./src/utils/"),
|
"@utils": fileURLToPath(new URL("./src/utils/", import.meta.url)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user