2024-03-06 18:53:40 +01:00
|
|
|
export default class SettingsActions {
|
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
|
|
|
constructor() {}
|
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
|
|
|
getInfo() {
|
|
|
|
let handle = document.getElementById('settings-handle').value;
|
|
|
|
let email = document.getElementById('settings-email').value;
|
|
|
|
let url = document.getElementById('settings-url').value;
|
|
|
|
let title = document.getElementById('settings-title').value;
|
|
|
|
let desc = document.getElementById('settings-desc').value;
|
2024-05-13 21:36:06 +02:00
|
|
|
let memberID = document.getElementById('member-id').value;
|
2024-03-06 18:53:40 +01:00
|
|
|
//let privacy = document.getElementById('privacy-toggle').getAttribute('data-private');
|
|
|
|
let render = document.getElementById('render-toggle').getAttribute('data-render');
|
|
|
|
let background = document
|
2024-03-19 23:35:02 +01:00
|
|
|
.querySelector('.background')
|
2024-03-06 18:53:40 +01:00
|
|
|
.style.backgroundImage.slice(4, -1)
|
|
|
|
.replace(/"/g, '');
|
|
|
|
let selected = '';
|
|
|
|
let selects = document.querySelectorAll('.theme-select');
|
2024-06-25 23:33:42 +02:00
|
|
|
//let smtpDomain = document.getElementById('smtp-domain').value;
|
|
|
|
//let smtpEmail = document.getElementById('smtp-email').value;
|
|
|
|
//let smtpPass = document.getElementById('smtp-pass').value;
|
|
|
|
//let mgDomain = document.getElementById('mg-domain').value;
|
|
|
|
//let mgKey = document.getElementById('mg-key').value;
|
2024-03-06 18:53:40 +01:00
|
|
|
let mailActive = '';
|
|
|
|
let mailOptions = document.querySelectorAll('.mail-option');
|
|
|
|
let apiStatus = document
|
|
|
|
.getElementById('api-access-toggle')
|
|
|
|
.getAttribute('data-enabled');
|
|
|
|
let dynamicRenderStatus = document
|
|
|
|
.getElementById('dynamic-render-toggle')
|
|
|
|
.getAttribute('data-enabled');
|
|
|
|
var i, count;
|
|
|
|
for (i = 0, count = selects.length; i < count; i++) {
|
|
|
|
if (selects[i].getAttribute('data-enabled') == 'true')
|
|
|
|
selected = selects[i].id;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, count = mailOptions.length; i < count; i++) {
|
|
|
|
if (mailOptions[i].getAttribute('data-enabled') == 'true')
|
|
|
|
mailActive = mailOptions[i].id;
|
|
|
|
}
|
|
|
|
let settingsData = {
|
|
|
|
global: {
|
|
|
|
base_url: url,
|
|
|
|
title: title,
|
|
|
|
descriptions: desc,
|
|
|
|
background: background,
|
|
|
|
private: false,
|
|
|
|
renderOnSave: render,
|
|
|
|
theme: selected,
|
|
|
|
externalAPI: apiStatus,
|
|
|
|
dynamicRender: dynamicRenderStatus
|
|
|
|
},
|
2024-05-13 21:36:06 +02:00
|
|
|
member: {
|
|
|
|
handle: handle,
|
|
|
|
email: email,
|
|
|
|
id: memberID
|
2024-03-06 18:53:40 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
return new Promise(function (resolve) {
|
|
|
|
resolve(settingsData);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
|
|
|
}
|