2019-11-22 07:36:18 +01:00
|
|
|
export default class SettingsActions {
|
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
2019-11-29 20:12:15 +01:00
|
|
|
constructor() {}
|
2019-11-22 07:36:18 +01:00
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
2020-05-23 21:40:01 +02:00
|
|
|
getInfo() {
|
2019-11-22 07:36:18 +01:00
|
|
|
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;
|
2019-11-29 20:12:15 +01:00
|
|
|
let desc = document.getElementById('settings-desc').value;
|
2020-07-06 23:04:29 +02:00
|
|
|
//let privacy = document.getElementById('privacy-toggle').getAttribute('data-private');
|
2019-11-29 20:12:15 +01:00
|
|
|
let render = document.getElementById('render-toggle').getAttribute('data-render');
|
2019-11-22 07:36:18 +01:00
|
|
|
let background = document.getElementById('background').src;
|
|
|
|
let selected = '';
|
|
|
|
let selects = document.querySelectorAll('.theme-select');
|
|
|
|
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;
|
|
|
|
let mailActive = '';
|
|
|
|
let mailOptions = document.querySelectorAll('.mail-option');
|
|
|
|
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 = {
|
2019-11-29 20:12:15 +01:00
|
|
|
global: {
|
|
|
|
base_url: url,
|
|
|
|
title: title,
|
|
|
|
descriptions: desc,
|
|
|
|
background: background,
|
2020-07-06 23:04:29 +02:00
|
|
|
private: false,
|
2019-11-29 20:12:15 +01:00
|
|
|
renderOnSave: render,
|
|
|
|
theme: selected
|
|
|
|
},
|
|
|
|
member: { handle: handle, email: email },
|
|
|
|
email: {
|
|
|
|
active: mailActive,
|
2019-11-22 07:36:18 +01:00
|
|
|
smtp: {
|
|
|
|
domain: smtpDomain,
|
|
|
|
email: smtpEmail,
|
|
|
|
password: smtpPass
|
|
|
|
},
|
|
|
|
mailgun: {
|
|
|
|
domain: mgDomain,
|
|
|
|
key: mgKey
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-05-23 21:40:01 +02:00
|
|
|
return new Promise(function (resolve) {
|
|
|
|
resolve(settingsData);
|
2019-11-22 07:36:18 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
|
|
|
}
|