Initial commit

This commit is contained in:
2018-07-21 14:50:16 +08:00
commit 3af4f5f884
24 changed files with 5894 additions and 0 deletions

159
admin/index.html Normal file
View File

@@ -0,0 +1,159 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<style>
.number {
width: 70px
}
</style>
<script type="text/javascript">
function showHideSettings() {
var $secure = $('#secure');
var $auth = $('#auth');
if ($secure.prop('checked')) {
$('#_certPublic').show();
$('#_certPrivate').show();
$('#_certChained').show();
$('.le-settings').show();
if ($('#leEnabled').prop('checked')) {
$('.le-sub-settings').show();
if ($('#leUpdate').prop('checked')) {
$('.le-sub-settings-update').show();
} else {
$('.le-sub-settings-update').hide();
}
} else {
$('.le-sub-settings').hide();
}
} else {
$('#_certPublic').hide();
$('#_certPrivate').hide();
$('#_certChained').hide();
$auth.prop('checked', false);
$('.le-settings').hide();
}
if ($auth.prop('checked')) {
$secure.prop('checked', true);
$('#defaultUser').val('admin');
$('.defaultUser').hide();
} else {
$('.defaultUser').show();
}
}
// the function loadSettings has to exist ...
function load(settings, onChange) {
if (!settings) return;
getIPs(function(ips) {
for (var i = 0; i < ips.length; i++) {
$('#bind').append('<option value="' + ips[i].address + '">' + ips[i].name + '</option>');
}
$('#bind.value').val(settings.bind);
});
if (!settings.lePort) settings.lePort = 80;
$('.value').each(function () {
var key = $(this).attr('id');
var $value = $('#' + key + '.value');
if ($value.attr('type') === 'checkbox') {
$value.prop('checked', settings[key]).change(function() {
onChange();
});
} else {
$value.val(settings[key]).change(function() {
onChange();
}).keyup(function() {
onChange();
});
}
});
onChange(false);
fillSelectCertificates('#certPublic', 'public', settings.certPublic);
fillSelectCertificates('#certPrivate', 'private', settings.certPrivate);
fillSelectCertificates('#certChained', 'chained', settings.certChained);
fillUsers('#defaultUser', settings.defaultUser);
$('#auth').change(function () {
if ($(this).prop('checked')) {
$('#secure').prop('checked', true);
}
showHideSettings();
});
$('#secure').change(function () {
showHideSettings();
});
showHideSettings();
}
function save(callback) {
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});
if ($('#secure').prop('checked') && (!$('#certPrivate').val() || !$('#certPublic').val())) {
showMessage(_('Set certificates or load it first in the system settings (right top).'));
return;
}
callback(obj);
}
</script>
</head>
<body>
<!-- you have to put your config page in a div with id adapter-container -->
<div id="adapter-container">
<table><tr><td><img src="socketio.png"></td><td><h3 class="translate">socket.io adapter settings</h3></td></tr></table>
<table>
<tr><td><label class="translate" for="bind">IP:</label></td><td><select class="value" id="bind"></select></td></tr>
<tr><td><label class="translate" for="port">Port:</label></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
<tr><td><label class="translate" for="secure">Secure(HTTPS):</label></td><td><input class="value" id="secure" type="checkbox" /></td></tr>
<tr><td><label class="translate" for="auth">Authentication:</label></td><td><input class="value" id="auth" type="checkbox" /></td></tr>
<tr id="_certPublic">
<td class="translate"><label class="translate" for="certPublic">Public certificate:</label></td>
<td><select id="certPublic" class="value"></select></td>
</tr>
<tr id="_certPrivate">
<td class="translate"><label class="translate" for="certPrivate">Private certificate:</label></td>
<td><select id="certPrivate" class="value"></select></td>
</tr>
<tr id="_certChained">
<td class="translate"><label class="translate" for="certChained">Chained certificate:</label></td>
<td><select id="certChained" class="value"></select></td>
</tr>
<tr class="defaultUser"><td class="translate"><label class="translate" for="defaultUser">Run as:</label></td><td><select class="value" id="defaultUser"></select></td></tr>
<tr class="socketio"><td class="translate"><label class="translate" for="forceWebSockets">Force Web-Sockets:</label></td><td><input type="checkbox" class="value" id="forceWebSockets"/></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr class="le-settings"><td colspan="2"><h3 class="translate">Let's Encrypt settings</h3></tr>
<tr class="le-settings"><td><label for="leEnabled" class="translate">Use Lets Encrypt certificates:</label></td><td><input class="value" id="leEnabled" type="checkbox" /></td></tr>
<tr class="le-settings le-sub-settings"><td><label for="leUpdate" class="translate">Use this instance for automatic update:</label></td><td><input class="value" id="leUpdate" type="checkbox" /></td></tr>
<tr class="le-settings le-sub-settings le-sub-settings-update"><td><label for="lePort" class="translate">Port to check the domain:</label></td><td><input class="value number" id="lePort" type="number" size="5" maxlength="5" /></td></tr>
</table>
</div>
</body>
</html>

208
admin/index_m.html Normal file
View File

@@ -0,0 +1,208 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<script type="text/javascript">
function showHideSettings() {
var $secure = $('#secure');
var $auth = $('#auth');
if ($secure.prop('checked')) {
$('.col-certPublic').show();
$('.col-certPrivate').show();
$('.col-certChained').show();
$('.le-settings').removeClass('disabled');
$auth.removeClass('disabled');
if ($('#leEnabled').prop('checked')) {
$('.le-sub-settings').show();
if ($('#leUpdate').prop('checked')) {
$('.le-sub-settings-update').show();
} else {
$('.le-sub-settings-update').hide();
}
} else {
$('.le-sub-settings').hide();
}
} else {
$('.col-certPublic').hide();
$('.col-certPrivate').hide();
$('.col-certChained').hide();
if ($auth.prop('checked')) {
showToast(_('Please activate secure communication'));
$auth.prop('checked', false);
}
$auth.addClass('disabled');
$('.le-settings').addClass('disabled');
}
if ($auth.prop('checked')) {
$secure.prop('checked', true);
$('#defaultUser').val('admin');
$('.col-defaultUser').hide();
$('.col-ttl').show();
} else {
$('.col-defaultUser').show();
$('.col-ttl').hide();
}
}
// the function loadSettings has to exist ...
function load(settings, onChange) {
if (!settings) return;
getIPs(function(ips) {
for (var i = 0; i < ips.length; i++) {
$('#bind').append('<option value="' + ips[i].address + '">' + ips[i].name + '</option>');
}
$('#bind.value').val(settings.bind).select();
});
if (!settings.lePort) settings.lePort = 80;
$('.value').each(function () {
var key = $(this).attr('id');
var $value = $('#' + key + '.value');
if ($value.attr('type') === 'checkbox') {
$value.prop('checked', settings[key]).change(function() {
showHideSettings();
onChange();
});
} else {
$value.val(settings[key]).change(function() {
onChange();
}).keyup(function() {
onChange();
});
}
});
onChange(false);
fillSelectCertificates('#certPublic', 'public', settings.certPublic);
fillSelectCertificates('#certPrivate', 'private', settings.certPrivate);
fillSelectCertificates('#certChained', 'chained', settings.certChained);
fillUsers('#defaultUser', settings.defaultUser);
showHideSettings();
}
function save(callback) {
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});
if ($('#secure').prop('checked') && (!$('#certPrivate').val() || !$('#certPublic').val())) {
showToast(null, _('Set certificates or load it first in the system settings (right top).'));
return;
}
callback(obj);
}
</script>
</head>
<body>
<!-- you have to put your config page in a div with id adapter-container -->
<div class="m adapter-container">
<div class="row">
<div class="col s12">
<ul class="tabs">
<li class="tab col s2"><a href="#tab-main" class="translate active">Main settings</a></li>
<li class="tab col s2 le-settings"><a href="#tab-le" class="translate">Let's Encrypt SSL</a></li>
</ul>
</div>
<div id="tab-main" class="col s12 page">
<div class="row">
<div class="col s12 m4 l2">
<img src="socketio.png" class="logo">
</div>
</div>
<div class="row">
<div class="col s12 m8 l5">
<select class="value" id="bind"></select>
<label class="translate" for="bind">IP:</label>
</div>
<div class="col s12 m4 l1">
<input class="value number" id="port" min="1" max="65565" type="number"/>
<label class="translate" for="port">Port:</label>
</div>
</div>
<div class="row">
<div class="col s12 m3">
<input class="value" id="secure" type="checkbox" />
<label class="translate" for="secure">Secure(HTTPS):</label>
</div>
<div class="col s12 m3 col-certPublic">
<select id="certPublic" class="value"></select>
<label class="translate" for="certPublic">Public certificate:</label>
</div>
<div class="col s12 m3 col-certPrivate">
<select id="certPrivate" class="value"></select>
<label class="translate" for="certPrivate">Private certificate:</label>
</div>
<div class="col s12 m3 col-certChained">
<select id="certChained" class="value"></select>
<label class="translate" for="certChained">Chained certificate:</label>
</div>
</div>
<div class="row">
<div class="col s12 m3">
<input class="value" id="auth" type="checkbox" />
<label class="translate" for="auth">Authentication:</label>
</div>
<div class="col s12 m3 col-defaultUser">
<select class="value" id="defaultUser"></select>
<label class="translate" for="defaultUser">Run as:</label>
</div>
<div class="col s12 m3 col-ttl">
<input class="value" id="ttl" />
<label class="translate" for="ttl">Login timeout(sec):</label>
</div>
</div>
<div class="row socketio">
<div class="col s12 m3">
<input type="checkbox" class="value" id="forceWebSockets"/>
<span class="translate" for="forceWebSockets">Force Web-Sockets:</span>
</div>
</div>
</div>
<div id="tab-le" class="col s12 page">
<div class="row">
<div class="col s12">
<img src="../../img/le.png" class="logo-le">
</div>
</div>
<div class="row">
<div class="col s11">
<input class="value" id="leEnabled" type="checkbox" data-link="https://git.spacen.net/yunkong2/yunkong2.admin#lets-encrypt-certificates"/>
<label for="leEnabled" class="translate">Use Lets Encrypt certificates:</label>
</div>
</div>
<div class="row le-sub-settings">
<div class="col s11">
<input class="value" id="leUpdate" type="checkbox" data-link="https://git.spacen.net/yunkong2/yunkong2.admin#lets-encrypt-certificates"/>
<label for="leUpdate" class="translate">Use this instance for automatic update:</label>
</div>
</div>
<div class="row le-sub-settings le-sub-settings-update">
<div class="col s11 m4 l2">
<input class="value number" id="lePort" type="number" size="5" maxlength="5" data-link="https://git.spacen.net/yunkong2/yunkong2.admin#lets-encrypt-certificates"/>
<label for="lePort" class="translate">Port to check the domain:</label>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

BIN
admin/socketio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

22
admin/words.js Normal file
View File

@@ -0,0 +1,22 @@
// DO NOT EDIT THIS FILE!!! IT WILL BE AUTOMATICALLY GENERATED FROM src/i18n
/*global systemDictionary:true */
'use strict';
systemDictionary = {
"socket.io adapter settings": { "en": "socket.io adapter settings", "de": "socket.io adapter settings", "ru": "socket.io adapter settings", "pt": "Configurações do adaptador socket.io", "nl": "socket.io-adapterinstellingen", "fr": "Paramètres de l'adaptateur socket.io", "it": "impostazioni della scheda socket.io", "es": "Configuración del adaptador socket.io", "pl": "ustawienia adaptera socket.io"},
"Run as:": { "en": "Run as", "de": "Laufen unter Anwender", "ru": "Запустить от пользователя", "pt": "Correr como", "nl": "Rennen als", "fr": "Courir comme", "it": "Correre come", "es": "Correr como", "pl": "Uruchom jako"},
"IP:": { "en": "IP", "de": "IP", "ru": "IP", "pt": "IP", "nl": "IK P", "fr": "IP", "it": "IP", "es": "IP", "pl": "IP"},
"Port:": { "en": "Port", "de": "Port", "ru": "Порт", "pt": "Porta", "nl": "Haven", "fr": "Port", "it": "Porta", "es": "Puerto", "pl": "Port"},
"Secure(HTTPS):": { "en": "Secure(HTTPS)", "de": "Verschlüsselung(HTTPS)", "ru": "Шифрование(HTTPS)", "pt": "Seguro (HTTPS)", "nl": "Secure (HTTPS)", "fr": "Sécurisé (HTTPS)", "it": "Sicuro (HTTPS)", "es": "Seguro (HTTPS)", "pl": "Bezpieczne (HTTPS)"},
"Authentication:": { "en": "Authentication", "de": "Authentifikation", "ru": "Аутентификация", "pt": "Autenticação", "nl": "authenticatie", "fr": "Authentification", "it": "Autenticazione", "es": "Autenticación", "pl": "Poświadczenie"},
"Listen on all IPs": { "en": "Listen on all IPs", "de": "An allen IP Adressen hören", "ru": "Открыть сокет на всех IP адресах", "pt": "Ouça todos os IPs", "nl": "Luister op alle IP's", "fr": "Écoutez sur toutes les adresses IP", "it": "Ascolta su tutti gli IP", "es": "Escuchar en todas las direcciones IP", "pl": "Posłuchaj na wszystkich IP"},
"help_tip": { "en": "On save the adapter restarts with new configuration immediately", "de": "Beim Speichern von Einstellungen der Adapter wird sofort neu gestartet.", "ru": "Сразу после сохранения настроек драйвер перезапуститься с новыми значениями", "pt": "Em salvar, o adaptador reinicia com a nova configuração imediatamente", "nl": "Bij opslaan wordt de adapter onmiddellijk opnieuw opgestart met een nieuwe configuratie", "fr": "Sur enregistrer l'adaptateur redémarre avec la nouvelle configuration immédiatement", "it": "Al salvataggio, l'adattatore si riavvia immediatamente con la nuova configurazione", "es": "Al guardar, el adaptador se reinicia con una nueva configuración de inmediato", "pl": "Po zapisaniu adapter natychmiast uruchamia się ponownie z nową konfiguracją"},
"Public certificate:": { "en": "Public certificate", "de": "Publikzertifikat", "ru": "'Public' сертификат", "pt": "Certificado público", "nl": "Openbaar certificaat", "fr": "Certificat public", "it": "Certificato pubblico", "es": "Certificado público", "pl": "Certyfikat publiczny"},
"Private certificate:": { "en": "Private certificate", "de": "Privatzertifikat", "ru": "'Private' сертификат", "pt": "Certificado privado", "nl": "Privé certificaat", "fr": "Certificat privé", "it": "Certificato privato", "es": "Certificado privado", "pl": "Prywatny certyfikat"},
"Chained certificate:": { "en": "Chained certificate", "de": "Kettenzertifikat", "ru": "'Chained' сертификат", "pt": "Certificado acorrentado", "nl": "Geketend certificaat", "fr": "Certificat chaîné", "it": "Certificato incatenato", "es": "Certificado encadenado", "pl": "Przykuty certyfikat"},
"Force Web-Sockets:": { "en": "Force Web-Sockets", "de": "Nur Web-Sockets", "ru": "Только Web-Sockets", "pt": "Forçar Web-Sockets", "nl": "Force Web-Sockets", "fr": "Forcer les Web-Sockets", "it": "Force Web-Sockets", "es": "Force Web-Sockets", "pl": "Wymuszaj gniazda internetowe"},
"Let's Encrypt settings": { "en": "Let's Encrypt settings", "de": "Einstellungen Let's Encrypt", "ru": "Настройки Let's Encrypt", "pt": "Vamos criptografar configurações", "nl": "Laten we de instellingen versleutelen", "fr": "Cryptons les paramètres", "it": "Let's Encrypt settings", "es": "Vamos a cifrar la configuración", "pl": "Zakodujmy ustawienia"},
"Use Lets Encrypt certificates:": { "en": "Use Let's Encrypt certificates", "de": "Benutzen Let's Encrypt Zertifikate", "ru": "Использовать сертификаты Let's Encrypt", "pt": "Use Vamos criptografar certificados", "nl": "Gebruik Let's Encrypt-certificaten", "fr": "Utiliser les certificats Let's Encrypt", "it": "Utilizza Let's Encrypt certificates", "es": "Utilice los certificados Let's Encrypt", "pl": "Użyj Let's Encrypt certificates"},
"Use this instance for automatic update:": { "en": "Use this instance for automatic update", "de": "Benutze diese Instanz für automatische Updates", "ru": "Обновлять сертификаты в этом драйвере", "pt": "Use esta instância para atualização automática", "nl": "Gebruik deze instantie voor automatische update", "fr": "Utilisez cette instance pour la mise à jour automatique", "it": "Utilizza questa istanza per l'aggiornamento automatico", "es": "Use esta instancia para la actualización automática", "pl": "Użyj tej instancji do automatycznej aktualizacji"},
"Port to check the domain:": { "en": "Port to check the domain", "de": "Port um die Domain zu prüfen", "ru": "Порт для проверки доменного имени", "pt": "Porta para verificar o domínio", "nl": "Poort om het domein te controleren", "fr": "Port pour vérifier le domaine", "it": "Porta per controllare il dominio", "es": "Puerto para verificar el dominio", "pl": "Port do sprawdzenia domeny"}
};