🔨 Refactor(custom): remove unused file

This commit is contained in:
Kuingsmile
2024-07-05 14:58:28 +08:00
parent 875d034f4e
commit 1238e1caf4
6 changed files with 23 additions and 58 deletions

View File

@@ -51,4 +51,5 @@ app.use(pinia)
app.use(hljsVuePlugin)
app.use(VueVideoPlayer)
app.mount('#app')
initTalkingData()

View File

@@ -384,13 +384,13 @@ const fileSortExtReverse = ref(false)
const isShowBatchRenameDialog = ref(false)
const batchRenameMatch = ref('')
const batchRenameReplace = ref('')
const mathcedCount = computed(() => {
const matchedFiles = filterList.value.filter((item: any) => {
return customStrMatch(item.imgUrl, batchRenameMatch.value)
})
return matchedFiles.length
})
const dateRange = ref('')
const mathcedCount = computed(() => {
return filterList.value.filter((item: any) => {
return customStrMatch(item.imgUrl, batchRenameMatch.value)
}).length
})
onBeforeRouteUpdate((to, from) => {
if (from.name === 'gallery') {
clearChoosedList()
@@ -400,10 +400,8 @@ onBeforeRouteUpdate((to, from) => {
}
})
// init deleteCloud
async function initDeleteCloud() {
const config = (await getConfig()) as any
deleteCloud.value = config.settings.deleteCloudFile || false
deleteCloud.value = (await getConfig<boolean>(configPaths.settings.deleteCloudFile)) || false
}
onBeforeMount(async () => {
@@ -420,28 +418,16 @@ onBeforeMount(async () => {
function handleDetectShiftKey(event: KeyboardEvent) {
if (event.key === 'Shift') {
if (event.type === 'keydown') {
isShiftKeyPress.value = true
} else if (event.type === 'keyup') {
isShiftKeyPress.value = false
}
isShiftKeyPress.value = event.type === 'keydown'
}
}
const filterList = computed(() => {
return getGallery()
})
console.log(filterList)
const isAllSelected = computed(() => {
const values = Object.values(choosedList)
if (values.length === 0) {
return false
} else {
return filterList.value.every(item => {
return choosedList[item.id!]
})
}
return Object.values(choosedList).length > 0 && filterList.value.every(item => choosedList[item.id!])
})
function formatFileName(name: string) {
@@ -558,8 +544,6 @@ async function copy(item: ImgInfo) {
const obj = {
title: $T('COPY_LINK_SUCCEED'),
body: copyLink
// sometimes will cause lagging
// icon: item.url || item.imgUrl
}
const myNotification = new Notification(obj.title, obj)
myNotification.onclick = () => {
@@ -662,7 +646,6 @@ function toggleSelectAll() {
}
function multiRemove() {
// choosedList -> { [id]: true or false }; true means choosed. false means not choosed.
const multiRemoveNumber = Object.values(choosedList).filter(item => item).length
if (multiRemoveNumber) {
$confirm(
@@ -917,11 +900,13 @@ onActivated(async () => {
initDeleteCloud()
})
</script>
<script lang="ts">
export default {
name: 'GalleryPage'
}
</script>
<style lang="stylus">
.PhotoSlider
&__BannerIcon

View File

@@ -162,7 +162,6 @@ const latestVersionMap = reactive<{ [key: string]: string }>({})
const pluginListToolTip = $T('PLUGIN_LIST')
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
const updateAllToolTip = $T('PLUGIN_UPDATE_ALL')
// const id = ref('')
const defaultLogo = ref(`this.src="file://${__static.replace(/\\/g, '/')}/roundLogo.png"`)
const $configForm = ref<InstanceType<typeof ConfigForm> | null>(null)
const npmSearchText = computed(() => {

View File

@@ -6,38 +6,32 @@ import { IRPCActionType } from '#/types/enum'
import { IGalleryDB } from '#/types/extra-vue'
export class GalleryDB implements IGalleryDB {
async #actionHandler<T>(method: IRPCActionType, ...args: any[]): Promise<T | undefined> {
return await triggerRPC<T>(method, ...args)
}
async get<T>(filter?: IFilter): Promise<IGetResult<T> | undefined> {
const res = await this.#msgHandler<IGetResult<T>>(IRPCActionType.GALLERY_GET_DB, filter)
return res
return await this.#actionHandler<IGetResult<T>>(IRPCActionType.GALLERY_GET_DB, filter)
}
async insert<T>(value: T): Promise<IResult<T> | undefined> {
const res = await this.#msgHandler<IResult<T>>(IRPCActionType.GALLERY_INSERT_DB, value)
return res
return await this.#actionHandler<IResult<T>>(IRPCActionType.GALLERY_INSERT_DB, value)
}
async insertMany<T>(value: T[]): Promise<IResult<T>[] | undefined> {
const res = await this.#msgHandler<IResult<T>[]>(IRPCActionType.GALLERY_INSERT_DB_BATCH, value)
return res
return await this.#actionHandler<IResult<T>[]>(IRPCActionType.GALLERY_INSERT_DB_BATCH, value)
}
async updateById(id: string, value: IObject): Promise<boolean> {
const res = (await this.#msgHandler<boolean>(IRPCActionType.GALLERY_UPDATE_BY_ID_DB, id, value)) || false
return res
return (await this.#actionHandler<boolean>(IRPCActionType.GALLERY_UPDATE_BY_ID_DB, id, value)) || false
}
async getById<T>(id: string): Promise<IResult<T> | undefined> {
const res = await this.#msgHandler<IResult<T> | undefined>(IRPCActionType.GALLERY_GET_BY_ID_DB, id)
return res
return await this.#actionHandler<IResult<T> | undefined>(IRPCActionType.GALLERY_GET_BY_ID_DB, id)
}
async removeById(id: string): Promise<void> {
const res = await this.#msgHandler<void>(IRPCActionType.GALLERY_REMOVE_BY_ID_DB, id)
return res
}
async #msgHandler<T>(method: IRPCActionType, ...args: any[]): Promise<T | undefined> {
return await triggerRPC<T>(method, ...args)
return await this.#actionHandler<void>(IRPCActionType.GALLERY_REMOVE_BY_ID_DB, id)
}
}

View File

@@ -1,15 +0,0 @@
import { v4 as uuid } from 'uuid'
export const completeUploaderMetaConfig = (originData: IStringKeyMap): IStringKeyMap => {
return Object.assign(
{
_configName: 'Default'
},
originData,
{
_id: uuid(),
_createdAt: Date.now(),
_updatedAt: Date.now()
}
)
}

View File

@@ -1,5 +1,6 @@
import axios from 'axios'
import yaml from 'js-yaml'
import { RELEASE_URL, RELEASE_URL_BACKUP } from '#/utils/static'
export const getLatestVersion = async (): Promise<string> => {