mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-23 02:23:31 +07:00
33 lines
932 B
JavaScript
33 lines
932 B
JavaScript
|
function preset_export() {
|
||
|
const modalTextArea = document.getElementById('modal-export-preset-textarea');
|
||
|
const settings = require('electron-settings');
|
||
|
var presets = settings.get('presets');
|
||
|
|
||
|
presets = JSON.stringify(presets);
|
||
|
modalTextArea.innerHTML = btoa(presets);
|
||
|
}
|
||
|
|
||
|
function preset_import() {
|
||
|
const modalTextArea = document.getElementById('modal-import-preset-textarea');
|
||
|
const settings = require('electron-settings');
|
||
|
var currentPresets = settings.get('presets');
|
||
|
var presetsToBeImported = atob(modalTextArea.value);
|
||
|
|
||
|
try {
|
||
|
presetsToBeImported = JSON.parse(presetsToBeImported);
|
||
|
} catch (e) {
|
||
|
notification('danger', 'Unable to import presets, malformed data.');
|
||
|
console.error(e);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var updatedPresets = Object.assign(
|
||
|
{},
|
||
|
currentPresets,
|
||
|
presetsToBeImported
|
||
|
);
|
||
|
settings.set('presets', updatedPresets);
|
||
|
updatePresetList();
|
||
|
modalTextArea.innerText = '';
|
||
|
}
|