73 |
74 | 75 | <% if (successMsg) { %><%=successMsg%><% } %> 76 | <% if (errorMsg) { %><%=errorMsg%><% } %> 77 | 78 | 81 |
-------------------------------------------------------------------------------- /src/web/views/inc/post-script-footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/web/views/js/config.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | function ucwords(str) { 3 | return (str + '') 4 | .replace(/^(.)|\s+(.)/g, function ($1) { 5 | return $1.toUpperCase(); 6 | }) 7 | } 8 | 9 | function testBot(bot, cfg) { 10 | let url = '/' + bot + '/test'; 11 | 12 | fetchAsync(url, cfg).then(function(res) { 13 | let buildMsg; 14 | if ((res.status === "error")) { 15 | buildMsg = "Connection failed. "; 16 | 17 | let hardFailures = [400, 403, 404, 502]; 18 | 19 | if (hardFailures.includes(res.response.statusCode)) { 20 | buildMsg += res.response.statusCode; 21 | } 22 | setFailedMsg(buildMsg, bot); 23 | } else { 24 | buildMsg = "Connection successful! "; 25 | setSuccessMsg(buildMsg, bot); 26 | } 27 | $('#form-' + bot + ' .testBot').html('Test Connectivity'); 28 | window.scrollTo(0,0); 29 | }); 30 | } 31 | 32 | function testApi(api, cfg) { 33 | let url = '/' + api + '/test'; 34 | 35 | fetchAsync(url, cfg).then(function(res) { 36 | let buildMsg; 37 | if ((res.status === "error")) { 38 | buildMsg = "Connection failed. "; 39 | 40 | let hardFailures = [400, 403, 404, 502]; 41 | 42 | if (hardFailures.includes(res.response.statusCode)) { 43 | buildMsg += res.response.statusCode; 44 | } else { 45 | if ((api === "tautulli") && (res.response.body)) { 46 | let detail = JSON.parse(res.response.body); 47 | buildMsg += detail.response.message; 48 | } 49 | } 50 | setFailedMsg(buildMsg, api); 51 | } else { 52 | buildMsg = "Connection successful! "; 53 | if (api === "tautulli") 54 | buildMsg += "Version " + res.response.data.version; 55 | else 56 | buildMsg += "Version " + res.version; 57 | setSuccessMsg(buildMsg, api); 58 | } 59 | $('#form-' + api + ' .testApi').html('Test Connectivity'); 60 | window.scrollTo(0,0); 61 | }); 62 | } 63 | 64 | async function fetchAsync (url, config={}) { 65 | let response; 66 | if (config) { 67 | response = await fetch(url,config); 68 | } else { 69 | response = await fetch(url); 70 | } 71 | return await response.json(); 72 | } 73 | 74 | function setSuccessMsg(msg, api) { 75 | $('#main-alert .message').html(ucwords(api) + ': ' + msg); 76 | $('#main-alert').removeClass('collapse').removeClass('alert-danger').removeClass('alert-warning').addClass('alert-success').show(); 77 | } 78 | 79 | function setFailedMsg(msg, api) { 80 | $('#main-alert .message').html(ucwords(api) + ': ' + msg); 81 | $('#main-alert').removeClass('collapse').removeClass('alert-success').removeClass('alert-warning').addClass('alert-danger').show(); 82 | } 83 | 84 | function setWarningMsg(msg, api) { 85 | $('#main-alert .message').html(ucwords(api) + ': ' + msg); 86 | $('#main-alert').removeClass('collapse').removeClass('alert-success').removeClass('alert-danger').addClass('alert-warning').show(); 87 | } 88 | 89 | $('.testBot').click(function(e) { 90 | e.preventDefault(); 91 | let request = {}; 92 | 93 | // figure out which bot this is 94 | request.bot = $(this).data('bot'); 95 | 96 | // grab bot details from the relevant form 97 | request.token = $('#form-' + request.bot + ' input.token').val(); 98 | 99 | // make sure that we actually have enough data to proceed first... 100 | if (!request.token) { 101 | setWarningMsg('One or more required fields are missing. Please double check your configuration.', request.bot); 102 | window.scrollTo(0,0); 103 | return false; 104 | } 105 | 106 | // load a fancy spinning thingy 107 | $(this).html(' Testing...'); 108 | 109 | // tell the ajax function this is a post request, and we're sending data 110 | let cfg = { 111 | method: 'POST', 112 | headers: { 113 | 'Accept': 'application/json', 114 | 'Content-Type': 'application/json', 115 | }, 116 | body: JSON.stringify(request) 117 | }; 118 | 119 | // fire off to the test that does the hard work 120 | testBot(request.bot, cfg); 121 | }) 122 | 123 | $('.testApi').click(function(e) { 124 | e.preventDefault(); 125 | let request = {}; 126 | 127 | // figure out which api this is 128 | request.api = $(this).data('api'); 129 | 130 | // grab api details from the relevant form 131 | request.host = $('#form-' + request.api + ' input.host').val(); 132 | request.port = $('#form-' + request.api + ' input.port').val(); 133 | request.baseurl = $('#form-' + request.api + ' input.baseurl').val(); 134 | request.apikey = $('#form-' + request.api + ' input.apikey').val(); 135 | request.ssl = $('#form-' + request.api + ' input.ssl').is(':checked') ? 'true' : 'false'; 136 | 137 | // make sure that we actually have enough data to proceed first... 138 | if (!request.host || !request.apikey) { 139 | setWarningMsg('One or more required fields are missing. Please double check your configuration.', request.api); 140 | window.scrollTo(0,0); 141 | return false; 142 | } 143 | 144 | // load a fancy spinning thingy 145 | $(this).html(' Testing...'); 146 | 147 | 148 | // tell the ajax function this is a post request, and we're sending data 149 | let cfg = { 150 | method: 'POST', 151 | headers: { 152 | 'Accept': 'application/json', 153 | 'Content-Type': 'application/json', 154 | }, 155 | body: JSON.stringify(request) 156 | }; 157 | 158 | // fire off to the test that does the hard work 159 | testApi(request.api, cfg); 160 | }); 161 | 162 | $('button.close').click(function() { 163 | $($(this).data('parent-id')).hide(); 164 | }); 165 | 166 | // are you sure?! 167 | $('.reset-button').click(function() { 168 | return confirm('Are you sure?'); 169 | }); 170 | 171 | // show current tab on load / refresh 172 | $("ul.nav-tabs > li > a").on("shown.bs.tab", function(e) { 173 | var id = $(e.target).attr("href").substr(1); 174 | window.location.hash = id; 175 | }); 176 | 177 | // on load of the page: switch to the currently selected tab 178 | var hash = window.location.hash; 179 | $('#nav-tabs a[href="' + hash + '"]').tab('show'); 180 | }); -------------------------------------------------------------------------------- /src/web/views/js/login.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | async function fetchAsync (url, config={}) { 3 | let response; 4 | if (config) { 5 | response = await fetch(url,config); 6 | } else { 7 | response = await fetch(url); 8 | } 9 | return await response 10 | } 11 | 12 | $(document).ready( function () { 13 | fetchAsync('/login/verify', { 14 | method: 'GET', 15 | headers: { 16 | 'Accept': 'application/json', 17 | 'Content-Type': 'application/json', 18 | } 19 | }).then((response) => { 20 | if (response.status === 200) 21 | window.location = response.url; 22 | if (response.status === 401) 23 | console.log("Mellow - Your Little Discord Friend :-)"); 24 | }); 25 | }); 26 | }); -------------------------------------------------------------------------------- /src/web/views/login.ejs: -------------------------------------------------------------------------------- 1 | <%- include('inc/header'); -%> 2 | 3 | 16 | 17 | <%- include('inc/footer'); -%> 18 | 19 | 20 | <%- include('inc/post-script-footer'); -%> -------------------------------------------------------------------------------- /src/web/views/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 46 | 48 | 50 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/web/views/tabs/bot.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 |
7 | 8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 | 16 | This is your numeric ID on Discord (enable developer mode, right click your user, Copy ID) 17 | 18 |
19 |
20 | 21 |
22 | 23 |
24 | 25 |
26 |
27 | 28 |
29 | 30 |
31 | 32 | 33 | Leave blank to watch all channels. 34 | 35 |
36 |
37 | 38 |
39 | 40 |
41 | checked<% } %>> 42 |
43 |
44 | 45 |
46 | 47 |
48 | checked<% } %>> 49 |
50 |
51 |
52 |
53 |
54 |
55 | 56 | Enter the Discord role names. Leave blank if anyone can request. 57 | 58 |
59 |
60 | 61 |
62 | 63 |
64 | 65 |
66 |
67 | 68 |
69 | 70 |
71 | 72 |
73 |
74 | 75 |
76 | 77 |
78 | 79 | 80 | The name of the admin role for admin commands. 81 | 82 |
83 |
84 | 85 |
86 |
87 | 88 | Bot Behaviors 89 | 90 |
91 |
92 | 93 |
94 | 95 |
96 | 100 | 101 | Which Service should be used as default for movie and tv commands. 102 | 103 |
104 |
105 | 106 |
107 | 108 |
109 | 113 | 114 | Which selection should be used if multiple results are returned. 115 | 116 |
117 |
118 |
119 |
120 | 121 |
122 |
123 | 124 | 125 | Reset 126 |
127 |
128 |
-------------------------------------------------------------------------------- /src/web/views/tabs/general.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | 6 |
7 |
8 | 9 |
10 | 11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 19 |
20 |
21 | 22 |
-------------------------------------------------------------------------------- /src/web/views/tabs/ombi.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | 6 |
7 |
8 | 9 |
10 | 11 |
12 | 13 |
14 |
15 | 16 |
17 | 18 |
19 | 20 | 21 | Only enter this if you have a custom base URL, for example with a reverse proxy. 22 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | checked<% } %>> 30 |
31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 |
39 | 40 |
41 | 42 |
43 | 44 | 45 | Enter Ombi username if you want custom permissions. 46 | 47 |
48 |
49 | 50 |
51 |
52 | 53 | 54 | Reset 55 |
56 |
57 |
-------------------------------------------------------------------------------- /src/web/views/tabs/radarr.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 |
7 | 8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | Only enter this if you have a custom base URL, for example with a reverse proxy. 24 | 25 |
26 |
27 | 28 |
29 | 30 |
31 | checked<% } %>> 32 |
33 |
34 | 35 |
36 | 37 |
38 | 39 |
40 |
41 |
42 |
43 |
44 |
45 | 46 | Please set these after saving the config, or requests won't work 47 | 48 |
49 |
50 | 51 |
52 | 53 |
54 | 62 |
63 |
64 | 65 |
66 | 67 |
68 | 76 |
77 |
78 | 79 |
80 | 81 |
82 | 88 |
89 |
90 | 91 |
92 | 93 |
94 | checked<% } %>> 95 |
96 |
97 |
98 |
99 | 100 |
101 |
102 | 103 | 104 | Reset 105 |
106 |
107 |
-------------------------------------------------------------------------------- /src/web/views/tabs/sonarr.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 |
7 | checked<% } %>> 8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 | 18 |
19 | 20 |
21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 | 29 | 30 | Only enter this if you have a custom base URL, for example with a reverse proxy. 31 | 32 |
33 |
34 | 35 |
36 | 37 |
38 | checked<% } %>> 39 |
40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 |
48 |
49 |
50 |
51 |
52 | 53 | Please set these after saving the config, or requests won't work 54 | 55 |
56 |
57 | 58 |
59 | 60 |
61 | 69 |
70 |
71 | 72 |
73 | 74 |
75 | 83 |
84 |
85 | 86 |
87 | 88 |
89 | 97 |
98 |
99 | 100 |
101 | 102 |
103 | 111 |
112 |
113 | 114 |
115 | 116 |
117 | 125 |
126 |
127 | 128 |
129 | 130 |
131 | checked<% } %>> 132 |
133 |
134 | 135 |
136 | 137 |
138 | checked<% } %>> 139 |
140 |
141 |
142 |
143 | 144 |
145 |
146 | 147 | 148 | Reset 149 |
150 |
151 |
-------------------------------------------------------------------------------- /src/web/views/tabs/tautulli.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | 6 |
7 |
8 | 9 |
10 | 11 |
12 | 13 |
14 |
15 | 16 |
17 | 18 |
19 | 20 | 21 | Only enter this if you have a custom base URL, for example with a reverse proxy. 22 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | checked<% } %>> 30 |
31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 |
39 | 40 |
41 |
42 | 43 | 44 | Reset 45 |
46 |
47 |
--------------------------------------------------------------------------------