mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
feat(api-server): Add HTTPS support and custom certificate configuration (#3874)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { dialog } from 'electron';
|
||||
import prompt from 'custom-electron-prompt';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
@ -93,5 +94,51 @@ export const onMenu = async ({
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('plugins.api-server.menu.https.label'),
|
||||
type: 'submenu',
|
||||
submenu: [
|
||||
{
|
||||
label: t('plugins.api-server.menu.https.submenu.enable-https.label'),
|
||||
type: 'checkbox',
|
||||
checked: config.useHttps,
|
||||
click(menuItem) {
|
||||
setConfig({ ...config, useHttps: menuItem.checked });
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.api-server.menu.https.submenu.cert.label'),
|
||||
type: 'normal',
|
||||
async click() {
|
||||
const config = await getConfig();
|
||||
const result = await dialog.showOpenDialog(window, {
|
||||
title: t(
|
||||
'plugins.api-server.menu.https.submenu.cert.dialogTitle',
|
||||
),
|
||||
filters: [{ name: 'Certificate', extensions: ['crt', 'pem'] }],
|
||||
properties: ['openFile'],
|
||||
});
|
||||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
setConfig({ ...config, certPath: result.filePaths[0] });
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.api-server.menu.https.submenu.key.label'),
|
||||
type: 'normal',
|
||||
async click() {
|
||||
const config = await getConfig();
|
||||
const result = await dialog.showOpenDialog(window, {
|
||||
title: t('plugins.api-server.menu.https.submenu.key.dialogTitle'),
|
||||
filters: [{ name: 'Private Key', extensions: ['key', 'pem'] }],
|
||||
properties: ['openFile'],
|
||||
});
|
||||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
setConfig({ ...config, keyPath: result.filePaths[0] });
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user