Merge remote-tracking branch 'origin/master'

This commit is contained in:
kunfei 2023-04-16 22:52:21 +08:00
commit d9a93daeb9
27 changed files with 83 additions and 85 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{u as n,A as r}from"./index-cbd182e6.js";import"./vendor-8be1f5fb.js";const i=n();i.setMiniInterface(window.innerWidth<750);window.onresize=()=>{i.setMiniInterface(window.innerWidth<750)};r.getReadConfig().then(a=>{var e=a.data.data;if(e){const t=n();let o=JSON.parse(e),s=t.config;o=Object.assign(s,o),t.setConfig(o)}});
import{u as n,A as r}from"./index-ab2e286b.js";import"./vendor-8be1f5fb.js";const i=n();i.setMiniInterface(window.innerWidth<750);window.onresize=()=>{i.setMiniInterface(window.innerWidth<750)};r.getReadConfig().then(a=>{var e=a.data.data;if(e){const t=n();let o=JSON.parse(e),s=t.config;o=Object.assign(s,o),t.setConfig(o)}});

View File

@ -1 +0,0 @@
const a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"/></svg>';export{a as l};

View File

@ -0,0 +1 @@
import{u}from"./index-ab2e286b.js";const f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function D(t,n,e,a){let s=t<12?"AM":"PM";return a&&(s=s.split("").reduce((l,i)=>l+=`${i}.`,"")),e?s.toLowerCase():s}function L(t,n,e={}){var a;const s=t.getFullYear(),l=t.getMonth(),i=t.getDate(),o=t.getHours(),r=t.getMinutes(),g=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),c=(a=e.customMeridiem)!=null?a:D,M={YY:()=>String(s).slice(-2),YYYY:()=>s,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(e.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(e.locales,{month:"long"}),D:()=>String(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(o),HH:()=>`${o}`.padStart(2,"0"),h:()=>`${o%12||12}`.padStart(1,"0"),hh:()=>`${o%12||12}`.padStart(2,"0"),m:()=>String(r),mm:()=>`${r}`.padStart(2,"0"),s:()=>String(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(e.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(e.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(e.locales,{weekday:"long"}),A:()=>c(o,r),AA:()=>c(o,r,!1,!0),a:()=>c(o,r,!0),aa:()=>c(o,r,!0,!0)};return n.replace(f,(S,h)=>h||M[S]())}const w=t=>/,\s*\{/.test(t)||!(t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:"));function Y(t){return location.origin+"/image?path="+encodeURIComponent(t)+"&url="+encodeURIComponent(sessionStorage.getItem("bookUrl"))+"&width="+u().config.readWidth}const $=t=>{let n=new Date().getTime(),e=Math.floor((n-t)/1e3),a="";return e<=30?a="":e<60?a=e+"":e<3600?a=Math.floor(e/60)+"":e<86400?a=Math.floor(e/3600)+"":e<2592e3?a=Math.floor(e/86400)+"":a=L(new Date(t),"YYYY-MM-DD"),a},v='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"/></svg>';export{$ as d,Y as g,w as i,v as l};

View File

@ -0,0 +1 @@
.el-link[data-v-aee57c78]{padding:4px}.el-text[data-v-aee57c78]{padding-top:20px}.error[data-v-d4c4e88b]{border-color:var(--el-color-error)!important;color:var(--el-color-error)!important;--el-checkbox-checked-text-color: var(--el-color-error);--el-checkbox-checked-bg-color: var(--el-color-error);--el-checkbox-checked-input-border-color: var(--el-color-error)}.tool[data-v-3d581419]{display:flex;margin:4px 0;justify-content:center}#source-list[data-v-3d581419]{margin-top:6px;height:calc(100vh - 119px)}#source-list[data-v-3d581419] .el-checkbox{margin-bottom:4px;width:100%}[data-v-fe904689] #debug-text{height:calc(100vh - 86px)}[data-v-7e91a802] .el-input{width:100%}[data-v-7e91a802] #source-json{height:calc(100vh - 50px)}[data-v-dcce2457] .el-tabs__header{margin-bottom:5px}.flex-space-between[data-v-dc7cd0f9]{display:flex;justify-content:space-between;align-items:baseline}.flex-column-center[data-v-dc7cd0f9]{display:flex;flex-direction:column;justify-content:center}.menu>.el-button[data-v-dc7cd0f9]{margin:4px;padding:1em;width:6em}.hotkeys-item .title[data-v-dc7cd0f9]{width:5em;display:flex;justify-content:flex-end;margin-right:1em}.hotkeys-item__content[data-v-dc7cd0f9]{display:flex;flex-wrap:wrap;flex:1}.hotkeys-item__content div[data-v-dc7cd0f9]{margin-bottom:1em}.hotkeys-item__content span[data-v-dc7cd0f9]{margin:.5em}[data-v-2cfb5302] .el-tab-pane{height:calc(100vh - 55px);padding-top:15px;padding-right:5px;overflow-y:auto}[data-v-2cfb5302] .el-tabs__header{margin:0}kbd{background-color:#fcfcfc;border-radius:3px;border:1px solid hsl(0deg,0%,80%);padding:4px 5px;font-weight:700}code{background-color:#f2f1f1;padding:.125rem .25rem;border-radius:.25rem;font-size:.835rem}body{padding:0;margin:0}.el-tabs__header{position:sticky;top:0px;z-index:2;background-color:#fff}.editor[data-v-e99e7704]{display:flex;height:100vh;overflow:hidden}.editor .left[data-v-e99e7704]{flex:1;margin-left:20px}.editor .right[data-v-e99e7704]{flex:1;width:360px;margin-right:20px}

View File

@ -1 +0,0 @@
.el-link[data-v-aee57c78]{padding:4px}.el-text[data-v-aee57c78]{padding-top:20px}.error[data-v-4f0ba808]{border-color:var(--el-color-error)!important;color:var(--el-color-error)!important;--el-checkbox-checked-text-color: var(--el-color-error);--el-checkbox-checked-bg-color: var(--el-color-error);--el-checkbox-checked-input-border-color: var(--el-color-error)}.tool[data-v-794cdcb4]{display:flex;margin:4px 0;justify-content:center}#source-list[data-v-794cdcb4]{margin-top:6px;height:calc(100vh - 119px)}#source-list[data-v-794cdcb4] .el-checkbox{margin-bottom:4px;width:100%}[data-v-fe904689] #debug-text{height:calc(100vh - 86px)}[data-v-7e91a802] .el-input{width:100%}[data-v-7e91a802] #source-json{height:calc(100vh - 50px)}[data-v-dcce2457] .el-tabs__header{margin-bottom:5px}.flex-space-between[data-v-18524ea3]{display:flex;justify-content:space-between;align-items:baseline}.flex-column-center[data-v-18524ea3]{display:flex;flex-direction:column;justify-content:center}.menu>.el-button[data-v-18524ea3]{margin:4px;padding:1em;width:6em}.hotkeys-item .title[data-v-18524ea3]{width:5em;display:flex;justify-content:flex-end;margin-right:1em}.hotkeys-item__content[data-v-18524ea3]{display:flex;flex-wrap:wrap;flex:1}.hotkeys-item__content div[data-v-18524ea3]{margin-bottom:1em}.hotkeys-item__content span[data-v-18524ea3]{margin:.5em}[data-v-d4af52d7] .el-tab-pane{height:calc(100vh - 55px);padding-top:15px;padding-right:5px;overflow-y:auto}[data-v-d4af52d7] .el-tabs__header{margin:0}kbd{background-color:#fcfcfc;border-radius:3px;border:1px solid hsl(0deg,0%,80%);padding:4px 5px;font-weight:700}code{background-color:#f2f1f1;padding:.125rem .25rem;border-radius:.25rem;font-size:.835rem}body{padding:0;margin:0}.el-tabs__header{position:sticky;top:0px;z-index:2;background-color:#fff}.editor[data-v-ef32d41f]{display:flex;height:100vh;overflow:hidden}.editor .left[data-v-ef32d41f]{flex:1;margin-left:20px}.editor .right[data-v-ef32d41f]{flex:1;width:360px;margin-right:20px}.editor #loading[data-v-ef32d41f]{position:fixed;top:100px;left:90vw}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,10 +4,10 @@
<meta charset="UTF-8" />
<link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script type="module" crossorigin src="./assets/index-cbd182e6.js"></script>
<script type="module" crossorigin src="./assets/index-ab2e286b.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-8be1f5fb.js">
<link rel="stylesheet" href="./assets/vendor-6f0d1692.css">
<link rel="stylesheet" href="./assets/index-964f1746.css">
<link rel="stylesheet" href="./assets/index-71b7f9c4.css">
</head>
<body>

View File

@ -4,6 +4,7 @@
"ComponentPublicInstance": true,
"ComputedRef": true,
"EffectScope": true,
"ElLoading": true,
"ElMessage": true,
"InjectionKey": true,
"PropType": true,

View File

@ -5,6 +5,7 @@
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const ElLoading: typeof import('element-plus/es')['ElLoading']
const ElMessage: typeof import('element-plus/es')['ElMessage']
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
const computed: typeof import('vue')['computed']

View File

@ -3,7 +3,7 @@
<div class="wrapper">
<div
class="book"
v-for="book in props.books"
v-for="book in books"
:key="book.bookUrl"
@click="handleClick(book)"
>
@ -22,7 +22,7 @@
<div class="author">
{{ book.author }}
</div>
<div class="tags" v-show="props.isSearch">
<div class="tags" v-show="isSearch">
<el-tag
v-for="tag in book.kind?.split(',').slice(0, 2)"
:key="tag"
@ -30,16 +30,16 @@
{{ tag }}
</el-tag>
</div>
<div class="update-info" v-show="!props.isSearch">
<div class="update-info" v-show="!isSearch">
<div class="dot"></div>
<div class="size">{{ book.totalChapterNum }}</div>
<div class="dot"></div>
<div class="date">{{ dateFormat(book.lastCheckTime) }}</div>
</div>
</div>
<div class="intro" v-show="props.isSearch">{{ book.intro }}</div>
<div class="intro" v-show="isSearch">{{ book.intro }}</div>
<div class="dur-chapter" v-show="!props.isSearch">
<div class="dur-chapter" v-show="!isSearch">
已读{{ book.durChapterTitle }}
</div>
<div class="last-chapter">最新{{ book.latestChapterTitle }}</div>

View File

@ -1,9 +1,10 @@
<template>
<div v-for="(para, index) in props.carray" :key="index">
<div v-for="(para, index) in carray" :key="index">
<img
class="full"
v-if="/^\s*<img[^>]*src[^>]+>$/.test(para)"
:src="getImageSrc(para)"
@error.once="proxyImage"
loading="lazy"
/>
<p v-else :style="style" v-html="para" />
@ -12,8 +13,10 @@
<script setup>
import config from "../plugins/config";
import { getImageFromLegado, isLegadoUrl } from "../plugins/utils";
const store = useBookStore();
const props = defineProps(["carray"]);
defineProps(["carray"]);
const fontFamily = computed(() => {
if (store.config.font >= 0) {
@ -30,10 +33,15 @@ const style = computed(() => {
return style;
});
function getImageSrc(content) {
const getImageSrc = (content) => {
const imgPattern = /<img[^>]*src="([^"]*(?:"[^>]+\})?)"[^>]*>/;
return content.match(imgPattern)[1];
}
const src = content.match(imgPattern)[1];
if (isLegadoUrl(src)) return getImageFromLegado(src);
return src;
};
const proxyImage = (event) => {
event.target.src = getImageFromLegado(event.target.src);
};
watch(fontSize, () => {
store.setShowContent(false);

View File

@ -11,12 +11,12 @@
</template>
<script setup>
const { source } = defineProps(['source'])
const store = useSourceStore()
const { errorPushSources } = storeToRefs(store)
const handleSourceClick = source => {
store.changeCurrentSource(source)
}
defineProps(["source"]);
const store = useSourceStore();
const { errorPushSources } = storeToRefs(store);
const handleSourceClick = (source) => {
store.changeCurrentSource(source);
};
</script>
<style lang="scss" scoped>
.error {

View File

@ -30,7 +30,7 @@
</div>
<el-checkbox-group id="source-list" v-model="sourceSelect">
<virtual-list
style="height: 100%; overflow-y: auto; overflow-x: hidden;"
style="height: 100%; overflow-y: auto; overflow-x: hidden"
:data-key="(source) => source.bookSourceUrl || source.sourceUrl"
:data-sources="sourcesFiltered"
:data-component="SourceItem"
@ -42,7 +42,7 @@
<script setup>
import { Folder, Delete, Download, Search } from "@element-plus/icons-vue";
import { isSourceContains } from "../utils/souce";
import VirtualList from 'vue3-virtual-scroll-list';
import VirtualList from "vue3-virtual-scroll-list";
import SourceItem from "./SourceItem.vue";
const store = useSourceStore();
@ -98,7 +98,10 @@ const importSourceFile = () => {
};
const outExport = () => {
const exportFile = document.createElement("a");
let sources = sourceSelect.value.length === 0 ? sourcesFiltered.value : sourceSelect.value,
let sources =
sourceSelect.value.length === 0
? sourcesFiltered.value
: sourceSelect.value,
sourceType = isBookSource.value ? "BookSource" : "RssSource";
exportFile.download = `${sourceType}_${Date()
@ -129,5 +132,4 @@ const outExport = () => {
width: 100%;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<el-tabs id="source-edit">
<el-tab-pane
v-for="{ name, children } in tabsData"
v-for="{ name, children } in Object.values(config)"
:label="name"
:key="name"
>
@ -59,11 +59,7 @@
<script setup>
const store = useSourceStore();
const props = defineProps(["config"]);
const tabsData = Object.values(props.config);
defineProps(["config"]);
const { currentSource } = storeToRefs(store);
</script>

View File

@ -73,25 +73,27 @@ import { isInvaildSource } from "../utils/souce";
const store = useSourceStore();
const pull = () => {
const loadingMsg = ElMessage({
message: '加载中……',
message: "加载中……",
showClose: true,
duration: 0
})
API.getSources().then(({ data }) => {
if (data.isSuccess) {
store.changeTabName("editList");
store.saveSources(data.data);
ElMessage({
message: `成功拉取${data.data.length}条源`,
type: "success",
});
} else {
ElMessage({
message: data.errorMsg ?? "后端错误",
type: "error",
});
}
}).finally(() => loadingMsg.close());
duration: 0,
});
API.getSources()
.then(({ data }) => {
if (data.isSuccess) {
store.changeTabName("editList");
store.saveSources(data.data);
ElMessage({
message: `成功拉取${data.data.length}条源`,
type: "success",
});
} else {
ElMessage({
message: data.errorMsg ?? "后端错误",
type: "error",
});
}
})
.finally(() => loadingMsg.close());
};
const push = () => {

View File

@ -1,7 +1,7 @@
import { formatDate } from "@vueuse/shared";
export const isLegadoUrl = (/** @type {string} */ url) =>
/,\s*\s*\{/.test(url) ||
/,\s*\{/.test(url) ||
!(
url.startsWith("http") ||
url.startsWith("data:") ||
@ -11,10 +11,6 @@ export const isLegadoUrl = (/** @type {string} */ url) =>
* @param {string} src
*/
export function getImageFromLegado(src) {
//返回阅读代理的图片链接 已经代理的或者dataurl返回传入值
if (!isLegadoUrl(src)) {
return src;
}
return (
(import.meta.env.VITE_API || location.origin) +
"/image?path=" +

View File

@ -85,7 +85,7 @@
<div class="title" :index="data.index" v-if="showContent">
{{ data.title }}
</div>
<chapter-content :carray="data.content" v-if="showContent"/>
<chapter-content :carray="data.content" v-if="showContent" />
</div>
<div class="loading" ref="loading"></div>
<div class="bottom-bar" ref="bottom"></div>
@ -105,7 +105,7 @@ const loadingSerive = ref(null);
const content = ref();
watch(showLoading, (loading) => {
if (!loading) return loadingSerive.value?.close();
if (!loading) return loadingSerive.value?.close();
loadingSerive.value = ElLoading.service({
target: content.value,
spinner: loadingSvg,
@ -139,15 +139,13 @@ const {
showContent,
} = storeToRefs(store);
const { chapterPos, index: chapterIndex} = toRefs(store.readingBook);
const { chapterPos, index: chapterIndex } = toRefs(store.readingBook);
const { theme, infiniteLoading } = toRefs(store.config);
//
const bodyColor = computed(() => settings.themes[theme.value].body);
const chapterColor = computed(
() => settings.themes[theme.value].content
);
const chapterColor = computed(() => settings.themes[theme.value].content);
const popupColor = computed(() => settings.themes[theme.value].popup);
const readWidth = computed(() => {
@ -215,7 +213,6 @@ watch(popupColor, (color) => {
rightBarTheme.value.background = color;
});
watchEffect(() => {
if (chapterData.value.length > 0) {
store.setContentLoading(false);

View File

@ -147,7 +147,7 @@ const searchBook = () => {
() => {
showLoading.value = false;
if (books.value.length == 0) {
ElMessage.info("搜索结果为空")
ElMessage.info("搜索结果为空");
}
}
);
@ -224,7 +224,7 @@ const fetchBookShelfData = () => {
showLoading.value = false;
store.setConnectType("danger");
store.setConnectStatus("连接失败");
ElMessage.error("后端连接失败")
ElMessage.error("后端连接失败");
store.setNewConnect(false);
throw error;
});

View File

@ -34,10 +34,5 @@ if (/bookSource/i.test(location.href)) {
width: 360px;
margin-right: 20px;
}
#loading {
position: fixed;
top: 100px;
left: 90vw;
}
}
</style>