pull/1168/head
lyswhut 2023-02-01 12:50:52 +08:00
parent ba3b2f613a
commit 6075f413dc
50 changed files with 74 additions and 70 deletions

View File

@ -65,8 +65,8 @@
"build:renderer-scripts": "cross-env NODE_ENV=production webpack --config build-config/renderer-scripts/webpack.config.prod.js --progress",
"build": "npm run clean:electron && npm run build:main && npm run build:renderer && npm run build:renderer-lyric && npm run build:renderer-scripts",
"lint": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly src",
"lint:fix": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly --fix src",
"postinstall": "electron-builder install-app-deps",
"lint:fix": "eslint --ext .js,.vue -f node_modules/eslint-formatter-friendly --fix src",
"dp": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:1081 npm run pack",
"up": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:1081 npm i"
},

View File

@ -1,5 +1,5 @@
import {
IAudioMetadata as iAudioMetadata,
type IAudioMetadata as iAudioMetadata,
} from 'music-metadata'
declare global {

View File

@ -4,7 +4,7 @@
// }
declare module '*.vue' {
import { Component } from 'vue'
import { type Component } from 'vue'
const component: Component
export default component
}

View File

@ -3,8 +3,8 @@ import path from 'path'
import { EventEmitter } from 'events'
import { performance } from 'perf_hooks'
import { STATUS } from './util'
import http from 'http'
import { request, Options as RequestOptions } from './request'
import type http from 'http'
import { request, type Options as RequestOptions } from './request'
export interface Options {
forceResume: boolean

View File

@ -1,7 +1,7 @@
import Downloader, { Options as DownloaderOptions } from './Downloader'
import Downloader, { type Options as DownloaderOptions } from './Downloader'
import { getRequestAgent } from './util'
import { sizeFormate } from '@common/utils'
import http from 'http'
import type http from 'http'
// these are the default options
// const options = {

View File

@ -120,7 +120,7 @@ export const fixNewMusicInfoQuality = (musicInfo: LX.Music.MusicInfo) => {
}
export const filterMusicList = <T extends LX.Music.MusicInfo>(list: T[]): T[] => {
const ids: Set<string> = new Set()
const ids = new Set<string>()
return list.filter(s => {
if (!s.id || ids.has(s.id) || !s.name) return false
if (s.singer == null) s.singer = ''

View File

@ -14,9 +14,9 @@ import {
shallowRef,
unref,
markRaw,
ComputedRef,
Ref,
ShallowRef,
type ComputedRef,
type Ref,
type ShallowRef,
defineProps,
defineEmits,
defineComponent,

View File

@ -1,4 +1,4 @@
import { App, ref } from 'vue'
import { type App, ref } from 'vue'
import { messages } from './index'
import type { Messages, Message } from './index'

View File

@ -1,5 +1,5 @@
import { Event as App, Type as AppType } from './AppEvent'
import { Event as List, Type as ListType } from './ListEvent'
import { Event as App, type Type as AppType } from './AppEvent'
import { Event as List, type Type as ListType } from './ListEvent'
export type {
AppType,

View File

@ -1,5 +1,5 @@
// import { throttle } from '@common/utils/common'
import { Server } from 'socket.io'
import { type Server } from 'socket.io'
// import { sendSyncActionList } from '@main/modules/winMain'
import { encryptMsg, decryptMsg } from '../server/utils'

View File

@ -1,4 +1,4 @@
import http from 'http'
import type http from 'http'
import { SYNC_CODE } from './config'
import {
aesEncrypt,

View File

@ -1,6 +1,6 @@
import http from 'http'
import { Server, Socket } from 'socket.io'
import { createHttpTerminator, HttpTerminator } from 'http-terminator'
import { Server, type Socket } from 'socket.io'
import { createHttpTerminator, type HttpTerminator } from 'http-terminator'
import * as modules from '../modules'
import { authCode, authConnect } from './auth'
import { getAddress, getServerId, generateCode as handleGenerateCode, getClientKeyInfo, setClientKeyInfo } from './utils'

View File

@ -1,7 +1,7 @@
import { promises as fsPromises } from 'fs'
import { encryptMsg, decryptMsg, getSnapshotFilePath } from './utils'
import { throttle } from '@common/utils'
import { Server } from 'socket.io'
import { type Server } from 'socket.io'
import { sendCloseSelectMode, sendSelectMode } from '@main/modules/winMain'
import { LIST_IDS } from '@common/constants'
@ -98,7 +98,7 @@ const setRemotelList = async(socket: LX.Sync.Socket, listData: LX.Sync.ListData)
}
}
const writeFilePromises: Map<string, Promise<void>> = new Map()
const writeFilePromises = new Map<string, Promise<void>>()
const updateSnapshot = async(path: string, data: string) => {
console.log('updateSnapshot', path)
let writeFilePromise = writeFilePromises.get(path) ?? Promise.resolve()
@ -136,7 +136,7 @@ const handleMergeList = (
newList = [...sourceList, ...targetList]
break
}
const map: Map<string | number, LX.Music.MusicInfo> = new Map()
const map = new Map<string | number, LX.Music.MusicInfo>()
const ids: Array<string | number> = []
switch (addMusicLocationType) {
case 'top':
@ -313,9 +313,9 @@ const mergeListDataFromSnapshot = (
snapshotList: LX.Music.MusicInfo[],
addMusicLocationType: LX.AddMusicLocationType,
): LX.Music.MusicInfo[] => {
const removedListIds: Set<string | number> = new Set()
const sourceListItemIds: Set<string | number> = new Set()
const targetListItemIds: Set<string | number> = new Set()
const removedListIds = new Set<string | number>()
const sourceListItemIds = new Set<string | number>()
const targetListItemIds = new Set<string | number>()
for (const m of sourceList) sourceListItemIds.add(m.id)
for (const m of targetList) targetListItemIds.add(m.id)
if (snapshotList) {
@ -325,7 +325,7 @@ const mergeListDataFromSnapshot = (
}
let newList
const map: Map<string | number, LX.Music.MusicInfo> = new Map()
const map = new Map<string | number, LX.Music.MusicInfo>()
const ids = []
switch (addMusicLocationType) {
case 'top':
@ -362,9 +362,9 @@ const handleMergeListDataFromSnapshot = async(socket: LX.Sync.Socket, snapshot:
const localUserListData = createUserListDataObj(localListData)
const remoteUserListData = createUserListDataObj(remoteListData)
const snapshotUserListData = createUserListDataObj(snapshot)
const removedListIds: Set<string | number> = new Set()
const localUserListIds: Set<string | number> = new Set()
const remoteUserListIds: Set<string | number> = new Set()
const removedListIds = new Set<string | number>()
const localUserListIds = new Set<string | number>()
const remoteUserListIds = new Set<string | number>()
for (const l of localListData.userList) localUserListIds.add(l.id)
for (const l of remoteListData.userList) remoteUserListIds.add(l.id)

View File

@ -8,7 +8,7 @@ import { sendShowUpdateAlert, sendStatusChange } from '@main/modules/winMain'
let userApi: LX.UserApi.UserApiInfo
let apiStatus: LX.UserApi.UserApiStatus = { status: true }
const requestQueue = new Map()
const timeouts: Map<string, NodeJS.Timeout> = new Map()
const timeouts = new Map<string, NodeJS.Timeout>()
interface InitParams {
params: {
status: boolean

View File

@ -1,6 +1,6 @@
// import fs from 'fs'
import { join } from 'path'
import { WindowSize, windowSizeList } from '@common/config'
import { type WindowSize, windowSizeList } from '@common/config'
import { nativeImage } from 'electron'
export const getWindowSizeInfo = (windowSizeId: number | string): WindowSize => {

View File

@ -1,8 +1,8 @@
/* eslint-disable no-var */
// import { Event as WinMainEvent } from '@main/modules/winMain/event'
// import { Event as WinLyricEvent } from '@main/modules/winLyric/event'
import { AppType, ListType } from '@main/event'
import { DBSeriveTypes } from '@main/worker/utils'
import { type AppType, type ListType } from '@main/event'
import { type DBSeriveTypes } from '@main/worker/utils'
interface Lx {
appSetting: LX.AppSetting

View File

@ -1,4 +1,4 @@
import { workerDBSeriveTypes } from '@main/worker/dbService'
import { type workerDBSeriveTypes } from '@main/worker/dbService'
declare global {
// interface WorkerDBSeriveTypes {

View File

@ -1,4 +1,4 @@
import Database from 'better-sqlite3'
import type Database from 'better-sqlite3'
const migrateV1 = (db: Database.Database) => {
const sql = `

View File

@ -1,4 +1,4 @@
import { I18n } from '@lyric/plugins/i18n'
import { type I18n } from '@lyric/plugins/i18n'
declare global {
interface Window {

View File

@ -3,7 +3,7 @@ import { defaultList } from '@renderer/store/list/state'
import { getListMusics, addListMusics } from '@renderer/store/list/action'
import { addTempPlayList } from '@renderer/store/player/action'
import { appSetting } from '@renderer/store/setting'
import { Ref } from '@common/utils/vueTools'
import { type Ref } from '@common/utils/vueTools'
import { playList } from '@renderer/core/player'
import { LIST_IDS } from '@common/constants'

View File

@ -1,4 +1,4 @@
import { ref, computed, ComputedRef } from '@common/utils/vueTools'
import { ref, computed, type ComputedRef } from '@common/utils/vueTools'
import { isPlay } from '@renderer/store/player/state'
import { appSetting } from '@renderer/store/setting'
// import { interval, intervalCancel } from '@renderer/utils/ipc'

View File

@ -1,5 +1,5 @@
// import './axios'
import { App } from 'vue'
import { type App } from 'vue'
import dialog from './Dialog'
import './Tips'
import svgIcon from './SvgIcon'

View File

@ -2,7 +2,7 @@ import { ref, reactive, shallowRef, markRaw, computed, watch } from '@common/uti
import { windowSizeList as configWindowSizeList } from '@common/config'
import { appSetting } from './setting'
import pkg from '../../../package.json'
import { ProgressInfo } from 'electron-updater'
import { type ProgressInfo } from 'electron-updater'
import music from '@renderer/utils/musicSdk'
process.versions.app = pkg.version

View File

@ -2,7 +2,7 @@
import { deduplicationList, toNewMusicInfo } from '@renderer/utils'
import musicSdk from '@renderer/utils/musicSdk'
import { markRaw, markRawList } from '@common/utils/vueTools'
import { boards, Board, listDetailInfo, ListDetailInfo } from './state'
import { boards, type Board, listDetailInfo, type ListDetailInfo } from './state'
const cache = new Map<string, any>()

View File

@ -1,6 +1,6 @@
// import { reactive, ref, shallowRef } from '@common/utils/vueTools'
import {
PlayerMusicInfo,
type PlayerMusicInfo,
musicInfo,
isPlay,
status,

View File

@ -3,7 +3,7 @@ import music from '@renderer/utils/musicSdk'
import { deduplicationList, toNewMusicInfo } from '@renderer/utils'
import { sortInsert, similar } from '@common/utils/common'
import { sources, maxPages, listInfos, ListInfo } from './state'
import { sources, maxPages, listInfos, type ListInfo } from './state'
interface SearchResult {
list: LX.Music.MusicInfo[]

View File

@ -3,7 +3,7 @@ import music from '@renderer/utils/musicSdk'
// import { deduplicationList } from '@common/utils/renderer'
import { ListInfo } from '@renderer/store/songList/state'
import { type ListInfo } from '@renderer/store/songList/state'
export type { ListInfoItem } from '@renderer/store/songList/state'

View File

@ -2,16 +2,20 @@
import { deduplicationList, toNewMusicInfo } from '@renderer/utils'
import musicSdk from '@renderer/utils/musicSdk'
import { markRaw, markRawList } from '@common/utils/vueTools'
import type { ListDetailInfo, ListInfoItem, ListInfo } from './state'
import {
tags,
TagInfo,
listInfo,
listDetailInfo,
selectListInfo,
isVisibleListDetail,
openSongListInputInfo,
} from './state'
import type {
ListDetailInfo,
ListInfoItem,
ListInfo,
TagInfo,
} from './state'
const cache = new Map<string, any>()

View File

@ -1,6 +1,6 @@
import { AppEventTypes, KeyEventTypes } from '@renderer/event'
import { MainTypes, DownloadTypes } from '@renderer/worker/utils'
import { I18n } from '@renderer/plugins/i18n'
import { type AppEventTypes, type KeyEventTypes } from '@renderer/event'
import { type MainTypes, type DownloadTypes } from '@renderer/worker/utils'
import { type I18n } from '@renderer/plugins/i18n'
// interface LX.EnvParams {
// deeplink?: string | null
// cmdParams: LX.CmdParams

View File

@ -1,4 +1,4 @@
import { I18n } from '@/lang'
import { type I18n } from '@/lang'
declare module 'vue' {
interface ComponentCustomProperties {

View File

@ -1,5 +1,5 @@
import { workerMainTypes } from '@renderer/worker/main/index'
import { workerDownloadTypes } from '@renderer/worker/download/index'
import { type workerMainTypes } from '@renderer/worker/main/index'
import { type workerDownloadTypes } from '@renderer/worker/download/index'
declare global {

View File

@ -15,7 +15,7 @@ import {
saveViewPrevState as saveViewPrevStateFromData,
} from '@renderer/utils/ipc'
import { throttle } from '@common/utils'
import { DEFAULT_SETTING, LIST_IDS } from '@common/constants'
import { type DEFAULT_SETTING, LIST_IDS } from '@common/constants'
import { dateFormat } from './index'
import { setUpdateTime } from '@renderer/store/list/action'

View File

@ -53,7 +53,7 @@ export const getFontSizeWithScreen = (screenWidth: number = window.innerWidth):
export const deduplicationList = <T extends LX.Music.MusicInfo>(list: T[]): T[] => {
const ids: Set<string> = new Set()
const ids = new Set<string>()
return list.filter(s => {
if (ids.has(s.id)) return false
ids.add(s.id)

View File

@ -1,6 +1,6 @@
import { isMac } from '@common/utils'
const downKeys: Set<string> = new Set()
const downKeys = new Set<string>()
export declare type KeyActionType = LX.KeyDownEevent['type']
export declare type Keys = LX.KeyDownEevent['keys']

View File

@ -1,4 +1,4 @@
import { onBeforeUnmount, ref, Ref, useCssModule } from '@common/utils/vueTools'
import { onBeforeUnmount, ref, type Ref, useCssModule } from '@common/utils/vueTools'
import { updateUserListPosition } from '@renderer/store/list/action'
import { userLists } from '@renderer/store/list/state'
import useDarg from '@renderer/utils/compositions/useDrag'

View File

@ -1,4 +1,4 @@
import { ref, nextTick, useCssModule, Ref } from '@common/utils/vueTools'
import { ref, nextTick, useCssModule, type Ref } from '@common/utils/vueTools'
import { userLists } from '@renderer/store/list/state'
import { updateUserList, createUserList } from '@renderer/store/list/action'

View File

@ -1,4 +1,4 @@
import { onMounted, useCssModule, Ref } from '@common/utils/vueTools'
import { onMounted, useCssModule, type Ref } from '@common/utils/vueTools'
export default ({ dom_lists_list }: {

View File

@ -5,7 +5,7 @@ import { getListMusics, addListMusics } from '@renderer/store/list/action'
import { addHistoryWord } from '@renderer/store/search/action'
// import { useI18n } from '@renderer/plugins/i18n'
// import { } from '@renderer/store/search/state'
import { search as searchMusic, listInfos, ListInfo } from '@renderer/store/search/music'
import { search as searchMusic, listInfos, type ListInfo } from '@renderer/store/search/music'
import { assertApiSupport } from '@renderer/store/utils'
export declare type SearchSource = LX.OnlineSource | 'all'

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const app_bg_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const aside_font_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const badge_primary_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const badge_secondary_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const badge_tertiary_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const close_btn_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const font_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const hide_btn_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const main_bg_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const primary_color_ref = ref(null)

View File

@ -1,5 +1,5 @@
import { ref } from '@common/utils/vueTools'
import { pickrTools, PickrTools } from '@renderer/utils/pickrTools'
import { pickrTools, type PickrTools } from '@renderer/utils/pickrTools'
export default () => {
const min_btn_color_ref = ref(null)

View File

@ -1,4 +1,4 @@
import { createDownload, DownloaderType, Options as DownloadOptions } from '@common/utils/download'
import { createDownload, type DownloaderType, type Options as DownloadOptions } from '@common/utils/download'
// import music from '@renderer/utils/musicSdk'
import { createDownloadInfo } from './utils'
// import {