Jamie Curnow 7 vuotta sitten
vanhempi
sitoutus
291cb9625e

+ 2 - 1
src/frontend/js/app/nginx/proxy/delete.ejs

@@ -7,10 +7,11 @@
         <form>
             <div class="row">
                 <div class="col-sm-12 col-md-12">
+                    <%= i18n('proxy-hosts', 'delete-confirm', {domains: domain_names.join(', ')}) %>
                     Are you sure you want to delete the Proxy host for: <strong><%- domain_names.join(', ') %></strong>?
                     <% if (ssl_enabled) { %>
                         <br><br>
-                        The SSL certificates attached will be removed, this action cannot be recovered.
+                        <%- i18n('proxy-hosts', 'delete-ssl') %>
                     <% } %>
                 </div>
             </div>

+ 5 - 5
src/frontend/js/app/nginx/proxy/form.ejs

@@ -7,7 +7,7 @@
         <form>
             <ul class="nav nav-tabs" role="tablist">
                 <li role="presentation" class="nav-item"><a href="#details" aria-controls="tab1" role="tab" data-toggle="tab" class="nav-link active"><i class="fe fe-zap"></i> <%- i18n('all-hosts', 'details') %></a></li>
-                <li role="presentation" class="nav-item"><a href="#ssl-options" aria-controls="tab2" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-shield"></i> <%- i18n('all-hosts', 'SSL') %></a></li>
+                <li role="presentation" class="nav-item"><a href="#ssl-options" aria-controls="tab2" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-shield"></i> <%- i18n('str', 'ssl') %></a></li>
             </ul>
             <div class="tab-content">
                 <!-- Details -->
@@ -62,11 +62,11 @@
                                 <div class="selectgroup w-100">
                                     <label class="selectgroup-item">
                                         <input type="radio" name="ssl_provider" value="letsencrypt" class="selectgroup-input"<%- ssl_provider !== 'other' ? ' checked' : '' %>>
-                                        <span class="selectgroup-button"><%- i18n('all-hosts', 'letsencrypt') %></span>
+                                        <span class="selectgroup-button"><%- i18n('ssl', 'letsencrypt') %></span>
                                     </label>
                                     <label class="selectgroup-item">
                                         <input type="radio" name="ssl_provider" value="other" class="selectgroup-input"<%- ssl_provider === 'other' ? ' checked' : '' %>>
-                                        <span class="selectgroup-button"><%- i18n('all-hosts', 'other-ssl') %></span>
+                                        <span class="selectgroup-button"><%- i18n('ssl', 'other') %></span>
                                     </label>
                                 </div>
                             </div>
@@ -75,7 +75,7 @@
                         <!-- Lets encrypt -->
                         <div class="col-sm-12 col-md-12 letsencrypt-ssl">
                             <div class="form-group">
-                                <label class="form-label"><%- i18n('all-hosts', 'letsencrypt-email') %> <span class="form-required">*</span></label>
+                                <label class="form-label"><%- i18n('ssl', 'letsencrypt-email') %> <span class="form-required">*</span></label>
                                 <input name="meta[letsencrypt_email]" type="email" class="form-control" placeholder="" value="<%- getLetsencryptEmail() %>" required>
                             </div>
                         </div>
@@ -84,7 +84,7 @@
                                 <label class="custom-switch">
                                     <input type="checkbox" class="custom-switch-input" name="meta[letsencrypt_agree]" value="1" required<%- getLetsencryptAgree() ? ' checked' : '' %>>
                                     <span class="custom-switch-indicator"></span>
-                                    <span class="custom-switch-description"><%= i18n('all-hosts', 'letsencrypt-agree', {url: 'https://letsencrypt.org/repository/'}) %> <span class="form-required">*</span></span>
+                                    <span class="custom-switch-description"><%= i18n('ssl', 'letsencrypt-agree', {url: 'https://letsencrypt.org/repository/'}) %> <span class="form-required">*</span></span>
                                 </label>
                             </div>
                         </div>

+ 6 - 6
src/frontend/js/app/nginx/proxy/list/item.ejs

@@ -13,27 +13,27 @@
         %>
     </div>
     <div class="small text-muted">
-        Created: <%- formatDbDate(created_on, 'Do MMMM YYYY') %>
+        <%- i18n('str', 'created-on', {date: formatDbDate(created_on, 'Do MMMM YYYY')}) %>
     </div>
 </td>
 <td>
     <div class="text-monospace"><%- forward_ip %>:<%- forward_port %></div>
 </td>
 <td>
-    <div><%- ssl_enabled && ssl_provider ? ssl_provider : 'HTTP only' %></div>
+    <div><%- ssl_enabled && ssl_provider ? i18n('ssl', ssl_provider) : i18n('ssl', 'none') %></div>
 </td>
 <td>
-    <div><%- access_list_id ? access_list.name : 'Public' %></div>
+    <div><%- access_list_id ? access_list.name : i18n('str', 'public') %></div>
 </td>
 <% if (canManage) { %>
 <td class="text-center">
     <div class="item-action dropdown">
         <a href="#" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
         <div class="dropdown-menu dropdown-menu-right">
-            <a href="#" class="edit dropdown-item"><i class="dropdown-icon fe fe-edit"></i> Edit</a>
-            <a href="#" class="logs dropdown-item"><i class="dropdown-icon fe fe-book"></i> Logs</a>
+            <a href="#" class="edit dropdown-item"><i class="dropdown-icon fe fe-edit"></i> <%- i18n('str', 'edit') %></a>
+            <a href="#" class="logs dropdown-item"><i class="dropdown-icon fe fe-book"></i> <%- i18n('str', 'logs') %></a>
             <div class="dropdown-divider"></div>
-            <a href="#" class="delete dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> Delete</a>
+            <a href="#" class="delete dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('str', 'delete') %></a>
         </div>
     </div>
 </td>

+ 6 - 8
src/frontend/js/app/nginx/proxy/list/item.js

@@ -1,10 +1,8 @@
 'use strict';
 
-const Mn         = require('backbone.marionette');
-const Controller = require('../../../controller');
-const Api        = require('../../../api');
-const Cache      = require('../../../cache');
-const template   = require('./item.ejs');
+const Mn       = require('backbone.marionette');
+const App      = require('../../../main');
+const template = require('./item.ejs');
 
 module.exports = Mn.View.extend({
     template: template,
@@ -18,17 +16,17 @@ module.exports = Mn.View.extend({
     events: {
         'click @ui.edit': function (e) {
             e.preventDefault();
-            Controller.showNginxProxyForm(this.model);
+            App.Controller.showNginxProxyForm(this.model);
         },
 
         'click @ui.delete': function (e) {
             e.preventDefault();
-            Controller.showNginxProxyDeleteConfirm(this.model);
+            App.Controller.showNginxProxyDeleteConfirm(this.model);
         }
     },
 
     templateContext: {
-        canManage: Cache.User.canManage('proxy_hosts')
+        canManage: App.Cache.User.canManage('proxy_hosts')
     },
 
     initialize: function () {

+ 4 - 4
src/frontend/js/app/nginx/proxy/list/main.ejs

@@ -1,9 +1,9 @@
 <thead>
     <th width="30">&nbsp;</th>
-    <th>Source</th>
-    <th>Destination</th>
-    <th>SSL</th>
-    <th>Access</th>
+    <th><%- i18n('str', 'source') %></th>
+    <th><%- i18n('str', 'destination') %></th>
+    <th><%- i18n('str', 'ssl') %></th>
+    <th><%- i18n('str', 'access') %></th>
     <% if (canManage) { %>
     <th>&nbsp;</th>
     <% } %>

+ 2 - 2
src/frontend/js/app/nginx/proxy/list/main.js

@@ -1,9 +1,9 @@
 'use strict';
 
 const Mn       = require('backbone.marionette');
+const App      = require('../../../main');
 const ItemView = require('./item');
 const template = require('./main.ejs');
-const Cache    = require('../../../cache');
 
 const TableBody = Mn.CollectionView.extend({
     tagName:   'tbody',
@@ -23,7 +23,7 @@ module.exports = Mn.View.extend({
     },
 
     templateContext: {
-        canManage: Cache.User.canManage('proxy_hosts')
+        canManage: App.Cache.User.canManage('proxy_hosts')
     },
 
     onRender: function () {

+ 19 - 7
src/frontend/js/i18n/messages.json

@@ -14,7 +14,15 @@
       "cancel": "Cancel",
       "sure": "Yes I'm Sure",
       "disabled": "Disabled",
-      "choose-file": "Choose file"
+      "choose-file": "Choose file",
+      "source": "Source",
+      "destination": "Destination",
+      "ssl": "SSL",
+      "access": "Access",
+      "public": "Public",
+      "edit": "Edit",
+      "delete": "Delete",
+      "logs": "Logs"
     },
     "login": {
       "title": "Login to your account"
@@ -48,18 +56,20 @@
     "all-hosts": {
       "empty-subtitle": "{manage, select, true{Why don't you create one?} other{And you don't have permission to create one.}}",
       "details": "Details",
-      "ssl": "SSL",
       "enable-ssl": "Enable SSL",
       "force-ssl": "Force SSL",
       "domain-names": "Domain Names",
       "cert-provider": "Certificate Provider",
-      "other-ssl": "Other",
-      "letsencrypt": "Let's Encrypt",
-      "letsencrypt-email": "Email Address for Let's Encrypt",
-      "letsencrypt-agree": "I Agree to the <a href=\"{url}\" target=\"_blank\">Let's Encrypt Terms of Service</a>",
       "other-certificate": "Certificate",
       "other-certificate-key": "Certificate Key"
     },
+    "ssl": {
+      "letsencrypt": "Let's Encrypt",
+      "other": "Other",
+      "none": "HTTP only",
+      "letsencrypt-email": "Email Address for Let's Encrypt",
+      "letsencrypt-agree": "I Agree to the <a href=\"{url}\" target=\"_blank\">Let's Encrypt Terms of Service</a>"
+    },
     "proxy-hosts": {
       "title": "Proxy Hosts",
       "empty": "There are no Proxy Hosts",
@@ -67,7 +77,9 @@
       "form-title": "{id, select, undefined{New} other{Edit}} Proxy Host",
       "forward-ip": "Forward IP",
       "forward-port": "Forward Port",
-      "delete": "Delete Proxy Host"
+      "delete": "Delete Proxy Host",
+      "delete-confirm": "Are you sure you want to delete the Proxy host for: <strong>{domains}</strong>?",
+      "delete-ssl": "The SSL certificates attached will be removed, this action cannot be recovered."
     },
     "redirection-hosts": {
       "title": "Redirection Hosts"

+ 8 - 7
src/frontend/js/models/dead-host.js

@@ -7,13 +7,14 @@ const model = Backbone.Model.extend({
 
     defaults: function () {
         return {
-            created_on:          null,
-            modified_on:         null,
-            owner:               null,
-            domain_name:         '',
-            ssl_enabled:         false,
-            ssl_provider:        false,
-            meta:                []
+            id:           0,
+            created_on:   null,
+            modified_on:  null,
+            owner:        null,
+            domain_name:  '',
+            ssl_enabled:  false,
+            ssl_provider: false,
+            meta:         []
         };
     }
 });

+ 1 - 0
src/frontend/js/models/proxy-host.js

@@ -7,6 +7,7 @@ const model = Backbone.Model.extend({
 
     defaults: function () {
         return {
+            id:              0,
             created_on:      null,
             modified_on:     null,
             domain_names:    [],

+ 1 - 0
src/frontend/js/models/redirection-host.js

@@ -7,6 +7,7 @@ const model = Backbone.Model.extend({
 
     defaults: function () {
         return {
+            id:                  0,
             created_on:          null,
             modified_on:         null,
             owner:               null,

+ 1 - 0
src/frontend/js/models/stream.js

@@ -7,6 +7,7 @@ const model = Backbone.Model.extend({
 
     defaults: function () {
         return {
+            id:              0,
             created_on:      null,
             modified_on:     null,
             owner:           null,

+ 1 - 0
src/frontend/js/models/user.js

@@ -8,6 +8,7 @@ const model = Backbone.Model.extend({
 
     defaults: function () {
         return {
+            id:          0,
             name:        '',
             nickname:    '',
             email:       '',