Skip to content

Commit

Permalink
Added insecure SSL option to the settings form.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Mar 8, 2024
1 parent 3c44c80 commit 121ab69
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app.bundle

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions definitions/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ ON('ready', function() {

if (PREF.name)
CONF.name = PREF.name;

if (PREF.insecure)
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
});

ON('service', function() {
Expand Down
3 changes: 2 additions & 1 deletion public/parts/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<div class="help"><i class="ti ti-globe"></i>@(The link will be available in the main menu)</div>
<br />
<div data---="input__?.login__maxlength:200">@(URL address for login)</div>
<div class="help"><i class="ti ti-keys"></i>@(The code will send credentials to this URL address in the background and the API must return a user profile or an error.) <a href="https://docs.totaljs.com/code/z5hu001uc41d/" target="_blank">@(Read more)</a>.</div>
<div class="help m"><i class="ti ti-keys"></i>@(The code will send credentials to this URL address in the background and the API must return a user profile or an error.) <a href="https://docs.totaljs.com/code/z5hu001uc41d/" target="_blank">@(Read more)</a>.</div>
<div data---="input__?.insecure__type:checkbox">@(Allow insecure SSL for requests)</div>
<hr />
<div data---="input__?.accesstoken__maxlength:100;camouflage:•;icon:check-circle green;placeholder:@(Enter a token);icon:ti ti-key">@(API Access token)</div>
<div class="help m"><span class="link exec" data-exec="?/generate">@(Generate token)</span></div>
Expand Down
5 changes: 5 additions & 0 deletions schemas/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ NEWSCHEMA('Settings', function(schema) {
schema.define('superadmin', 'String');
schema.define('login', 'String');
schema.define('accesstoken', 'String');
schema.define('insecure', Boolean);

schema.setQuery(function($) {

Expand All @@ -19,6 +20,7 @@ NEWSCHEMA('Settings', function(schema) {
data.superadmin = PREF.superadmin;
data.login = PREF.login;
data.accesstoken = PREF.accesstoken;
data.insecure = PREF.insecure;
$.callback(data);

});
Expand All @@ -39,6 +41,9 @@ NEWSCHEMA('Settings', function(schema) {
PREF.set('accesstoken', model.accesstoken);
PREF.set('login', model.login);
PREF.set('superadmin', model.superadmin);
PREF.set('insecure', model.insecure);

process.env.NODE_TLS_REJECT_UNAUTHORIZED = model.insecure ? '0' : '1';
CONF.totalapi = model.token;

$.success();
Expand Down

0 comments on commit 121ab69

Please sign in to comment.