mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Interface conversion, search bar layout
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import { IpcInvokeHandlers, IpcToMainEmitHandlers } from '../src-shared/interfaces/ipc.interface'
|
||||
import { getBatchSongDetails } from './ipc/browse/BatchSongDetailsHandler.ipc'
|
||||
import { songSearch } from './ipc/browse/SearchHandler.ipc'
|
||||
import { getSongDetails } from './ipc/browse/SongDetailsHandler.ipc'
|
||||
import { download } from './ipc/download/DownloadHandler'
|
||||
import { getSettings, setSettings } from './ipc/SettingsHandler.ipc'
|
||||
import { downloadUpdate, getCurrentVersion, getUpdateAvailable, quitAndInstall, retryUpdate } from './ipc/UpdateHandler.ipc'
|
||||
@@ -10,9 +7,6 @@ import { isMaximized, maximize, minimize, openUrl, quit, restore, showFile, show
|
||||
export function getIpcInvokeHandlers(): IpcInvokeHandlers {
|
||||
return {
|
||||
getSettings,
|
||||
songSearch,
|
||||
getSongDetails,
|
||||
getBatchSongDetails,
|
||||
getCurrentVersion,
|
||||
getUpdateAvailable,
|
||||
isMaximized,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { serverURL } from '../../../src-shared/Paths'
|
||||
|
||||
export async function getBatchSongDetails(songIds: number[]) {
|
||||
const response = await fetch(`https://${serverURL}/api/data/song-versions/${songIds.join(',')}`)
|
||||
return await response.json()
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { SongSearch } from '../../../src-shared/interfaces/search.interface'
|
||||
import { serverURL } from '../../../src-shared/Paths'
|
||||
|
||||
export async function songSearch(search: SongSearch) {
|
||||
const response = await fetch(`https://${serverURL}/api/search`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(search),
|
||||
})
|
||||
|
||||
return await response.json()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { serverURL } from '../../../src-shared/Paths'
|
||||
|
||||
export async function getSongDetails(songId: number) {
|
||||
const response = await fetch(`https://${serverURL}/api/data/song-versions/${songId}`)
|
||||
return await response.json()
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import { parse } from 'path'
|
||||
import { rimraf } from 'rimraf'
|
||||
|
||||
import { NewDownload, ProgressType } from '../../../src-shared/interfaces/download.interface'
|
||||
import { DriveFile } from '../../../src-shared/interfaces/songDetails.interface'
|
||||
import { sanitizeFilename } from '../../../src-shared/UtilFunctions'
|
||||
import { hasVideoExtension } from '../../ElectronUtilFunctions'
|
||||
import { emitIpcEvent } from '../../main'
|
||||
@@ -26,7 +25,9 @@ export class ChartDownload {
|
||||
private cancelFn: undefined | (() => void)
|
||||
|
||||
private callbacks = {} as Callbacks
|
||||
private files: DriveFile[]
|
||||
// TODO
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private files: any[]
|
||||
private percent = 0 // Needs to be stored here because errors won't know the exact percent
|
||||
private tempPath: string
|
||||
private wasCanceled = false
|
||||
@@ -60,7 +61,9 @@ export class ChartDownload {
|
||||
this.callbacks[event] = callback
|
||||
}
|
||||
|
||||
filterDownloadFiles(files: DriveFile[]) {
|
||||
// TODO
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
filterDownloadFiles(files: any[]) {
|
||||
return files.filter(file => {
|
||||
return (file.name !== 'ch.dat') && (settings.downloadVideos || !hasVideoExtension(file.name))
|
||||
})
|
||||
|
||||
@@ -19,9 +19,6 @@ function getListenerAdder<K extends keyof IpcFromMainEmitEvents>(key: K) {
|
||||
const electronApi: ContextBridgeApi = {
|
||||
invoke: {
|
||||
getSettings: getInvoker('getSettings'),
|
||||
songSearch: getInvoker('songSearch'),
|
||||
getSongDetails: getInvoker('getSongDetails'),
|
||||
getBatchSongDetails: getInvoker('getBatchSongDetails'),
|
||||
getCurrentVersion: getInvoker('getCurrentVersion'),
|
||||
getUpdateAvailable: getInvoker('getUpdateAvailable'),
|
||||
isMaximized: getInvoker('isMaximized'),
|
||||
|
||||
Reference in New Issue
Block a user