Skip to content

Commit 5de9489

Browse files
committed
* initial
1 parent da28991 commit 5de9489

35 files changed

+1369
-1
lines changed

config.template.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* User configuration
3+
* Copy to config.js to enable it
4+
*/
5+
let config = {
6+
/**
7+
* The host to bind the webinterface to
8+
* null if you want allow every hostname
9+
*/
10+
"host": null,
11+
12+
/**
13+
* The port for the server and websocket
14+
* The given number is the one for the webinterface
15+
* Notice that both given number and the number+1 will be required
16+
*/
17+
"port": 4340
18+
};
19+
20+
module.exports = config;

db/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

logs/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"express": "^4.14.0",
1414
"lowdb": "^0.14.0",
1515
"request": "^2.79.0",
16-
"ws": "^1.1.1"
16+
"ws": "^1.1.1",
17+
"unzip": "^0.1.11"
1718
}
1819
}

public/images/logo.png

29.4 KB
Loading

public/index.html

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<meta name="format-detection" content="telephone=no">
6+
<meta name="msapplication-tap-highlight" content="no">
7+
<meta name="viewport"
8+
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
9+
<link rel="stylesheet" type="text/css" href="stylesheets/lib/sandstone/bootstrap.min.css">
10+
<link rel="stylesheet" type="text/css" href="stylesheets/lib/bootstrap-select.min.css">
11+
<link rel="stylesheet" type="text/css" href="stylesheets/scss/page.css">
12+
<link rel="shortcut icon" href="images/logo.png" type="image/png">
13+
<script type="text/javascript" src="scripts/lib/jquery-3.2.1.min.js"></script>
14+
<script type="text/javascript" src="scripts/lib/jquery.serializejson.min.js"></script>
15+
<script type="text/javascript" src="scripts/lib/bootstrap.min.js"></script>
16+
<script type="text/javascript" src="scripts/lib/bootstrap-select.min.js"></script>
17+
<script type="text/javascript" src="scripts/lib/bootstrap-notify.min.js"></script>
18+
<script type="text/javascript" src="scripts/lang.js"></script>
19+
<script type="text/javascript" src="scripts/socket.js"></script>
20+
<script type="text/javascript" src="scripts/storage.js"></script>
21+
<script type="text/javascript" src="scripts/global.js"></script>
22+
<script type="text/javascript" src="scripts/modal.js"></script>
23+
<script type="text/javascript" src="scripts/tpl.js"></script>
24+
<title>Web FTP Client</title>
25+
</head>
26+
<body>
27+
<div class="loader"></div>
28+
29+
<div id="wrapper" class="hidden">
30+
<div class="menu-top">
31+
<span class="dropdown">
32+
<button class="btn btn-default dropdown-toggle" type="button" id="menu-file" data-toggle="dropdown"
33+
aria-haspopup="true" aria-expanded="true">File <span class="caret"></span>
34+
</button>
35+
<ul class="dropdown-menu" aria-labelledby="menu-file">
36+
<li><a href="#">Servermanager</a></li>
37+
<li role="separator" class="divider"></li>
38+
<li><a href="#">Export</a></li>
39+
<li><a href="#">Import</a></li>
40+
</ul>
41+
</span>
42+
</div>
43+
<div class="menu-icons">Icons</div>
44+
<div class="quick-connect-bar form-inline">
45+
<input type="text" name="host" placeholder="Server Host/Ip" class="form-control input-sm">
46+
<input type="text" name="username" placeholder="Username" class="form-control input-sm">
47+
<input type="password" name="password" placeholder="Password" class="form-control input-sm">
48+
<input type="number" name="port" placeholder="Port" class="form-control input-sm" size="5" min="0" max="65535" step="1">
49+
</div>
50+
<div class="logs">Logs</div>
51+
<div class="browser">
52+
<div class="local">Local Browser</div>
53+
<div class="server">Server Browser</div>
54+
</div>
55+
<div class="transfer">Transfers</div>
56+
</div>
57+
</body>
58+
</html>

public/scripts/global.js

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"use strict";
2+
3+
/**
4+
* Just get a translation value for given key
5+
* @param {string} key
6+
* @param {object=} params
7+
* @return {string}
8+
*/
9+
function t(key, params) {
10+
return lang.get(key, params)
11+
}
12+
13+
/**
14+
* Show a note message on top
15+
* @param {string} message
16+
* @param {string=} type
17+
* @param {number=} delay
18+
*/
19+
function note(message, type, delay) {
20+
if (delay === -1) delay = 99999999;
21+
$.notify({
22+
"message": t(message)
23+
}, {
24+
"type": typeof type == "undefined" ? "info" : type,
25+
placement: {
26+
from: "top",
27+
align: "center"
28+
},
29+
"delay": delay || 5000,
30+
});
31+
}
32+
33+
/**
34+
* Get depth object value, write like foo[bar][etc]
35+
* @param {object} object
36+
* @param {string} key
37+
* @returns {*|undefined}
38+
*/
39+
function getObjectValue(object, key) {
40+
var spl = key.split("[");
41+
var o = object;
42+
for (var i = 0; i < spl.length; i++) {
43+
var keySplit = spl[i].replace(/\]$/g, "");
44+
if (typeof o[keySplit] == "undefined") return undefined;
45+
o = o[keySplit];
46+
}
47+
return o;
48+
}
49+
50+
$(function () {
51+
if (typeof WebSocket == "undefined") {
52+
note("Your browser is not supported in this application (Outdated Browser). Please upgrade to the newest version");
53+
return;
54+
}
55+
var body = $("body");
56+
var hasTouch = true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch);
57+
body.addClass(hasTouch ? "no-touch" : "touch");
58+
// bind tooltips
59+
$(document).tooltip({
60+
"selector": '[data-tooltip]',
61+
"container": "body",
62+
"html": true,
63+
"title": function () {
64+
return t($(this).attr("data-tooltip"));
65+
}
66+
}).on("inserted.bs.tooltip", function (ev) {
67+
// hide if we are on mobile touch device
68+
if (hasTouch) {
69+
setTimeout(function () {
70+
$(ev.target).trigger("mouseout");
71+
}, 1000);
72+
}
73+
});
74+
lang.replaceInHtml(body);
75+
socket.connectAndLoadView();
76+
});

public/scripts/lang.js

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"use strict";
2+
/**
3+
* Translations
4+
*/
5+
6+
var lang = {};
7+
8+
/**
9+
* Just get a translation value for given key
10+
* @param {string} key
11+
* @param {object=} params
12+
* @return {string}
13+
*/
14+
lang.get = function (key, params) {
15+
var v = key;
16+
if (typeof lang.values[lang.language] != "undefined" && typeof lang.values[lang.language][key] != "undefined") {
17+
v = lang.values[lang.language][key];
18+
} else if (typeof lang.values["en"] != "undefined" && typeof lang.values["en"][key] != "undefined") {
19+
v = lang.values["en"][key];
20+
}
21+
if (typeof params != "undefined") {
22+
for (var i in params) {
23+
if (params.hasOwnProperty(i)) {
24+
v = v.replace(new RegExp("{" + i + "}", "ig"), params[i]);
25+
}
26+
}
27+
}
28+
return v;
29+
};
30+
31+
/**
32+
* Replace all placeholders in html with proper translation values
33+
* @param {JQuery} el The element to replace values in
34+
*/
35+
lang.replaceInHtml = function (el) {
36+
var get = lang.get;
37+
var elements = el.find("[data-translate]");
38+
elements.each(function () {
39+
$(this).html(get($(this).attr("data-translate")));
40+
});
41+
elements.removeAttr("data-translate");
42+
elements = el.find("[data-translate-property]");
43+
elements.each(function () {
44+
var s = $(this).attr("data-translate-property").split(",");
45+
$(this).attr(s[0], get(s[1]));
46+
});
47+
elements.removeAttr("data-translate-property");
48+
};
49+
50+
/**
51+
* The translation values
52+
* @type {object.<string, object<string, string>>}
53+
*/
54+
lang.values = {"en": {}, "de": {}};
55+
56+
// en values
57+
lang.values.en = {
58+
59+
};
60+
61+
// de values
62+
lang.values.de = {};
63+
64+
/**
65+
* The current language, default to en
66+
* @type {string}
67+
*/
68+
lang.language = "en";
69+
70+
// check for a other supported language depending on the users defined languages
71+
if (navigator.languages) {
72+
(function () {
73+
for (var i = 0; i < navigator.languages.length; i++) {
74+
var l = navigator.languages[i];
75+
if (typeof lang.values[l] != "undefined") {
76+
lang.language = l;
77+
break;
78+
}
79+
}
80+
})();
81+
}

public/scripts/lib/bootstrap-notify.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/scripts/lib/bootstrap-select.min.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/scripts/lib/bootstrap.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/scripts/lib/jquery-3.2.1.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)