trial support

This commit is contained in:
SPRINX0\prochazka
2024-09-04 12:51:57 +02:00
parent d8467b5ae1
commit faa186c1e4
3 changed files with 52 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ const connections = require('../controllers/connections');
const { getAuthProviderFromReq } = require('../auth/authProvider');
const { checkLicense, checkLicenseKey } = require('../utility/checkLicense');
const storage = require('./storage');
const { getAuthProxyUrl } = require('../utility/authProxy');
const lock = new AsyncLock();
@@ -163,6 +164,19 @@ module.exports = {
}
},
startTrial_meta: true,
async startTrial() {
try {
const resp = await axios.default.post(`${getAuthProxyUrl()}/trial-license`, { type: 'premium-trial', days: 30 });
return resp.data;
} catch (err) {
return {
status: 'error',
message: err.messa,
};
}
},
updateSettings_meta: true,
async updateSettings(values, req) {
if (!hasPermission(`settings/change`, req)) return false;