Compare commits

...
31 Commits
Author SHA1 Message Date
Henrique Dias 5dc210c000 Version 1.3.8
Former-commit-id: f69ca91fc441142e07dfe8dd5cb92c419a1cd44a [formerly 679e456d16586b10e00c5aceb1cea75eb62e10dc] [formerly 50f4889e1eb2797c0c899af48acb1305fa33b671 [formerly 1e700ef167]]
Former-commit-id: ba0df3d330275d2fa1a5e02c608051f3f1422124 [formerly 77d49e18d479776cf670eb008878364fd4c7292a]
Former-commit-id: 2bfe39e4b6371996559557eeb00a15a895e4321a
2017-10-30 16:24:27 +00:00
Henrique Dias 3bb3fdb956 GOFMT
Former-commit-id: bbc11e551ed79fc41af61d67bfb9a882dfc8e655 [formerly 4ef42ee3251bdf613b7e24b50692629fbf8965ed] [formerly 10abcd7f0e34753069a80a683df94084f03fdb4b [formerly 1d4cbd622c]]
Former-commit-id: 7ac0c18ad61cd491f22b906e1efd87892d729cb2 [formerly b45c7e312058490ae90c8162e6cc1264613a9126]
Former-commit-id: 1c7e8ebd2f1b1dc5bd25df9f30a77c9b73ccad4d
2017-10-30 15:47:59 +00:00
Henrique Dias b96a4a63c0 whitelist .htaccess to be edited; close #258
Former-commit-id: 1114b97a9b0cf236d96ce283bbf8d482cc85170f [formerly 6419fbd11f28ce1dc5ebdfcde0d34adabd016052] [formerly c1135ecdb720db11f4e1182c5456c484f5f58ed1 [formerly 72ee240ce3]]
Former-commit-id: 09fc62ffc432b822ea495b19bc5daafbd3ed8912 [formerly c1eb12242b30a1d90299427c387e0b2a25ce0f24]
Former-commit-id: e097526998a0d9c6382bd9d97af3bf161e8fcd0c
2017-10-30 15:36:40 +00:00
Henrique Dias 3d54b2bd90 fix #260
Former-commit-id: 0d8742754bb756ad3a83599850dae5f477282430 [formerly 5cb7d75b695d8400fc2af87edd551d6450e7365f] [formerly a6a814c40a5ff4f195c4ab470d4fccc92bd8c1c8 [formerly 99c8c92c6c]]
Former-commit-id: 45eba5ff05f8e64fbf33d9d670e19a0cf4880656 [formerly 88dc856045b9d51596f36ce387b1c4f3e85a7d3c]
Former-commit-id: 1eadaef460060da8ae71df3c66f242c844992725
2017-10-30 15:24:06 +00:00
Henrique Dias 95d43a344c [ci skip] auto: setting untracked version
Former-commit-id: 4f9b713ad6cd1f90e7569c9eb083b2740b2f6a60 [formerly ffa130fe00c78b2431ceb16bf1e18345a98826a3] [formerly 5aecd62f16317a53810677fc49a40af297d6bd91 [formerly f4f7147717]]
Former-commit-id: cd5e3739e28213efeaa59cb1fe68b25b35068d46 [formerly 10edbd82feb4d35296c1edf1ab977860b7504470]
Former-commit-id: 4067d711f14eb26232204a89a6263b989ee0494f
2017-10-29 13:33:42 +00:00
Henrique Dias 1077d5cd6b Version 1.3.7
Former-commit-id: c76a13cb8d0bf0a360c63c18cbfac378f8888425 [formerly e58788aa3de9e8fb54894a72bdd567c3846bf943] [formerly 77cd4f2feb8ef317cfeeff84d85ffb7eff4d899f [formerly 3cddb26572]]
Former-commit-id: af62db2d663287f662990539be428ae84f1974cf [formerly eaae8679ea0b9daeeba5cd29dd981d60d66e6c1e]
Former-commit-id: 886b61f0af26b85625cf7092ce5e7d4c5e44ed59
2017-10-29 13:33:31 +00:00
Henrique Dias 57cc174b3d [ci skip] auto: setting untracked version
Former-commit-id: ed15673452af4cd3ccf1a1f316efd6a733e6bd43 [formerly 0a9637c464bbae4c5c351f7e6f65dd24197a9968] [formerly e7388628831533d4476ba69c8d0cfac3ae18be14 [formerly 08bfeea103]]
Former-commit-id: 412e1b3bfcdef0037292b7ab3f5a5eeb4e9523f3 [formerly 2ca352a5af95eedadc91ea207833bdb670f1481a]
Former-commit-id: b359f15e105d55a9761aa9bf43c331bad113d561
2017-10-29 13:32:10 +00:00
Henrique Dias cf61baa273 Version 1.3.4
Former-commit-id: 6d70d81a1967f171a41cecbdad8664fc65d1111a [formerly e273e78de0030dcb2eec730a00f248f1e8dbd9f7] [formerly 37b0ede2385e153153a854112ffab1065bcdd44d [formerly f89b86939e]]
Former-commit-id: 84fc2f9742c2e0011254ee762faf6f087986c6fa [formerly f22c175e96173bf25aa08067533937041152fdb3]
Former-commit-id: 32981c2a1211608d2d5c059264aa5eb434099400
2017-10-29 13:32:02 +00:00
Henrique Dias 2d5cd2d1d3 Fix Travis
Former-commit-id: 435a3bebf2ac1bbae2f1ed94d596956227141358 [formerly 46e69c9783cb07a9ca6b7bd428a1ab54cff2005b] [formerly 36ed5ea293a4d39d161bffed5b18a1d7f1a0d5c1 [formerly 3434090a7c]]
Former-commit-id: d5bc8f96b631af8d440438c1a089e710ae09a47a [formerly f447c0c7031af05129bf7c45b6c87168a365738d]
Former-commit-id: 627ac93b54b236e20d552486d125cef813eaf9e5
2017-10-29 13:12:54 +00:00
Henrique Dias 9472aad877 Fix #262 #266
Former-commit-id: 0acca700ed0a2ced8bf6b5b019aa6ff4774b8ea8 [formerly 0ff934dd107e56f4b7349f1363dfb1b6cbbc7916] [formerly f8b60e60087d754b46ca4dad49a151bec299febd [formerly ae1702c4e2]]
Former-commit-id: 824abe0c6cb5d32c061e8efd4a7f1d3354b3dbfe [formerly 655809d5c670c9de352c473de1fe08303a4c5506]
Former-commit-id: 6ca6f383602241b8a50c13cce5b066cd5f2cf990
2017-10-29 13:07:48 +00:00
Henrique Dias dd0f3ef144 [ci skip] auto: setting untracked version
Former-commit-id: 7abc56816c4aee81b91bccce14251ed71b02ac0e [formerly 5d1acb37bf487778cb740299a0f25846f49f0ad4] [formerly b97420d631839e9a7a74961403113986d493638f [formerly 26e1e44d60]]
Former-commit-id: c196dfa47127e87efcec64c4cda2e7013e5cdc4d [formerly 5647ffd57b1e049a3e11f6ec37fd2344abfc591a]
Former-commit-id: 3cc55fc8d38f553f0405972dd39da2b0bbb52740
2017-10-15 08:28:41 +01:00
Henrique Dias 44e492160b Version 1.3.6
Former-commit-id: 28c72f8ee9f7cf548dd5f2c2cc564b31ba13ada8 [formerly cd087b92826cb418d4d17ac26a8cfeb408a54919] [formerly bf241b663bdcfc00737f5bb429ef4a669c1a6c2b [formerly 3e9c3ed912]]
Former-commit-id: 2b74d089de06c4fa5d4933e0c11ff8b1afcd2f46 [formerly 9ac185e1ea76c1beec895f6c51109fd137547e60]
Former-commit-id: a27b4e08dc726769b4731abb5865d2e908387774
2017-10-15 08:28:28 +01:00
Henrique Dias 0137b03887 Fix Portuguese language reference and DRY
Former-commit-id: 3954a92011b3c1699236b32373688ce80f720179 [formerly 67bca685bac4e893f836b21f85f4369444f3e708] [formerly 9817c40128b6660be30ea48b5317d07d21b84ca0 [formerly 77df2034f5]]
Former-commit-id: 2681c1f068e8094f0f9593a4c21fc6f84d8a6353 [formerly 26986c2af1193a31e3abec64b829cb29aa97011c]
Former-commit-id: c2813afc8de2e22ff9f3de0f55fbb26b3b954619
2017-10-15 08:26:22 +01:00
Equim 92c9b134c3 i18n: auto detect locale from browser (#253)
* i18n: detect locale from browser

* fix regex for locale matching

* remove debug code


Former-commit-id: 17e550af54ff213d5e2b60f83b374cd962052b5b [formerly 62fb089a7a45092b3818135dd68fac218067ef67] [formerly 733c463d2332307dafd40da5e77c6c9558239283 [formerly 4b84492a11]]
Former-commit-id: 2e117c9e060ac5cd9f80a0de2a4582eef74df6b8 [formerly 5fb6fc086bb2ebeb49a578042240a26a7879a4b8]
Former-commit-id: 7692a4fbb2889acbd7c6ee09ccd01a234998616a
2017-10-15 08:12:40 +01:00
Geno 1737702c7c typo in logging (#255)
Former-commit-id: fd0b7d6887e14b77ab97b323f4e8d1bb51ecda23 [formerly fb4fab794ca27e8f77e0dec71483cec51e4a8fce] [formerly df9da803a4301a8b1e5ed93f1f3fd121b8a3bf49 [formerly b93aed98b1]]
Former-commit-id: d17f1d4be63659781b4254b9ec36737d2f794008 [formerly 27cc8277db82e0ae123d2b1ffe95bed297c6095d]
Former-commit-id: 8137dd86f6f3caef4636416f6370bd686773df3a
2017-10-15 08:06:53 +01:00
Equim ece52ecf7c Don't expose error (#254)
* share: remove share link when it has been moved

* http: don't expose error


Former-commit-id: c7f1d28117c770006132c75e5950d73aa9d87a12 [formerly f29a0260622644a79ff401263ba4efb143dea23a] [formerly fdd741679f09c72a121076e0a62a0d2a6eafefe4 [formerly 538b99ee77]]
Former-commit-id: 5ec9b62254b0cbc233673e7e196a5a4ece53a3f4 [formerly d26d45418267d11a1a211ba90a8b68b5b9fad714]
Former-commit-id: 57333d74cbac7088c6c527a4fe757af427dedea8
2017-10-14 10:07:01 +01:00
Henrique Dias a7d6a72718 Build Assets
Former-commit-id: aa40a922e2dbd104bed161fd6564343c64f2fb34 [formerly 16a73ea595678b00ab9690338015746a8f5e5f02] [formerly cf4ef0a6fe12d211a1e905047a3a2cdba12e9c84 [formerly 7f7d536c5e]]
Former-commit-id: cb509a9c9961b4c8d2c6f8f67b37f30b2732eef8 [formerly f7465805945f0c08312c31bb067e3d9546d883bd]
Former-commit-id: cab59e68c27cd7c180a8964889c759efbbff7616
2017-10-09 08:28:49 +01:00
Henrique Dias 3fa9286238 ViewMode constants; default view modes
Former-commit-id: d51ad4b2671c76c3a493daf93fd4fb94a76826ed [formerly 576cfa8ebe9c66c9dbc1c8f79ab8ba7fecbe8845] [formerly 0969e87e3c070763d6e58f1d09f815b772814e4d [formerly 8633e9677b]]
Former-commit-id: 4dad4cf6bb3858122cd4d4c6a574e691788ef9ae [formerly 0b356f24a005c8886bd2165884e363f277456d8f]
Former-commit-id: cadb7589dad74e9bdb47bf3664f98ac672940fe5
2017-10-09 08:26:05 +01:00
Henrique Dias ad5ff4cfe0 Close #248
Former-commit-id: af79c3515a4a6a6d5b72da1193b888b7cd03b286 [formerly bb0e1f8e966e238feacf3013eccf9b5e711f7061] [formerly 0f38f0df6f964f88310fde0e59f6b3a79b9c103c [formerly 90c2de44c3]]
Former-commit-id: ac03a781bce6530b0512b014c38e8d8c77d8ec01 [formerly 5469e2322432fd1991229f909e69d70966fe8f9e]
Former-commit-id: d17517418e68671237ad845df93b62840038d8d7
2017-10-09 08:14:17 +01:00
Henrique Dias 9aee1ebd2a [ci skip] auto: setting untracked version
Former-commit-id: 89e071320621710d9f24bf4dde8827f159c64d31 [formerly 6d44fe3f3e56b82762bacce64c1682262d4d1a90] [formerly 8e0f92b3205067d4644bf2febdc160d84696a37a [formerly 769bdad12a]]
Former-commit-id: 9e00c24fdca0e1ebe71aceb84624ea0b9fb85afa [formerly a04f2e37805000e19c7dcdb7daafe2396cb8269e]
Former-commit-id: 827a695fce5d7731e58052dbbf4f5bd0e3d6f5c7
2017-10-08 23:48:24 +01:00
Henrique Dias f8ed1b41d6 Version 1.3.5
Former-commit-id: e064282645a50d6eeeb293577da260c586d4bb45 [formerly 2a9ac206ab79a8f115ed25a3afb595663f18fcb4] [formerly 2ea943c96653266a9533d9e95776955821706ea4 [formerly dd59e3c62b]]
Former-commit-id: 4ec9b9738ee48943830b9045ae40e7c305010bf3 [formerly 7748b70d5109e788ad146b466b3430a822037570]
Former-commit-id: 0981b89cb1d7bc0da43d47ff8900eb1c67301982
2017-10-08 23:47:56 +01:00
Equim bb9b0dfd2b i18n: Fix typo (#250)
Former-commit-id: c27f105374233923e7691327f7e6f6b9a52077ce [formerly c34be33394c74229a1029edf21d9c83d5c9dd2a9] [formerly 3f5bd5a8457310d034b7fe761beb915caf35ae65 [formerly f0609757f7]]
Former-commit-id: 82d69494e5c421a245ceff0df033529ef488e419 [formerly 910438160faa1e853c91252845443514a066b3f9]
Former-commit-id: 01874c63eb13dc39471c3c2cd06a9b2e99394f46
2017-10-08 23:42:51 +01:00
Henrique Dias cc2ce884fc [ci skip] auto: setting untracked version
Former-commit-id: d68d28c1e0000f0308b1e84a912f00b8a91f7fbf [formerly 15e0131f25aa82b8bb340e2d58d09c35a4a91754] [formerly 282b0c8d07c82de35fb87927c9da29182efaceff [formerly 9d27c38097]]
Former-commit-id: 9cc06bb0c230f2acac72fc6b4d00e4d8446a5f88 [formerly 5634a96f7b01d6f08a6a46f24dab7a3f03668fd6]
Former-commit-id: c9629add111d645e386461016771ebd1b14b98b5
2017-09-11 09:49:54 +01:00
Henrique Dias e7e7679002 Version 1.3.4
Former-commit-id: f7727c37ed227e062a34de8b67a5bdeb95caab27 [formerly 9202314bd4a0a0288e3b95c179aaeaaf38997f7f] [formerly c57ba427c5e85f4aff34ccc5476d2c374c93a6d4 [formerly d41715c0c2]]
Former-commit-id: 7aa4c2ee81fa7dd451fef64198335f7a6ee78173 [formerly 4d1553375b1a3c86e9f8de45ef658ff8fe64aba4]
Former-commit-id: 85340361dc98b2ce775d1c41291ff3af165f99ee
2017-09-11 09:49:42 +01:00
Henrique Dias 9a829fd594 fix #241
Former-commit-id: 8578bf0b790ea4b8b5c5da4876fbccd2ead42d3c [formerly b67d35502fb0c9a3c57226b812dd2b869c5fcae1] [formerly 506eb279c974a86b232be57f87a11ec283b3b742 [formerly f658394dd7]]
Former-commit-id: e9565ce6a4ef229943f132fb6e05c5ec853447ed [formerly d0b2c24f6df2a74c403ded829cfd0746659e7d5f]
Former-commit-id: 2f4afe92081915821dd5b2fe745faf1492bdcabf
2017-09-11 09:46:17 +01:00
Henrique Dias 624d61930c Add ReCaptcha to main
Former-commit-id: 06bc7079f6d939e5531a3d9600052f979adac86d [formerly e6d8fa4418ccfa8f0163530647099432a936d4ee] [formerly dbd0cfc3770972afdf7aae8121d3af50681d55eb [formerly 879ad7b518]]
Former-commit-id: e6706456ba300c501ae66664596b5709e45d87df [formerly 98238eb61781a545ee4bac512a4f02257f4cf165]
Former-commit-id: 30bfb2b201ecbbd1ac2cf58cbadbe82daea793cb
2017-09-11 09:23:59 +01:00
Henrique Dias ee30e7711f implement recaptcha on login
Former-commit-id: d7495b6fff4a99a8d155a3be87b15535a74a1305 [formerly 5b3a544447cca0d1cdcb6c87ca94f450a5493506] [formerly b4de1a4f5d4dd295c98366ede2b87bf2cb7918f9 [formerly 002f8066c7]]
Former-commit-id: c0e5d38111a99f8e3e71fb5db86e19b7ba44ec48 [formerly 1b5e454263ba64ced95c6d4b51f5f32e66f74758]
Former-commit-id: cfb17a53fc86d0071fba91503502444f5f10a0c7
2017-09-11 09:00:59 +01:00
Henrique Dias 6e5116aa27 [ci skip] auto: setting untracked version
Former-commit-id: 4f0cecd21f2f1fec680773c6242d6ab9687384f3 [formerly 1dec18820a98ad1ffc39eddff12167b4d1564254] [formerly ffdde8ede3a4d934d492224a046b654518cffbe9 [formerly a61329843c]]
Former-commit-id: 865c60a764807ea8d6781ac4bc95a4c8ddd9ef56 [formerly c9799373cf5e9637c78faffb94117c355a3a4f8c]
Former-commit-id: 070a498ca4c9d6da545c9b10d60e0f84e7e56889
2017-09-10 10:14:35 +01:00
Henrique Dias 34acffbb7b Version 1.3.3
Former-commit-id: d3126ad3137ddb4270199227c7ac4a0aa248b117 [formerly d8de0edac44991fb25fc3d58bc5fbf34ca51e14c] [formerly 65f8bd6a9c9a15f2182f7d9d0d0317df8a7a636c [formerly 53dedb7f5e]]
Former-commit-id: 473f94e0b181bfe06eaf73648775af5e89b03032 [formerly 9efded6125dc4ef0384f441933139847513fde51]
Former-commit-id: 8ada7c0571decba2abb0e721650401f040a6fb86
2017-09-10 10:14:22 +01:00
Henrique Dias eb6f26c191 Add view mode on users created on previous versions
Former-commit-id: 6c3e320b2004beb8172e966e1a7f1885e33ed20b [formerly 829930444312dcfa1e144b3631c56632f6094d01] [formerly 68ae2ee9df5b3908fb30a07094f7d464818a0d52 [formerly b651d03ea9]]
Former-commit-id: 3af8ad9075641ca34504e33a2eb363eff7c6c63d [formerly e2873038181f9cc6f8d1c465aa5544cf98eb735d]
Former-commit-id: 584b5c3452545d2a6361ade02e093fe5596a52c3
2017-09-10 10:13:10 +01:00
Henrique Dias 06f3e9744a [ci skip] auto: setting untracked version
Former-commit-id: c7af338241ab6cac5e5e6f5683a8394e30a1ff6b [formerly a28f7d51e97810acd69616c22eb578f2d65e8528] [formerly 6b372592bf387d73b10e42a29ab75a5b99647d65 [formerly 750862b17d]]
Former-commit-id: a6a9cedfc2f7507080b39c665d97e8b586a746de [formerly ceeb7a7fc060245d21d169eb22b6b099fc4c384d]
Former-commit-id: 5dcf4b4c5a1caf3b482baf7f0f8aecb1b69a9263
2017-09-07 18:28:22 +01:00
77 changed files with 3126 additions and 2887 deletions

No files matched your search

+13 -13
View File
@@ -1,13 +1,13 @@
{ {
"presets": [ "presets": [
["env", { "modules": false }], ["env", { "modules": false }],
"stage-2" "stage-2"
], ],
"plugins": ["transform-runtime"], "plugins": ["transform-runtime"],
"env": { "env": {
"test": { "test": {
"presets": ["env", "stage-2"], "presets": ["env", "stage-2"],
"plugins": [ "istanbul" ] "plugins": [ "istanbul" ]
} }
} }
} }
+4 -4
View File
@@ -1,4 +1,4 @@
assets/ assets/
testdata/ testdata/
caddy/ caddy/
.github/ .github/
+13 -13
View File
@@ -1,14 +1,14 @@
root = true root = true
[*] [*]
charset = utf-8 charset = utf-8
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
# 4 space indentation # 4 space indentation
[*.go] [*.go]
indent_style = tab indent_style = tab
indent_size = 4 indent_size = 4
+2 -2
View File
@@ -1,2 +1,2 @@
build/*.js build/*.js
config/*.js config/*.js
+27 -27
View File
@@ -1,27 +1,27 @@
// http://eslint.org/docs/user-guide/configuring // http://eslint.org/docs/user-guide/configuring
module.exports = { module.exports = {
root: true, root: true,
parser: 'babel-eslint', parser: 'babel-eslint',
parserOptions: { parserOptions: {
sourceType: 'module' sourceType: 'module'
}, },
env: { env: {
browser: true, browser: true,
}, },
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard', extends: 'standard',
// required to lint *.vue files // required to lint *.vue files
plugins: [ plugins: [
'html' 'html'
], ],
// add your custom rules here // add your custom rules here
'rules': { 'rules': {
// allow paren-less arrow functions // allow paren-less arrow functions
'arrow-parens': 0, 'arrow-parens': 0,
// allow async-await // allow async-await
'generator-star-spacing': 0, 'generator-star-spacing': 0,
// allow debugger during development // allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
} }
} }
+24 -24
View File
@@ -1,24 +1,24 @@
### Instructions (remove before submitting): ### Instructions (remove before submitting):
1. Are you asking for help with using Caddy or File Manager? Please use our forum instead: https://forum.caddyserver.com. 1. Are you asking for help with using Caddy or File Manager? Please use our forum instead: https://forum.caddyserver.com.
2. If you are filing a bug report, please answer the following questions. 2. If you are filing a bug report, please answer the following questions.
3. If your issue is not a bug report, you do not need to use this template. 3. If your issue is not a bug report, you do not need to use this template.
4. If not using with Caddy, ignore questions 1 and 2. 4. If not using with Caddy, ignore questions 1 and 2.
### 1. Have you downloaded File Manager from caddyserver.com? If yes, when have you done that? If no, and you are running a custom build, which is the revision of File Manager's repository? ### 1. Have you downloaded File Manager from caddyserver.com? If yes, when have you done that? If no, and you are running a custom build, which is the revision of File Manager's repository?
### 2. What is your entire Caddyfile? ### 2. What is your entire Caddyfile?
```text ```text
(Put Caddyfile here) (Put Caddyfile here)
``` ```
### 3. What are you trying to do? ### 3. What are you trying to do?
### 4. What did you expect to see? ### 4. What did you expect to see?
### 5. What did you see instead (give full error messages and/or log)? ### 5. What did you see instead (give full error messages and/or log)?
### 6. How can someone who is starting from scratch reproduce this behaviour as minimally as possible? ### 6. How can someone who is starting from scratch reproduce this behaviour as minimally as possible?
+2
View File
@@ -6,3 +6,5 @@ node_modules/
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
.idea
.vscode
+29 -29
View File
@@ -1,29 +1,29 @@
build: build:
main: cmd/filemanager/main.go main: cmd/filemanager/main.go
binary: filemanager binary: filemanager
goos: goos:
- darwin - darwin
- linux - linux
- windows - windows
- freebsd - freebsd
- netbsd - netbsd
- openbsd - openbsd
goarch: goarch:
- amd64 - amd64
- 386 - 386
- arm - arm
- arm64 - arm64
ignore: ignore:
- goos: openbsd - goos: openbsd
goarch: arm goarch: arm
goarm: 6 goarm: 6
- goos: freebsd - goos: freebsd
goarch: arm goarch: arm
goarm: 6 goarm: 6
archive: archive:
name_template: "{{.Os}}-{{.Arch}}-{{ .ProjectName }}" name_template: "{{.Os}}-{{.Arch}}-{{ .ProjectName }}"
format: tar.gz format: tar.gz
format_overrides: format_overrides:
- goos: windows - goos: windows
format: zip format: zip
+1 -1
View File
@@ -15,7 +15,7 @@ install:
- go get github.com/tsenart/deadcode - go get github.com/tsenart/deadcode
script: script:
- gometalinter --disable-all -E vet -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --exclude="rice-box.go" --tests ./... - gometalinter --disable-all -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --exclude="rice-box.go" --tests ./...
- go test ./... -timeout 30s - go test ./... -timeout 30s
after_success: after_success:
+46 -46
View File
@@ -1,46 +1,46 @@
# Contributor Covenant Code of Conduct # Contributor Covenant Code of Conduct
## Our Pledge ## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards ## Our Standards
Examples of behavior that contributes to creating a positive environment include: Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language * Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences * Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism * Gracefully accepting constructive criticism
* Focusing on what is best for the community * Focusing on what is best for the community
* Showing empathy towards other community members * Showing empathy towards other community members
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances * The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks * Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment * Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission * Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting * Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities ## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope ## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement ## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hacdias@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hacdias@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution ## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org [homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/ [version]: http://contributor-covenant.org/version/1/4/
+14 -14
View File
@@ -1,14 +1,14 @@
# Contributing # Contributing
If you want to contribute or want to build the code from source, you will need to have the most recent version of Go and, if you want to change the static assets (JS, CSS, ...), Node.js installed on your computer. To start developing, you just need to do the following: If you want to contribute or want to build the code from source, you will need to have the most recent version of Go and, if you want to change the static assets (JS, CSS, ...), Node.js installed on your computer. To start developing, you just need to do the following:
1. `go get github.com/hacdias/filemanager` 1. `go get github.com/hacdias/filemanager`
2. `cd $GOPATH/src/github.com/hacdias/filemanager` 2. `cd $GOPATH/src/github.com/hacdias/filemanager`
3. `npm install` 3. `npm install`
4. `npm run dev` - regenerates the static assets automatically 4. `npm run dev` - regenerates the static assets automatically
5. `go install github.com/hacdias/filemanager/cmd/filemanager` 5. `go install github.com/hacdias/filemanager/cmd/filemanager`
6. Execute `$GOPATH/bin/filemanager` 6. Execute `$GOPATH/bin/filemanager`
The steps 3 and 4 are only required **if you want to develop the front-end**. Otherwise, you can ignore them. Before pulling, if you made any change on assets folder, you must run the `build.sh` script on the root of this repository. The steps 3 and 4 are only required **if you want to develop the front-end**. Otherwise, you can ignore them. Before pulling, if you made any change on assets folder, you must run the `build.sh` script on the root of this repository.
If you are using this as a Caddy plugin, you should use its [official instructions for plugins](https://github.com/mholt/caddy/wiki/Extending-Caddy#2-plug-in-your-plugin) and import `github.com/hacdias/filemanager/caddy/filemanager`. If you are using this as a Caddy plugin, you should use its [official instructions for plugins](https://github.com/mholt/caddy/wiki/Extending-Caddy#2-plug-in-your-plugin) and import `github.com/hacdias/filemanager/caddy/filemanager`.
+22 -22
View File
@@ -1,22 +1,22 @@
FROM golang:alpine FROM golang:alpine
COPY . /go/src/github.com/hacdias/filemanager COPY . /go/src/github.com/hacdias/filemanager
WORKDIR /go/src/github.com/hacdias/filemanager WORKDIR /go/src/github.com/hacdias/filemanager
RUN apk add --no-cache git RUN apk add --no-cache git
RUN go get ./... RUN go get ./...
WORKDIR /go/src/github.com/hacdias/filemanager/cmd/filemanager WORKDIR /go/src/github.com/hacdias/filemanager/cmd/filemanager
RUN CGO_ENABLED=0 go build -a RUN CGO_ENABLED=0 go build -a
RUN mv filemanager /go/bin/filemanager RUN mv filemanager /go/bin/filemanager
FROM scratch FROM scratch
COPY --from=0 /go/bin/filemanager /filemanager COPY --from=0 /go/bin/filemanager /filemanager
VOLUME /srv VOLUME /srv
EXPOSE 80 EXPOSE 80
COPY Docker.json /config.json COPY Docker.json /config.json
ENTRYPOINT ["/filemanager"] ENTRYPOINT ["/filemanager"]
CMD ["--config", "/config.json"] CMD ["--config", "/config.json"]
+201 -201
View File
@@ -1,201 +1,201 @@
Apache License Apache License
Version 2.0, January 2004 Version 2.0, January 2004
http://www.apache.org/licenses/ http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions. 1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, "License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document. and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by "Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License. the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all "Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition, control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the "control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity. outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity "You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License. exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, "Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation including but not limited to software source code, documentation
source, and configuration files. source, and configuration files.
"Object" form shall mean any form resulting from mechanical "Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation, not limited to compiled object code, generated documentation,
and conversions to other media types. and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or "Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work copyright notice that is included in or attached to the work
(an example is provided in the Appendix below). (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object "Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of, separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof. the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including "Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted" the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution." designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity "Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work. subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of 2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual, this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of, copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form. Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of 3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual, this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made, (except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work, use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s) Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate granted to You under this License for that Work shall terminate
as of the date such litigation is filed. as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the 4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You modifications, and in Source or Object form, provided that You
meet the following conditions: meet the following conditions:
(a) You must give any other recipients of the Work or (a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices (b) You must cause any modified files to carry prominent notices
stating that You changed the files; and stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works (c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work, attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of excluding those notices that do not pertain to any part of
the Derivative Works; and the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its (d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or, documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed that such additional attribution notices cannot be construed
as modifying the License. as modifying the License.
You may add Your own copyright statement to Your modifications and You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use, for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License. the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, 5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions. this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions. with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade 6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor, names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file. origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or 7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS, Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License. risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, 8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise, whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill, Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages. has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing 9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer, the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity, and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify, of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability. of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work. APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}" boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright {yyyy} {name of copyright owner} Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
+78 -78
View File
@@ -1,78 +1,78 @@
![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif) ![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif)
# filemanager # filemanager
[![Build](https://img.shields.io/travis/hacdias/filemanager.svg?style=flat-square)](https://travis-ci.org/hacdias/filemanager) [![Build](https://img.shields.io/travis/hacdias/filemanager.svg?style=flat-square)](https://travis-ci.org/hacdias/filemanager)
[![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/filemanager?style=flat-square)](https://goreportcard.com/report/hacdias/filemanager) [![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/filemanager?style=flat-square)](https://goreportcard.com/report/hacdias/filemanager)
[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/hacdias/filemanager) [![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/hacdias/filemanager)
filemanager provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app or as a middleware. filemanager provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app or as a middleware.
# Table of contents # Table of contents
+ [Getting started](#getting-started) + [Getting started](#getting-started)
+ [Features](#features) + [Features](#features)
- [Users](#users) - [Users](#users)
- [Search](#search) - [Search](#search)
+ [Contributing](#contributing) + [Contributing](#contributing)
+ [Donate](#donate) + [Donate](#donate)
# Getting started # Getting started
You can find the Getting Started guide on the [documentation](https://henriquedias.com/filemanager/quick-start/). You can find the Getting Started guide on the [documentation](https://henriquedias.com/filemanager/quick-start/).
# Features # Features
Easy login system. Easy login system.
![Login Page](https://user-images.githubusercontent.com/5447088/28432382-975493dc-6d7f-11e7-9190-23f8037159dc.jpg) ![Login Page](https://user-images.githubusercontent.com/5447088/28432382-975493dc-6d7f-11e7-9190-23f8037159dc.jpg)
Listings of your files, available in two styles: mosaic and list. You can delete, move, rename, upload and create new files, as well as directories. Single files can be downloaded directly, and multiple files as *.zip*, *.tar*, *.tar.gz*, *.tar.bz2* or *.tar.xz*. Listings of your files, available in two styles: mosaic and list. You can delete, move, rename, upload and create new files, as well as directories. Single files can be downloaded directly, and multiple files as *.zip*, *.tar*, *.tar.gz*, *.tar.bz2* or *.tar.xz*.
![Mosaic Listing](https://user-images.githubusercontent.com/5447088/28432384-9771bb4c-6d7f-11e7-8564-3a9bd6a3ce3a.jpg) ![Mosaic Listing](https://user-images.githubusercontent.com/5447088/28432384-9771bb4c-6d7f-11e7-8564-3a9bd6a3ce3a.jpg)
File Manager editor is powered by [Codemirror](https://codemirror.net/) and if you're working with markdown files with metadata, both parts will be separated from each other so you can focus on the content. File Manager editor is powered by [Codemirror](https://codemirror.net/) and if you're working with markdown files with metadata, both parts will be separated from each other so you can focus on the content.
![Markdown Editor](https://user-images.githubusercontent.com/5447088/28432383-9756fdac-6d7f-11e7-8e58-fec49470d15f.jpg) ![Markdown Editor](https://user-images.githubusercontent.com/5447088/28432383-9756fdac-6d7f-11e7-8e58-fec49470d15f.jpg)
On the settings page, a regular user can set its own custom CSS to personalize the experience and change its password. For admins, they can manage the permissions of each user, set commands which can be executed when certain events are triggered (such as before saving and after saving) and change plugin's settings. On the settings page, a regular user can set its own custom CSS to personalize the experience and change its password. For admins, they can manage the permissions of each user, set commands which can be executed when certain events are triggered (such as before saving and after saving) and change plugin's settings.
![Settings](https://user-images.githubusercontent.com/5447088/28432385-9776ec66-6d7f-11e7-90a5-891bacd4d02f.jpg) ![Settings](https://user-images.githubusercontent.com/5447088/28432385-9776ec66-6d7f-11e7-90a5-891bacd4d02f.jpg)
We also allow the users to search in the directories and execute commands if allowed. We also allow the users to search in the directories and execute commands if allowed.
## Users ## Users
We support multiple users and each user can have its own scope and custom stylesheet. The administrator is able to choose which permissions should be given to the users, as well as the commands they can execute. Each user also have a set of rules, in which he can be prevented or allowed to access some directories (regular expressions included!). We support multiple users and each user can have its own scope and custom stylesheet. The administrator is able to choose which permissions should be given to the users, as well as the commands they can execute. Each user also have a set of rules, in which he can be prevented or allowed to access some directories (regular expressions included!).
![Users](https://user-images.githubusercontent.com/5447088/28432386-977f388a-6d7f-11e7-9006-87d16f05f1f8.jpg) ![Users](https://user-images.githubusercontent.com/5447088/28432386-977f388a-6d7f-11e7-9006-87d16f05f1f8.jpg)
## Search ## Search
FileManager allows you to search through your files and it has some options. By default, your search will be something like this: FileManager allows you to search through your files and it has some options. By default, your search will be something like this:
``` ```
this are keywords this are keywords
``` ```
If you search for that it will look at every file that contains "this", "are" or "keywords" on their name. If you want to search for an exact term, you should surround your search by double quotes: If you search for that it will look at every file that contains "this", "are" or "keywords" on their name. If you want to search for an exact term, you should surround your search by double quotes:
``` ```
"this is the name" "this is the name"
``` ```
That will search for any file that contains "this is the name" on its name. It won't search for each separated term this time. That will search for any file that contains "this is the name" on its name. It won't search for each separated term this time.
By default, every search will be case sensitive. Although, you can make a case insensitive search by adding `case:insensitive` to the search terms, like this: By default, every search will be case sensitive. Although, you can make a case insensitive search by adding `case:insensitive` to the search terms, like this:
``` ```
this are keywords case:insensitive this are keywords case:insensitive
``` ```
# Contributing # Contributing
The contributing guidelines can be found [here](https://github.com/hacdias/filemanager/blob/master/CONTRIBUTING.md). The contributing guidelines can be found [here](https://github.com/hacdias/filemanager/blob/master/CONTRIBUTING.md).
# Donate # Donate
Enjoying this project? You can [donate to its creator](https://henriquedias.com/donate/). He will appreciate. Enjoying this project? You can [donate to its creator](https://henriquedias.com/donate/). He will appreciate.
+31 -31
View File
@@ -1,31 +1,31 @@
require('./check-versions')() require('./check-versions')()
process.env.NODE_ENV = 'production' process.env.NODE_ENV = 'production'
var ora = require('ora') var ora = require('ora')
var rm = require('rimraf') var rm = require('rimraf')
var path = require('path') var path = require('path')
var chalk = require('chalk') var chalk = require('chalk')
var webpack = require('webpack') var webpack = require('webpack')
var config = require('./config') var config = require('./config')
var webpackConfig = require('./webpack.prod.conf') var webpackConfig = require('./webpack.prod.conf')
var spinner = ora('building for production...') var spinner = ora('building for production...')
spinner.start() spinner.start()
rm(path.join(config.assetsRoot, config.assetsSubDirectory), err => { rm(path.join(config.assetsRoot, config.assetsSubDirectory), err => {
if (err) throw err if (err) throw err
webpack(webpackConfig, function (err, stats) { webpack(webpackConfig, function (err, stats) {
spinner.stop() spinner.stop()
if (err) throw err if (err) throw err
process.stdout.write(stats.toString({ process.stdout.write(stats.toString({
colors: true, colors: true,
modules: false, modules: false,
children: false, children: false,
chunks: false, chunks: false,
chunkModules: false chunkModules: false
}) + '\n\n') }) + '\n\n')
console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.cyan(' Build complete.\n'))
}) })
}) })
+48 -48
View File
@@ -1,48 +1,48 @@
var chalk = require('chalk') var chalk = require('chalk')
var semver = require('semver') var semver = require('semver')
var packageConfig = require('../../package.json') var packageConfig = require('../../package.json')
var shell = require('shelljs') var shell = require('shelljs')
function exec (cmd) { function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim() return require('child_process').execSync(cmd).toString().trim()
} }
var versionRequirements = [ var versionRequirements = [
{ {
name: 'node', name: 'node',
currentVersion: semver.clean(process.version), currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node versionRequirement: packageConfig.engines.node
} }
] ]
if (shell.which('npm')) { if (shell.which('npm')) {
versionRequirements.push({ versionRequirements.push({
name: 'npm', name: 'npm',
currentVersion: exec('npm --version'), currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm versionRequirement: packageConfig.engines.npm
}) })
} }
module.exports = function () { module.exports = function () {
var warnings = [] var warnings = []
for (var i = 0; i < versionRequirements.length; i++) { for (var i = 0; i < versionRequirements.length; i++) {
var mod = versionRequirements[i] var mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' + warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' + chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement) chalk.green(mod.versionRequirement)
) )
} }
} }
if (warnings.length) { if (warnings.length) {
console.log('') console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:')) console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log() console.log()
for (var i = 0; i < warnings.length; i++) { for (var i = 0; i < warnings.length; i++) {
var warning = warnings[i] var warning = warnings[i]
console.log(' ' + warning) console.log(' ' + warning)
} }
console.log() console.log()
process.exit(1) process.exit(1)
} }
} }
+26 -26
View File
@@ -1,26 +1,26 @@
// see http://vuejs-templates.github.io/webpack for documentation. // see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path') var path = require('path')
module.exports = { module.exports = {
index: path.resolve(__dirname, '../dist/index.html'), index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'), assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '{{ .BaseURL }}/', assetsPublicPath: '{{ .BaseURL }}/',
build: { build: {
env: { env: {
NODE_ENV: '"production"' NODE_ENV: '"production"'
}, },
productionSourceMap: true, productionSourceMap: true,
// Run the build command with an extra argument to // Run the build command with an extra argument to
// View the bundle analyzer report after build finishes: // View the bundle analyzer report after build finishes:
// `npm run build --report` // `npm run build --report`
// Set to `true` or `false` to always turn it on or off // Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report bundleAnalyzerReport: process.env.npm_config_report
}, },
dev: { dev: {
env: { env: {
NODE_ENV: '"development"' NODE_ENV: '"development"'
}, },
produceSourceMap: true produceSourceMap: true
} }
} }
+16 -16
View File
@@ -1,17 +1,17 @@
// This service worker file is effectively a 'no-op' that will reset any // This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination. // previous service worker registered for the same host:port combination.
// In the production build, this file is replaced with an actual service worker // In the production build, this file is replaced with an actual service worker
// file that will precache your site's local assets. // file that will precache your site's local assets.
// See https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432 // See https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
self.addEventListener('install', () => self.skipWaiting()); self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', () => { self.addEventListener('activate', () => {
self.clients.matchAll({ type: 'window' }).then(windowClients => { self.clients.matchAll({ type: 'window' }).then(windowClients => {
for (let windowClient of windowClients) { for (let windowClient of windowClients) {
// Force open pages to refresh, so that they have a chance to load the // Force open pages to refresh, so that they have a chance to load the
// fresh navigation response from the local dev server. // fresh navigation response from the local dev server.
windowClient.navigate(windowClient.url); windowClient.navigate(windowClient.url);
} }
}); });
}); });
+55 -55
View File
@@ -1,55 +1,55 @@
(function() { (function() {
'use strict'; 'use strict';
// Check to make sure service workers are supported in the current browser, // Check to make sure service workers are supported in the current browser,
// and that the current page is accessed from a secure origin. Using a // and that the current page is accessed from a secure origin. Using a
// service worker from an insecure origin will trigger JS console errors. // service worker from an insecure origin will trigger JS console errors.
const isLocalhost = Boolean(window.location.hostname === 'localhost' || const isLocalhost = Boolean(window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' || window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
) )
); );
window.addEventListener('load', function() { window.addEventListener('load', function() {
if ('serviceWorker' in navigator && if ('serviceWorker' in navigator &&
(window.location.protocol === 'https:' || isLocalhost)) { (window.location.protocol === 'https:' || isLocalhost)) {
navigator.serviceWorker.register('{{ .BaseURL }}/sw.js') navigator.serviceWorker.register('{{ .BaseURL }}/sw.js')
.then(function(registration) { .then(function(registration) {
// updatefound is fired if service-worker.js changes. // updatefound is fired if service-worker.js changes.
registration.onupdatefound = function() { registration.onupdatefound = function() {
// updatefound is also fired the very first time the SW is installed, // updatefound is also fired the very first time the SW is installed,
// and there's no need to prompt for a reload at that point. // and there's no need to prompt for a reload at that point.
// So check here to see if the page is already controlled, // So check here to see if the page is already controlled,
// i.e. whether there's an existing service worker. // i.e. whether there's an existing service worker.
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// The updatefound event implies that registration.installing is set // The updatefound event implies that registration.installing is set
const installingWorker = registration.installing; const installingWorker = registration.installing;
installingWorker.onstatechange = function() { installingWorker.onstatechange = function() {
switch (installingWorker.state) { switch (installingWorker.state) {
case 'installed': case 'installed':
// At this point, the old content will have been purged and the // At this point, the old content will have been purged and the
// fresh content will have been added to the cache. // fresh content will have been added to the cache.
// It's the perfect time to display a "New content is // It's the perfect time to display a "New content is
// available; please refresh." message in the page's interface. // available; please refresh." message in the page's interface.
break; break;
case 'redundant': case 'redundant':
throw new Error('The installing ' + throw new Error('The installing ' +
'service worker became redundant.'); 'service worker became redundant.');
default: default:
// Ignore // Ignore
} }
}; };
} }
}; };
}).catch(function(e) { }).catch(function(e) {
console.error('Error during service worker registration:', e); console.error('Error during service worker registration:', e);
}); });
} }
}); });
})(); })();
+70 -70
View File
@@ -1,70 +1,70 @@
var path = require('path') var path = require('path')
var config = require('./config') var config = require('./config')
var ExtractTextPlugin = require('extract-text-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin')
exports.assetsPath = function (_path) { exports.assetsPath = function (_path) {
var assetsSubDirectory = config.assetsSubDirectory var assetsSubDirectory = config.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path) return path.posix.join(assetsSubDirectory, _path)
} }
exports.cssLoaders = function (options) { exports.cssLoaders = function (options) {
options = options || {} options = options || {}
var cssLoader = { var cssLoader = {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
minimize: process.env.NODE_ENV === 'production', minimize: process.env.NODE_ENV === 'production',
sourceMap: options.sourceMap sourceMap: options.sourceMap
} }
} }
// generate loader string to be used with extract text plugin // generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) { function generateLoaders (loader, loaderOptions) {
var loaders = [cssLoader] var loaders = [cssLoader]
if (loader) { if (loader) {
loaders.push({ loaders.push({
loader: loader + '-loader', loader: loader + '-loader',
options: Object.assign({}, loaderOptions, { options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap sourceMap: options.sourceMap
}) })
}) })
} }
// Extract CSS when that option is specified // Extract CSS when that option is specified
// (which is the case during production build) // (which is the case during production build)
if (options.extract) { if (options.extract) {
return ExtractTextPlugin.extract({ return ExtractTextPlugin.extract({
use: loaders, use: loaders,
fallback: 'vue-style-loader' fallback: 'vue-style-loader'
}) })
} else { } else {
return ['vue-style-loader'].concat(loaders) return ['vue-style-loader'].concat(loaders)
} }
} }
// https://vue-loader.vuejs.org/en/configurations/extract-css.html // https://vue-loader.vuejs.org/en/configurations/extract-css.html
return { return {
css: generateLoaders(), css: generateLoaders(),
postcss: generateLoaders(), postcss: generateLoaders(),
less: generateLoaders('less'), less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }), sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'), scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'), stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus') styl: generateLoaders('stylus')
} }
} }
// Generate loaders for standalone style files (outside of .vue) // Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) { exports.styleLoaders = function (options) {
var output = [] var output = []
var loaders = exports.cssLoaders(options) var loaders = exports.cssLoaders(options)
for (var extension in loaders) { for (var extension in loaders) {
var loader = loaders[extension] var loader = loaders[extension]
output.push({ output.push({
test: new RegExp('\\.' + extension + '$'), test: new RegExp('\\.' + extension + '$'),
use: loader use: loader
}) })
} }
return output return output
} }
+12 -12
View File
@@ -1,12 +1,12 @@
var utils = require('./utils') var utils = require('./utils')
var config = require('./config') var config = require('./config')
var isProduction = process.env.NODE_ENV === 'production' var isProduction = process.env.NODE_ENV === 'production'
module.exports = { module.exports = {
loaders: utils.cssLoaders({ loaders: utils.cssLoaders({
sourceMap: isProduction sourceMap: isProduction
? config.build.productionSourceMap ? config.build.productionSourceMap
: config.dev.produceSourceMap, : config.dev.produceSourceMap,
extract: isProduction extract: isProduction
}) })
} }
+69 -69
View File
@@ -1,69 +1,69 @@
var path = require('path') var path = require('path')
var utils = require('./utils') var utils = require('./utils')
var config = require('./config') var config = require('./config')
var vueLoaderConfig = require('./vue-loader.conf') var vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) { function resolve (dir) {
return path.join(__dirname, '..', dir) return path.join(__dirname, '..', dir)
} }
module.exports = { module.exports = {
entry: { entry: {
app: './assets/src/main.js' app: './assets/src/main.js'
}, },
output: { output: {
path: config.assetsRoot, path: config.assetsRoot,
filename: '[name].js', filename: '[name].js',
publicPath: config.assetsPublicPath publicPath: config.assetsPublicPath
}, },
resolve: { resolve: {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],
alias: { alias: {
'vue$': 'vue/dist/vue.esm.js', 'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src') '@': resolve('src')
} }
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.(yml|yaml)$/, test: /\.(yml|yaml)$/,
loader: 'yml-loader' loader: 'yml-loader'
}, },
{ {
test: /\.(js|vue)$/, test: /\.(js|vue)$/,
loader: 'eslint-loader', loader: 'eslint-loader',
enforce: 'pre', enforce: 'pre',
include: [resolve('src'), resolve('test')], include: [resolve('src'), resolve('test')],
options: { options: {
formatter: require('eslint-friendly-formatter') formatter: require('eslint-friendly-formatter')
} }
}, },
{ {
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader', loader: 'vue-loader',
options: vueLoaderConfig options: vueLoaderConfig
}, },
{ {
test: /\.js$/, test: /\.js$/,
loader: 'babel-loader', loader: 'babel-loader',
include: [resolve('src'), resolve('test')] include: [resolve('src'), resolve('test')]
}, },
{ {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader', loader: 'url-loader',
options: { options: {
limit: 10000, limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]') name: utils.assetsPath('img/[name].[hash:7].[ext]')
} }
}, },
{ {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader', loader: 'url-loader',
options: { options: {
// limit: 10000, // limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]') name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
} }
} }
] ]
} }
} }
+81 -81
View File
@@ -1,81 +1,81 @@
var fs = require('fs') var fs = require('fs')
var path = require('path') var path = require('path')
var utils = require('./utils') var utils = require('./utils')
var webpack = require('webpack') var webpack = require('webpack')
var config = require('./config') var config = require('./config')
var merge = require('webpack-merge') var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf') var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
var CopyWebpackPlugin = require('copy-webpack-plugin') var CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = merge(baseWebpackConfig, { module.exports = merge(baseWebpackConfig, {
watch: true, watch: true,
module: { module: {
rules: utils.styleLoaders({ rules: utils.styleLoaders({
sourceMap: config.dev.produceSourceMap, sourceMap: config.dev.produceSourceMap,
extract: true extract: true
}) })
}, },
devtool: '#cheap-module-eval-source-map', devtool: '#cheap-module-eval-source-map',
output: { output: {
path: config.assetsRoot, path: config.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'), filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
}, },
plugins: [ plugins: [
new webpack.NoEmitOnErrorsPlugin(), new webpack.NoEmitOnErrorsPlugin(),
new FriendlyErrorsPlugin(), new FriendlyErrorsPlugin(),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': config.dev.env 'process.env': config.dev.env
}), }),
// extract css into its own file // extract css into its own file
new ExtractTextPlugin({ new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css') filename: utils.assetsPath('css/[name].[contenthash].css')
}), }),
// generate dist index.html with correct asset hash for caching. // generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html // you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin // see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: config.index, filename: config.index,
template: 'assets/index.html', template: 'assets/index.html',
inject: true, inject: true,
// necessary to consistently work with multiple chunks via CommonsChunkPlugin // necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency', chunksSortMode: 'dependency',
serviceWorkerLoader: `<script>${fs.readFileSync(path.join(__dirname, serviceWorkerLoader: `<script>${fs.readFileSync(path.join(__dirname,
'./service-worker-dev.js'), 'utf-8')}</script>` './service-worker-dev.js'), 'utf-8')}</script>`
}), }),
// split vendor js into its own file // split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'vendor', name: 'vendor',
minChunks: function (module, count) { minChunks: function (module, count) {
// any required modules inside node_modules are extracted to vendor // any required modules inside node_modules are extracted to vendor
return ( return (
module.resource && module.resource &&
/\.js$/.test(module.resource) && /\.js$/.test(module.resource) &&
module.resource.indexOf( module.resource.indexOf(
path.join(__dirname, '../../node_modules') path.join(__dirname, '../../node_modules')
) === 0 ) === 0
) )
} }
}), }),
// extract webpack runtime and module manifest to its own file in order to // extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated // prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'manifest', name: 'manifest',
chunks: ['vendor'] chunks: ['vendor']
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
from: path.resolve(__dirname, '../static'), from: path.resolve(__dirname, '../static'),
to: config.assetsSubDirectory, to: config.assetsSubDirectory,
ignore: ['.*'] ignore: ['.*']
}, },
{ {
from: path.resolve(__dirname, '../../node_modules/codemirror/mode/*/*'), from: path.resolve(__dirname, '../../node_modules/codemirror/mode/*/*'),
to: path.join(config.assetsSubDirectory, 'js/codemirror/mode/[name]/[name].js') to: path.join(config.assetsSubDirectory, 'js/codemirror/mode/[name]/[name].js')
} }
]) ])
] ]
}) })
+5
View File
@@ -8,6 +8,7 @@
<meta name="staticgen" content="{{ .StaticGen }}"> <meta name="staticgen" content="{{ .StaticGen }}">
<meta name="noauth" content="{{ .NoAuth }}"> <meta name="noauth" content="{{ .NoAuth }}">
<meta name="version" content="{{ .Version }}"> <meta name="version" content="{{ .Version }}">
<meta name="recaptcha" content="{{ .ReCaptchaKey }}">
<title>File Manager</title> <title>File Manager</title>
<link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png">
@@ -27,6 +28,10 @@
<script>CSS = "{{ .CSS }}"</script> <script>CSS = "{{ .CSS }}"</script>
{{ if .ReCaptcha -}}
<script src='https://www.google.com/recaptcha/api.js?render=explicit'></script>
{{ end }}
<% for (var chunk of webpack.chunks) { <% for (var chunk of webpack.chunks) {
for (var file of chunk.files) { for (var file of chunk.files) {
if (file.match(/\.(js|css)$/)) { %> if (file.match(/\.(js|css)$/)) { %>
+34 -8
View File
@@ -1,22 +1,48 @@
<template> <template>
<router-view @update:css="updateCSS" @clean:css="cleanCSS"></router-view> <router-view :dependencies="loaded" @update:css="updateCSS" @clean:css="cleanCSS"></router-view>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'app', name: 'app',
computed: mapState(['recaptcha']),
data () {
return {
loaded: false
}
},
mounted () { mounted () {
// Remove loading animation. if (this.recaptcha.length === 0) {
let loading = document.getElementById('loading') this.unload()
loading.classList.add('done') return
}
setTimeout(function () { let check = () => {
loading.parentNode.removeChild(loading) if (typeof window.grecaptcha === 'undefined') {
}, 200) setTimeout(check, 100)
return
}
this.updateCSS() this.unload()
}
check()
}, },
methods: { methods: {
unload () {
this.loaded = true
// Remove loading animation.
let loading = document.getElementById('loading')
loading.classList.add('done')
setTimeout(function () {
loading.parentNode.removeChild(loading)
}, 200)
this.updateCSS()
},
updateCSS (global = false) { updateCSS (global = false) {
let css = this.$store.state.css let css = this.$store.state.css
+4 -4
View File
@@ -1,5 +1,5 @@
<svg id="content" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144"> <svg id="content" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144">
<circle cx="72" cy="72" r="72" fill="#2979ff"/> <circle cx="72" cy="72" r="72" fill="#2979ff"/>
<circle cx="72" cy="72" r="48" fill="#40c4ff"/> <circle cx="72" cy="72" r="48" fill="#40c4ff"/>
<circle cx="72" cy="72" r="24" fill="#fff"/> <circle cx="72" cy="72" r="24" fill="#fff"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 239 B

+22 -22
View File
@@ -1,22 +1,22 @@
<template> <template>
<select v-on:change="change" :value="selected"> <select v-on:change="change" :value="selected">
<option value="en">{{ $t('languages.en') }}</option> <option value="en">{{ $t('languages.en') }}</option>
<option value="fr">{{ $t('languages.fr') }}</option> <option value="fr">{{ $t('languages.fr') }}</option>
<option value="pt">{{ $t('languages.pt') }}</option> <option value="pt">{{ $t('languages.pt') }}</option>
<option value="ja">{{ $t('languages.ja') }}</option> <option value="ja">{{ $t('languages.ja') }}</option>
<option value="zh-cn">{{ $t('languages.zhCN') }}</option> <option value="zh-cn">{{ $t('languages.zhCN') }}</option>
<option value="zh-tw">{{ $t('languages.zhTW') }}</option> <option value="zh-tw">{{ $t('languages.zhTW') }}</option>
</select> </select>
</template> </template>
<script> <script>
export default { export default {
name: 'languages', name: 'languages',
props: [ 'selected' ], props: [ 'selected' ],
methods: { methods: {
change (event) { change (event) {
this.$emit('update:selected', event.target.value) this.$emit('update:selected', event.target.value)
} }
} }
} }
</script> </script>
+265 -265
View File
@@ -1,265 +1,265 @@
<template> <template>
<div id="search" @click="open" v-bind:class="{ active , ongoing }"> <div id="search" @click="open" v-bind:class="{ active , ongoing }">
<div id="input"> <div id="input">
<button v-if="active" class="action" @click="close" :aria-label="$t('buttons.close')" :title="$t('buttons.close')"> <button v-if="active" class="action" @click="close" :aria-label="$t('buttons.close')" :title="$t('buttons.close')">
<i class="material-icons">arrow_back</i> <i class="material-icons">arrow_back</i>
</button> </button>
<i v-else class="material-icons">search</i> <i v-else class="material-icons">search</i>
<input type="text" <input type="text"
@keyup="keyup" @keyup="keyup"
@keyup.enter="submit" @keyup.enter="submit"
ref="input" ref="input"
:autofocus="active" :autofocus="active"
v-model.trim="value" v-model.trim="value"
:aria-label="$t('search.writeToSearch')" :aria-label="$t('search.writeToSearch')"
:placeholder="placeholder"> :placeholder="placeholder">
</div> </div>
<div id="result"> <div id="result">
<div> <div>
<template v-if="search.length === 0 && commands.length === 0"> <template v-if="search.length === 0 && commands.length === 0">
<p>{{ text }}</p> <p>{{ text }}</p>
<template v-if="value.length === 0"> <template v-if="value.length === 0">
<div class="boxes"> <div class="boxes">
<h3>{{ $t('search.types') }}</h3> <h3>{{ $t('search.types') }}</h3>
<div> <div>
<div tabindex="0" <div tabindex="0"
role="button" role="button"
@click="init('type:image')" @click="init('type:image')"
:aria-label="$t('search.images')"> :aria-label="$t('search.images')">
<i class="material-icons">insert_photo</i> <i class="material-icons">insert_photo</i>
<p>{{ $t('search.images') }}</p> <p>{{ $t('search.images') }}</p>
</div> </div>
<div tabindex="0" <div tabindex="0"
role="button" role="button"
@click="init('type:audio')" @click="init('type:audio')"
:aria-label="$t('search.music')"> :aria-label="$t('search.music')">
<i class="material-icons">volume_up</i> <i class="material-icons">volume_up</i>
<p>{{ $t('search.music') }}</p> <p>{{ $t('search.music') }}</p>
</div> </div>
<div tabindex="0" <div tabindex="0"
role="button" role="button"
@click="init('type:video')" @click="init('type:video')"
:aria-label="$t('search.video')"> :aria-label="$t('search.video')">
<i class="material-icons">movie</i> <i class="material-icons">movie</i>
<p>{{ $t('search.video') }}</p> <p>{{ $t('search.video') }}</p>
</div> </div>
<div tabindex="0" <div tabindex="0"
role="button" role="button"
@click="init('type:pdf')" @click="init('type:pdf')"
:aria-label="$t('search.pdf')"> :aria-label="$t('search.pdf')">
<i class="material-icons">picture_as_pdf</i> <i class="material-icons">picture_as_pdf</i>
<p>{{ $t('search.pdf') }}</p> <p>{{ $t('search.pdf') }}</p>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
</template> </template>
<ul v-else-if="search.length > 0"> <ul v-else-if="search.length > 0">
<li v-for="s in search"> <li v-for="s in search">
<router-link @click.native="close" :to="'./' + s.path"> <router-link @click.native="close" :to="'./' + s.path">
<i v-if="s.dir" class="material-icons">folder</i> <i v-if="s.dir" class="material-icons">folder</i>
<i v-else class="material-icons">insert_drive_file</i> <i v-else class="material-icons">insert_drive_file</i>
<span>./{{ s.path }}</span> <span>./{{ s.path }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
<pre v-else-if="commands.length > 0"> <pre v-else-if="commands.length > 0">
<template v-for="c in commands">{{ c }}</template> <template v-for="c in commands">{{ c }}</template>
</pre> </pre>
</div> </div>
<p id="renew"><i class="material-icons spin">autorenew</i></p> <p id="renew"><i class="material-icons spin">autorenew</i></p>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import url from '@/utils/url' import url from '@/utils/url'
import * as api from '@/utils/api' import * as api from '@/utils/api'
export default { export default {
name: 'search', name: 'search',
data: function () { data: function () {
return { return {
value: '', value: '',
active: false, active: false,
ongoing: false, ongoing: false,
scrollable: null, scrollable: null,
search: [], search: [],
commands: [], commands: [],
reload: false reload: false
} }
}, },
watch: { watch: {
show (val, old) { show (val, old) {
this.active = (val === 'search') this.active = (val === 'search')
// If the hover was search and now it's something else // If the hover was search and now it's something else
// we should blur the input. // we should blur the input.
if (old === 'search' && val !== 'search') { if (old === 'search' && val !== 'search') {
if (this.reload) { if (this.reload) {
this.$store.commit('setReload', true) this.$store.commit('setReload', true)
} }
document.body.style.overflow = 'auto' document.body.style.overflow = 'auto'
this.reset() this.reset()
this.$refs.input.blur() this.$refs.input.blur()
} }
// If we are starting to show the search box, we should // If we are starting to show the search box, we should
// focus the input. // focus the input.
if (val === 'search') { if (val === 'search') {
this.reload = false this.reload = false
this.$refs.input.focus() this.$refs.input.focus()
document.body.style.overflow = 'hidden' document.body.style.overflow = 'hidden'
} }
} }
}, },
computed: { computed: {
...mapState(['user', 'show']), ...mapState(['user', 'show']),
// Placeholder value. // Placeholder value.
placeholder: function () { placeholder: function () {
if (this.user.allowCommands && this.user.commands.length > 0) { if (this.user.allowCommands && this.user.commands.length > 0) {
return this.$t('search.searchOrCommand') return this.$t('search.searchOrCommand')
} }
return this.$t('search.search') return this.$t('search.search')
}, },
// The text that is shown on the results' box while // The text that is shown on the results' box while
// there is no search result or command output to show. // there is no search result or command output to show.
text: function () { text: function () {
if (this.ongoing) { if (this.ongoing) {
return '' return ''
} }
if (this.value.length === 0) { if (this.value.length === 0) {
if (this.user.allowCommands && this.user.commands.length > 0) { if (this.user.allowCommands && this.user.commands.length > 0) {
return `${this.$t('search.searchOrSupportedCommand')} ${this.user.commands.join(', ')}.` return `${this.$t('search.searchOrSupportedCommand')} ${this.user.commands.join(', ')}.`
} }
this.$t('search.type') this.$t('search.type')
} }
if (!this.supported() || !this.user.allowCommands) { if (!this.supported() || !this.user.allowCommands) {
return this.$t('search.pressToSearch') return this.$t('search.pressToSearch')
} else { } else {
return this.$t('search.pressToExecute') return this.$t('search.pressToExecute')
} }
} }
}, },
mounted: function () { mounted: function () {
// Gets the result div which will be scrollable. // Gets the result div which will be scrollable.
this.scrollable = document.querySelector('#search #result') this.scrollable = document.querySelector('#search #result')
// Adds the keydown event on window for the ESC key, so // Adds the keydown event on window for the ESC key, so
// when it's pressed, it closes the search window. // when it's pressed, it closes the search window.
window.addEventListener('keydown', (event) => { window.addEventListener('keydown', (event) => {
if (event.keyCode === 27) { if (event.keyCode === 27) {
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
} }
}) })
}, },
methods: { methods: {
// Sets the search to active. // Sets the search to active.
open (event) { open (event) {
this.$store.commit('showHover', 'search') this.$store.commit('showHover', 'search')
}, },
// Closes the search and prevents the event // Closes the search and prevents the event
// of propagating so it doesn't trigger the // of propagating so it doesn't trigger the
// click event on #search. // click event on #search.
close (event) { close (event) {
event.stopPropagation() event.stopPropagation()
event.preventDefault() event.preventDefault()
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
}, },
// Checks if the current input is a supported command. // Checks if the current input is a supported command.
supported () { supported () {
let pieces = this.value.split(' ') let pieces = this.value.split(' ')
for (let i = 0; i < this.user.commands.length; i++) { for (let i = 0; i < this.user.commands.length; i++) {
if (pieces[0] === this.user.commands[i]) { if (pieces[0] === this.user.commands[i]) {
return true return true
} }
} }
return false return false
}, },
// Initializes the search with a default value. // Initializes the search with a default value.
init (string) { init (string) {
this.value = string + ' ' this.value = string + ' '
this.$refs.input.focus() this.$refs.input.focus()
}, },
// Resets the search box value. // Resets the search box value.
reset () { reset () {
this.value = '' this.value = ''
this.active = false this.active = false
this.ongoing = false this.ongoing = false
this.search = [] this.search = []
this.commands = [] this.commands = []
}, },
// When the user presses a key, if it is ESC // When the user presses a key, if it is ESC
// then it will close the search box. Otherwise, // then it will close the search box. Otherwise,
// it will set the search box to active and clean // it will set the search box to active and clean
// the search results, as well as commands'. // the search results, as well as commands'.
keyup (event) { keyup (event) {
if (event.keyCode === 27) { if (event.keyCode === 27) {
this.close(event) this.close(event)
return return
} }
this.search.length = 0 this.search.length = 0
this.commands.length = 0 this.commands.length = 0
}, },
// Submits the input to the server and sets ongoing to true. // Submits the input to the server and sets ongoing to true.
submit (event) { submit (event) {
this.ongoing = true this.ongoing = true
let path = this.$route.path let path = this.$route.path
if (this.$store.state.req.kind !== 'listing') { if (this.$store.state.req.kind !== 'listing') {
path = url.removeLastDir(path) + '/' path = url.removeLastDir(path) + '/'
} }
// In case of being a command. // In case of being a command.
if (this.supported() && this.user.allowCommands) { if (this.supported() && this.user.allowCommands) {
api.command(path, this.value, api.command(path, this.value,
(event) => { (event) => {
this.commands.push(event.data) this.commands.push(event.data)
this.scrollable.scrollTop = this.scrollable.scrollHeight this.scrollable.scrollTop = this.scrollable.scrollHeight
}, },
(event) => { (event) => {
this.reload = true this.reload = true
this.ongoing = false this.ongoing = false
this.scrollable.scrollTop = this.scrollable.scrollHeight this.scrollable.scrollTop = this.scrollable.scrollHeight
} }
) )
return return
} }
// In case of being a search. // In case of being a search.
api.search(path, this.value, api.search(path, this.value,
(event) => { (event) => {
let response = JSON.parse(event.data) let response = JSON.parse(event.data)
if (response.path[0] === '/') { if (response.path[0] === '/') {
response.path = response.path.substring(1) response.path = response.path.substring(1)
} }
this.search.push(response) this.search.push(response)
this.scrollable.scrollTop = this.scrollable.scrollHeight this.scrollable.scrollTop = this.scrollable.scrollHeight
}, },
(event) => { (event) => {
this.ongoing = false this.ongoing = false
this.scrollable.scrollTop = this.scrollable.scrollHeight this.scrollable.scrollTop = this.scrollable.scrollHeight
} }
) )
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button @click="show" :aria-label="$t('buttons.copy')" :title="$t('buttons.copy')" class="action" id="copy-button"> <button @click="show" :aria-label="$t('buttons.copy')" :title="$t('buttons.copy')" class="action" id="copy-button">
<i class="material-icons">content_copy</i> <i class="material-icons">content_copy</i>
<span>{{ $t('buttons.copyFile') }}</span> <span>{{ $t('buttons.copyFile') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'copy-button', name: 'copy-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'copy') this.$store.commit('showHover', 'copy')
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button @click="show" :aria-label="$t('buttons.delete')" :title="$t('buttons.delete')" class="action" id="delete-button"> <button @click="show" :aria-label="$t('buttons.delete')" :title="$t('buttons.delete')" class="action" id="delete-button">
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
<span>{{ $t('buttons.delete') }}</span> <span>{{ $t('buttons.delete') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'delete-button', name: 'delete-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'delete') this.$store.commit('showHover', 'delete')
} }
} }
} }
</script> </script>
+39 -39
View File
@@ -1,39 +1,39 @@
<template> <template>
<button @click="download" :aria-label="$t('buttons.download')" :title="$t('buttons.download')" id="download-button" class="action"> <button @click="download" :aria-label="$t('buttons.download')" :title="$t('buttons.download')" id="download-button" class="action">
<i class="material-icons">file_download</i> <i class="material-icons">file_download</i>
<span>{{ $t('buttons.download') }}</span> <span>{{ $t('buttons.download') }}</span>
<span v-if="selectedCount > 0" class="counter">{{ selectedCount }}</span> <span v-if="selectedCount > 0" class="counter">{{ selectedCount }}</span>
</button> </button>
</template> </template>
<script> <script>
import {mapGetters, mapState} from 'vuex' import {mapGetters, mapState} from 'vuex'
import * as api from '@/utils/api' import * as api from '@/utils/api'
export default { export default {
name: 'download-button', name: 'download-button',
computed: { computed: {
...mapState(['req', 'selected']), ...mapState(['req', 'selected']),
...mapGetters(['selectedCount']) ...mapGetters(['selectedCount'])
}, },
methods: { methods: {
download: function (event) { download: function (event) {
// If we are not on a listing, download the current file. // If we are not on a listing, download the current file.
if (this.req.kind !== 'listing') { if (this.req.kind !== 'listing') {
api.download(null, this.$route.path) api.download(null, this.$route.path)
return return
} }
// If we are on a listing and there is one element selected, // If we are on a listing and there is one element selected,
// download it. // download it.
if (this.selectedCount === 1 && !this.req.items[this.selected[0]].isDir) { if (this.selectedCount === 1 && !this.req.items[this.selected[0]].isDir) {
api.download(null, this.req.items[this.selected[0]].url) api.download(null, this.req.items[this.selected[0]].url)
return return
} }
// Otherwise show the prompt to choose the formt of the download. // Otherwise show the prompt to choose the formt of the download.
this.$store.commit('showHover', 'download') this.$store.commit('showHover', 'download')
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button :title="$t('buttons.info')" :aria-label="$t('buttons.info')" class="action" @click="show"> <button :title="$t('buttons.info')" :aria-label="$t('buttons.info')" class="action" @click="show">
<i class="material-icons">info</i> <i class="material-icons">info</i>
<span>{{ $t('buttons.info') }}</span> <span>{{ $t('buttons.info') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'info-button', name: 'info-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'info') this.$store.commit('showHover', 'info')
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button @click="show" :aria-label="$t('buttons.move')" :title="$t('buttons.move')" class="action" id="move-button"> <button @click="show" :aria-label="$t('buttons.move')" :title="$t('buttons.move')" class="action" id="move-button">
<i class="material-icons">forward</i> <i class="material-icons">forward</i>
<span>{{ $t('buttons.moveFile') }}</span> <span>{{ $t('buttons.moveFile') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'move-button', name: 'move-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'move') this.$store.commit('showHover', 'move')
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button @click="show" :aria-label="$t('buttons.rename')" :title="$t('buttons.rename')" class="action" id="rename-button"> <button @click="show" :aria-label="$t('buttons.rename')" :title="$t('buttons.rename')" class="action" id="rename-button">
<i class="material-icons">mode_edit</i> <i class="material-icons">mode_edit</i>
<span>{{ $t('buttons.rename') }}</span> <span>{{ $t('buttons.rename') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'rename-button', name: 'rename-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'rename') this.$store.commit('showHover', 'rename')
} }
} }
} }
</script> </script>
+21 -21
View File
@@ -1,21 +1,21 @@
<template> <template>
<button @click="show" <button @click="show"
:aria-label="$t('buttons.schedule')" :aria-label="$t('buttons.schedule')"
:title="$t('buttons.schedule')" :title="$t('buttons.schedule')"
id="schedule-button" id="schedule-button"
class="action"> class="action">
<i class="material-icons">alarm</i> <i class="material-icons">alarm</i>
<span>{{ $t('buttons.schedule') }}</span> <span>{{ $t('buttons.schedule') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'schedule-button', name: 'schedule-button',
methods: { methods: {
show: function (event) { show: function (event) {
this.$store.commit('showHover', 'schedule') this.$store.commit('showHover', 'schedule')
} }
} }
} }
</script> </script>
+17 -17
View File
@@ -1,17 +1,17 @@
<template> <template>
<button @click="upload" :aria-label="$t('buttons.upload')" :title="$t('buttons.upload')" class="action" id="upload-button"> <button @click="upload" :aria-label="$t('buttons.upload')" :title="$t('buttons.upload')" class="action" id="upload-button">
<i class="material-icons">file_upload</i> <i class="material-icons">file_upload</i>
<span>{{ $t('buttons.upload') }}</span> <span>{{ $t('buttons.upload') }}</span>
</button> </button>
</template> </template>
<script> <script>
export default { export default {
name: 'upload-button', name: 'upload-button',
methods: { methods: {
upload: function (event) { upload: function (event) {
document.getElementById('upload-input').click() document.getElementById('upload-input').click()
} }
} }
} }
</script> </script>
+4
View File
@@ -196,6 +196,10 @@ export default {
}) })
}, },
paste (event) { paste (event) {
if (event.target.tagName.toLowerCase() === 'input') {
return
}
event.preventDefault() event.preventDefault()
let items = [] let items = []
+15 -3
View File
@@ -119,9 +119,21 @@ export default {
} }
if (event.shiftKey && this.selected.length === 1) { if (event.shiftKey && this.selected.length === 1) {
let fi = (this.index > this.selected[0]) ? this.selected[0] : this.index let fi = 0
let la = (this.index > this.selected[0]) ? this.index : this.selected[0] let la = 0
for (; fi <= la; fi++) this.addSelected(fi)
if (this.index > this.selected[0]) {
fi = this.selected[0] + 1
la = this.index
} else {
fi = this.index
la = this.selected[0] - 1
}
for (; fi <= la; fi++) {
this.addSelected(fi)
}
return return
} }
+1
View File
@@ -16,6 +16,7 @@
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button> :title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
<button class="flat" <button class="flat"
@click="copy" @click="copy"
:disabled="$route.path === dest"
:aria-label="$t('buttons.copy')" :aria-label="$t('buttons.copy')"
:title="$t('buttons.copy')">{{ $t('buttons.copy') }}</button> :title="$t('buttons.copy')">{{ $t('buttons.copy') }}</button>
</div> </div>
+1
View File
@@ -15,6 +15,7 @@
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button> :title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
<button class="flat" <button class="flat"
@click="move" @click="move"
:disabled="$route.path === dest"
:aria-label="$t('buttons.move')" :aria-label="$t('buttons.move')"
:title="$t('buttons.move')">{{ $t('buttons.move') }}</button> :title="$t('buttons.move')">{{ $t('buttons.move') }}</button>
</div> </div>
+84 -84
View File
@@ -1,84 +1,84 @@
<template> <template>
<div class="card floating"> <div class="card floating">
<div class="card-title"> <div class="card-title">
<h2>{{ $t('prompts.rename') }}</h2> <h2>{{ $t('prompts.rename') }}</h2>
</div> </div>
<div class="card-content"> <div class="card-content">
<p>{{ $t('prompts.renameMessage') }} <code>{{ oldName() }}</code>:</p> <p>{{ $t('prompts.renameMessage') }} <code>{{ oldName() }}</code>:</p>
<input autofocus type="text" @keyup.enter="submit" v-model.trim="name"> <input autofocus type="text" @keyup.enter="submit" v-model.trim="name">
</div> </div>
<div class="card-action"> <div class="card-action">
<button class="cancel flat" <button class="cancel flat"
@click="$store.commit('closeHovers')" @click="$store.commit('closeHovers')"
:aria-label="$t('buttons.cancel')" :aria-label="$t('buttons.cancel')"
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button> :title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
<button @click="submit" <button @click="submit"
class="flat" class="flat"
type="submit" type="submit"
:aria-label="$t('buttons.rename')" :aria-label="$t('buttons.rename')"
:title="$t('buttons.rename')">{{ $t('buttons.rename') }}</button> :title="$t('buttons.rename')">{{ $t('buttons.rename') }}</button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import url from '@/utils/url' import url from '@/utils/url'
import * as api from '@/utils/api' import * as api from '@/utils/api'
export default { export default {
name: 'rename', name: 'rename',
data: function () { data: function () {
return { return {
name: '' name: ''
} }
}, },
computed: mapState(['req', 'selected', 'selectedCount']), computed: mapState(['req', 'selected', 'selectedCount']),
methods: { methods: {
cancel: function (event) { cancel: function (event) {
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
}, },
oldName: function () { oldName: function () {
// Get the current name of the file we are editing. // Get the current name of the file we are editing.
if (this.req.kind !== 'listing') { if (this.req.kind !== 'listing') {
return this.req.name return this.req.name
} }
if (this.selectedCount === 0 || this.selectedCount > 1) { if (this.selectedCount === 0 || this.selectedCount > 1) {
// This shouldn't happen. // This shouldn't happen.
return return
} }
return this.req.items[this.selected[0]].name return this.req.items[this.selected[0]].name
}, },
submit: function (event) { submit: function (event) {
let oldLink = '' let oldLink = ''
let newLink = '' let newLink = ''
if (this.req.kind !== 'listing') { if (this.req.kind !== 'listing') {
oldLink = this.req.url oldLink = this.req.url
} else { } else {
oldLink = this.req.items[this.selected[0]].url oldLink = this.req.items[this.selected[0]].url
} }
this.name = encodeURIComponent(this.name) this.name = encodeURIComponent(this.name)
newLink = url.removeLastDir(oldLink) + '/' + this.name newLink = url.removeLastDir(oldLink) + '/' + this.name
api.move([{ from: oldLink, to: newLink }]) api.move([{ from: oldLink, to: newLink }])
.then(() => { .then(() => {
if (this.req.kind !== 'listing') { if (this.req.kind !== 'listing') {
this.$router.push({ path: newLink }) this.$router.push({ path: newLink })
return return
} }
this.$store.commit('setReload', true) this.$store.commit('setReload', true)
}).catch(error => { }).catch(error => {
this.$showError(error) this.$showError(error)
}) })
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
} }
} }
} }
</script> </script>
+5
View File
@@ -112,6 +112,11 @@ button.flat.cancel {
color: #ccc; color: #ccc;
} }
button.flat[disabled] {
color: #ccc;
cursor: not-allowed;
}
.mobile-only { .mobile-only {
display: none !important; display: none !important;
} }
+184 -184
View File
@@ -1,184 +1,184 @@
@import "~codemirror/lib/codemirror.css"; @import "~codemirror/lib/codemirror.css";
@import "~codemirror/theme/ttcn.css"; @import "~codemirror/theme/ttcn.css";
#editor { #editor {
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }
#editor .CodeMirror { #editor .CodeMirror {
box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px; box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px;
margin: 2em 0; margin: 2em 0;
border-radius: .5em; border-radius: .5em;
} }
#editor h2 { #editor h2 {
color: rgba(0, 0, 0, 0.3); color: rgba(0, 0, 0, 0.3);
font-weight: 500; font-weight: 500;
} }
.CodeMirror { .CodeMirror {
height: auto; height: auto;
} }
.markdown .CodeMirror { .markdown .CodeMirror {
padding: .75em; padding: .75em;
} }
.cm-s-markdown .CodeMirror-gutter { .cm-s-markdown .CodeMirror-gutter {
border-right: 1px solid #eff3f5; border-right: 1px solid #eff3f5;
padding-right: 5px; padding-right: 5px;
margin-right: 15px; margin-right: 15px;
min-width: 2.5em; min-width: 2.5em;
padding-bottom: 30px; padding-bottom: 30px;
} }
.cm-s-markdown .CodeMirror-cursor { .cm-s-markdown .CodeMirror-cursor {
border-right: 2px solid #667880; border-right: 2px solid #667880;
} }
.cm-s-markdown .CodeMirror-lines { .cm-s-markdown .CodeMirror-lines {
margin: 0; margin: 0;
} }
.cm-s-markdown { .cm-s-markdown {
color: #3D494E; color: #3D494E;
} }
.cm-s-markdown span.cm-header { .cm-s-markdown span.cm-header {
color: #3D494E; color: #3D494E;
font-weight: bold; font-weight: bold;
} }
.cm-s-markdown span.cm-variable-2 { .cm-s-markdown span.cm-variable-2 {
color: #3D494E; color: #3D494E;
} }
.cm-s-markdown span.cm-meta { .cm-s-markdown span.cm-meta {
color: #516066; color: #516066;
} }
.cm-s-markdown span.cm-hr { .cm-s-markdown span.cm-hr {
color: #516066; color: #516066;
} }
.cm-s-markdown span.cm-comment { .cm-s-markdown span.cm-comment {
color: #868f93; color: #868f93;
} }
.cm-s-markdown span.cm-qualifier { .cm-s-markdown span.cm-qualifier {
color: #868f93; color: #868f93;
} }
.cm-s-markdown span.cm-number { .cm-s-markdown span.cm-number {
color: #197987; color: #197987;
} }
.cm-s-markdown span.cm-variable { .cm-s-markdown span.cm-variable {
color: #197987; color: #197987;
} }
.cm-s-markdown span.cm-builtin { .cm-s-markdown span.cm-builtin {
color: #197987; color: #197987;
} }
.cm-s-markdown span.cm-link { .cm-s-markdown span.cm-link {
color: #197987; color: #197987;
text-decoration: underline; text-decoration: underline;
} }
.cm-s-markdown span.cm-tag { .cm-s-markdown span.cm-tag {
color: #197987; color: #197987;
} }
.cm-s-markdown span.cm-string { .cm-s-markdown span.cm-string {
color: #48abb9; color: #48abb9;
} }
.cm-s-markdown span.cm-string-2 { .cm-s-markdown span.cm-string-2 {
color: #48abb9; color: #48abb9;
} }
.cm-s-markdown span.cm-quote { .cm-s-markdown span.cm-quote {
color: #48abb9; color: #48abb9;
} }
.cm-s-markdown span.cm-atom { .cm-s-markdown span.cm-atom {
color: #48abb9; color: #48abb9;
} }
.cm-s-markdown span.cm-property { .cm-s-markdown span.cm-property {
color: #82a367; color: #82a367;
} }
.cm-s-markdown span.cm-operator { .cm-s-markdown span.cm-operator {
color: #82a367; color: #82a367;
} }
.cm-s-markdown span.cm-variable-3 { .cm-s-markdown span.cm-variable-3 {
color: #82a367; color: #82a367;
} }
.cm-s-markdown span.cm-attribute { .cm-s-markdown span.cm-attribute {
color: #90bb74; color: #90bb74;
} }
.cm-s-markdown span.cm-def { .cm-s-markdown span.cm-def {
color: #90bb74; color: #90bb74;
} }
.cm-s-markdown span.cm-keyword { .cm-s-markdown span.cm-keyword {
color: #ec6c45; color: #ec6c45;
} }
.cm-s-markdown span.cm-bracket { .cm-s-markdown span.cm-bracket {
color: #ec6c45; color: #ec6c45;
} }
.cm-s-markdown span.cm-error { .cm-s-markdown span.cm-error {
color: #e45346; color: #e45346;
} }
.cm-s-markdown span.cm-em { .cm-s-markdown span.cm-em {
font-style: italic; font-style: italic;
} }
.cm-s-markdown span.cm-strong { .cm-s-markdown span.cm-strong {
font-weight: bold; font-weight: bold;
} }
.cm-s-markdown .cm-header-1 { .cm-s-markdown .cm-header-1 {
font-size: 200%; font-size: 200%;
line-height: 200%; line-height: 200%;
} }
.cm-s-markdown .cm-header-2 { .cm-s-markdown .cm-header-2 {
font-size: 160%; font-size: 160%;
line-height: 160%; line-height: 160%;
} }
.cm-s-markdown .cm-header-3 { .cm-s-markdown .cm-header-3 {
font-size: 125%; font-size: 125%;
line-height: 125%; line-height: 125%;
} }
.cm-s-markdown .cm-header-4 { .cm-s-markdown .cm-header-4 {
font-size: 110%; font-size: 110%;
line-height: 110%; line-height: 110%;
} }
.cm-s-markdown .cm-comment { .cm-s-markdown .cm-comment {
background: rgba(0, 0, 0, .05); background: rgba(0, 0, 0, .05);
border-radius: 2px; border-radius: 2px;
} }
.cm-s-markdown .cm-link { .cm-s-markdown .cm-link {
color: #7f8c8d; color: #7f8c8d;
} }
.cm-s-markdown .cm-url { .cm-s-markdown .cm-url {
color: #aab2b3; color: #aab2b3;
} }
.cm-s-markdown .cm-strikethrough { .cm-s-markdown .cm-strikethrough {
text-decoration: line-through; text-decoration: line-through;
} }
+137 -137
View File
@@ -1,137 +1,137 @@
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-cyrillic-ext.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-cyrillic-ext.woff2) format('woff2');
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-cyrillic.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-cyrillic.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-greek-ext.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-greek-ext.woff2) format('woff2');
unicode-range: U+1F00-1FFF; unicode-range: U+1F00-1FFF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-greek.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-greek.woff2) format('woff2');
unicode-range: U+0370-03FF; unicode-range: U+0370-03FF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-vietnamese.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-vietnamese.woff2) format('woff2');
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-latin-ext.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-latin-ext.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-latin.woff2) format('woff2'); src: local('Roboto'), local('Roboto-Regular'), url(../assets/fonts/roboto/normal-latin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-cyrillic-ext.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-cyrillic-ext.woff2) format('woff2');
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-cyrillic.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-cyrillic.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-greek-ext.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-greek-ext.woff2) format('woff2');
unicode-range: U+1F00-1FFF; unicode-range: U+1F00-1FFF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-greek.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-greek.woff2) format('woff2');
unicode-range: U+0370-03FF; unicode-range: U+0370-03FF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-vietnamese.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-vietnamese.woff2) format('woff2');
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-latin-ext.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-latin-ext.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
} }
@font-face { @font-face {
font-family: 'Roboto'; font-family: 'Roboto';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-latin.woff2) format('woff2'); src: local('Roboto Medium'), local('Roboto-Medium'), url(../assets/fonts/roboto/medium-latin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
} }
@font-face { @font-face {
font-family: 'Material Icons'; font-family: 'Material Icons';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Material Icons'), local('MaterialIcons-Regular'), url(../assets/fonts/material/icons.woff2) format('woff2'); src: local('Material Icons'), local('MaterialIcons-Regular'), url(../assets/fonts/material/icons.woff2) format('woff2');
} }
.prompt .file-list ul li:before, .prompt .file-list ul li:before,
.material-icons { .material-icons {
font-family: 'Material Icons'; font-family: 'Material Icons';
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
font-size: 24px; font-size: 24px;
line-height: 1; line-height: 1;
letter-spacing: normal; letter-spacing: normal;
text-transform: none; text-transform: none;
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
word-wrap: normal; word-wrap: normal;
direction: ltr; direction: ltr;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-feature-settings: 'liga'; font-feature-settings: 'liga';
} }
+8
View File
@@ -29,6 +29,14 @@
width: 90%; width: 90%;
} }
#login.recaptcha form {
min-width: 304px;
}
#login #recaptcha {
margin: .5em 0 0;
}
#login input { #login input {
width: 100%; width: 100%;
width: 100%; width: 100%;
+113 -113
View File
@@ -1,113 +1,113 @@
@media (max-width: 1024px) { @media (max-width: 1024px) {
nav { nav {
width: 10em width: 10em
} }
} }
@media (max-width: 1024px) { @media (max-width: 1024px) {
#listing.list .item.header, #listing.list .item.header,
main { main {
width: calc(100% - 13em) width: calc(100% - 13em)
} }
} }
@media (max-width: 736px) { @media (max-width: 736px) {
#more { #more {
display: inherit display: inherit
} }
header .overlay { header .overlay {
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
} }
#dropdown { #dropdown {
position: fixed; position: fixed;
top: 1em; top: 1em;
right: 1em; right: 1em;
display: block; display: block;
background-color: #fff; background-color: #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
transform: scale(0); transform: scale(0);
transition: .1s ease-in-out transform; transition: .1s ease-in-out transform;
transform-origin: top right; transform-origin: top right;
z-index: 99999; z-index: 99999;
} }
#dropdown > div { #dropdown > div {
display: block; display: block;
} }
#dropdown.active { #dropdown.active {
transform: scale(1); transform: scale(1);
} }
#dropdown .action { #dropdown .action {
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 0; border-radius: 0;
width: 100%; width: 100%;
} }
#dropdown .action span:not(.counter) { #dropdown .action span:not(.counter) {
display: inline-block; display: inline-block;
padding: .4em; padding: .4em;
} }
#dropdown .counter { #dropdown .counter {
left: 2.25em; left: 2.25em;
} }
#file-selection { #file-selection {
position: fixed; position: fixed;
bottom: 1em; bottom: 1em;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
display: flex; display: flex;
align-items: center; align-items: center;
background: #fff; background: #fff;
box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px; box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px;
width: 95%; width: 95%;
max-width: 20em; max-width: 20em;
} }
#file-selection .action { #file-selection .action {
border-radius: 50%; border-radius: 50%;
width: auto; width: auto;
} }
#file-selection > span { #file-selection > span {
display: inline-block; display: inline-block;
margin-left: 1em; margin-left: 1em;
color: #6f6f6f; color: #6f6f6f;
margin-right: auto; margin-right: auto;
} }
nav { nav {
top: 0; top: 0;
z-index: 99999; z-index: 99999;
background: #fff; background: #fff;
height: 100%; height: 100%;
width: 16em; width: 16em;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
transition: .1s ease left; transition: .1s ease left;
left: -17em; left: -17em;
} }
nav.active { nav.active {
left: 0; left: 0;
} }
header .search-button, header .search-button,
header>div:first-child>.action { header>div:first-child>.action {
display: inherit; display: inherit;
} }
header img { header img {
display: none; display: none;
} }
#listing { #listing {
margin-bottom: 5em; margin-bottom: 5em;
} }
#listing.list .item.header, #listing.list .item.header,
main { main {
width: calc(100% - 2em); width: calc(100% - 2em);
} }
main { main {
margin: 0 1em; margin: 0 1em;
width: calc(100% - 2em); width: calc(100% - 2em);
} }
#search { #search {
display: none; display: none;
} }
#search.active { #search.active {
display: block; display: block;
} }
} }
+32 -1
View File
@@ -9,8 +9,39 @@ import zhTW from './zh-tw.yaml'
Vue.use(VueI18n) Vue.use(VueI18n)
export function detectLocale () {
let locale = (navigator.language || navigator.browserLangugae).toLowerCase()
switch (true) {
case /^en.*/i.test(locale):
locale = 'en'
break
case /^fr.*/i.test(locale):
locale = 'fr'
break
case /^pt.*/i.test(locale):
locale = 'pt'
break
case /^ja.*/i.test(locale):
locale = 'ja'
break
case /^zh-CN/i.test(locale):
locale = 'zh-cn'
break
case /^zh-TW/i.test(locale):
locale = 'zh-tw'
break
case /^zh.*/i.test(locale):
locale = 'zh-cn'
break
default:
locale = 'en'
}
return locale
}
const i18n = new VueI18n({ const i18n = new VueI18n({
locale: 'en', locale: detectLocale(),
fallbackLocale: 'en', fallbackLocale: 'en',
messages: { messages: {
'en': en, 'en': en,
+200 -200
View File
@@ -1,200 +1,200 @@
permanent: 永久 permanent: 永久
buttons: buttons:
cancel: キャンセル cancel: キャンセル
close: 閉じる close: 閉じる
copy: コピー copy: コピー
copyFile: ファイルをコピー copyFile: ファイルをコピー
copyToClipboard: クリップボードにコピー copyToClipboard: クリップボードにコピー
create: 作成 create: 作成
delete: 削除 delete: 削除
download: ダウンロード download: ダウンロード
info: 情報 info: 情報
more: More more: More
move: 移動 move: 移動
moveFile: ファイルを移動 moveFile: ファイルを移動
new: 新規 new: 新規
next: 次 next: 次
ok: OK ok: OK
replace: 置き換える replace: 置き換える
previous: 前 previous: 前
rename: 名前を変更 rename: 名前を変更
reportIssue: 問題を報告 reportIssue: 問題を報告
save: 保存 save: 保存
search: 検索 search: 検索
select: 選択 select: 選択
share: シェア share: シェア
publish: 発表 publish: 発表
selectMultiple: 複数選択 selectMultiple: 複数選択
schedule: スケジュール schedule: スケジュール
switchView: 表示を切り替わる switchView: 表示を切り替わる
toggleSidebar: サイドバーを表示する toggleSidebar: サイドバーを表示する
update: 更新 update: 更新
upload: アップロード upload: アップロード
permalink: 固定リンク permalink: 固定リンク
success: success:
linkCopied: リンクがコピーされました! linkCopied: リンクがコピーされました!
errors: errors:
forbidden: アクセスが拒否されました。 forbidden: アクセスが拒否されました。
internal: 内部エラーが発生しました。 internal: 内部エラーが発生しました。
notFound: リソースが見つからなりませんでした。 notFound: リソースが見つからなりませんでした。
files: files:
folders: フォルダ folders: フォルダ
files: ファイル files: ファイル
body: 本文 body: 本文
clear: クリアー clear: クリアー
closePreview: プレビューを閉じる closePreview: プレビューを閉じる
home: ホーム home: ホーム
lastModified: 最終変更 lastModified: 最終変更
loading: ローディング... loading: ローディング...
lonely: ここには何もない... lonely: ここには何もない...
metadata: メタデータ metadata: メタデータ
multipleSelectionEnabled: 複数選択有効 multipleSelectionEnabled: 複数選択有効
name: 名前 name: 名前
size: サイズ size: サイズ
sortByName: 名前によるソート sortByName: 名前によるソート
sortBySize: サイズによるソート sortBySize: サイズによるソート
sortByLastModified: 最終変更日付によるソート sortByLastModified: 最終変更日付によるソート
help: help:
click: ファイルやディレクトリを選択 click: ファイルやディレクトリを選択
ctrl: ctrl:
click: 複数のファイルやディレクトリを選択 click: 複数のファイルやディレクトリを選択
f: 検索を有効にする f: 検索を有効にする
s: ファイルを保存またはカレントディレクトリをダウンロード s: ファイルを保存またはカレントディレクトリをダウンロード
del: 選択した項目を削除 del: 選択した項目を削除
doubleClick: ファイルやディレクトリをオープン doubleClick: ファイルやディレクトリをオープン
esc: 選択をクリアーまたはプロンプトを閉じる esc: 選択をクリアーまたはプロンプトを閉じる
f1: このヘルプを表示 f1: このヘルプを表示
f2: ファイルの名前を変更 f2: ファイルの名前を変更
help: ヘルプ help: ヘルプ
login: login:
password: パスワード password: パスワード
submit: ログイン submit: ログイン
username: ユーザ名 username: ユーザ名
wrongCredentials: ユーザ名またはパスワードが間違っています。 wrongCredentials: ユーザ名またはパスワードが間違っています。
prompts: prompts:
copy: コピー copy: コピー
copyMessage: コピーの目標ディレクトリを選択してください: copyMessage: コピーの目標ディレクトリを選択してください:
currentlyNavigating: 現在閲覧しているディレクトリ: currentlyNavigating: 現在閲覧しているディレクトリ:
deleteMessageMultiple: '{count} つのファイルを本当に削除してよろしいですか。' deleteMessageMultiple: '{count} つのファイルを本当に削除してよろしいですか。'
deleteMessageSingle: このファイル/フォルダを本当に削除してよろしいですか。 deleteMessageSingle: このファイル/フォルダを本当に削除してよろしいですか。
deleteTitle: ファイルを削除 deleteTitle: ファイルを削除
displayName: 名前: displayName: 名前:
download: ファイルをダウンロード download: ファイルをダウンロード
downloadMessage: 圧縮形式を選択してください。 downloadMessage: 圧縮形式を選択してください。
error: あるエラーが発生しました。 error: あるエラーが発生しました。
fileInfo: ファイル情報 fileInfo: ファイル情報
filesSelected: '{count} つのファイルは選択されました。' filesSelected: '{count} つのファイルは選択されました。'
lastModified: 最終変更 lastModified: 最終変更
move: 移動 move: 移動
moveMessage: 移動の目標ディレクトリを選択してください: moveMessage: 移動の目標ディレクトリを選択してください:
newDir: 新しいディレクトリを作成 newDir: 新しいディレクトリを作成
newDirMessage: 新しいディレクトリの名前を入力してください。 newDirMessage: 新しいディレクトリの名前を入力してください。
newFile: 新しいファイルを作成 newFile: 新しいファイルを作成
newFileMessage: 新しいファイルの名前を入力してください。 newFileMessage: 新しいファイルの名前を入力してください。
numberDirs: ディレクトリ個数 numberDirs: ディレクトリ個数
numberFiles: ファイル個数 numberFiles: ファイル個数
replace: 置き換える replace: 置き換える
replaceMessage: > replaceMessage: >
アップロードするファイルの中でかち合う名前が一つあります。 アップロードするファイルの中でかち合う名前が一つあります。
既存のファイルを置き換えりませんか。 既存のファイルを置き換えりませんか。
rename: 名前を変更 rename: 名前を変更
renameMessage: 名前を変更しようファイルは: renameMessage: 名前を変更しようファイルは:
show: 表示 show: 表示
size: サイズ size: サイズ
schedule: スケジュール schedule: スケジュール
scheduleMessage: このポストの発表日付をスケジュールしてください。 scheduleMessage: このポストの発表日付をスケジュールしてください。
newArchetype: ある元型に基づいて新しいポストを作成します。ファイルは コンテンツフォルダに作成されます。 newArchetype: ある元型に基づいて新しいポストを作成します。ファイルは コンテンツフォルダに作成されます。
settings: settings:
admin: 管理者 admin: 管理者
administrator: 管理者 administrator: 管理者
allowCommands: コマンドの実行 allowCommands: コマンドの実行
allowEdit: ファイルやディレクトリの編集、名前変更と削除 allowEdit: ファイルやディレクトリの編集、名前変更と削除
allowNew: ファイルとディレクトリの作成 allowNew: ファイルとディレクトリの作成
allowPublish: ポストとぺーじの発表 allowPublish: ポストとぺーじの発表
avoidChanges: "(変更を避けるために空白にしてください)" avoidChanges: "(変更を避けるために空白にしてください)"
changePassword: パスワードを変更 changePassword: パスワードを変更
commands: コマンド commands: コマンド
commandsHelp: "\ commandsHelp: "\
ここで、名前付きイベントに実行するコマンドを設定することができます。\ ここで、名前付きイベントに実行するコマンドを設定することができます。\
一行にコマンド一つを入力してください。\ 一行にコマンド一つを入力してください。\
イベントはファイルに関連する場合、例えばファイル保存の前にまたは後で、\ イベントはファイルに関連する場合、例えばファイル保存の前にまたは後で、\
環境変数 FILE はファイルのパスに割り当てられます。" 環境変数 FILE はファイルのパスに割り当てられます。"
commandsUpdated: コマンドは更新されました! commandsUpdated: コマンドは更新されました!
customStylesheet: カスタムスタイルシ ート customStylesheet: カスタムスタイルシ ート
examples: 例 examples: 例
globalSettings: グローバル設定 globalSettings: グローバル設定
language: 言語 language: 言語
lockPassowrd: 新しいパスワードを変更に禁止 lockPassword: 新しいパスワードを変更に禁止
newPassword: 新しいパスワード newPassword: 新しいパスワード
newPasswordConfirm: 新しいパスワードを確認します newPasswordConfirm: 新しいパスワードを確認します
newUser: 新しいユーザー newUser: 新しいユーザー
password: パスワード password: パスワード
passwordUpdated: パスワードは更新されました! passwordUpdated: パスワードは更新されました!
permissions: 権限 permissions: 権限
permissionsHelp: "\ permissionsHelp: "\
あなたはユーザーを管理者に設定し、または権限を個々に設定しできます。\ あなたはユーザーを管理者に設定し、または権限を個々に設定しできます。\
\"管理者\"を選択する場合、その他のすべての選択肢は自動的に設定されます。\ \"管理者\"を選択する場合、その他のすべての選択肢は自動的に設定されます。\
ユーザーの管理は管理者の権限として保留されました。" ユーザーの管理は管理者の権限として保留されました。"
profileSettings: プロファイル設定 profileSettings: プロファイル設定
ruleExample1: "\ ruleExample1: "\
各フォルダに名前はドットで始まるファイル(例えば、.git、.gitignore)\ 各フォルダに名前はドットで始まるファイル(例えば、.git、.gitignore)\
へのアクセスを制限します。" へのアクセスを制限します。"
ruleExample2: 範囲のルートパスに名前は Caddyfile のファイルへのアクセスを制限します。 ruleExample2: 範囲のルートパスに名前は Caddyfile のファイルへのアクセスを制限します。
rules: 規則 rules: 規則
rulesHelp1: "\ rulesHelp1: "\
ここに、あなたはこのユーザーの許可または拒否規則を設定できます。\ ここに、あなたはこのユーザーの許可または拒否規則を設定できます。\
ブロックされたファイルはリストに表示されません、それではアクセスも制限されます。\ ブロックされたファイルはリストに表示されません、それではアクセスも制限されます。\
正規表現(regex)のサポートと範囲に相対のパスが提供されています。" 正規表現(regex)のサポートと範囲に相対のパスが提供されています。"
rulesHelp2: "\ rulesHelp2: "\
一行に規則一つを入力してください、\ 一行に規則一つを入力してください、\
その間に規則はキーワード {0} や {1} で始める必要があります。\ その間に規則はキーワード {0} や {1} で始める必要があります。\
そして正規表現を使う場合、{2} と入力し、表現やパスを入力してください。" そして正規表現を使う場合、{2} と入力し、表現やパスを入力してください。"
scope: 範囲 scope: 範囲
settingsUpdated: 設定は更新されました! settingsUpdated: 設定は更新されました!
user: ユーザー user: ユーザー
userCommands: ユーザーのコマンド userCommands: ユーザーのコマンド
userCommandsHelp: "\ userCommandsHelp: "\
空白区切りの有効のコマンドのリストを指定してください。\ 空白区切りの有効のコマンドのリストを指定してください。\
例:" 例:"
userCreated: ユーザーは作成されました! userCreated: ユーザーは作成されました!
userDeleted: ユーザーは削除されました! userDeleted: ユーザーは削除されました!
userManagement: ユーザー管理 userManagement: ユーザー管理
username: ユーザー名 username: ユーザー名
users: ユーザー users: ユーザー
userUpdated: ユーザーは更新されました! userUpdated: ユーザーは更新されました!
sidebar: sidebar:
help: ヘルプ help: ヘルプ
logout: ログアウト logout: ログアウト
myFiles: 私のファイル myFiles: 私のファイル
newFile: 新しいファイルを作成 newFile: 新しいファイルを作成
newFolder: 新しいフォルダを作成 newFolder: 新しいフォルダを作成
settings: 設定 settings: 設定
siteSettings: サイト設定 siteSettings: サイト設定
hugoNew: Hugo New hugoNew: Hugo New
preview: プレビュー preview: プレビュー
search: search:
images: 画像 images: 画像
music: 音楽 music: 音楽
pdf: PDF pdf: PDF
pressToExecute: Enter を押して実行します。 pressToExecute: Enter を押して実行します。
pressToSearch: Enter を押して検索します。 pressToSearch: Enter を押して検索します。
search: 検索... search: 検索...
searchOrCommand: コマンドを検索または実行します。 searchOrCommand: コマンドを検索または実行します。
searchOrSupportedCommand: サポートしているコマンドを検索または実行します: searchOrSupportedCommand: サポートしているコマンドを検索または実行します:
type: キーワードを入力し、Enter を押して検索します。 type: キーワードを入力し、Enter を押して検索します。
types: 種類 types: 種類
video: ビデオ video: ビデオ
writeToSearch: ここにキーワードを入力してください writeToSearch: ここにキーワードを入力してください
languages: languages:
en: English en: English
fr: Français fr: Français
pt: Português pt: Português
ja: 日本語 ja: 日本語
zhCN: 中文 (简体) zhCN: 中文 (简体)
zhTW: 中文 (繁體) zhTW: 中文 (繁體)
time: time:
unit: 時間単位 unit: 時間単位
seconds: 秒 seconds: 秒
minutes: 分 minutes: 分
hours: 時間 hours: 時間
days: 日 days: 日
+198 -198
View File
@@ -1,198 +1,198 @@
permanent: 永久 permanent: 永久
buttons: buttons:
cancel: 取消 cancel: 取消
close: 关闭 close: 关闭
copy: 复制 copy: 复制
copyFile: 复制文件 copyFile: 复制文件
copyToClipboard: 复制到剪贴板 copyToClipboard: 复制到剪贴板
create: 创建 create: 创建
delete: 删除 delete: 删除
download: 下载 download: 下载
info: 信息 info: 信息
more: 更多 more: 更多
move: 移动 move: 移动
moveFile: 移动文件 moveFile: 移动文件
new: 新 new: 新
next: 下一个 next: 下一个
ok: 确定 ok: 确定
replace: 替换 replace: 替换
previous: 上一个 previous: 上一个
rename: 重命名 rename: 重命名
reportIssue: 报告问题 reportIssue: 报告问题
save: 保存 save: 保存
search: 搜索 search: 搜索
select: 选择 select: 选择
share: 分享 share: 分享
publish: 发布 publish: 发布
selectMultiple: 选择多个 selectMultiple: 选择多个
schedule: 计划 schedule: 计划
switchView: 切换显示方式 switchView: 切换显示方式
toggleSidebar: 切换侧边栏 toggleSidebar: 切换侧边栏
update: 更新 update: 更新
upload: 上传 upload: 上传
permalink: 获取永久链接 permalink: 获取永久链接
success: success:
linkCopied: 链接已复制! linkCopied: 链接已复制!
errors: errors:
forbidden: 你被禁止访问。 forbidden: 你被禁止访问。
internal: 内部出现麻烦了。 internal: 内部出现麻烦了。
notFound: 找不到文件。 notFound: 找不到文件。
files: files:
folders: 文件夹 folders: 文件夹
files: 文件 files: 文件
body: Body body: Body
clear: 清空 clear: 清空
closePreview: 关闭预览 closePreview: 关闭预览
home: 主页 home: 主页
lastModified: 最后修改 lastModified: 最后修改
loading: 加载中... loading: 加载中...
lonely: 这里没有任何文件... lonely: 这里没有任何文件...
metadata: 元数据 metadata: 元数据
multipleSelectionEnabled: 多选模式已开启 multipleSelectionEnabled: 多选模式已开启
name: 名称 name: 名称
size: 大小 size: 大小
sortByName: 按名称排序 sortByName: 按名称排序
sortBySize: 按大小排序 sortBySize: 按大小排序
sortByLastModified: 按最后修改时间排序 sortByLastModified: 按最后修改时间排序
help: help:
click: 选择文件或目录 click: 选择文件或目录
ctrl: ctrl:
click: 选择多个文件或目录 click: 选择多个文件或目录
f: 打开搜索框 f: 打开搜索框
s: 保存文件或下载当前文件夹 s: 保存文件或下载当前文件夹
del: 删除所选的文件/文件夹 del: 删除所选的文件/文件夹
doubleClick: 打开文件/文件夹 doubleClick: 打开文件/文件夹
esc: 清除已选项或关闭提示信息 esc: 清除已选项或关闭提示信息
f1: 显示该帮助信息 f1: 显示该帮助信息
f2: 重命名文件/文件夹 f2: 重命名文件/文件夹
help: 帮助 help: 帮助
login: login:
password: 密码 password: 密码
submit: 登录 submit: 登录
username: 用户名 username: 用户名
wrongCredentials: 用户名或密码错误 wrongCredentials: 用户名或密码错误
prompts: prompts:
copy: 复制 copy: 复制
copyMessage: 请选择欲复制至的目录: copyMessage: 请选择欲复制至的目录:
currentlyNavigating: 当前目录: currentlyNavigating: 当前目录:
deleteMessageMultiple: 你确定要删除这 {count} 个文件吗? deleteMessageMultiple: 你确定要删除这 {count} 个文件吗?
deleteMessageSingle: 你确定要删除这个文件/文件夹吗? deleteMessageSingle: 你确定要删除这个文件/文件夹吗?
deleteTitle: 删除文件 deleteTitle: 删除文件
displayName: 名称: displayName: 名称:
download: 下载文件 download: 下载文件
downloadMessage: 请选择要下载的压缩格式。 downloadMessage: 请选择要下载的压缩格式。
error: 出了一点问题... error: 出了一点问题...
fileInfo: 文件信息 fileInfo: 文件信息
filesSelected: 已选择 {count} 个文件。 filesSelected: 已选择 {count} 个文件。
lastModified: 最后修改 lastModified: 最后修改
move: 移动 move: 移动
moveMessage: 请选择欲移动至的目录: moveMessage: 请选择欲移动至的目录:
newDir: 新建目录 newDir: 新建目录
newDirMessage: 请输入新目录的名称。 newDirMessage: 请输入新目录的名称。
newFile: 新建文件 newFile: 新建文件
newFileMessage: 请输入新文件的名称。 newFileMessage: 请输入新文件的名称。
numberDirs: 目录数 numberDirs: 目录数
numberFiles: 文件数 numberFiles: 文件数
replace: 替换 replace: 替换
replaceMessage: "\ replaceMessage: "\
您尝试上传的文件中有一个与现有文件的名称存在冲突。\ 您尝试上传的文件中有一个与现有文件的名称存在冲突。\
是否替换现有的同名文件?" 是否替换现有的同名文件?"
rename: 重命名 rename: 重命名
renameMessage: 请输入新名称,旧名称为: renameMessage: 请输入新名称,旧名称为:
show: 揭示 show: 揭示
size: 大小 size: 大小
schedule: 计划 schedule: 计划
scheduleMessage: 请选择发布这篇帖子的日期。 scheduleMessage: 请选择发布这篇帖子的日期。
newArchetype: 创建一个基于原型的新帖子。您的文件将会创建在内容文件夹中。 newArchetype: 创建一个基于原型的新帖子。您的文件将会创建在内容文件夹中。
settings: settings:
admin: 管理员 admin: 管理员
administrator: 管理员 administrator: 管理员
allowCommands: 执行命令(Linux 代码) allowCommands: 执行命令(Linux 代码)
allowEdit: 编辑、重命名或删除文件/目录 allowEdit: 编辑、重命名或删除文件/目录
allowNew: 创建新文件和目录 allowNew: 创建新文件和目录
allowPublish: 发布新的帖子与页面 allowPublish: 发布新的帖子与页面
avoidChanges: '(留空以避免更改)' avoidChanges: '(留空以避免更改)'
changePassword: 更改密码 changePassword: 更改密码
commands: 命令(linux 代码) commands: 命令(linux 代码)
commandsHelp: "\ commandsHelp: "\
在这里,您可以设置在指定事件下执行的命令,一行一条。\ 在这里,您可以设置在指定事件下执行的命令,一行一条。\
若事件与文件相关,如“在保存文件前”,\ 若事件与文件相关,如“在保存文件前”,\
则文件的路径会被赋值给环境变量 \"FILE\"。" 则文件的路径会被赋值给环境变量 \"FILE\"。"
commandsUpdated: 命令已更新! commandsUpdated: 命令已更新!
customStylesheet: 自定义样式表 customStylesheet: 自定义样式表
examples: 例子 examples: 例子
globalSettings: 全局设置 globalSettings: 全局设置
language: 语言 language: 语言
lockPassowrd: 禁止用户修改密码 lockPassword: 禁止用户修改密码
newPassword: 您的新密码 newPassword: 您的新密码
newPasswordConfirm: 重输一遍新密码 newPasswordConfirm: 重输一遍新密码
newUser: 新建用户 newUser: 新建用户
password: 密码 password: 密码
passwordUpdated: 密码已更新! passwordUpdated: 密码已更新!
permissions: 权限 permissions: 权限
permissionsHelp: "\ permissionsHelp: "\
您可以将该用户设置为管理员,也可以单独选择各项权限。\ 您可以将该用户设置为管理员,也可以单独选择各项权限。\
如果选择了“管理员”,则其他的选项会被自动勾上,\ 如果选择了“管理员”,则其他的选项会被自动勾上,\
同时该用户可以管理其他用户。" 同时该用户可以管理其他用户。"
profileSettings: 配置文件设置 profileSettings: 配置文件设置
ruleExample1: "\ ruleExample1: "\
阻止用户访问所有文件夹下任何以 . 开头的文件\ 阻止用户访问所有文件夹下任何以 . 开头的文件\
(隐藏文件, 例如: .git, .gitignore)。" (隐藏文件, 例如: .git, .gitignore)。"
ruleExample2: 阻止用户访问其目录范围的根目录下名为 Caddyfile 的文件。 ruleExample2: 阻止用户访问其目录范围的根目录下名为 Caddyfile 的文件。
rules: 规则 rules: 规则
rulesHelp1: "\ rulesHelp1: "\
您可以为该用户制定一组黑名单或白名单式的规则,\ 您可以为该用户制定一组黑名单或白名单式的规则,\
被屏蔽的文件将不会显示在列表中,用户也无权限访问,\ 被屏蔽的文件将不会显示在列表中,用户也无权限访问,\
支持相对于目录范围的路径。" 支持相对于目录范围的路径。"
rulesHelp2: "\ rulesHelp2: "\
每行一条规则,且必须以关键词 {0} 或 {1} 开头。\ 每行一条规则,且必须以关键词 {0} 或 {1} 开头。\
如要使用正则表达式,请在加上 {2} 之后再附上表达式或路径。" 如要使用正则表达式,请在加上 {2} 之后再附上表达式或路径。"
scope: 目录范围 scope: 目录范围
settingsUpdated: 设置已更新! settingsUpdated: 设置已更新!
user: 用户 user: 用户
userCommands: 用户命令(Linux 代码) userCommands: 用户命令(Linux 代码)
userCommandsHelp: "\ userCommandsHelp: "\
指定该用户可以执行的命令(Linux 代码),用空格分隔。\ 指定该用户可以执行的命令(Linux 代码),用空格分隔。\
例如:" 例如:"
userCreated: 用户已创建! userCreated: 用户已创建!
userDeleted: 用户已删除! userDeleted: 用户已删除!
userManagement: 用户管理 userManagement: 用户管理
username: 用户名 username: 用户名
users: 用户 users: 用户
userUpdated: 用户已更新! userUpdated: 用户已更新!
sidebar: sidebar:
help: 帮助 help: 帮助
logout: 登出 logout: 登出
myFiles: 我的文件 myFiles: 我的文件
newFile: 新建文件 newFile: 新建文件
newFolder: 新建文件夹 newFolder: 新建文件夹
settings: 设置 settings: 设置
siteSettings: 网站设置 siteSettings: 网站设置
hugoNew: Hugo New hugoNew: Hugo New
preview: 预览 preview: 预览
search: search:
images: 图像 images: 图像
music: 音乐 music: 音乐
pdf: PDF pdf: PDF
pressToExecute: 按回车键执行。 pressToExecute: 按回车键执行。
pressToSearch: 按回车键搜索。 pressToSearch: 按回车键搜索。
search: 搜索... search: 搜索...
searchOrCommand: 搜索或者执行命令(Linux 代码)... searchOrCommand: 搜索或者执行命令(Linux 代码)...
searchOrSupportedCommand: 搜索或使用您可以使用的命令(一次只能执行一个命令): searchOrSupportedCommand: 搜索或使用您可以使用的命令(一次只能执行一个命令):
type: 键入并按回车键进行搜索。 type: 键入并按回车键进行搜索。
types: 类型 types: 类型
video: 视频 video: 视频
writeToSearch: 请输入要搜索的内容 writeToSearch: 请输入要搜索的内容
languages: languages:
en: English en: English
fr: Français fr: Français
pt: Português pt: Português
ja: 日本語 ja: 日本語
zhCN: 中文 (简体) zhCN: 中文 (简体)
zhTW: 中文 (繁體) zhTW: 中文 (繁體)
time: time:
unit: 时间单位 unit: 时间单位
seconds: 秒 seconds: 秒
minutes: 分钟 minutes: 分钟
hours: 小时 hours: 小时
days: 天 days: 天
+1 -1
View File
@@ -31,7 +31,7 @@ Vue.prototype.$showError = function (error) {
type: 'error', type: 'error',
timeout: null, timeout: null,
buttons: [ buttons: [
Noty.button(i18n.t('buttons.reportIssue'), 'cancel', function () { Noty.button(i18n.t('buttons.reportIssue'), '', function () {
window.open('https://github.com/hacdias/filemanager/issues/new') window.open('https://github.com/hacdias/filemanager/issues/new')
}), }),
Noty.button(i18n.t('buttons.close'), '', function () { Noty.button(i18n.t('buttons.close'), '', function () {
+15 -15
View File
@@ -11,7 +11,7 @@ import ProfileSettings from '@/views/settings/Profile'
import Error403 from '@/views/errors/403' import Error403 from '@/views/errors/403'
import Error404 from '@/views/errors/404' import Error404 from '@/views/errors/404'
import Error500 from '@/views/errors/500' import Error500 from '@/views/errors/500'
import auth from '@/utils/auth.js' import auth from '@/utils/auth'
import store from '@/store' import store from '@/store'
Vue.use(Router) Vue.use(Router)
@@ -51,14 +51,13 @@ const router = new Router({
path: '/settings', path: '/settings',
name: 'Settings', name: 'Settings',
component: Settings, component: Settings,
redirect: {
path: '/settings/profile'
},
meta: {
disableOnNoAuth: true
},
children: [ children: [
{
path: '/settings',
name: 'Settings',
redirect: {
path: '/settings/profile'
}
},
{ {
path: '/settings/profile', path: '/settings/profile',
name: 'Profile Settings', name: 'Profile Settings',
@@ -131,16 +130,17 @@ router.beforeEach((to, from, next) => {
auth.loggedIn() auth.loggedIn()
.then(() => { .then(() => {
if (to.matched.some(record => record.meta.requiresAdmin)) { if (to.matched.some(record => record.meta.requiresAdmin)) {
if (store.state.user.admin) { if (!store.state.user.admin) {
next() next({ path: '/403' })
return return
} }
}
next({ if (to.matched.some(record => record.meta.disableOnNoAuth)) {
path: '/403' if (store.state.noAuth) {
}) next({ path: '/403' })
return
return }
} }
next() next()
+1
View File
@@ -17,6 +17,7 @@ const state = {
window.CSS = null window.CSS = null
return css return css
})(), })(),
recaptcha: document.querySelector('meta[name="recaptcha"]').getAttribute('content'),
staticGen: document.querySelector('meta[name="staticgen"]').getAttribute('content'), staticGen: document.querySelector('meta[name="staticgen"]').getAttribute('content'),
baseURL: document.querySelector('meta[name="base"]').getAttribute('content'), baseURL: document.querySelector('meta[name="base"]').getAttribute('content'),
noAuth: (document.querySelector('meta[name="noauth"]').getAttribute('content') === 'true'), noAuth: (document.querySelector('meta[name="noauth"]').getAttribute('content') === 'true'),
+9 -3
View File
@@ -1,4 +1,4 @@
import i18n from '@/i18n' import * as i18n from '@/i18n'
import moment from 'moment' import moment from 'moment'
const mutations = { const mutations = {
@@ -27,8 +27,14 @@ const mutations = {
setLoading: (state, value) => { state.loading = value }, setLoading: (state, value) => { state.loading = value },
setReload: (state, value) => { state.reload = value }, setReload: (state, value) => { state.reload = value },
setUser: (state, value) => { setUser: (state, value) => {
moment.locale(value.locale) let locale = value.locale
i18n.locale = value.locale
if (locale === '') {
locale = i18n.detectLocale()
}
moment.locale(locale)
i18n.default.locale = locale
state.user = value state.user = value
}, },
setCSS: (state, value) => (state.css = value), setCSS: (state, value) => (state.css = value),
+2 -2
View File
@@ -31,8 +31,8 @@ function loggedIn () {
}) })
} }
function login (user, password) { function login (user, password, captcha) {
let data = {username: user, password: password} let data = {username: user, password: password, recaptcha: captcha}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let request = new window.XMLHttpRequest() let request = new window.XMLHttpRequest()
request.open('POST', `${store.state.baseURL}/api/auth/get`, true) request.open('POST', `${store.state.baseURL}/api/auth/get`, true)
+60 -60
View File
@@ -1,60 +1,60 @@
// Most of the code from this file comes from: // Most of the code from this file comes from:
// https://github.com/codemirror/CodeMirror/blob/master/addon/mode/loadmode.js // https://github.com/codemirror/CodeMirror/blob/master/addon/mode/loadmode.js
import * as CodeMirror from 'codemirror' import * as CodeMirror from 'codemirror'
import store from '@/store' import store from '@/store'
// Make CodeMirror available globally so the modes' can register themselves. // Make CodeMirror available globally so the modes' can register themselves.
window.CodeMirror = CodeMirror window.CodeMirror = CodeMirror
CodeMirror.modeURL = store.state.baseURL + '/static/js/codemirror/mode/%N/%N.js' CodeMirror.modeURL = store.state.baseURL + '/static/js/codemirror/mode/%N/%N.js'
var loading = {} var loading = {}
function splitCallback (cont, n) { function splitCallback (cont, n) {
var countDown = n var countDown = n
return function () { return function () {
if (--countDown === 0) cont() if (--countDown === 0) cont()
} }
} }
function ensureDeps (mode, cont) { function ensureDeps (mode, cont) {
var deps = CodeMirror.modes[mode].dependencies var deps = CodeMirror.modes[mode].dependencies
if (!deps) return cont() if (!deps) return cont()
var missing = [] var missing = []
for (var i = 0; i < deps.length; ++i) { for (var i = 0; i < deps.length; ++i) {
if (!CodeMirror.modes.hasOwnProperty(deps[i])) missing.push(deps[i]) if (!CodeMirror.modes.hasOwnProperty(deps[i])) missing.push(deps[i])
} }
if (!missing.length) return cont() if (!missing.length) return cont()
var split = splitCallback(cont, missing.length) var split = splitCallback(cont, missing.length)
for (i = 0; i < missing.length; ++i) CodeMirror.requireMode(missing[i], split) for (i = 0; i < missing.length; ++i) CodeMirror.requireMode(missing[i], split)
} }
CodeMirror.requireMode = function (mode, cont) { CodeMirror.requireMode = function (mode, cont) {
if (typeof mode !== 'string') mode = mode.name if (typeof mode !== 'string') mode = mode.name
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont) if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont)
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont) if (loading.hasOwnProperty(mode)) return loading[mode].push(cont)
var file = CodeMirror.modeURL.replace(/%N/g, mode) var file = CodeMirror.modeURL.replace(/%N/g, mode)
var script = document.createElement('script') var script = document.createElement('script')
script.src = file script.src = file
var others = document.getElementsByTagName('script')[0] var others = document.getElementsByTagName('script')[0]
var list = loading[mode] = [cont] var list = loading[mode] = [cont]
CodeMirror.on(script, 'load', function () { CodeMirror.on(script, 'load', function () {
ensureDeps(mode, function () { ensureDeps(mode, function () {
for (var i = 0; i < list.length; ++i) list[i]() for (var i = 0; i < list.length; ++i) list[i]()
}) })
}) })
others.parentNode.insertBefore(script, others) others.parentNode.insertBefore(script, others)
} }
CodeMirror.autoLoadMode = function (instance, mode) { CodeMirror.autoLoadMode = function (instance, mode) {
if (CodeMirror.modes.hasOwnProperty(mode)) return if (CodeMirror.modes.hasOwnProperty(mode)) return
CodeMirror.requireMode(mode, function () { CodeMirror.requireMode(mode, function () {
instance.setOption('mode', mode) instance.setOption('mode', mode)
}) })
} }
export default CodeMirror export default CodeMirror
+4 -4
View File
@@ -1,4 +1,4 @@
export default function (name) { export default function (name) {
let re = new RegExp('(?:(?:^|.*;\\s*)' + name + '\\s*\\=\\s*([^;]*).*$)|^.*$') let re = new RegExp('(?:(?:^|.*;\\s*)' + name + '\\s*\\=\\s*([^;]*).*$)|^.*$')
return document.cookie.replace(re, '$1') return document.cookie.replace(re, '$1')
} }
+28 -28
View File
@@ -1,28 +1,28 @@
export default function getRule (rules) { export default function getRule (rules) {
for (let i = 0; i < rules.length; i++) { for (let i = 0; i < rules.length; i++) {
rules[i] = rules[i].toLowerCase() rules[i] = rules[i].toLowerCase()
} }
let result = null let result = null
let find = Array.prototype.find let find = Array.prototype.find
find.call(document.styleSheets, styleSheet => { find.call(document.styleSheets, styleSheet => {
result = find.call(styleSheet.cssRules, cssRule => { result = find.call(styleSheet.cssRules, cssRule => {
let found = false let found = false
if (cssRule instanceof window.CSSStyleRule) { if (cssRule instanceof window.CSSStyleRule) {
for (let i = 0; i < rules.length; i++) { for (let i = 0; i < rules.length; i++) {
if (cssRule.selectorText.toLowerCase() === rules[i]) { if (cssRule.selectorText.toLowerCase() === rules[i]) {
found = true found = true
} }
} }
} }
return found return found
}) })
return result != null return result != null
}) })
return result return result
} }
+12 -12
View File
@@ -1,12 +1,12 @@
function removeLastDir (url) { function removeLastDir (url) {
var arr = url.split('/') var arr = url.split('/')
if (arr.pop() === '') { if (arr.pop() === '') {
arr.pop() arr.pop()
} }
return arr.join('/') return arr.join('/')
} }
export default { export default {
removeLastDir: removeLastDir removeLastDir: removeLastDir
} }
+231 -231
View File
@@ -1,231 +1,231 @@
<template> <template>
<div> <div>
<div id="breadcrumbs"> <div id="breadcrumbs">
<router-link to="/files/" :aria-label="$t('files.home')" :title="$t('files.home')"> <router-link to="/files/" :aria-label="$t('files.home')" :title="$t('files.home')">
<i class="material-icons">home</i> <i class="material-icons">home</i>
</router-link> </router-link>
<span v-for="link in breadcrumbs" :key="link.name"> <span v-for="link in breadcrumbs" :key="link.name">
<span class="chevron"><i class="material-icons">keyboard_arrow_right</i></span> <span class="chevron"><i class="material-icons">keyboard_arrow_right</i></span>
<router-link :to="link.url">{{ link.name }}</router-link> <router-link :to="link.url">{{ link.name }}</router-link>
</span> </span>
</div> </div>
<div v-if="error"> <div v-if="error">
<not-found v-if="error.message === '404'"></not-found> <not-found v-if="error.message === '404'"></not-found>
<forbidden v-else-if="error.message === '403'"></forbidden> <forbidden v-else-if="error.message === '403'"></forbidden>
<internal-error v-else></internal-error> <internal-error v-else></internal-error>
</div> </div>
<editor v-else-if="isEditor"></editor> <editor v-else-if="isEditor"></editor>
<listing :class="{ multiple }" v-else-if="isListing"></listing> <listing :class="{ multiple }" v-else-if="isListing"></listing>
<preview v-else-if="isPreview"></preview> <preview v-else-if="isPreview"></preview>
<div v-else> <div v-else>
<h2 class="message"> <h2 class="message">
<span>{{ $t('files.loading') }}</span> <span>{{ $t('files.loading') }}</span>
</h2> </h2>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Forbidden from './errors/403' import Forbidden from './errors/403'
import NotFound from './errors/404' import NotFound from './errors/404'
import InternalError from './errors/500' import InternalError from './errors/500'
import Preview from '@/components/files/Preview' import Preview from '@/components/files/Preview'
import Listing from '@/components/files/Listing' import Listing from '@/components/files/Listing'
import Editor from '@/components/files/Editor' import Editor from '@/components/files/Editor'
import * as api from '@/utils/api' import * as api from '@/utils/api'
import { mapGetters, mapState, mapMutations } from 'vuex' import { mapGetters, mapState, mapMutations } from 'vuex'
export default { export default {
name: 'files', name: 'files',
components: { components: {
Forbidden, Forbidden,
NotFound, NotFound,
InternalError, InternalError,
Preview, Preview,
Listing, Listing,
Editor Editor
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'selectedCount' 'selectedCount'
]), ]),
...mapState([ ...mapState([
'req', 'req',
'user', 'user',
'reload', 'reload',
'multiple', 'multiple',
'loading' 'loading'
]), ]),
isListing () { isListing () {
return this.req.kind === 'listing' && !this.loading return this.req.kind === 'listing' && !this.loading
}, },
isPreview () { isPreview () {
return this.req.kind === 'preview' && !this.loading return this.req.kind === 'preview' && !this.loading
}, },
isEditor () { isEditor () {
return this.req.kind === 'editor' && !this.loading return this.req.kind === 'editor' && !this.loading
}, },
breadcrumbs () { breadcrumbs () {
let parts = this.$route.path.split('/') let parts = this.$route.path.split('/')
if (parts[0] === '') { if (parts[0] === '') {
parts.shift() parts.shift()
} }
if (parts[parts.length - 1] === '') { if (parts[parts.length - 1] === '') {
parts.pop() parts.pop()
} }
let breadcrumbs = [] let breadcrumbs = []
for (let i = 0; i < parts.length; i++) { for (let i = 0; i < parts.length; i++) {
if (i === 0) { if (i === 0) {
breadcrumbs.push({ name: decodeURIComponent(parts[i]), url: '/' + parts[i] + '/' }) breadcrumbs.push({ name: decodeURIComponent(parts[i]), url: '/' + parts[i] + '/' })
} else { } else {
breadcrumbs.push({ name: decodeURIComponent(parts[i]), url: breadcrumbs[i - 1].url + parts[i] + '/' }) breadcrumbs.push({ name: decodeURIComponent(parts[i]), url: breadcrumbs[i - 1].url + parts[i] + '/' })
} }
} }
breadcrumbs.shift() breadcrumbs.shift()
if (breadcrumbs.length > 3) { if (breadcrumbs.length > 3) {
while (breadcrumbs.length !== 4) { while (breadcrumbs.length !== 4) {
breadcrumbs.shift() breadcrumbs.shift()
} }
breadcrumbs[0].name = '...' breadcrumbs[0].name = '...'
} }
return breadcrumbs return breadcrumbs
} }
}, },
data: function () { data: function () {
return { return {
error: null error: null
} }
}, },
created () { created () {
this.fetchData() this.fetchData()
}, },
watch: { watch: {
'$route': 'fetchData', '$route': 'fetchData',
'reload': function () { 'reload': function () {
this.fetchData() this.fetchData()
} }
}, },
mounted () { mounted () {
window.addEventListener('keydown', this.keyEvent) window.addEventListener('keydown', this.keyEvent)
window.addEventListener('scroll', this.scroll) window.addEventListener('scroll', this.scroll)
}, },
beforeDestroy () { beforeDestroy () {
window.removeEventListener('keydown', this.keyEvent) window.removeEventListener('keydown', this.keyEvent)
window.removeEventListener('scroll', this.scroll) window.removeEventListener('scroll', this.scroll)
}, },
destroyed () { destroyed () {
this.$store.commit('updateRequest', {}) this.$store.commit('updateRequest', {})
}, },
methods: { methods: {
...mapMutations([ 'setLoading' ]), ...mapMutations([ 'setLoading' ]),
fetchData () { fetchData () {
// Reset view information. // Reset view information.
this.$store.commit('setReload', false) this.$store.commit('setReload', false)
this.$store.commit('resetSelected') this.$store.commit('resetSelected')
this.$store.commit('multiple', false) this.$store.commit('multiple', false)
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
// Set loading to true and reset the error. // Set loading to true and reset the error.
this.setLoading(true) this.setLoading(true)
this.error = null this.error = null
let url = this.$route.path let url = this.$route.path
if (url === '') url = '/' if (url === '') url = '/'
if (url[0] !== '/') url = '/' + url if (url[0] !== '/') url = '/' + url
api.fetch(url) api.fetch(url)
.then((req) => { .then((req) => {
if (!url.endsWith('/') && req.url.endsWith('/')) { if (!url.endsWith('/') && req.url.endsWith('/')) {
window.history.replaceState(window.history.state, document.title, window.location.pathname + '/') window.history.replaceState(window.history.state, document.title, window.location.pathname + '/')
} }
this.$store.commit('updateRequest', req) this.$store.commit('updateRequest', req)
document.title = req.name document.title = req.name
this.setLoading(false) this.setLoading(false)
}) })
.catch(error => { .catch(error => {
this.setLoading(false) this.setLoading(false)
this.error = error this.error = error
}) })
}, },
keyEvent (event) { keyEvent (event) {
// Esc! // Esc!
if (event.keyCode === 27) { if (event.keyCode === 27) {
this.$store.commit('closeHovers') this.$store.commit('closeHovers')
// If we're on a listing, unselect all // If we're on a listing, unselect all
// files and folders. // files and folders.
if (this.req.kind === 'listing') { if (this.req.kind === 'listing') {
this.$store.commit('resetSelected') this.$store.commit('resetSelected')
} }
} }
// Del! // Del!
if (event.keyCode === 46) { if (event.keyCode === 46) {
if (this.req.kind === 'editor' || if (this.req.kind === 'editor' ||
this.$route.name !== 'Files' || this.$route.name !== 'Files' ||
this.loading || this.loading ||
!this.user.allowEdit || !this.user.allowEdit ||
(this.req.kind === 'listing' && this.selectedCount === 0)) return (this.req.kind === 'listing' && this.selectedCount === 0)) return
this.$store.commit('showHover', 'delete') this.$store.commit('showHover', 'delete')
} }
// F1! // F1!
if (event.keyCode === 112) { if (event.keyCode === 112) {
event.preventDefault() event.preventDefault()
this.$store.commit('showHover', 'help') this.$store.commit('showHover', 'help')
} }
// F2! // F2!
if (event.keyCode === 113) { if (event.keyCode === 113) {
if (this.req.kind === 'editor' || if (this.req.kind === 'editor' ||
this.$route.name !== 'Files' || this.$route.name !== 'Files' ||
this.loading || this.loading ||
!this.user.allowEdit || !this.user.allowEdit ||
(this.req.kind === 'listing' && this.selectedCount === 0) || (this.req.kind === 'listing' && this.selectedCount === 0) ||
(this.req.kind === 'listing' && this.selectedCount > 1)) return (this.req.kind === 'listing' && this.selectedCount > 1)) return
this.$store.commit('showHover', 'rename') this.$store.commit('showHover', 'rename')
} }
// CTRL + S // CTRL + S
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {
if (String.fromCharCode(event.which).toLowerCase() === 's') { if (String.fromCharCode(event.which).toLowerCase() === 's') {
event.preventDefault() event.preventDefault()
if (this.req.kind !== 'editor') { if (this.req.kind !== 'editor') {
document.getElementById('download-button').click() document.getElementById('download-button').click()
} }
} }
} }
}, },
scroll (event) { scroll (event) {
if (this.req.kind !== 'listing' || this.$store.state.req.display === 'mosaic') return if (this.req.kind !== 'listing' || this.$store.state.req.display === 'mosaic') return
let top = 112 - window.scrollY let top = 112 - window.scrollY
if (top < 64) { if (top < 64) {
top = 64 top = 64
} }
document.querySelector('#listing.list .item.header').style.top = top + 'px' document.querySelector('#listing.list .item.header').style.top = top + 'px'
}, },
openSidebar () { openSidebar () {
this.$store.commit('showHover', 'sidebar') this.$store.commit('showHover', 'sidebar')
}, },
openSearch () { openSearch () {
this.$store.commit('showHover', 'search') this.$store.commit('showHover', 'search')
} }
} }
} }
</script> </script>
+32 -3
View File
@@ -1,11 +1,12 @@
<template> <template>
<div id="login"> <div id="login" :class="{ recaptcha: recaptcha.length > 0 }">
<form @submit="submit"> <form @submit="submit">
<img src="../assets/logo.svg" alt="File Manager"> <img src="../assets/logo.svg" alt="File Manager">
<h1>File Manager</h1> <h1>File Manager</h1>
<div v-if="wrong" class="wrong">{{ $t("login.wrongCredentials") }}</div> <div v-if="wrong" class="wrong">{{ $t("login.wrongCredentials") }}</div>
<input type="text" v-model="username" :placeholder="$t('login.username')"> <input type="text" v-model="username" :placeholder="$t('login.username')">
<input type="password" v-model="password" :placeholder="$t('login.password')"> <input type="password" v-model="password" :placeholder="$t('login.password')">
<div v-if="recaptcha.length" id="recaptcha"></div>
<input type="submit" :value="$t('login.submit')"> <input type="submit" :value="$t('login.submit')">
</form> </form>
</div> </div>
@@ -13,9 +14,12 @@
<script> <script>
import auth from '@/utils/auth' import auth from '@/utils/auth'
import { mapState } from 'vuex'
export default { export default {
name: 'login', name: 'login',
props: ['dependencies'],
computed: mapState(['recaptcha']),
data: function () { data: function () {
return { return {
wrong: false, wrong: false,
@@ -23,8 +27,23 @@ export default {
password: '' password: ''
} }
}, },
mounted () {
if (this.dependencies) this.setup()
},
watch: {
dependencies: function (val) {
if (val) this.setup()
}
},
methods: { methods: {
submit: function (event) { setup () {
if (this.recaptcha.length === 0) return
window.grecaptcha.render('recaptcha', {
sitekey: this.recaptcha
})
},
submit (event) {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
@@ -33,7 +52,17 @@ export default {
redirect = '/files/' redirect = '/files/'
} }
auth.login(this.username, this.password) let captcha = ''
if (this.recaptcha.length > 0) {
captcha = window.grecaptcha.getResponse()
if (captcha === '') {
this.wrong = true
return
}
}
auth.login(this.username, this.password, captcha)
.then(() => { this.$router.push({ path: redirect }) }) .then(() => { this.$router.push({ path: redirect }) })
.catch(() => { this.wrong = true }) .catch(() => { this.wrong = true })
} }
+13 -13
View File
@@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<h2 class="message"> <h2 class="message">
<i class="material-icons">error</i> <i class="material-icons">error</i>
<span>{{ $t('errors.forbidden') }}</span> <span>{{ $t('errors.forbidden') }}</span>
</h2> </h2>
</div> </div>
</template> </template>
<script> <script>
export default {name: 'forbidden'} export default {name: 'forbidden'}
</script> </script>
+13 -13
View File
@@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<h2 class="message"> <h2 class="message">
<i class="material-icons">gps_off</i> <i class="material-icons">gps_off</i>
<span>{{ $t('errors.notFound') }}</span> <span>{{ $t('errors.notFound') }}</span>
</h2> </h2>
</div> </div>
</template> </template>
<script> <script>
export default {name: 'not-found'} export default {name: 'not-found'}
</script> </script>
+13 -13
View File
@@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<h2 class="message"> <h2 class="message">
<i class="material-icons">error_outline</i> <i class="material-icons">error_outline</i>
<span>{{ $t('errors.internal') }}</span> <span>{{ $t('errors.internal') }}</span>
</h2> </h2>
</div> </div>
</template> </template>
<script> <script>
export default {name: 'internal-error'} export default {name: 'internal-error'}
</script> </script>
+1 -2
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="dashboard"> <div class="dashboard">
<form class="card" @submit.prevent="saveStaticGen"> <form class="card" v-if="staticGen.length" @submit.prevent="saveStaticGen">
<div class="card-title"> <div class="card-title">
<h2>{{ capitalize($store.state.staticGen) }}</h2> <h2>{{ capitalize($store.state.staticGen) }}</h2>
</div> </div>
@@ -80,7 +80,6 @@ export default {
created () { created () {
getSettings() getSettings()
.then(settings => { .then(settings => {
console.log(settings)
if (this.$store.state.staticGen.length > 0) { if (this.$store.state.staticGen.length > 0) {
this.parseStaticGen(settings.staticGen) this.parseStaticGen(settings.staticGen)
} }
+20 -20
View File
@@ -1,20 +1,20 @@
{ {
"name": "File Manager", "name": "File Manager",
"short_name": "File Manager", "short_name": "File Manager",
"icons": [ "icons": [
{ {
"src": "{{ .BaseURL }}/static/img/icons/android-chrome-192x192.png", "src": "{{ .BaseURL }}/static/img/icons/android-chrome-192x192.png",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}, },
{ {
"src": "{{ .BaseURL }}/static/img/icons/android-chrome-512x512.png", "src": "{{ .BaseURL }}/static/img/icons/android-chrome-512x512.png",
"sizes": "512x512", "sizes": "512x512",
"type": "image/png" "type": "image/png"
} }
], ],
"start_url": "{{ .BaseURL }}/", "start_url": "{{ .BaseURL }}/",
"display": "standalone", "display": "standalone",
"background_color": "#ffffff", "background_color": "#ffffff",
"theme_color": "#2979ff" "theme_color": "#2979ff"
} }
+50 -50
View File
@@ -1,50 +1,50 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>File Manager</title> <title>File Manager</title>
<link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png">
<!--[if IE]><link rel="shortcut icon" href="{{ .BaseURL }}/static/img/icons/favicon.ico"><![endif]--> <!--[if IE]><link rel="shortcut icon" href="{{ .BaseURL }}/static/img/icons/favicon.ico"><![endif]-->
<link rel="manifest" href="{{ .BaseURL }}/static/manifest.json"> <link rel="manifest" href="{{ .BaseURL }}/static/manifest.json">
<meta name="theme-color" content="#2979ff"> <meta name="theme-color" content="#2979ff">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="assets"> <meta name="apple-mobile-web-app-title" content="assets">
<link rel="apple-touch-icon" href="{{ .BaseURL }}/static/img/icons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" href="{{ .BaseURL }}/static/img/icons/apple-touch-icon-152x152.png">
<meta name="msapplication-TileImage" content="{{ .BaseURL }}/static/img/icons/msapplication-icon-144x144.png"> <meta name="msapplication-TileImage" content="{{ .BaseURL }}/static/img/icons/msapplication-icon-144x144.png">
<meta name="msapplication-TileColor" content="#2979ff"> <meta name="msapplication-TileColor" content="#2979ff">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<style> <style>
* { * {
box-sizing: border-box box-sizing: border-box
} }
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
color: #6f6f6f; color: #6f6f6f;
background: #f8f8f8; background: #f8f8f8;
} }
body > div { body > div {
text-align: center; text-align: center;
position: absolute; position: absolute;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
top: 50%; top: 50%;
left: 50%; left: 50%;
box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px; box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px;
background: #fff; background: #fff;
display: block; display: block;
border-radius: 0.2em; border-radius: 0.2em;
padding: 2em 3em; padding: 2em 3em;
} }
body > a * { body > a * {
margin: 0; margin: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div><h1>404 Not Found</h1></div> <div><h1>404 Not Found</h1></div>
</body> </body>
</html> </html>
+85 -85
View File
@@ -1,85 +1,85 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>{{ .File.Name }}</title> <title>{{ .File.Name }}</title>
<link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="{{ .BaseURL }}/static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="{{ .BaseURL }}/static/img/icons/favicon-16x16.png">
<!--[if IE]><link rel="shortcut icon" href="{{ .BaseURL }}/static/img/icons/favicon.ico"><![endif]--> <!--[if IE]><link rel="shortcut icon" href="{{ .BaseURL }}/static/img/icons/favicon.ico"><![endif]-->
<link rel="manifest" href="{{ .BaseURL }}/static/manifest.json"> <link rel="manifest" href="{{ .BaseURL }}/static/manifest.json">
<meta name="theme-color" content="#2979ff"> <meta name="theme-color" content="#2979ff">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="assets"> <meta name="apple-mobile-web-app-title" content="assets">
<link rel="apple-touch-icon" href="{{ .BaseURL }}/static/img/icons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" href="{{ .BaseURL }}/static/img/icons/apple-touch-icon-152x152.png">
<meta name="msapplication-TileImage" content="{{ .BaseURL }}/static/img/icons/msapplication-icon-144x144.png"> <meta name="msapplication-TileImage" content="{{ .BaseURL }}/static/img/icons/msapplication-icon-144x144.png">
<meta name="msapplication-TileColor" content="#2979ff"> <meta name="msapplication-TileColor" content="#2979ff">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<style> <style>
* { * {
box-sizing: border-box box-sizing: border-box
} }
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
color: #6f6f6f; color: #6f6f6f;
background: #f8f8f8; background: #f8f8f8;
} }
a { a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
body > a { body > a {
text-align: center; text-align: center;
position: absolute; position: absolute;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
top: 50%; top: 50%;
left: 50%; left: 50%;
box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px; box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 3px, rgba(0, 0, 0, 0.12) 0px 1px 2px;
background: #fff; background: #fff;
display: block; display: block;
border-radius: 0.2em; border-radius: 0.2em;
width: 90%; width: 90%;
max-width: 25em; max-width: 25em;
} }
body > a > div:first-child { body > a > div:first-child {
width: 100%; width: 100%;
padding: 1em; padding: 1em;
cursor: pointer; cursor: pointer;
background: #ffffff; background: #ffffff;
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
border-bottom: 1px solid rgba(0, 0, 0, 0.05); border-bottom: 1px solid rgba(0, 0, 0, 0.05);
} }
body > a > div:last-child { body > a > div:last-child {
padding: 2em 3em; padding: 2em 3em;
} }
body > a * { body > a * {
margin: 0; margin: 0;
} }
body > a h1 { body > a h1 {
margin-top: .2em; margin-top: .2em;
} }
</style> </style>
</head> </head>
<body> <body>
<a href="?dl=1"> <a href="?dl=1">
<div>Download {{ if .File.IsDir }}Folder{{ else }}File{{ end }}</div> <div>Download {{ if .File.IsDir }}Folder{{ else }}File{{ end }}</div>
<div> <div>
{{ if .File.IsDir -}} {{ if .File.IsDir -}}
<svg fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg"> <svg fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg">
<path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/> <path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>
<path d="M0 0h24v24H0z" fill="none"/> <path d="M0 0h24v24H0z" fill="none"/>
</svg> </svg>
{{ else -}} {{ else -}}
<svg fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg"> <svg fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg">
<path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/> <path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
<path d="M0 0h24v24H0z" fill="none"/> <path d="M0 0h24v24H0z" fill="none"/>
</svg> </svg>
{{ end -}} {{ end -}}
<h1>{{ .File.Name }}</h1> <h1>{{ .File.Name }}</h1>
</div> </div>
</a> </a>
</body> </body>
</html> </html>
+13 -13
View File
@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
# Install rice tool if not present # Install rice tool if not present
if ! [ -x "$(command -v rice)" ]; then if ! [ -x "$(command -v rice)" ]; then
go get github.com/GeertJohan/go.rice/rice go get github.com/GeertJohan/go.rice/rice
fi fi
# Clean the dist folder and build the assets # Clean the dist folder and build the assets
rm -rf assets/dist rm -rf assets/dist
npm run build npm run build
# Embed the assets using rice # Embed the assets using rice
rice embed-go rice embed-go
+22 -6
View File
@@ -48,6 +48,8 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
scope := "." scope := "."
database := "" database := ""
noAuth := false noAuth := false
reCaptchaKey := ""
reCaptchaSecret := ""
if plugin != "" { if plugin != "" {
baseURL = "/admin" baseURL = "/admin"
@@ -152,9 +154,21 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
} }
u.ViewMode = c.Val() u.ViewMode = c.Val()
if u.ViewMode != "mosaic" && u.ViewMode != "list" { if u.ViewMode != filemanager.MosaicViewMode && u.ViewMode != filemanager.ListViewMode {
return nil, c.ArgErr() return nil, c.ArgErr()
} }
case "recaptcha_key":
if !c.NextArg() {
return nil, c.ArgErr()
}
reCaptchaKey = c.Val()
case "recaptcha_secret":
if !c.NextArg() {
return nil, c.ArgErr()
}
reCaptchaSecret = c.Val()
case "no_auth": case "no_auth":
if !c.NextArg() { if !c.NextArg() {
noAuth = true noAuth = true
@@ -193,7 +207,7 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
sha := hex.EncodeToString(hasher.Sum(nil)) sha := hex.EncodeToString(hasher.Sum(nil))
database = filepath.Join(path, sha+".db") database = filepath.Join(path, sha+".db")
fmt.Println("[WARNING] A database is going to be created for your File Manager instace at " + database + fmt.Println("[WARNING] A database is going to be created for your File Manager instance at " + database +
". It is highly recommended that you set the 'database' option to '" + sha + ".db'\n") ". It is highly recommended that you set the 'database' option to '" + sha + ".db'\n")
} }
@@ -213,10 +227,12 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
} }
m := &filemanager.FileManager{ m := &filemanager.FileManager{
NoAuth: noAuth, NoAuth: noAuth,
BaseURL: "", BaseURL: "",
PrefixURL: "", PrefixURL: "",
DefaultUser: u, ReCaptchaKey: reCaptchaKey,
ReCaptchaSecret: reCaptchaSecret,
DefaultUser: u,
Store: &filemanager.Store{ Store: &filemanager.Store{
Config: bolt.ConfigStore{DB: db}, Config: bolt.ConfigStore{DB: db},
Users: bolt.UsersStore{DB: db}, Users: bolt.UsersStore{DB: db},
+35 -25
View File
@@ -12,7 +12,7 @@ import (
"github.com/asdine/storm" "github.com/asdine/storm"
lumberjack "gopkg.in/natefinch/lumberjack.v2" "gopkg.in/natefinch/lumberjack.v2"
"github.com/hacdias/filemanager" "github.com/hacdias/filemanager"
"github.com/hacdias/filemanager/bolt" "github.com/hacdias/filemanager/bolt"
@@ -24,24 +24,26 @@ import (
) )
var ( var (
addr string addr string
config string config string
database string database string
scope string scope string
commands string commands string
logfile string logfile string
staticg string staticg string
locale string locale string
baseurl string baseurl string
prefixurl string prefixurl string
viewMode string viewMode string
port int recaptchakey string
noAuth bool recaptchasecret string
allowCommands bool port int
allowEdit bool noAuth bool
allowNew bool allowCommands bool
allowPublish bool allowEdit bool
showVer bool allowNew bool
allowPublish bool
showVer bool
) )
func init() { func init() {
@@ -55,12 +57,14 @@ func init() {
flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users") flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users")
flag.StringVar(&prefixurl, "prefixurl", "", "Prefix URL") flag.StringVar(&prefixurl, "prefixurl", "", "Prefix URL")
flag.StringVar(&viewMode, "view-mode", "mosaic", "Default view mode for new users") flag.StringVar(&viewMode, "view-mode", "mosaic", "Default view mode for new users")
flag.StringVar(&recaptchakey, "recaptcha-key", "", "ReCaptcha site key")
flag.StringVar(&recaptchasecret, "recaptcha-secret", "", "ReCaptcha secret")
flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users") flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users")
flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users") flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users")
flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users") flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users")
flag.BoolVar(&allowNew, "allow-new", true, "Default allow new option for new users") flag.BoolVar(&allowNew, "allow-new", true, "Default allow new option for new users")
flag.BoolVar(&noAuth, "no-auth", false, "Disables authentication") flag.BoolVar(&noAuth, "no-auth", false, "Disables authentication")
flag.StringVar(&locale, "locale", "en", "Default locale for new users") flag.StringVar(&locale, "locale", "", "Default locale for new users, set it empty to enable auto detect from browser")
flag.StringVar(&staticg, "staticgen", "", "Static Generator you want to enable") flag.StringVar(&staticg, "staticgen", "", "Static Generator you want to enable")
flag.BoolVarP(&showVer, "version", "v", false, "Show version") flag.BoolVarP(&showVer, "version", "v", false, "Show version")
} }
@@ -77,11 +81,13 @@ func setupViper() {
viper.SetDefault("AllowNew", true) viper.SetDefault("AllowNew", true)
viper.SetDefault("AllowPublish", true) viper.SetDefault("AllowPublish", true)
viper.SetDefault("StaticGen", "") viper.SetDefault("StaticGen", "")
viper.SetDefault("Locale", "en") viper.SetDefault("Locale", "")
viper.SetDefault("NoAuth", false) viper.SetDefault("NoAuth", false)
viper.SetDefault("BaseURL", "") viper.SetDefault("BaseURL", "")
viper.SetDefault("PrefixURL", "") viper.SetDefault("PrefixURL", "")
viper.SetDefault("ViewMode", "mosaic") viper.SetDefault("ViewMode", filemanager.MosaicViewMode)
viper.SetDefault("ReCaptchaKey", "")
viper.SetDefault("ReCaptchaSecret", "")
viper.BindPFlag("Port", flag.Lookup("port")) viper.BindPFlag("Port", flag.Lookup("port"))
viper.BindPFlag("Address", flag.Lookup("address")) viper.BindPFlag("Address", flag.Lookup("address"))
@@ -99,6 +105,8 @@ func setupViper() {
viper.BindPFlag("BaseURL", flag.Lookup("baseurl")) viper.BindPFlag("BaseURL", flag.Lookup("baseurl"))
viper.BindPFlag("PrefixURL", flag.Lookup("prefixurl")) viper.BindPFlag("PrefixURL", flag.Lookup("prefixurl"))
viper.BindPFlag("ViewMode", flag.Lookup("view-mode")) viper.BindPFlag("ViewMode", flag.Lookup("view-mode"))
viper.BindPFlag("ReCaptchaKey", flag.Lookup("recaptcha-key"))
viper.BindPFlag("ReCaptchaSecret", flag.Lookup("recaptcha-secret"))
viper.SetConfigName("filemanager") viper.SetConfigName("filemanager")
viper.AddConfigPath(".") viper.AddConfigPath(".")
@@ -179,9 +187,11 @@ func handler() http.Handler {
} }
fm := &filemanager.FileManager{ fm := &filemanager.FileManager{
NoAuth: viper.GetBool("NoAuth"), NoAuth: viper.GetBool("NoAuth"),
BaseURL: viper.GetString("BaseURL"), BaseURL: viper.GetString("BaseURL"),
PrefixURL: viper.GetString("PrefixURL"), PrefixURL: viper.GetString("PrefixURL"),
ReCaptchaKey: viper.GetString("ReCaptchaKey"),
ReCaptchaSecret: viper.GetString("ReCaptchaSecret"),
DefaultUser: &filemanager.User{ DefaultUser: &filemanager.User{
AllowCommands: viper.GetBool("AllowCommands"), AllowCommands: viper.GetBool("AllowCommands"),
AllowEdit: viper.GetBool("AllowEdit"), AllowEdit: viper.GetBool("AllowEdit"),
+1
View File
@@ -418,6 +418,7 @@ var textExtensions = [...]string{
".sh", ".bash", ".ps1", ".bat", ".cmd", ".sh", ".bash", ".ps1", ".bat", ".cmd",
".php", ".pl", ".py", ".php", ".pl", ".py",
"Caddyfile", "Caddyfile",
".htaccess",
".c", ".cc", ".h", ".hh", ".cpp", ".hpp", ".f90", ".c", ".cc", ".h", ".hh", ".cpp", ".hpp", ".f90",
".f", ".bas", ".d", ".ada", ".nim", ".cr", ".java", ".cs", ".vala", ".vapi", ".f", ".bas", ".d", ".ada", ".nim", ".cr", ".java", ".cs", ".vala", ".vapi",
} }
+21 -3
View File
@@ -15,14 +15,20 @@ import (
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
rice "github.com/GeertJohan/go.rice" "github.com/GeertJohan/go.rice"
"github.com/hacdias/fileutils" "github.com/hacdias/fileutils"
"github.com/mholt/caddy" "github.com/mholt/caddy"
"github.com/robfig/cron" "github.com/robfig/cron"
) )
// Version is the current File Manager version. // Version is the current File Manager version.
const Version = "1.3.2" const (
// Version is the current File Manager version.
Version = "1.3.8"
ListViewMode = "list"
MosaicViewMode = "mosaic"
)
var ( var (
ErrExist = errors.New("the resource already exists") ErrExist = errors.New("the resource already exists")
@@ -66,6 +72,10 @@ type FileManager struct {
// there will only exist one user, called "admin". // there will only exist one user, called "admin".
NoAuth bool NoAuth bool
// ReCaptcha Site key and secret.
ReCaptchaKey string
ReCaptchaSecret string
// StaticGen is the static websit generator handler. // StaticGen is the static websit generator handler.
StaticGen StaticGen StaticGen StaticGen
@@ -201,6 +211,14 @@ func (m *FileManager) Setup() error {
} }
} }
// TODO: remove this after 1.5
for _, user := range users {
if user.ViewMode != ListViewMode && user.ViewMode != MosaicViewMode {
user.ViewMode = ListViewMode
m.Store.Users.Update(user, "ViewMode")
}
}
m.DefaultUser.Username = "" m.DefaultUser.Username = ""
m.DefaultUser.Password = "" m.DefaultUser.Password = ""
@@ -344,7 +362,7 @@ var DefaultUser = User{
Rules: []*Rule{}, Rules: []*Rule{},
CSS: "", CSS: "",
Admin: true, Admin: true,
Locale: "en", Locale: "",
Scope: ".", Scope: ".",
FileSystem: fileutils.Dir("."), FileSystem: fileutils.Dir("."),
ViewMode: "mosaic", ViewMode: "mosaic",
+57 -2
View File
@@ -1,16 +1,58 @@
package http package http
import ( import (
"bytes"
"encoding/json" "encoding/json"
"fmt"
"net/http" "net/http"
"net/url"
"strings" "strings"
"time" "time"
jwt "github.com/dgrijalva/jwt-go" "github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request" "github.com/dgrijalva/jwt-go/request"
fm "github.com/hacdias/filemanager" fm "github.com/hacdias/filemanager"
) )
type cred struct {
Password string `json:"password"`
Username string `json:"username"`
Recaptcha string `json:"recaptcha"`
}
// recaptcha checks the recaptcha code.
func recaptcha(secret string, response string) (bool, error) {
api := "https://www.google.com/recaptcha/api/siteverify"
body := url.Values{}
body.Set("secret", secret)
body.Add("response", response)
client := &http.Client{}
resp, err := client.Post(api, "application/x-www-form-urlencoded", bytes.NewBufferString(body.Encode()))
if err != nil {
return false, err
}
if resp.StatusCode != http.StatusOK {
return false, nil
}
var data struct {
Success bool `json:"success"`
ChallengeTS time.Time `json:"challenge_ts"`
Hostname string `json:"hostname"`
ErrorCodes interface{} `json:"error-codes"`
}
err = json.NewDecoder(resp.Body).Decode(&data)
if err != nil {
return false, err
}
return data.Success, nil
}
// authHandler proccesses the authentication for the user. // authHandler proccesses the authentication for the user.
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) { func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// NoAuth instances shouldn't call this method. // NoAuth instances shouldn't call this method.
@@ -19,7 +61,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
} }
// Receive the credentials from the request and unmarshal them. // Receive the credentials from the request and unmarshal them.
var cred fm.User var cred cred
if r.Body == nil { if r.Body == nil {
return http.StatusForbidden, nil return http.StatusForbidden, nil
} }
@@ -29,6 +71,19 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
return http.StatusForbidden, nil return http.StatusForbidden, nil
} }
// If ReCaptcha is enabled, check the code.
if len(c.ReCaptchaSecret) > 0 {
ok, err := recaptcha(c.ReCaptchaSecret, cred.Recaptcha)
if err != nil {
fmt.Println(err)
return http.StatusForbidden, err
}
if !ok {
return http.StatusForbidden, nil
}
}
// Checks if the user exists. // Checks if the user exists.
u, err := c.Store.Users.GetByUsername(cred.Username, c.NewFS) u, err := c.Store.Users.GetByUsername(cred.Username, c.NewFS)
if err != nil { if err != nil {
+11 -10
View File
@@ -25,16 +25,13 @@ func Handler(m *fm.FileManager) http.Handler {
if code >= 400 { if code >= 400 {
w.WriteHeader(code) w.WriteHeader(code)
if err == nil { txt := http.StatusText(code)
txt := http.StatusText(code) log.Printf("%v: %v %v\n", r.URL.Path, code, txt)
log.Printf("%v: %v %v\n", r.URL.Path, code, txt) w.Write([]byte(txt + "\n"))
w.Write([]byte(txt))
}
} }
if err != nil { if err != nil {
log.Print(err) log.Print(err)
w.Write([]byte(err.Error()))
} }
}) })
} }
@@ -226,10 +223,13 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
w.Header().Set("Content-Type", contentType+"; charset=utf-8") w.Header().Set("Content-Type", contentType+"; charset=utf-8")
data := map[string]interface{}{ data := map[string]interface{}{
"BaseURL": c.RootURL(), "BaseURL": c.RootURL(),
"NoAuth": c.NoAuth, "NoAuth": c.NoAuth,
"Version": fm.Version, "Version": fm.Version,
"CSS": template.CSS(c.CSS), "CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
"ReCaptchaSecret": c.ReCaptchaSecret,
} }
if c.StaticGen != nil { if c.StaticGen != nil {
@@ -267,6 +267,7 @@ func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, erro
info, err := os.Stat(s.Path) info, err := os.Stat(s.Path)
if err != nil { if err != nil {
c.Store.Share.Delete(s.Hash)
return ErrorToHTTP(err, false), err return ErrorToHTTP(err, false), err
} }
+8
View File
@@ -182,6 +182,7 @@ func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
} }
u.Password = pw u.Password = pw
u.ViewMode = fm.MosaicViewMode
// Saves the user to the database. // Saves the user to the database.
err = c.Store.Users.Save(u) err = c.Store.Users.Save(u)
@@ -268,6 +269,13 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
return http.StatusBadRequest, err return http.StatusBadRequest, err
} }
// If we're updating the default user. Only for NoAuth
// implementations. Used to change the viewMode.
if id == 0 && c.NoAuth {
c.DefaultUser.ViewMode = u.ViewMode
return http.StatusOK, nil
}
// Updates the CSS and locale. // Updates the CSS and locale.
if which == "partial" { if which == "partial" {
c.User.CSS = u.CSS c.User.CSS = u.CSS
+9 -9
View File
@@ -8055,15 +8055,6 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true "dev": true
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-length": { "string-length": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz", "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz",
@@ -8100,6 +8091,15 @@
} }
} }
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+1 -1
View File
@@ -1 +1 @@
36b9bba06c64cd83f3994bbb77fc36948d9d2dfe 9536ea589ebfb34b4ccbf549776ff8b4c70d6dd6