Explorar o código

Incorporate feedback

- Empty function removed
- Placeholder and Maxlength restored
- Validation improved
- Typo fixed
Björn Heinrichs %!s(int64=4) %!d(string=hai) anos
pai
achega
ba7bb57ca2

+ 1 - 1
backend/migrations/20210423103500_stream_domain.js

@@ -1,4 +1,4 @@
-const migrate_name = 'scream-domain';
+const migrate_name = 'stream_domain';
 const logger       = require('../logger').migrate;
 
 /**

+ 13 - 3
backend/schema/endpoints/streams.json

@@ -21,9 +21,19 @@
       "maximum": 65535
     },
     "forwarding_host": {
-      "type": "string",
-      "minLength": 1,
-      "maxLength": 255
+      "oneOf": [
+        {
+          "$ref": "../definitions.json#/definitions/domain_name"
+        },
+        {
+          "type": "string",
+          "format": "ipv4"
+        },
+        {
+          "type": "string",
+          "format": "ipv6"
+        }
+      ]
     },
     "forwarding_port": {
       "type": "integer",

+ 1 - 1
frontend/js/app/nginx/stream/form.ejs

@@ -15,7 +15,7 @@
                 <div class="col-sm-8 col-md-8">
                     <div class="form-group">
                         <label class="form-label"><%- i18n('streams', 'forwarding-host') %><span class="form-required">*</span></label>
-                        <input type="text" name="forwarding_host" class="form-control text-monospace" value="<%- forwarding_host %>" autocomplete="off" required>
+                        <input type="text" name="forwarding_host" class="form-control text-monospace" placeholder="example.com or 10.0.0.1 or 2001:db8:3333:4444:5555:6666:7777:8888" value="<%- forwarding_host %>" autocomplete="off" maxlength="255" required>
                     </div>
                 </div>
                 <div class="col-sm-4 col-md-4">

+ 0 - 3
frontend/js/app/nginx/stream/form.js

@@ -76,9 +76,6 @@ module.exports = Mn.View.extend({
         }
     },
 
-    onRender: function () {
-    },
-
     initialize: function (options) {
         if (typeof options.model === 'undefined' || !options.model) {
             this.model = new StreamModel.Model();