This commit is contained in:
pa
2025-12-21 01:05:04 +09:00
committed by Natsumi
parent 26ed9fcce8
commit 99d4a8d1d5
5 changed files with 55 additions and 12 deletions

View File

@@ -4,15 +4,15 @@
"target": "ESNext",
"allowJs": true,
"checkJs": true,
"jsx": "preserve",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "bundler",
"forceConsistentCasingInFileNames": true,
"lib": ["esnext", "dom", "dom.iterable"],
"types": ["vite/client", "element-plus/global", "node"]
"lib": ["esnext"],
"types": ["node"],
"noEmit": true
},
"include": ["src/**/*", "src-electron/**/*"],
"include": ["src/vite.config.js", "src/shared/utils/localizationHelperCLI.js"],
"exclude": ["node_modules", "build"]
}

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "nodenext",
"target": "ES2022",
"allowJs": true,
"checkJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "nodenext",
"forceConsistentCasingInFileNames": true,
"lib": ["esnext", "dom"],
"types": ["node"],
"noEmit": true
},
"include": ["**/*"],
"exclude": ["../node_modules", "../build"]
}

20
src/jsconfig.json Normal file
View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"allowJs": true,
"checkJs": true,
"jsx": "preserve",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "bundler",
"forceConsistentCasingInFileNames": true,
"lib": ["esnext", "dom", "dom.iterable"],
"types": ["vite/client", "element-plus/global"],
"resolveJsonModule": true,
"noEmit": true
},
"include": ["**/*"],
"exclude": ["../node_modules", "../build", "vite.config.js", "shared/utils/localizationHelperCLI.js"]
}

View File

@@ -196,7 +196,7 @@ export function request(endpoint, options) {
if (
init.method === 'GET' &&
status === 404 &&
endpoint.startsWith('avatars/')
endpoint?.startsWith('avatars/')
) {
ElMessage({
message: t('message.api_handler.avatar_private_or_deleted'),

View File

@@ -8,8 +8,8 @@ import {
removeFromArray,
replaceReactiveObject
} from '../shared/utils';
import { database } from '../service/database';
import { avatarRequest, favoriteRequest } from '../api';
import { database } from '../service/database';
import { processBulk } from '../service/request';
import { useAppearanceSettingsStore } from './settings/appearance';
import { useAvatarStore } from './avatar';
@@ -1258,7 +1258,10 @@ export const useFavoriteStore = defineStore('Favorite', () => {
* @param {Function | null} onProgress - Progress callback function, receives (current, total) parameters
* @returns {Promise<{total: number, invalid: number, invalidIds: string[]}>}
*/
async function checkInvalidLocalAvatars(targetGroup = null, onProgress = null) {
async function checkInvalidLocalAvatars(
targetGroup = null,
onProgress = null
) {
const result = {
total: 0,
invalid: 0,
@@ -1283,19 +1286,19 @@ export const useFavoriteStore = defineStore('Favorite', () => {
if (!favoriteGroup || favoriteGroup.length === 0) {
continue;
}
for (const favorite of favoriteGroup) {
currentIndex++;
if (typeof onProgress === 'function') {
onProgress(currentIndex, result.total);
}
try {
await avatarRequest.getAvatar({
avatarId: favorite.id
});
await new Promise(resolve => setTimeout(resolve, 500));
await new Promise((resolve) => setTimeout(resolve, 500));
} catch (err) {
result.invalid++;
result.invalidIds.push(favorite.id);
@@ -1329,7 +1332,9 @@ export const useFavoriteStore = defineStore('Favorite', () => {
}
for (const avatarId of avatarIds) {
const index = favoriteGroup.findIndex(fav => fav.id === avatarId);
const index = favoriteGroup.findIndex(
(fav) => fav.id === avatarId
);
if (index !== -1) {
removeLocalAvatarFavorite(avatarId, group);
result.removed++;