mirror of
https://github.com/bitinflow/rerun-encoder.git
synced 2026-03-14 06:06:03 +00:00
Rewrite s3 uploader
Update user on upload/boot
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import {BrowserWindow} from "electron";
|
||||
import {User} from "../../shared/schema";
|
||||
import axios from "axios";
|
||||
|
||||
export function emit(event: any, ...args: any) {
|
||||
// Send a message to all windows
|
||||
BrowserWindow.getAllWindows().forEach((win) => {
|
||||
win.webContents.send(event, ...args)
|
||||
});
|
||||
}
|
||||
|
||||
export async function resolveUser(accessToken: string, tokenType: string): Promise<User> {
|
||||
const response = await axios.get('https://api.rerunmanager.com/v1/channels/me', {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': `${tokenType} ${accessToken}`,
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
id: response.data.id,
|
||||
name: response.data.name,
|
||||
config: response.data.config,
|
||||
avatar_url: response.data.avatar_url,
|
||||
premium: response.data.premium,
|
||||
}
|
||||
}
|
||||
@@ -161,8 +161,8 @@ ipcMain.handle('encode', async (event: IpcMainInvokeEvent, ...args: any[]) => {
|
||||
onUploadProgress: (id, progress) => event.sender.send('encode-upload-progress', id, progress),
|
||||
onUploadComplete: (id, video) => event.sender.send('encode-upload-complete', id, video),
|
||||
onError: (id, error) => event.sender.send('encode-error', id, error),
|
||||
}, settingsRepository.getSettings());
|
||||
return await encoder.encode()
|
||||
}, settingsRepository);
|
||||
return encoder.encode();
|
||||
})
|
||||
ipcMain.handle('commitSettings', async (event: IpcMainInvokeEvent, ...args: any[]) => settingsRepository.commitSettings(args[0]))
|
||||
settingsRepository.watch((settings: Settings) => emit('settings', settings));
|
||||
|
||||
Reference in New Issue
Block a user