Compare commits

..

37 Commits

Author SHA1 Message Date
Henrique Dias
03bdc57334 chore: version 1.8.0
chore: remove mips and misple due to compiling issues

Former-commit-id: ff1ab1b2a7f565ab9a7ec641c2158451208b939c [formerly 4c3f92a99672985e351bba104bbdb39cb442567f] [formerly 62e767638a349586584ebf16a9bfaaeb5de485c9 [formerly 30d5603964]]
Former-commit-id: 2aaa5a5e38f5ffd2bd08de26dc87caaabf81399c [formerly 9aa15449ec3391649367d7df8f16224d6772b8b5]
Former-commit-id: 60c82bdb832ebd50f5d9a9c6997da617849f7920
2018-06-28 17:33:23 +01:00
Henrique Dias
00e80365da docs: update screenshots
Former-commit-id: a2c782005b0a6566852847628e13de89087b2f31 [formerly e07e40fb4b7a1c44d930758d8641d1005f04e504] [formerly 7cd48e4afc82cd96671004984121a053e0b19d4b [formerly 102df60321]]
Former-commit-id: c266b57797145bc48f47fb12eb41bfa0786198f7 [formerly 53e746f3706e233045b1e93eea2977bb84917b1d]
Former-commit-id: 234de2cfc43b74964ca92e91f3bfafe637bb1968
2018-06-28 17:10:29 +01:00
Henrique Dias
aeba656a3b chore: update dependencies
Former-commit-id: 923d89ba332e6cc8fe80acdb821bff6b4ec003ed [formerly 45291bd9bbed76416b79a0a24d37aa32cfc86afc] [formerly 8d52172856c5ca1bbd7d5426a42dd8129d0c1b3e [formerly acc6e575ef]]
Former-commit-id: 3636b2e136c09a89f60a4f74adf980bfb5bb1d2d [formerly 3b84ff7966be81f45145f2eabed6b5705dd6cf09]
Former-commit-id: 505b1e40ac3adf3a4aad59e6f769d1fd34b0408a
2018-06-28 13:32:13 +01:00
Vladyslav Tokarchuk
dd40590ee6 fix: directory "others" execute permission, close #300
Former-commit-id: 0b0798905c957972e4deb0a934593f8c06910160 [formerly d77b03128a8c6b28a07998be4a29e3cfa8c14345] [formerly 19c9cefe047c2ef0c43d03d37fc4633bc35fbdb9 [formerly a07b08dae5]]
Former-commit-id: 72b8c93ab89c5df491899b3e41be46090089b406 [formerly 4a3e4bbac51eb2cc5c2fb75cb6de8ed5da01a108]
Former-commit-id: 86a702dbd2daa2ce36e799f6fd8b2ec8957c6844
2018-06-27 12:27:41 +01:00
1138-4EB
3ffb64abcd Add logo (#436)
* Add new logo

* Add new logo to README

* center logo in the readme

* add icon and logo in multiple formats #417

* rename logo.* to banner.*, crop white space, add icon_raw


Former-commit-id: c52c4c30f8f3a21a0c53f64452bf242146600956 [formerly 2d1d1efcd07060e18d26a7ecb530087f66b93d88] [formerly 4ee282a565c0cf5bc7ee7c07b338530c4592aea4 [formerly c0531c129a]]
Former-commit-id: c00a2f847ba387a304bfc59248626a2636e05dc6 [formerly a86618d87d4490ae891d50dfa92f42e9117be2c6]
Former-commit-id: f670dda3f4713e070625a56a76dc264aa62bf0c2
2018-06-26 18:10:12 +08:00
Henrique Dias
2dbb080fa2 chore: setting untracked version [ci skip]
Former-commit-id: ab9c804efbf5c372bc72fb1692a892cdf6c03d9c [formerly 24fadc2ccb26cbde51949560642a4dcd05e8cb55] [formerly 041bb1d3b5bddf9e9d9a00a0d15bc107bde8597a [formerly e3162e7170]]
Former-commit-id: f7612d5ad4db40943017edca2c90cfa9e46cb42e [formerly ed73a7e4e7dda445a6810529b345fe07d296fdf6]
Former-commit-id: 1c20c6e4c26b88f4381ce672de174f465b844012
2018-05-20 14:57:11 +01:00
Henrique Dias
f014828ee6 chore: version 1.7.1
Former-commit-id: 5b1b7642b56050a35dd06e020fe666d54ac4608b [formerly 3f64b131efb30db09461791b0bcce8a45cde2fd7] [formerly 31799922e187b67442ca8d024304dbdfa37b76f8 [formerly a8c589172d]]
Former-commit-id: c034e606c858c02346bd6de223a8dae1c35cde6f [formerly d9ee0ae17078a3510552541b26ba50d4c1d48806]
Former-commit-id: f94753f8d2de4ef2c99c0e5a19a863c8e5c464fe
2018-05-20 14:56:25 +01:00
Equim
bab6b7760b fix name_template for arm arch
Former-commit-id: a6c02bbd245beec733e61853c0a2446d464779fb [formerly 0399fb8fd0458ca804df6786f2f2013dc92155ed] [formerly a4fb29cb77d6448beef4c6bba88c93f70ac1bd75 [formerly 347122153b]]
Former-commit-id: d7b0611d1e2d2c76f4b04a9faf681947b9973e52 [formerly fff496e7d33c0b9b81467a33c7398dc962efe941]
Former-commit-id: c7d63e5908af2541d7cf4444bdf1730eefe23c5a
2018-04-26 22:38:15 +08:00
1138-4EB
e278dbba65 Rename manager to browser (#406)
* rename File Manager to File Browser

* rename fm to fb


Former-commit-id: 82cd461b7efa992114a6cb6a3bb7fbae53558f42 [formerly 18b0295100462d2c798177086ddc3f615c50ca71] [formerly 5927828ac67268438cc6de00fcaf9140a8620794 [formerly 7643b0c4e3]]
Former-commit-id: 3661e0339db83f5e4e3afa9bcb1015401afb611d [formerly 50eb65db9848c8db82115913fb58399fc371d990]
Former-commit-id: 03e42a5b429a3f0a83c88799e086a4c51c5e031d
2018-04-23 22:42:52 +01:00
Henrique Dias
5a8c28fa6d Update package.json
Former-commit-id: 0481ae202a800cc772ecc73f2df6c34c7cd3c440 [formerly 39f2f5644324def07a26aeaba413009785edd01e] [formerly 1d8a679709a764eb3485cc235e78ea102f1eb2b1 [formerly cd0ab77388]]
Former-commit-id: 0539911bdb06bafddd89d01235444397653dfbdd [formerly cea0a516383ad638738b6bc4d0a12509cdc9daf8]
Former-commit-id: 4eeca9fed79ddce64b6c1da7dead970601541733
2018-04-23 20:29:16 +01:00
1138-4EB
e7e2edf76c fix #311, fix #312 (see filebrowser/frontend#7) (#405)
Former-commit-id: 2a2fe8e441a30073ff9dbb4ba4f6c6235709f158 [formerly 75aa9ca68f6fe2e20ff01d027c9c18e49fe75739] [formerly 371c60a517b81399929f520abc25462f7a271083 [formerly c6eb4fbac5]]
Former-commit-id: e501e318c908fd83ffe7a4984ea732385116aa97 [formerly c5a2a983c3960e2af98915b89a6abb3f2ae3bbde]
Former-commit-id: 90dd43012239882bf72855df4f538fa59f699d64
2018-04-23 20:21:18 +01:00
1138-4EB
dd2d02e492 fix309: merge CMD in the dockerfile to ENTRYPOINT (#397)
Former-commit-id: ca81d11e477ac00abf2998b69425f00a0fa9bfd3 [formerly 262790d3b7ddd904b38fc926658e275531ced99b] [formerly 7d2d31e627d5df0d2f78362a43a27d80725dd4be [formerly f7fdd6cc92]]
Former-commit-id: 097da2311051673f5bea9f851f1451938a7d1935 [formerly b7922bd40d932e03493345cdaca0541150d9a44e]
Former-commit-id: 6b915b5d648575b857d51dc885de675616509d18
2018-04-18 11:53:22 +01:00
Michael Lawson
735e74a858 Fix typo preventing "--allow-edit" from being set (#392)
Former-commit-id: 3762a51ff4883a37b27ba5f859c0633f46d9d7f6 [formerly e125c2f788f5c04c4546ddfc6d86fff1d6624142] [formerly 2d696d4c1857621a9f8ae8c0637a5f43d783c2a5 [formerly 54d0845212]]
Former-commit-id: b063d159d13c5024b79d7dd7bbb5770732efd7e7 [formerly d75479c0c17ca461e36930501ee415a4b8863319]
Former-commit-id: b4a1f4516594d07ff22894384713b0fcb5ba15d8
2018-04-06 05:24:32 +08:00
Henrique Dias
7fc2414476 chore: add more architectures and arm versions (#379)
closes #357

Former-commit-id: 3ee5cc7ba30971665983f9e4a6ff9c25736c02db [formerly a804a698af9226856a76451dc78b756ce9d97dcc] [formerly e1ec927e96a80c90d039efd85a706135f6d4725a [formerly 281339337d]]
Former-commit-id: 6cdd27c4d9ecdb019b99228cbe5641949efc71d6 [formerly dac19ea15f5c7fa6d4b5eaad1c3a5267ae561900]
Former-commit-id: 2a263d999de61788373209667fa8c67a4e3850ad
2018-03-11 22:05:57 +08:00
Henrique Dias
822b8f8e05 chore: setting untracked version [ci skip]
Former-commit-id: 1bf9470ebe3331bcf61f1335de88b4298d253d3c [formerly 360a3ff78b73dadb59a78dc96a4708a4e8e7669b] [formerly c09ce1961737ed92aa22960025e25c0c63847f3e [formerly 5facaf219f]]
Former-commit-id: 4716a43b6e1a3a107d9f9b586376c726e4362ebf [formerly 4ff2f3a2b977b0f1ccaf7eb7ebc8fd4b57f459a9]
Former-commit-id: d0dd7a8e05f6495882493978ed3507aefbdcbd25
2018-03-10 13:25:56 +00:00
Henrique Dias
2d63c288e4 chore: version 1.7.0
Former-commit-id: fad547009e94abcf390a7a9a5fbda912890f5558 [formerly 38266b3eac1f5b6f45d12fdfa83afcf7daa98e60] [formerly e36ec6f4c2b25002be967b4a5dc9566749ac8d42 [formerly 97d26e2348]]
Former-commit-id: 59730ce4eac5932e9d52ffd5dbe810f52f69f548 [formerly 327efa168ad4669b585228fd6b7ced76b261e1f7]
Former-commit-id: d325631f00a18d8fc6009f571b66192809cb8875
2018-03-10 13:25:46 +00:00
Henrique Dias
218a96eebd chore: update dependencies
Former-commit-id: 17c4e043823582d827f3de6a50fc48f2c60250a7 [formerly b1783b936da0e7ede97e128c0d73d20c4c0f5c1b] [formerly b170eca4528721f3269451f6fabeffa54d08fcb9 [formerly fbf49d61d6]]
Former-commit-id: b34516564cf6520f8c21693e287c092bc65b76e9 [formerly b45a4f2367831aee0e5def4096e34b6afb4b8a83]
Former-commit-id: b06ebe48ba6311fa50488aa26b0cc74118d4dfd7
2018-03-10 13:25:11 +00:00
Henrique Dias
4fbef557ee chore: setting untracked version [ci skip]
Former-commit-id: 0fbfd17b4531b45f781fb8517eb155ec953a98f2 [formerly 3a6821e11c979bc638eeb1d31458f1ff7605f69e] [formerly 0ecb209c4172fc504860f25325e03d78f4a12408 [formerly dc97fb7dc6]]
Former-commit-id: 18dc494d9c4b250dc451316ee6c342e0bc26a5e0 [formerly e375068391bba6b1e4c477895bcf054574c7865a]
Former-commit-id: eed4fd2cddeb199b22843a293e8471cb3a40ab0a
2018-03-10 09:00:56 +00:00
Henrique Dias
0a4c803650 chore: version 1.6.0
Former-commit-id: 9b5297726d87eb6617a8c99a1f8e23c9b4d7f1e2 [formerly e227cf02e128ba194fba68f9aca3ea61476e65f4] [formerly 4d23059dc7db2615079ea2364ea5db10663a27e5 [formerly 5f9d216542]]
Former-commit-id: 7676703b8cf5c681fd671a7fe457f4bcdeafcdc2 [formerly 13e2b075b1db00a8de95742ac1a377bdb8272585]
Former-commit-id: 64bfe1b140a3d98c1e6c77b1d225cfb7e5ed5055
2018-03-10 09:00:46 +00:00
Henrique Dias
68c5b8cd52 chore: remove failing arches
Former-commit-id: bca9d8ef1c447c295b564711e52271c233ee76aa [formerly a8b9b2c7706199b9e655f77f51193540af9dcdaa] [formerly e03e1f77be77d2f9ae853472c03197183e3d000e [formerly 4c197176fc]]
Former-commit-id: 0a904664f8bf4177eb1e573a3dbd2e71ffbd86b4 [formerly 74c0785f2cd7b5c92c910f9043b9ccc06433acbc]
Former-commit-id: 70a547ce5220e833f393a9c94b1d70c76fa708d1
2018-03-10 09:00:24 +00:00
Equim
0cff87be24 alternative ReCaptcha, close #366
Former-commit-id: c8c9baff75891868283bd353c83a19d38e6bc0e9 [formerly 88aeffc35a402c44c9c92a534c8cd271124826a7] [formerly 39cfd0e090894509e913100aa2f9b325ad6e5b68 [formerly 6e1c6a4a8c]]
Former-commit-id: a49c1046af3ba28c469e93e7d88013f5a6b1d062 [formerly 07c801b64ed03b187bb1dd9bbfb502b92572af44]
Former-commit-id: aa69ed3d4d78f8942b8b2c924c73c8e4c4965520
2018-02-27 17:12:54 +00:00
Equim
a2fcb8b3b0 feat: 6 bytes version of share link, close #331
Former-commit-id: a4a4edf89a32e9b8338474eb3322de69e12da83e [formerly 57124e6118adfbf0ae38ec77ce6816f6351174ad] [formerly 6d9e5b81bf0f52373147cb46d3c71d7e8e1362a7 [formerly f0a703baa7]]
Former-commit-id: 7da431b8bf791bdfe66fca2b0f87fc4b4918543b [formerly 4d02e3f0a697b912fb639b09857ae5daa0851ebf]
Former-commit-id: 87af8b945b414dad82d1c6769d6ec014e097aa22
2018-02-27 17:06:23 +00:00
Equim
5eb9e95720 chore: use dep to manage vendor (#364)
Former-commit-id: a5262bb5a3ca329e8d9d7f68bbcd932bcd4f5aa0 [formerly 38cda564a25a09a12a849a5ac756b55e895d8ac7] [formerly b70c0cf897f19e468259148fc75e9a60de5252ab [formerly a184b775b3]]
Former-commit-id: 1de8ed7a5b316b7a64cad814c0efc80b67a9668f [formerly 5ef584fce122832b7e9200e6a7c6259a2b0e3c09]
Former-commit-id: 7e11fda1d06bd57d16a03a17d7c3a644e46c451a
2018-02-25 08:55:48 +00:00
Henrique Dias
967d4e28de chore: setting untracked version [ci skip]
Former-commit-id: 093104cb4d68178bf5de22289d58c465fca10552 [formerly 17499e5eec1c3c54f9e1c699818ea823be3d6728] [formerly 0e561b7ea77348ba12e29173607062c6badccc88 [formerly 4bd2e8e333]]
Former-commit-id: 992c37c538e5aa2aec9b6504cf836f2dd6aea2c9 [formerly cf3727500421de16876ddc84462d48b5600e1946]
Former-commit-id: af2ab326c2092bc169a44622e56b10000d6091dc
2018-02-24 08:45:44 +00:00
Henrique Dias
ee53803fc2 chore: version 1.5.5
Former-commit-id: cee33f264a3b98f9e635203f38793a5b4147792f [formerly 0619dbb1ca27fb4b3f030a77c2a1eae4233f3c87] [formerly eb56b144bfc0ec579fac4abd31aae495f3ba3498 [formerly 04096b6d1e]]
Former-commit-id: 4630f7870de9502b05b9bfd84c0feb022220b20b [formerly 029af42ac358788458facfba9236265e78bf681a]
Former-commit-id: b4471eb6375f7a46fe7344f6e301ea88722d389e
2018-02-24 08:45:16 +00:00
Henrique Dias
fa2ab280aa chore: bump frontend version
Former-commit-id: a381a7cf11629dc1fd8c847299f90b931accf2c6 [formerly 8da5f9853d69fb4a77a9d563be75408a1c0abf26] [formerly d7eaec9372fea8b12154755ccfb5a527e7d4a105 [formerly b0e3ec25ba]]
Former-commit-id: d745e4d51195a9d054bec17809f6a2c4da296c94 [formerly 03513fff5e0c16d3a2d694e5e2a76465157b1bb1]
Former-commit-id: c94620ff90019ee0e725fd1fa16017368a8d9715
2018-02-24 08:44:31 +00:00
Henrique Dias
395801016b chore: setting untracked version [ci skip]
Former-commit-id: f35ba7ce165f0d16b5943a26f713cfdd701d1ea1 [formerly 6a439c90d9c04a9d7c946444f1177b328f2b4735] [formerly 85ae45844946d0f4575b5fb1929fecb9a9a56b1b [formerly 52803ddb26]]
Former-commit-id: 1678fc7a028b881e4e7c7a721adaf51120877b04 [formerly c5a6dcf31959b2444d38a93705edb7ade958122d]
Former-commit-id: 73bd93eac053a1857d034f30af66a3f1fee3bd36
2018-02-18 12:27:49 +00:00
Henrique Dias
30ed82a70f chore: version 1.5.4
Former-commit-id: 1ad07843678a00d0f24d490dbdbbe5c211782c91 [formerly f0328a485087490f0f6fb1bdb8751ce0377edb63] [formerly 381a1863aa910ba03b89b47769b575f6dc2869d6 [formerly 83af6f2720]]
Former-commit-id: 8bdb8c1913820d84a3b504a7d55c98cd675baa58 [formerly 6b84fde09c4e03b8d9504d9786ae953e69d83402]
Former-commit-id: 9ddd4867df78fcbf7cd8302ab408fef3cdbf8906
2018-02-18 12:27:38 +00:00
Henrique Dias
ab643cd0c4 fix: not being able to change settings (#359)
Former-commit-id: 6230e0e979ca561a778be5f1aa245e85adb808e9 [formerly a14bfa497f716aa95a6b24d04e09361f06ff0b31] [formerly 008421161a7563ce29631cd103eef34597dd211a [formerly 7e962180b2]]
Former-commit-id: 3ac8515e4d0d2fff862af27ef14b23a8a66226a6 [formerly 83798c187f0df689f85f4118140661f04c051d60]
Former-commit-id: 1edf72e1db7824b1a64fbd97889835d20d9af500
2018-02-18 12:26:07 +00:00
Henrique Dias
85e5beaa4a chore: setting untracked version [ci skip]
Former-commit-id: c61d0cbd94e07432d75926fdc2c23dc365674351 [formerly f48aae15e3a532a9988b63be960185fd839db46d] [formerly 7807dcf654b3a05c2743b63fbd63d3a42e4381fc [formerly d117e4d005]]
Former-commit-id: a8fcba07f677764ee58f5bde4f10cb7dddf18bef [formerly aba5eff7c0ea571e728322e33070a977323f194c]
Former-commit-id: 3eb36b35a1672e254b046131309556ee22b1845d
2018-02-18 10:03:45 +00:00
Henrique Dias
3cab34c68b chore: version 1.5.3
Former-commit-id: fdf8f683da6bfb0c9c5f653f89969ed28a5fac86 [formerly ba0afcdbb13ea6040a77397d9b5cc1844b04d3df] [formerly c5625bc490f452970645719cec512f62796da98e [formerly 13030c7ace]]
Former-commit-id: d3fd31bf729a46295c53b3bbd9f7d2c09ce1ed13 [formerly 8278bc090fd8b99ef07b3d376d1243f14c8aa7aa]
Former-commit-id: ca391495213b2523fbde1c2aef1ee7a7818715e2
2018-02-18 10:03:34 +00:00
Henrique Dias
8299f8ed06 chore: go 1.10 and fix linters
Former-commit-id: 289bceb9a90eb2422a69010863e7f2691eae357f [formerly b0cbba626a1185f95c6ce98d453cce99ee208e97] [formerly 90388476afb899550d56c82f836203e3d7942df6 [formerly 5c188d9dd4]]
Former-commit-id: a318b0f544706102d05a1f6faaeb2bbbd11ede29 [formerly 05b5bf7216959990c8cdccebae5fd91769aa9596]
Former-commit-id: af8ef1c7dc5926a9f6912249b2c0a334452c239b
2018-02-18 09:59:49 +00:00
Henrique Dias
da05c5048e fix: bypass errors on symbolic links
Former-commit-id: 20cd8429be62bbe7c4f2ee48f7dddc2f389d5117 [formerly f857fe8d323a25e00e193f959aac605d742d7f15] [formerly 2c4ef521c756b902b7914a42958c163db85c2cc3 [formerly df453ca634]]
Former-commit-id: a638071b19674d82400639a142cb32085c20d1d9 [formerly aaabe20901f149ec00f4eea1ac730a6cf9f30856]
Former-commit-id: 43a13d56401f6b18fee8cff4806f960cd5683314
2018-02-18 09:49:40 +00:00
Henrique Dias
071e1ec19b chore: setting untracked version [ci skip]
Former-commit-id: d3e7532c6a00a899c1447cca4cd995e1f8feab73 [formerly 4d445abd785ae0adb8c8d0d748efbffa4ac2d001] [formerly 098e184c167f80cf3780e043ce941b3b36ddb41e [formerly 22327703fd]]
Former-commit-id: 84da73349f055e544276fafd9d3b4663ebe4e7d9 [formerly 28a71db5fb466aedb66045068a20647f192d12ad]
Former-commit-id: dbdc0c0a3953dbdd941cd3310bedbfc3d957362a
2018-02-04 00:40:16 +01:00
Henrique Dias
8884e68806 chore: version 1.5.2
Former-commit-id: 590181d208cd1a1addabbffa5c860afe234fbc60 [formerly d04974b17bc5cb290eca029c8e99af7d8a8555e8] [formerly a138ec0dba4609b2093dea1091ec8a4141504ae9 [formerly 60026f943b]]
Former-commit-id: 09ecb88b44745c160aa1db5262d299ce249b95bc [formerly 8458b1c621fa766998da3a886ac990495cf771ae]
Former-commit-id: 0a0bb60c235a1a2a8b98282d9e63ca5defb7d90f
2018-02-04 00:40:06 +01:00
Henrique Dias
68bfbe5103 feat: readd caddy to this repo
Former-commit-id: cf48e35cd8c5ceff57d1353c75ffacd1de96e9ad [formerly d62bc138c736881547184977110cd622f2d31847] [formerly 4270b9fb5c907097ce6babffcedafccb5a8b6356 [formerly 385cfba0ff]]
Former-commit-id: 04e6142a81d677781664c9a79e960465fadd3eb4 [formerly 2152b2410fb078914c788bf7f15ca8028af54c58]
Former-commit-id: e88a3fce1b9d16421ce9c1aa9c63c90705878bd2
2018-02-04 00:38:07 +01:00
Henrique Dias
4a7bdfc59b chore: setting untracked version [ci skip]
Former-commit-id: bf80464d9d029dbe2ad94e6a0578767051edcd0e [formerly 338f2cc8d8e86b6666d692fa1497da3acf0bd5f7] [formerly 2ed27b9f856328760b427bc0ad19eb62a04aabc0 [formerly 05cca04f2e]]
Former-commit-id: a7f4dd93d50011d538a206f6d5e317407c33f8bf [formerly 2386141b2825821c379d15bb183fddad6eb80b4d]
Former-commit-id: 5014565536c407489923ec844f0818b9f671d2f4
2018-02-03 00:15:05 +01:00
40 changed files with 1740 additions and 298 deletions

View File

@@ -2,20 +2,23 @@ version: 2
jobs:
linting:
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
cd cmd/filebrowser && go get ./... && cd ../..
curl -sL -o $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
chmod +x $GOPATH/bin/dep
dep ensure -v
go get github.com/alecthomas/gometalinter
gometalinter --install
- run:
name: Run linting
command: |
gometalinter --exclude="rice-box.go" \
--deadline=300s \
-D goconst \
-D gocyclo \
-D vetshadow \
@@ -24,30 +27,31 @@ jobs:
-D gas
build:
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
cd cmd/filebrowser
go get ./...
curl -sL -o $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
chmod +x $GOPATH/bin/dep
dep ensure -v
- run:
name: Building
command: go build
command: go build github.com/filebrowser/filebrowser/cmd/filebrowser
deploy:
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
cd cmd/filebrowser
go get ./...
cd ../..
curl -sL -o $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
chmod +x $GOPATH/bin/dep
dep ensure -v
- run:
name: Deploy
command: curl -sL https://git.io/goreleaser | bash

View File

@@ -1,24 +1,24 @@
### 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.
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.
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?
### 2. What is your entire Caddyfile?
```text
(Put Caddyfile here)
```
### 3. What are you trying to do?
### 4. What did you expect to see?
### 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?
### Instructions (remove before submitting):
1. Are you asking for help with using Caddy or File Browser? Please use our forum instead: https://forum.caddyserver.com.
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.
4. If not using with Caddy, ignore questions 1 and 2.
### 1. Have you downloaded File Browser 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 Browser's repository?
### 2. What is your entire Caddyfile?
```text
(Put Caddyfile here)
```
### 3. What are you trying to do?
### 4. What did you expect to see?
### 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?

3
.gitignore vendored
View File

@@ -9,4 +9,5 @@ yarn-error.log*
.idea
.vscode
package-lock.json
yarn.lock
yarn.lock
vendor

View File

@@ -15,22 +15,24 @@ build:
- 386
- arm
- arm64
- mips
- mips64
- mipsle
- mips64le
goarm:
- 5
- 6
- 7
ignore:
- goos: darwin
goarch: 386
- goos: openbsd
goarch: arm
goarm: 6
- goos: freebsd
goarch: arm
goarm: 6
- goos: linux
goarch: arm64
- goos: netbsd
goarch: arm
- goos: solaris
goarch: arm
archive:
name_template: "{{.Os}}-{{.Arch}}-{{ .ProjectName }}"
name_template: "{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{ .ProjectName }}"
format: tar.gz
format_overrides:
- goos: windows

View File

@@ -1,24 +1,24 @@
FROM golang:alpine
COPY . /go/src/github.com/filebrowser/filebrowser
WORKDIR /go/src/github.com/filebrowser/filebrowser
RUN apk add --no-cache git
RUN go get ./...
WORKDIR /go/src/github.com/filebrowser/filebrowser/cmd/filebrowser
RUN CGO_ENABLED=0 go build -a
RUN mv filebrowser /go/bin/filebrowser
FROM scratch
COPY --from=0 /go/bin/filebrowser /filebrowser
VOLUME /tmp
VOLUME /srv
EXPOSE 80
COPY Docker.json /config.json
ENTRYPOINT ["/filebrowser"]
CMD ["--config", "/config.json"]
FROM golang:alpine
COPY . /go/src/github.com/filebrowser/filebrowser
WORKDIR /go/src/github.com/filebrowser/filebrowser
RUN apk add --no-cache git curl && \
curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 && \
chmod +x /usr/local/bin/dep
RUN dep ensure -vendor-only
WORKDIR /go/src/github.com/filebrowser/filebrowser/cmd/filebrowser
RUN CGO_ENABLED=0 go build -a
RUN mv filebrowser /go/bin/filebrowser
FROM scratch
COPY --from=0 /go/bin/filebrowser /filebrowser
VOLUME /tmp
VOLUME /srv
EXPOSE 80
COPY Docker.json /config.json
ENTRYPOINT ["/filebrowser", "--config", "/config.json"]

423
Gopkg.lock generated Normal file
View File

@@ -0,0 +1,423 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/BurntSushi/toml"
packages = ["."]
revision = "a368813c5e648fee92e5f6c30e3944ff9d5e8895"
[[projects]]
branch = "master"
name = "github.com/GeertJohan/go.rice"
packages = [
".",
"embedded"
]
revision = "c02ca9a983da5807ddf7d796784928f5be4afd09"
[[projects]]
branch = "master"
name = "github.com/aead/chacha20"
packages = [
".",
"chacha"
]
revision = "c8d29375923a8e1d2a0f0dc0fc1d8a0aba5b97ba"
[[projects]]
name = "github.com/asdine/storm"
packages = [
".",
"codec",
"codec/json",
"index",
"internal",
"q"
]
revision = "68fc73b635f890fe7ba2f3b15ce80c85b28a744f"
version = "v2.0.2"
[[projects]]
branch = "master"
name = "github.com/bifurcation/mint"
packages = [
".",
"syntax"
]
revision = "340be3ae8c0ff8edce24cf59e7acdb1432bd5ce5"
[[projects]]
name = "github.com/chaseadamsio/goorgeous"
packages = ["."]
revision = "dcf1ef873b8987bf12596fe6951c48347986eb2f"
version = "v1.1.0"
[[projects]]
branch = "master"
name = "github.com/codahale/aesnicheck"
packages = ["."]
revision = "349fcc471aaccc29cd074e1275f1a494323826cd"
[[projects]]
name = "github.com/coreos/bbolt"
packages = ["."]
revision = "583e8937c61f1af6513608ccc75c97b6abdf4ff9"
version = "v1.3.0"
[[projects]]
branch = "master"
name = "github.com/daaku/go.zipexe"
packages = ["."]
revision = "a5fe2436ffcb3236e175e5149162b41cd28bd27d"
[[projects]]
name = "github.com/dgrijalva/jwt-go"
packages = [
".",
"request"
]
revision = "dbeaa9332f19a944acb5736b4456cfcc02140e29"
version = "v3.1.0"
[[projects]]
branch = "master"
name = "github.com/dsnet/compress"
packages = [
".",
"bzip2",
"bzip2/internal/sais",
"internal",
"internal/errors",
"internal/prefix"
]
revision = "cc9eb1d7ad760af14e8f918698f745e80377af4f"
[[projects]]
branch = "master"
name = "github.com/flynn/go-shlex"
packages = ["."]
revision = "3f9db97f856818214da2e1057f8ad84803971cff"
[[projects]]
name = "github.com/fsnotify/fsnotify"
packages = ["."]
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
name = "github.com/gohugoio/hugo"
packages = ["parser"]
revision = "25e88ccabe9b04c42ffb43528c86743f623fac46"
version = "v0.36.1"
[[projects]]
branch = "master"
name = "github.com/golang/snappy"
packages = ["."]
revision = "553a641470496b2327abcac10b36396bd98e45c9"
[[projects]]
name = "github.com/gorilla/websocket"
packages = ["."]
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
version = "v1.2.0"
[[projects]]
branch = "master"
name = "github.com/hacdias/fileutils"
packages = ["."]
revision = "76b1c6ab906773727a1ce2f7fb22830685166f85"
[[projects]]
branch = "master"
name = "github.com/hacdias/varutils"
packages = ["."]
revision = "82d3b57f667a756cfc4b1535951b46878881f3e1"
[[projects]]
branch = "master"
name = "github.com/hashicorp/go-syslog"
packages = ["."]
revision = "326bf4a7f709d263f964a6a96558676b103f3534"
[[projects]]
branch = "master"
name = "github.com/hashicorp/golang-lru"
packages = [
".",
"simplelru"
]
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
[[projects]]
branch = "master"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token"
]
revision = "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8"
[[projects]]
branch = "master"
name = "github.com/kardianos/osext"
packages = ["."]
revision = "ae77be60afb1dcacde03767a8c37337fad28ac14"
[[projects]]
branch = "master"
name = "github.com/lucas-clemente/aes12"
packages = ["."]
revision = "cd47fb39b79f867c6e4e5cd39cf7abd799f71670"
[[projects]]
branch = "master"
name = "github.com/lucas-clemente/fnv128a"
packages = ["."]
revision = "393af48d391698c6ae4219566bfbdfef67269997"
[[projects]]
name = "github.com/lucas-clemente/quic-go"
packages = [
".",
"h2quic",
"internal/ackhandler",
"internal/congestion",
"internal/crypto",
"internal/flowcontrol",
"internal/handshake",
"internal/protocol",
"internal/utils",
"internal/wire",
"qerr"
]
revision = "30851b9a3b4e958490b476fe72adafa67641361a"
version = "v0.7.0"
[[projects]]
branch = "master"
name = "github.com/lucas-clemente/quic-go-certificates"
packages = ["."]
revision = "d2f86524cced5186554df90d92529757d22c1cb6"
[[projects]]
name = "github.com/magiconair/properties"
packages = ["."]
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
version = "v1.7.6"
[[projects]]
name = "github.com/mholt/archiver"
packages = ["."]
revision = "26cf5bb32d07aa4e8d0de15f56ce516f4641d7df"
[[projects]]
name = "github.com/mholt/caddy"
packages = [
".",
"caddyfile",
"caddyhttp/httpserver",
"caddyhttp/staticfiles",
"caddytls"
]
revision = "d3f338ddab9ee24b376b5c9c51e202581e2d43ba"
version = "v0.10.11"
[[projects]]
name = "github.com/miekg/dns"
packages = ["."]
revision = "5364553f1ee9cddc7ac8b62dce148309c386695b"
version = "v1.0.4"
[[projects]]
branch = "master"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
[[projects]]
branch = "master"
name = "github.com/nwaples/rardecode"
packages = ["."]
revision = "e06696f847aeda6f39a8f0b7cdff193b7690aef6"
[[projects]]
name = "github.com/pelletier/go-toml"
packages = ["."]
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
version = "v1.1.0"
[[projects]]
name = "github.com/pierrec/lz4"
packages = ["."]
revision = "2fcda4cb7018ce05a25959d2fe08c83e3329f169"
version = "v1.1"
[[projects]]
name = "github.com/pierrec/xxHash"
packages = ["xxHash32"]
revision = "f051bb7f1d1aaf1b5a665d74fb6b0217712c69f7"
version = "v0.1.1"
[[projects]]
name = "github.com/robfig/cron"
packages = ["."]
revision = "b024fc5ea0e34bc3f83d9941c8d60b0622bfaca4"
version = "v1"
[[projects]]
name = "github.com/russross/blackfriday"
packages = ["."]
revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
version = "v1.5"
[[projects]]
branch = "master"
name = "github.com/shurcooL/sanitized_anchor_name"
packages = ["."]
revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
[[projects]]
name = "github.com/spf13/afero"
packages = [
".",
"mem"
]
revision = "bb8f1927f2a9d3ab41c9340aa034f6b803f4359c"
version = "v1.0.2"
[[projects]]
name = "github.com/spf13/cast"
packages = ["."]
revision = "8965335b8c7107321228e3e3702cab9832751bac"
version = "v1.2.0"
[[projects]]
branch = "master"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
[[projects]]
name = "github.com/spf13/pflag"
packages = ["."]
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
version = "v1.0.0"
[[projects]]
name = "github.com/spf13/viper"
packages = ["."]
revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7"
version = "v1.0.0"
[[projects]]
name = "github.com/ulikunitz/xz"
packages = [
".",
"internal/hash",
"internal/xlog",
"lzma"
]
revision = "0c6b41e72360850ca4f98dc341fd999726ea007f"
version = "v0.5.4"
[[projects]]
name = "github.com/xenolf/lego"
packages = ["acme"]
revision = "67c86d860a797ce2483f50d9174d4ed24984bef2"
version = "v0.4.1"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
packages = [
"bcrypt",
"blowfish",
"curve25519",
"ed25519",
"ed25519/internal/edwards25519",
"hkdf",
"ocsp"
]
revision = "49796115aa4b964c318aad4f3084fdb41e9aa067"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = [
"bpf",
"http2",
"http2/hpack",
"idna",
"internal/iana",
"internal/socket",
"ipv4",
"ipv6",
"lex/httplex",
"publicsuffix"
]
revision = "cbe0f9307d0156177f9dd5dc85da1a31abc5f2fb"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "88d2dcc510266da9f7f8c7f34e1940716cab5f5c"
[[projects]]
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable"
]
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
name = "gopkg.in/natefinch/lumberjack.v2"
packages = ["."]
revision = "a96e63847dc3c67d17befa69c303767e2f84e54f"
version = "v2.1"
[[projects]]
name = "gopkg.in/square/go-jose.v1"
packages = [
".",
"cipher",
"json"
]
revision = "aa2e30fdd1fe9dd3394119af66451ae790d50e0d"
version = "v1.1.0"
[[projects]]
name = "gopkg.in/yaml.v2"
packages = ["."]
revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5"
version = "v2.1.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1f68bed4490068370884abaa296aa651c27b3f2e0d0451a1ab567f059d44f820"
solver-name = "gps-cdcl"
solver-version = 1

70
Gopkg.toml Normal file
View File

@@ -0,0 +1,70 @@
[[constraint]]
branch = "master"
name = "github.com/GeertJohan/go.rice"
[[constraint]]
name = "github.com/asdine/storm"
version = "2.0.2"
[[constraint]]
name = "github.com/dgrijalva/jwt-go"
version = "3.1.0"
[[constraint]]
name = "github.com/gohugoio/hugo"
version = "0.36.1"
[[constraint]]
name = "github.com/gorilla/websocket"
version = "1.2.0"
[[constraint]]
branch = "master"
name = "github.com/hacdias/fileutils"
[[constraint]]
branch = "master"
name = "github.com/hacdias/varutils"
[[constraint]]
name = "github.com/mholt/archiver"
# TODO: switch to version when it's available
# this is for Archiver.Write() which was introduced in 548c791
revision = "26cf5bb32d07aa4e8d0de15f56ce516f4641d7df"
# version = "2.0.0"
[[constraint]]
name = "github.com/mholt/caddy"
version = "0.10.11"
[[constraint]]
branch = "master"
name = "github.com/mitchellh/mapstructure"
[[constraint]]
name = "github.com/robfig/cron"
version = "1.0.0"
[[constraint]]
name = "github.com/spf13/pflag"
version = "1.0.0"
[[constraint]]
name = "github.com/spf13/viper"
version = "1.0.0"
[[constraint]]
branch = "master"
name = "golang.org/x/crypto"
[[constraint]]
name = "gopkg.in/natefinch/lumberjack.v2"
version = "2.1.0"
[[override]]
name = "github.com/russross/blackfriday"
version = "^1.0.0"
[prune]
go-tests = true
unused-packages = true

154
README.md
View File

@@ -1,75 +1,79 @@
![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif)
# filebrowser
[![CircleCI](https://img.shields.io/circleci/project/github/filebrowser/filebrowser.svg?style=flat-square)](https://circleci.com/gh/filebrowser/filebrowser)
[![Go Report Card](https://goreportcard.com/badge/github.com/filebrowser/filebrowser?style=flat-square)](https://goreportcard.com/report/github.com/filebrowser/filebrowser)
[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/filebrowser/filebrowser)
[![Version](https://img.shields.io/github/release/filebrowser/filebrowser.svg?style=flat-square)](https://github.com/filebrowser/filebrowser/releases/latest)
filebrowser 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
+ [Getting started](#getting-started)
+ [Features](#features)
- [Users](#users)
- [Search](#search)
+ [Contributing](#contributing)
+ [Donate](#donate)
# Getting started
You can find the Getting Started guide on the [documentation](https://filebrowser.github.io/quick-start/).
# Features
Easy login system.
![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*.
![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.
![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.
![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.
## 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!).
![Users](https://user-images.githubusercontent.com/5447088/28432386-977f388a-6d7f-11e7-9006-87d16f05f1f8.jpg)
## Search
File Browser allows you to search through your files and it has some options. By default, your search will be something like this:
```
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:
```
"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.
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
```
# Contributing
The contributing guidelines can be found [here](https://github.com/filebrowser/community).
<p align="center">
<img src="logo/banner.png" width="550"/>
</p>
![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif)
# filebrowser
[![CircleCI](https://img.shields.io/circleci/project/github/filebrowser/filebrowser.svg?style=flat-square)](https://circleci.com/gh/filebrowser/filebrowser)
[![Go Report Card](https://goreportcard.com/badge/github.com/filebrowser/filebrowser?style=flat-square)](https://goreportcard.com/report/github.com/filebrowser/filebrowser)
[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/filebrowser/filebrowser)
[![Version](https://img.shields.io/github/release/filebrowser/filebrowser.svg?style=flat-square)](https://github.com/filebrowser/filebrowser/releases/latest)
filebrowser 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
+ [Getting started](#getting-started)
+ [Features](#features)
- [Users](#users)
- [Search](#search)
+ [Contributing](#contributing)
+ [Donate](#donate)
# Getting started
You can find the Getting Started guide on the [documentation](https://filebrowser.github.io/quick-start/).
# Features
Easy login system.
![Login Page](https://user-images.githubusercontent.com/5447088/42046516-fe702976-7af5-11e8-9d72-c996150b09f5.png)
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/42046515-fe3f7d58-7af5-11e8-8f87-270947ed755f.png)
File Browser 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/42046519-ff17b81c-7af5-11e8-90f3-184e0ad24b7c.png)
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/42046517-fea206e4-7af5-11e8-88fe-b88513b43f43.png)
We also allow the users to search in the directories and execute commands if allowed.
## 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!).
![Users](https://user-images.githubusercontent.com/5447088/42046518-fed14440-7af5-11e8-9a57-f4a611e9598d.png)
## Search
File Browser allows you to search through your files and it has some options. By default, your search will be something like this:
```
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:
```
"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.
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
```
# Contributing
The contributing guidelines can be found [here](https://github.com/filebrowser/community).

View File

@@ -2,7 +2,7 @@ package bolt
import (
"github.com/asdine/storm"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
// ConfigStore is a configuration store.
@@ -14,7 +14,7 @@ type ConfigStore struct {
func (c ConfigStore) Get(name string, to interface{}) error {
err := c.DB.Get("config", name, to)
if err == storm.ErrNotFound {
return fm.ErrNotExist
return fb.ErrNotExist
}
return err

View File

@@ -3,7 +3,7 @@ package bolt
import (
"github.com/asdine/storm"
"github.com/asdine/storm/q"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
// ShareStore is a shareable links store.
@@ -12,55 +12,55 @@ type ShareStore struct {
}
// Get gets a Share Link from an hash.
func (s ShareStore) Get(hash string) (*fm.ShareLink, error) {
var v fm.ShareLink
func (s ShareStore) Get(hash string) (*fb.ShareLink, error) {
var v fb.ShareLink
err := s.DB.One("Hash", hash, &v)
if err == storm.ErrNotFound {
return nil, fm.ErrNotExist
return nil, fb.ErrNotExist
}
return &v, err
}
// GetPermanent gets the permanent link from a path.
func (s ShareStore) GetPermanent(path string) (*fm.ShareLink, error) {
var v fm.ShareLink
func (s ShareStore) GetPermanent(path string) (*fb.ShareLink, error) {
var v fb.ShareLink
err := s.DB.Select(q.Eq("Path", path), q.Eq("Expires", false)).First(&v)
if err == storm.ErrNotFound {
return nil, fm.ErrNotExist
return nil, fb.ErrNotExist
}
return &v, err
}
// GetByPath gets all the links for a specific path.
func (s ShareStore) GetByPath(hash string) ([]*fm.ShareLink, error) {
var v []*fm.ShareLink
func (s ShareStore) GetByPath(hash string) ([]*fb.ShareLink, error) {
var v []*fb.ShareLink
err := s.DB.Find("Path", hash, &v)
if err == storm.ErrNotFound {
return v, fm.ErrNotExist
return v, fb.ErrNotExist
}
return v, err
}
// Gets retrieves all the shareable links.
func (s ShareStore) Gets() ([]*fm.ShareLink, error) {
var v []*fm.ShareLink
func (s ShareStore) Gets() ([]*fb.ShareLink, error) {
var v []*fb.ShareLink
err := s.DB.All(&v)
if err == storm.ErrNotFound {
return v, fm.ErrNotExist
return v, fb.ErrNotExist
}
return v, err
}
// Save stores a Share Link on the database.
func (s ShareStore) Save(l *fm.ShareLink) error {
func (s ShareStore) Save(l *fb.ShareLink) error {
return s.DB.Save(l)
}
// Delete deletes a Share Link from the database.
func (s ShareStore) Delete(hash string) error {
return s.DB.DeleteStruct(&fm.ShareLink{Hash: hash})
return s.DB.DeleteStruct(&fb.ShareLink{Hash: hash})
}

View File

@@ -0,0 +1,52 @@
package filemanager
import (
"net/http"
"github.com/filebrowser/filebrowser"
"github.com/filebrowser/filebrowser/caddy/parser"
h "github.com/filebrowser/filebrowser/http"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
func init() {
caddy.RegisterPlugin("filemanager", caddy.Plugin{
ServerType: "http",
Action: setup,
})
}
type plugin struct {
Next httpserver.Handler
Configs []*filebrowser.FileBrowser
}
// ServeHTTP determines if the request is for this plugin, and if all prerequisites are met.
func (f plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
for i := range f.Configs {
// Checks if this Path should be handled by File Manager.
if !httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) {
continue
}
h.Handler(f.Configs[i]).ServeHTTP(w, r)
return 0, nil
}
return f.Next.ServeHTTP(w, r)
}
// setup configures a new FileManager middleware instance.
func setup(c *caddy.Controller) error {
configs, err := parser.Parse(c, "")
if err != nil {
return err
}
httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
return plugin{Configs: configs, Next: next}
})
return nil
}

52
caddy/hugo/hugo.go Normal file
View File

@@ -0,0 +1,52 @@
package hugo
import (
"net/http"
"github.com/filebrowser/filebrowser"
"github.com/filebrowser/filebrowser/caddy/parser"
h "github.com/filebrowser/filebrowser/http"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
func init() {
caddy.RegisterPlugin("hugo", caddy.Plugin{
ServerType: "http",
Action: setup,
})
}
type plugin struct {
Next httpserver.Handler
Configs []*filebrowser.FileBrowser
}
// ServeHTTP determines if the request is for this plugin, and if all prerequisites are met.
func (f plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
for i := range f.Configs {
// Checks if this Path should be handled by File Manager.
if !httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) {
continue
}
h.Handler(f.Configs[i]).ServeHTTP(w, r)
return 0, nil
}
return f.Next.ServeHTTP(w, r)
}
// setup configures a new FileManager middleware instance.
func setup(c *caddy.Controller) error {
configs, err := parser.Parse(c, "hugo")
if err != nil {
return err
}
httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
return plugin{Configs: configs, Next: next}
})
return nil
}

52
caddy/jekyll/jekyll.go Normal file
View File

@@ -0,0 +1,52 @@
package jekyll
import (
"net/http"
"github.com/filebrowser/filebrowser"
"github.com/filebrowser/filebrowser/caddy/parser"
h "github.com/filebrowser/filebrowser/http"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
func init() {
caddy.RegisterPlugin("jekyll", caddy.Plugin{
ServerType: "http",
Action: setup,
})
}
type plugin struct {
Next httpserver.Handler
Configs []*filebrowser.FileBrowser
}
// ServeHTTP determines if the request is for this plugin, and if all prerequisites are met.
func (f plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
for i := range f.Configs {
// Checks if this Path should be handled by File Manager.
if !httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) {
continue
}
h.Handler(f.Configs[i]).ServeHTTP(w, r)
return 0, nil
}
return f.Next.ServeHTTP(w, r)
}
// setup configures a new FileManager middleware instance.
func setup(c *caddy.Controller) error {
configs, err := parser.Parse(c, "jekyll")
if err != nil {
return err
}
httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
return plugin{Configs: configs, Next: next}
})
return nil
}

312
caddy/parser/parser.go Normal file
View File

@@ -0,0 +1,312 @@
package parser
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/asdine/storm"
"github.com/filebrowser/filebrowser"
"github.com/filebrowser/filebrowser/bolt"
"github.com/filebrowser/filebrowser/staticgen"
"github.com/hacdias/fileutils"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
var databases = map[string]*storm.DB{}
// Parse ...
func Parse(c *caddy.Controller, plugin string) ([]*filebrowser.FileBrowser, error) {
var (
configs []*filebrowser.FileBrowser
err error
)
for c.Next() {
u := &filebrowser.User{
Locale: "en",
AllowCommands: true,
AllowEdit: true,
AllowNew: true,
AllowPublish: true,
Commands: []string{"git", "svn", "hg"},
CSS: "",
ViewMode: "mosaic",
Rules: []*filebrowser.Rule{{
Regex: true,
Allow: false,
Regexp: &filebrowser.Regexp{Raw: "\\/\\..+"},
}},
}
baseURL := "/"
scope := "."
database := ""
noAuth := false
alterRecaptcha := false
reCaptchaKey := ""
reCaptchaSecret := ""
if plugin != "" {
baseURL = "/admin"
}
// Get the baseURL and scope
args := c.RemainingArgs()
if plugin == "" {
if len(args) >= 1 {
baseURL = args[0]
}
if len(args) > 1 {
scope = args[1]
}
} else {
if len(args) >= 1 {
scope = args[0]
}
if len(args) > 1 {
baseURL = args[1]
}
}
for c.NextBlock() {
switch c.Val() {
case "database":
if !c.NextArg() {
return nil, c.ArgErr()
}
database = c.Val()
case "locale":
if !c.NextArg() {
return nil, c.ArgErr()
}
u.Locale = c.Val()
case "allow_commands":
if !c.NextArg() {
u.AllowCommands = true
continue
}
u.AllowCommands, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
case "allow_edit":
if !c.NextArg() {
u.AllowEdit = true
continue
}
u.AllowEdit, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
case "allow_new":
if !c.NextArg() {
u.AllowNew = true
continue
}
u.AllowNew, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
case "allow_publish":
if !c.NextArg() {
u.AllowPublish = true
continue
}
u.AllowPublish, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
case "commands":
if !c.NextArg() {
return nil, c.ArgErr()
}
u.Commands = strings.Split(c.Val(), " ")
case "css":
if !c.NextArg() {
return nil, c.ArgErr()
}
file := c.Val()
css, err := ioutil.ReadFile(file)
if err != nil {
return nil, err
}
u.CSS = string(css)
case "view_mode":
if !c.NextArg() {
return nil, c.ArgErr()
}
u.ViewMode = c.Val()
if u.ViewMode != filebrowser.MosaicViewMode && u.ViewMode != filebrowser.ListViewMode {
return nil, c.ArgErr()
}
case "alternative_recaptcha":
if !c.NextArg() {
alterRecaptcha = true
continue
}
alterRecaptcha, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
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":
if !c.NextArg() {
noAuth = true
continue
}
noAuth, err = strconv.ParseBool(c.Val())
if err != nil {
return nil, err
}
}
}
caddyConf := httpserver.GetConfig(c)
path := filepath.Join(caddy.AssetsPath(), "filemanager")
err := os.MkdirAll(path, 0700)
if err != nil {
return nil, err
}
// if there is a database path and it is not absolute,
// it will be relative to Caddy folder.
if !filepath.IsAbs(database) && database != "" {
database = filepath.Join(path, database)
}
// If there is no database path on the settings,
// store one in .caddy/filemanager/name.db.
if database == "" {
// The name of the database is the hashed value of a string composed
// by the host, address path and the baseurl of this File Manager
// instance.
hasher := md5.New()
hasher.Write([]byte(caddyConf.Addr.Host + caddyConf.Addr.Path + baseURL))
sha := hex.EncodeToString(hasher.Sum(nil))
database = filepath.Join(path, sha+".db")
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")
}
u.Scope = scope
u.FileSystem = fileutils.Dir(scope)
var db *storm.DB
if stored, ok := databases[database]; ok {
db = stored
} else {
db, err = storm.Open(database)
databases[database] = db
}
if err != nil {
return nil, err
}
recaptchaHost := "https://www.google.com"
if alterRecaptcha {
recaptchaHost = "https://recaptcha.net"
}
m := &filebrowser.FileBrowser{
NoAuth: noAuth,
BaseURL: "",
PrefixURL: "",
ReCaptchaHost: recaptchaHost,
ReCaptchaKey: reCaptchaKey,
ReCaptchaSecret: reCaptchaSecret,
DefaultUser: u,
Store: &filebrowser.Store{
Config: bolt.ConfigStore{DB: db},
Users: bolt.UsersStore{DB: db},
Share: bolt.ShareStore{DB: db},
},
NewFS: func(scope string) filebrowser.FileSystem {
return fileutils.Dir(scope)
},
}
err = m.Setup()
if err != nil {
return nil, err
}
switch plugin {
case "hugo":
// Initialize the default settings for Hugo.
hugo := &staticgen.Hugo{
Root: scope,
Public: filepath.Join(scope, "public"),
Args: []string{},
CleanPublic: true,
}
// Attaches Hugo plugin to this file manager instance.
err = m.Attach(hugo)
if err != nil {
return nil, err
}
case "jekyll":
// Initialize the default settings for Jekyll.
jekyll := &staticgen.Jekyll{
Root: scope,
Public: filepath.Join(scope, "_site"),
Args: []string{},
CleanPublic: true,
}
// Attaches Hugo plugin to this file manager instance.
err = m.Attach(jekyll)
if err != nil {
return nil, err
}
}
if err != nil {
return nil, err
}
m.NoAuth = noAuth
m.SetBaseURL(baseURL)
m.SetPrefixURL(strings.TrimSuffix(caddyConf.Addr.Path, "/"))
configs = append(configs, m)
}
return configs, nil
}

View File

@@ -44,6 +44,7 @@ var (
allowNew bool
allowPublish bool
showVer bool
alterRecaptcha bool
)
func init() {
@@ -64,6 +65,7 @@ func init() {
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(&noAuth, "no-auth", false, "Disables authentication")
flag.BoolVar(&alterRecaptcha, "alternative-recaptcha", false, "Use recaptcha.net for serving and handling, useful in China")
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.BoolVarP(&showVer, "version", "v", false, "Show version")
@@ -86,6 +88,7 @@ func setupViper() {
viper.SetDefault("BaseURL", "")
viper.SetDefault("PrefixURL", "")
viper.SetDefault("ViewMode", filebrowser.MosaicViewMode)
viper.SetDefault("AlternativeRecaptcha", false)
viper.SetDefault("ReCaptchaKey", "")
viper.SetDefault("ReCaptchaSecret", "")
@@ -97,7 +100,7 @@ func setupViper() {
viper.BindPFlag("Commands", flag.Lookup("commands"))
viper.BindPFlag("AllowCommands", flag.Lookup("allow-commands"))
viper.BindPFlag("AllowEdit", flag.Lookup("allow-edit"))
viper.BindPFlag("AlowNew", flag.Lookup("allow-new"))
viper.BindPFlag("AllowNew", flag.Lookup("allow-new"))
viper.BindPFlag("AllowPublish", flag.Lookup("allow-publish"))
viper.BindPFlag("Locale", flag.Lookup("locale"))
viper.BindPFlag("StaticGen", flag.Lookup("staticgen"))
@@ -105,6 +108,7 @@ func setupViper() {
viper.BindPFlag("BaseURL", flag.Lookup("baseurl"))
viper.BindPFlag("PrefixURL", flag.Lookup("prefixurl"))
viper.BindPFlag("ViewMode", flag.Lookup("view-mode"))
viper.BindPFlag("AlternativeRecaptcha", flag.Lookup("alternative-recaptcha"))
viper.BindPFlag("ReCaptchaKey", flag.Lookup("recaptcha-key"))
viper.BindPFlag("ReCaptchaSecret", flag.Lookup("recaptcha-secret"))
@@ -186,10 +190,16 @@ func handler() http.Handler {
log.Fatal(err)
}
recaptchaHost := "https://www.google.com"
if viper.GetBool("AlternativeRecaptcha") {
recaptchaHost = "https://recaptcha.net"
}
fm := &filebrowser.FileBrowser{
NoAuth: viper.GetBool("NoAuth"),
BaseURL: viper.GetString("BaseURL"),
PrefixURL: viper.GetString("PrefixURL"),
ReCaptchaHost: recaptchaHost,
ReCaptchaKey: viper.GetString("ReCaptchaKey"),
ReCaptchaSecret: viper.GetString("ReCaptchaSecret"),
DefaultUser: &filebrowser.User{

8
doc.go
View File

@@ -1,7 +1,7 @@
/*
Package filebrowser provides a web interface to access your files
wherever you are. To use this package as a middleware for your app,
you'll need to import both File Manager and File Manager HTTP packages.
you'll need to import both File Browser and File Browser HTTP packages.
import (
fm "github.com/filebrowser/filebrowser"
@@ -49,11 +49,11 @@ functions:
m.SetPrefixURL("/")
The Prefix URL is a part of the path that is already stripped from the
r.URL.Path variable before the request arrives to File Manager's handler.
r.URL.Path variable before the request arrives to File Browser's handler.
This is a function that will rarely be used. You can see one example on Caddy
filemanager plugin.
The Base URL is the URL path where you want File Manager to be available in. If
The Base URL is the URL path where you want File Browser to be available in. If
you want to be available at the root path, you should call:
m.SetBaseURL("/")
@@ -62,7 +62,7 @@ But if you want to access it at '/admin', you would call:
m.SetBaseURL("/admin")
Now, that you already have a File Manager instance created, you just need to
Now, that you already have a File Browser instance created, you just need to
add it to your handlers using m.ServeHTTP which is compatible to http.Handler.
We also have a m.ServeWithErrorsHTTP that returns the status code and an error.

View File

@@ -134,13 +134,12 @@ func (i *File) GetListing(u *User, r *http.Request) error {
}
if strings.HasPrefix(f.Mode().String(), "L") {
// It's a symbolic link
// The FileInfo from Readdir treats symbolic link as a file only.
// It's a symbolic link. We try to follow it. If it doesn't work,
// we stay with the link information instead if the target's.
info, err := os.Stat(f.Name())
if err != nil {
return err
if err == nil {
f = info
}
f = info
}
if f.IsDir() {

View File

@@ -22,8 +22,8 @@ import (
)
const (
// Version is the current File Manager version.
Version = "1.5.1"
// Version is the current File Browser version.
Version = "1.8.0"
ListViewMode = "list"
MosaicViewMode = "mosaic"
@@ -58,7 +58,7 @@ type FileBrowser struct {
Store *Store
// PrefixURL is a part of the URL that is already trimmed from the request URL before it
// arrives to our handlers. It may be useful when using File Manager as a middleware
// arrives to our handlers. It may be useful when using File Browser as a middleware
// such as in caddy-filemanager plugin. It is only useful in certain situations.
PrefixURL string
@@ -71,7 +71,8 @@ type FileBrowser struct {
// there will only exist one user, called "admin".
NoAuth bool
// ReCaptcha Site key and secret.
// ReCaptcha host, key and secret.
ReCaptchaHost string
ReCaptchaKey string
ReCaptchaSecret string
@@ -114,9 +115,9 @@ type FSBuilder func(scope string) FileSystem
// Setup loads the configuration from the database and configures
// the Assets and the Cron job. It must always be run after
// creating a File Manager object.
// creating a File Browser object.
func (m *FileBrowser) Setup() error {
// Creates a new File Manager instance with the Users
// Creates a new File Browser instance with the Users
// map and Assets box.
m.Assets = rice.MustFindBox("./node_modules/filebrowser-frontend/dist")
m.Cron = cron.New()
@@ -220,7 +221,7 @@ func (m *FileBrowser) Setup() error {
}
// RootURL returns the actual URL where
// File Manager interface can be accessed.
// File Browser interface can be accessed.
func (m FileBrowser) RootURL() string {
return m.PrefixURL + m.BaseURL
}
@@ -234,7 +235,7 @@ func (m *FileBrowser) SetPrefixURL(url string) {
m.PrefixURL = strings.TrimSuffix(url, "/")
}
// SetBaseURL updates the baseURL of a File Manager
// SetBaseURL updates the baseURL of a File Browser
// object.
func (m *FileBrowser) SetBaseURL(url string) {
url = strings.TrimPrefix(url, "/")
@@ -243,7 +244,7 @@ func (m *FileBrowser) SetBaseURL(url string) {
m.BaseURL = strings.TrimSuffix(url, "/")
}
// Attach attaches a static generator to the current File Manager.
// Attach attaches a static generator to the current File Browser.
func (m *FileBrowser) Attach(s StaticGen) error {
if reflect.TypeOf(s).Kind() != reflect.Ptr {
return errors.New("data should be a pointer to interface, not interface")
@@ -289,7 +290,7 @@ func (m FileBrowser) ShareCleaner() {
func (m FileBrowser) Runner(event string, path string, destination string, user *User) error {
commands := []string{}
// Get the commands from the File Manager instance itself.
// Get the commands from the File Browser instance itself.
if val, ok := m.Commands[event]; ok {
commands = append(commands, val...)
}

View File

@@ -9,10 +9,10 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
const reCaptchaAPI = "https://www.google.com/recaptcha/api/siteverify"
const reCaptchaAPI = "/recaptcha/api/siteverify"
type cred struct {
Password string `json:"password"`
@@ -21,14 +21,14 @@ type cred struct {
}
// reCaptcha checks the reCaptcha code.
func reCaptcha(secret string, response string) (bool, error) {
func reCaptcha(host, secret, response string) (bool, error) {
body := url.Values{}
body.Set("secret", secret)
body.Add("response", response)
client := &http.Client{}
resp, err := client.Post(reCaptchaAPI, "application/x-www-form-urlencoded", strings.NewReader(body.Encode()))
resp, err := client.Post(host+reCaptchaAPI, "application/x-www-form-urlencoded", strings.NewReader(body.Encode()))
if err != nil {
return false, err
}
@@ -50,7 +50,7 @@ func reCaptcha(secret string, response string) (bool, error) {
}
// authHandler processes the authentication for the user.
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func authHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// NoAuth instances shouldn't call this method.
if c.NoAuth {
return 0, nil
@@ -69,7 +69,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
// If ReCaptcha is enabled, check the code.
if len(c.ReCaptchaSecret) > 0 {
ok, err := reCaptcha(c.ReCaptchaSecret, cred.ReCaptcha)
ok, err := reCaptcha(c.ReCaptchaHost, c.ReCaptchaSecret, cred.ReCaptcha)
if err != nil {
return http.StatusForbidden, err
}
@@ -86,7 +86,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
}
// Checks if the password is correct.
if !fm.CheckPasswordHash(cred.Password, u.Password) {
if !fb.CheckPasswordHash(cred.Password, u.Password) {
return http.StatusForbidden, nil
}
@@ -96,7 +96,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
// renewAuthHandler is used when the front-end already has a JWT token
// and is checking if it is up to date. If so, updates its info.
func renewAuthHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func renewAuthHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
ok, u := validateAuth(c, r)
if !ok {
return http.StatusForbidden, nil
@@ -108,15 +108,15 @@ func renewAuthHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
// claims is the JWT claims.
type claims struct {
fm.User
fb.User
jwt.StandardClaims
}
// printToken prints the final JWT token to the user.
func printToken(c *fm.Context, w http.ResponseWriter) (int, error) {
func printToken(c *fb.Context, w http.ResponseWriter) (int, error) {
// Creates a copy of the user and removes it password
// hash so it never arrives to the user.
u := fm.User{}
u := fb.User{}
u = *c.User
u.Password = ""
@@ -125,7 +125,7 @@ func printToken(c *fm.Context, w http.ResponseWriter) (int, error) {
u,
jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),
Issuer: "File Manager",
Issuer: "File Browser",
},
}
@@ -165,7 +165,7 @@ func (e extractor) ExtractToken(r *http.Request) (string, error) {
// validateAuth is used to validate the authentication and returns the
// User if it is valid.
func validateAuth(c *fm.Context, r *http.Request) (bool, *fm.User) {
func validateAuth(c *fb.Context, r *http.Request) (bool, *fb.User) {
if c.NoAuth {
c.User = c.DefaultUser
return true, c.User

View File

@@ -7,14 +7,14 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
"github.com/hacdias/fileutils"
"github.com/mholt/archiver"
)
// downloadHandler creates an archive in one of the supported formats (zip, tar,
// tar.gz or tar.bz2) and sends it to be downloaded.
func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func downloadHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// If the file isn't a directory, serve it using http.ServeFile. We display it
// inline if it is requested.
if !c.File.IsDir {
@@ -77,7 +77,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
return 0, err
}
func downloadFileHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func downloadFileHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
file, err := os.Open(c.File.Path)
defer file.Close()

View File

@@ -10,13 +10,13 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
// Handler returns a function compatible with http.HandleFunc.
func Handler(m *fm.FileBrowser) http.Handler {
func Handler(m *fb.FileBrowser) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
code, err := serve(&fm.Context{
code, err := serve(&fb.Context{
FileBrowser: m,
User: nil,
File: nil,
@@ -37,9 +37,9 @@ func Handler(m *fm.FileBrowser) http.Handler {
}
// serve is the main entry point of this HTML application.
func serve(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func serve(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Checks if the URL contains the baseURL and strips it. Otherwise, it just
// returns a 404 fm.Error because we're not supposed to be here!
// returns a 404 fb.Error because we're not supposed to be here!
p := strings.TrimPrefix(r.URL.Path, c.BaseURL)
if len(p) >= len(r.URL.Path) && c.BaseURL != "" {
@@ -93,7 +93,7 @@ func serve(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
}
// staticHandler handles the static assets path.
func staticHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func staticHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.URL.Path != "/static/manifest.json" {
http.FileServer(c.Assets.HTTPBox()).ServeHTTP(w, r)
return 0, nil
@@ -103,7 +103,7 @@ func staticHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int,
}
// apiHandler is the main entry point for the /api endpoint.
func apiHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func apiHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.URL.Path == "/auth/get" {
return authHandler(c, w, r)
}
@@ -139,7 +139,7 @@ func apiHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, err
if c.Router == "checksum" || c.Router == "download" {
var err error
c.File, err = fm.GetInfo(r.URL, c.FileBrowser, c.User)
c.File, err = fb.GetInfo(r.URL, c.FileBrowser, c.User)
if err != nil {
return ErrorToHTTP(err, false), err
}
@@ -173,11 +173,11 @@ func apiHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, err
}
// serveChecksum calculates the hash of a file. Supports MD5, SHA1, SHA256 and SHA512.
func checksumHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func checksumHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
query := r.URL.Query().Get("algo")
val, err := c.File.Checksum(query)
if err == fm.ErrInvalidOption {
if err == fb.ErrInvalidOption {
return http.StatusBadRequest, err
} else if err != nil {
return http.StatusInternalServerError, err
@@ -205,7 +205,7 @@ func splitURL(path string) (string, string) {
}
// renderFile renders a file using a template with some needed variables.
func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error) {
func renderFile(c *fb.Context, w http.ResponseWriter, file string) (int, error) {
tpl := template.Must(template.New("file").Parse(c.Assets.MustString(file)))
var contentType string
@@ -223,12 +223,13 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
data := map[string]interface{}{
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fm.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fb.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaHost": c.ReCaptchaHost,
"ReCaptchaKey": c.ReCaptchaKey,
}
if c.StaticGen != nil {
@@ -245,9 +246,9 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
}
// sharePage build the share page.
func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func sharePage(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
s, err := c.Store.Share.Get(r.URL.Path)
if err == fm.ErrNotExist {
if err == fb.ErrNotExist {
w.WriteHeader(http.StatusNotFound)
return renderFile(c, w, "static/share/404.html")
}
@@ -270,7 +271,7 @@ func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, erro
return ErrorToHTTP(err, false), err
}
c.File = &fm.File{
c.File = &fb.File{
Path: s.Path,
Name: info.Name(),
ModTime: info.ModTime(),

View File

@@ -13,7 +13,7 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
"github.com/hacdias/fileutils"
)
@@ -27,7 +27,7 @@ func sanitizeURL(url string) string {
return path
}
func resourceHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourceHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
r.URL.Path = sanitizeURL(r.URL.Path)
switch r.Method {
@@ -62,9 +62,9 @@ func resourceHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
return http.StatusNotImplemented, nil
}
func resourceGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourceGetHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Gets the information of the directory/file.
f, err := fm.GetInfo(r.URL, c.FileBrowser, c.User)
f, err := fb.GetInfo(r.URL, c.FileBrowser, c.User)
if err != nil {
return ErrorToHTTP(err, false), err
}
@@ -104,7 +104,7 @@ func resourceGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (
return renderJSON(w, f)
}
func listingHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func listingHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
f := c.File
f.Kind = "listing"
@@ -133,7 +133,7 @@ func listingHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int,
return renderJSON(w, f)
}
func resourceDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourceDeleteHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Prevent the removal of the root directory.
if r.URL.Path == "/" || !c.User.AllowEdit {
return http.StatusForbidden, nil
@@ -158,7 +158,7 @@ func resourceDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request
return http.StatusOK, nil
}
func resourcePostPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourcePostPutHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if !c.User.AllowNew && r.Method == http.MethodPost {
return http.StatusForbidden, nil
}
@@ -182,7 +182,7 @@ func resourcePostPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Reques
}
// Otherwise we try to create the directory.
err := c.User.FileSystem.Mkdir(r.URL.Path, 0776)
err := c.User.FileSystem.Mkdir(r.URL.Path, 0775)
return ErrorToHTTP(err, false), err
}
@@ -201,7 +201,7 @@ func resourcePostPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Reques
}
// Create/Open the file.
f, err := c.User.FileSystem.OpenFile(r.URL.Path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0776)
f, err := c.User.FileSystem.OpenFile(r.URL.Path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775)
if err != nil {
return ErrorToHTTP(err, false), err
}
@@ -240,7 +240,7 @@ func resourcePostPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Reques
return http.StatusOK, nil
}
func resourcePublishSchedule(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourcePublishSchedule(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
publish := r.Header.Get("Publish")
schedule := r.Header.Get("Schedule")
@@ -271,7 +271,7 @@ func resourcePublishSchedule(c *fm.Context, w http.ResponseWriter, r *http.Reque
return http.StatusOK, nil
}
func resourcePublish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourcePublish(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
path := filepath.Join(c.User.Scope, r.URL.Path)
// Before save command handler.
@@ -293,7 +293,7 @@ func resourcePublish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
}
// resourcePatchHandler is the entry point for resource handler.
func resourcePatchHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func resourcePatchHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if !c.User.AllowEdit {
return http.StatusForbidden, nil
}

View File

@@ -6,12 +6,12 @@ import (
"net/http"
"reflect"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
"github.com/mitchellh/mapstructure"
)
type modifySettingsRequest struct {
*modifyRequest
modifyRequest
Data struct {
CSS string `json:"css"`
Commands map[string][]string `json:"commands"`
@@ -28,7 +28,7 @@ type option struct {
func parsePutSettingsRequest(r *http.Request) (*modifySettingsRequest, error) {
// Checks if the request body is empty.
if r.Body == nil {
return nil, fm.ErrEmptyRequest
return nil, fb.ErrEmptyRequest
}
// Parses the request body and checks if it's well formed.
@@ -40,13 +40,13 @@ func parsePutSettingsRequest(r *http.Request) (*modifySettingsRequest, error) {
// Checks if the request type is right.
if mod.What != "settings" {
return nil, fm.ErrWrongDataType
return nil, fb.ErrWrongDataType
}
return mod, nil
}
func settingsHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func settingsHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.URL.Path != "" && r.URL.Path != "/" {
return http.StatusNotFound, nil
}
@@ -67,7 +67,7 @@ type settingsGetRequest struct {
StaticGen []option `json:"staticGen"`
}
func settingsGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func settingsGetHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if !c.User.Admin {
return http.StatusForbidden, nil
}
@@ -97,7 +97,7 @@ func settingsGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (
return renderJSON(w, result)
}
func settingsPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func settingsPutHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if !c.User.Admin {
return http.StatusForbidden, nil
}

View File

@@ -1,17 +1,17 @@
package http
import (
"encoding/hex"
"encoding/base64"
"net/http"
"path/filepath"
"strconv"
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
func shareHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func shareHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
r.URL.Path = sanitizeURL(r.URL.Path)
switch r.Method {
@@ -26,10 +26,10 @@ func shareHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, e
return http.StatusNotImplemented, nil
}
func shareGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func shareGetHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
path := filepath.Join(c.User.Scope, r.URL.Path)
s, err := c.Store.Share.GetByPath(path)
if err == fm.ErrNotExist {
if err == fb.ErrNotExist {
return http.StatusNotFound, nil
}
@@ -51,10 +51,10 @@ func shareGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
return renderJSON(w, s)
}
func sharePostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func sharePostHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
path := filepath.Join(c.User.Scope, r.URL.Path)
var s *fm.ShareLink
var s *fb.ShareLink
expire := r.URL.Query().Get("expires")
unit := r.URL.Query().Get("unit")
@@ -67,14 +67,14 @@ func sharePostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
}
}
bytes, err := fm.GenerateRandomBytes(32)
bytes, err := fb.GenerateRandomBytes(6)
if err != nil {
return http.StatusInternalServerError, err
}
str := hex.EncodeToString(bytes)
str := base64.URLEncoding.EncodeToString(bytes)
s = &fm.ShareLink{
s = &fb.ShareLink{
Path: path,
Hash: str,
Expires: expire != "",
@@ -108,9 +108,9 @@ func sharePostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
return renderJSON(w, s)
}
func shareDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func shareDeleteHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
s, err := c.Store.Share.Get(strings.TrimPrefix(r.URL.Path, "/"))
if err == fm.ErrNotExist {
if err == fb.ErrNotExist {
return http.StatusNotFound, nil
}

View File

@@ -9,7 +9,7 @@ import (
"strconv"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
type modifyRequest struct {
@@ -18,13 +18,13 @@ type modifyRequest struct {
}
type modifyUserRequest struct {
*modifyRequest
Data *fm.User `json:"data"`
modifyRequest
Data *fb.User `json:"data"`
}
// usersHandler is the entry point of the users API. It's just a router
// to send the request to its
func usersHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func usersHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// If the user isn't admin and isn't making a PUT
// request, then return forbidden.
if !c.User.Admin && r.Method != http.MethodPut {
@@ -47,7 +47,7 @@ func usersHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, e
// getUserID returns the id from the user which is present
// in the request url. If the url is invalid and doesn't
// contain a valid ID, it returns an fm.Error.
// contain a valid ID, it returns an fb.Error.
func getUserID(r *http.Request) (int, error) {
// Obtains the ID in string from the URL and converts
// it into an integer.
@@ -63,11 +63,11 @@ func getUserID(r *http.Request) (int, error) {
// getUser returns the user which is present in the request
// body. If the body is empty or the JSON is invalid, it
// returns an fm.Error.
func getUser(c *fm.Context, r *http.Request) (*fm.User, string, error) {
// returns an fb.Error.
func getUser(c *fb.Context, r *http.Request) (*fb.User, string, error) {
// Checks if the request body is empty.
if r.Body == nil {
return nil, "", fm.ErrEmptyRequest
return nil, "", fb.ErrEmptyRequest
}
// Parses the request body and checks if it's well formed.
@@ -79,14 +79,14 @@ func getUser(c *fm.Context, r *http.Request) (*fm.User, string, error) {
// Checks if the request type is right.
if mod.What != "user" {
return nil, "", fm.ErrWrongDataType
return nil, "", fb.ErrWrongDataType
}
mod.Data.FileSystem = c.NewFS(mod.Data.Scope)
return mod.Data, mod.Which, nil
}
func usersGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func usersGetHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Request for the default user data.
if r.URL.Path == "/base" {
return renderJSON(w, c.DefaultUser)
@@ -118,7 +118,7 @@ func usersGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
}
u, err := c.Store.Users.Get(id, c.NewFS)
if err == fm.ErrExist {
if err == fb.ErrExist {
return http.StatusNotFound, err
}
@@ -130,7 +130,7 @@ func usersGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
return renderJSON(w, u)
}
func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func usersPostHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.URL.Path != "/" {
return http.StatusMethodNotAllowed, nil
}
@@ -142,22 +142,22 @@ func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
// Checks if username isn't empty.
if u.Username == "" {
return http.StatusBadRequest, fm.ErrEmptyUsername
return http.StatusBadRequest, fb.ErrEmptyUsername
}
// Checks if scope isn't empty.
if u.Scope == "" {
return http.StatusBadRequest, fm.ErrEmptyScope
return http.StatusBadRequest, fb.ErrEmptyScope
}
// Checks if password isn't empty.
if u.Password == "" {
return http.StatusBadRequest, fm.ErrEmptyPassword
return http.StatusBadRequest, fb.ErrEmptyPassword
}
// Initialize rules if they're not initialized.
if u.Rules == nil {
u.Rules = []*fm.Rule{}
u.Rules = []*fb.Rule{}
}
// If the view mode is empty, initialize with the default one.
@@ -181,17 +181,17 @@ func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
}
// Hashes the password.
pw, err := fm.HashPassword(u.Password)
pw, err := fb.HashPassword(u.Password)
if err != nil {
return http.StatusInternalServerError, err
}
u.Password = pw
u.ViewMode = fm.MosaicViewMode
u.ViewMode = fb.MosaicViewMode
// Saves the user to the database.
err = c.Store.Users.Save(u)
if err == fm.ErrExist {
if err == fb.ErrExist {
return http.StatusConflict, err
}
@@ -228,7 +228,7 @@ func checkFS(path string) (int, error) {
return 0, nil
}
func usersDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func usersDeleteHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.URL.Path == "/" {
return http.StatusMethodNotAllowed, nil
}
@@ -240,8 +240,8 @@ func usersDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (
// Deletes the user from the database.
err = c.Store.Users.Delete(id)
if err == fm.ErrNotExist {
return http.StatusNotFound, fm.ErrNotExist
if err == fb.ErrNotExist {
return http.StatusNotFound, fb.ErrNotExist
}
if err != nil {
@@ -251,7 +251,7 @@ func usersDeleteHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (
return http.StatusOK, nil
}
func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func usersPutHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// New users should be created on /api/users.
if r.URL.Path == "/" {
return http.StatusMethodNotAllowed, nil
@@ -298,14 +298,14 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// Updates the Password.
if which == "password" {
if u.Password == "" {
return http.StatusBadRequest, fm.ErrEmptyPassword
return http.StatusBadRequest, fb.ErrEmptyPassword
}
if id == c.User.ID && c.User.LockPassword {
return http.StatusForbidden, nil
}
c.User.Password, err = fm.HashPassword(u.Password)
c.User.Password, err = fb.HashPassword(u.Password)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -320,17 +320,17 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// If can only be all.
if which != "all" {
return http.StatusBadRequest, fm.ErrInvalidUpdateField
return http.StatusBadRequest, fb.ErrInvalidUpdateField
}
// Checks if username isn't empty.
if u.Username == "" {
return http.StatusBadRequest, fm.ErrEmptyUsername
return http.StatusBadRequest, fb.ErrEmptyUsername
}
// Checks if filesystem isn't empty.
if u.Scope == "" {
return http.StatusBadRequest, fm.ErrEmptyScope
return http.StatusBadRequest, fb.ErrEmptyScope
}
// Checks if the scope exists.
@@ -340,7 +340,7 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// Initialize rules if they're not initialized.
if u.Rules == nil {
u.Rules = []*fm.Rule{}
u.Rules = []*fb.Rule{}
}
// Initialize commands if not initialized.
@@ -350,7 +350,7 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// Gets the current saved user from the in-memory map.
suser, err := c.Store.Users.Get(id, c.NewFS)
if err == fm.ErrNotExist {
if err == fb.ErrNotExist {
return http.StatusNotFound, nil
}
@@ -362,7 +362,7 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// Changes the password if the request wants it.
if u.Password != "" {
pw, err := fm.HashPassword(u.Password)
pw, err := fb.HashPassword(u.Password)
if err != nil {
return http.StatusInternalServerError, err
}

View File

@@ -12,7 +12,7 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
"github.com/gorilla/websocket"
)
@@ -27,8 +27,8 @@ var (
)
// command handles the requests for VCS related commands: git, svn and mercurial
func command(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Upgrades the connection to a websocket and checks for fm.Errors.
func command(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Upgrades the connection to a websocket and checks for fb.Errors.
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
return 0, err
@@ -57,13 +57,14 @@ func command(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error)
allowed := false
for _, cmd := range c.User.Commands {
if cmd == command[0] {
if regexp.MustCompile(cmd).MatchString(command[0]) {
allowed = true
break
}
}
if !allowed {
err = conn.WriteMessage(websocket.BinaryMessage, cmdNotAllowed)
err = conn.WriteMessage(websocket.TextMessage, cmdNotAllowed)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -71,9 +72,9 @@ func command(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error)
return 0, nil
}
// Check if the program is talled is installed on the computer.
// Check if the program is installed on the computer.
if _, err = exec.LookPath(command[0]); err != nil {
err = conn.WriteMessage(websocket.BinaryMessage, cmdNotImplemented)
err = conn.WriteMessage(websocket.TextMessage, cmdNotImplemented)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -92,7 +93,7 @@ func command(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error)
cmd.Stderr = buff
cmd.Stdout = buff
// Starts the command and checks for fm.Errors.
// Starts the command and checks for fb.Errors.
err = cmd.Start()
if err != nil {
return http.StatusInternalServerError, err
@@ -240,8 +241,8 @@ func parseSearch(value string) *searchOptions {
}
// search searches for a file or directory.
func search(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Upgrades the connection to a websocket and checks for fm.Errors.
func search(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Upgrades the connection to a websocket and checks for fb.Errors.
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
return 0, err

BIN
logo/banner.cdr Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
c3bb28b9b6b54478b7bf3e2b740c508d678bd3e7

BIN
logo/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

267
logo/banner.svg Normal file
View File

@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: CorelDRAW X7 -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xml:space="preserve"
width="2486.4797"
height="516"
version="1.1"
style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 2486.4797 516"
id="svg3941"
sodipodi:docname="banner.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/umarcor/filebrowser/logo/banner.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><metadata
id="metadata3945"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="711"
id="namedview3943"
showgrid="false"
inkscape:zoom="0.29623288"
inkscape:cx="1341.9549"
inkscape:cy="202.9058"
inkscape:window-x="0"
inkscape:window-y="20"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_x0020_1" />
<defs
id="defs3896">
<font
id="FontID0"
horiz-adv-x="720"
font-variant="normal"
font-weight="700"
horiz-origin-x="0"
horiz-origin-y="0"
vert-origin-x="45"
vert-origin-y="90"
vert-adv-y="90">
<font-face
font-family="Ubuntu"
id="font-face3849">
</font-face>
<missing-glyph
id="missing-glyph3853"><path
d="M0 0z"
id="path3851" /></missing-glyph>
<glyph
unicode="w"
horiz-adv-x="783"
id="glyph3857"><path
d="M390.501 302.001c-13.3347,-50.6667 -27.4991,-101.001 -42.5007,-151.002 -15.0016,-49.9978 -30.8328,-100.332 -47.5012,-150.999l-115.999 0c-12.0005,27.9999 -24.9989,61.333 -39.167,99.9993 -14,38.6662 -28.5007,80.8343 -43.4986,126.501 -15.166,45.6662 -30.5002,94.0009 -46.167,145 -15.6668,50.9994 -31.001,102.5 -45.6662,154.5l157.001 0c5.33314,-24.001 11.1634,-50.1659 17.6663,-78.5022 6.33101,-28.3326 12.9984,-57.4985 19.9984,-87.4979 7.16816,-29.9994 14.5008,-60.167 22.166,-90.499 7.66896,-30.3358 15.6668,-59.5017 23.6684,-87.5017 8.66683,29.3342 17.1655,59.3336 25.4997,90.0019 8.33421,30.6646 16.3321,60.8322 24.001,90.499 7.66523,29.6668 14.9978,58.332 21.9978,85.9993 6.99999,27.6673 13.1665,53.4996 18.4997,77.5006l108.001 0c5.33314,-24.001 11.3353,-49.8333 17.9989,-77.5006 6.66736,-27.6673 13.6673,-56.3325 21,-85.9993 7.33634,-29.6668 15.0016,-59.8344 23.0032,-90.499 7.99785,-30.6684 16.3321,-60.6678 24.9989,-90.0019 7.99785,27.9999 16.1676,57.1659 24.1655,87.5017 8.00158,30.332 15.4986,60.4996 22.6668,90.499 6.99999,29.9994 13.6673,59.1654 20.0021,87.4979 6.49919,28.3363 12.3331,54.5012 17.6663,78.5022l154.998 0c-14.6652,-52.001 -29.9994,-103.501 -45.6662,-154.5 -15.6668,-50.9994 -31.001,-99.334 -46.167,-145 -14.9978,-45.6662 -29.6668,-87.8343 -43.9994,-126.501 -14.5008,-38.6662 -27.6673,-71.9993 -39.6678,-99.9993l-115.999 0c-16.6647,50.6667 -33.0005,101.001 -48.9999,150.999 -15.9994,50.0015 -30.6684,100.336 -43.9994,151.002z"
id="path3855" /></glyph>
<glyph
unicode="F"
horiz-adv-x="573"
id="glyph3861"><path
d="M80.0009 0l0 692.999 463.998 0 0 -131 -307.999 0 0 -144.996 274.001 0 0 -131 -274.001 0 0 -286.002 -155.999 0z"
id="path3859" /></glyph>
<glyph
unicode="e"
horiz-adv-x="583"
id="glyph3865"><path
d="M45.001 258.999c0,46.6678 7.16443,87.5017 21.5008,122.502 14.3326,34.9999 33.1649,64.1659 56.4969,87.4979 23.3358,23.3358 50.1697,41.002 80.5017,53.0026 30.332,11.9968 61.5012,17.9989 93.5001,17.9989 74.6678,0 133.665,-22.835 176.999,-68.5012 43.3341,-45.6662 64.9993,-112.833 64.9993,-201.501 0,-8.66683 -0.332621,-18.1633 -0.997862,-28.497 -0.668979,-10.3337 -1.33422,-19.5013 -1.99946,-27.5029l-338.002 0c3.33368,-30.6646 17.6663,-54.9983 43.0015,-72.9972 25.3315,-18.0026 59.3336,-27.0021 101.999,-27.0021 27.3347,0 54.1686,2.50026 80.5017,7.50078 26.3331,5.00052 47.8339,11.1671 64.4985,18.4997l20.0021 -120.999c-8.00158,-3.99892 -18.6679,-8.00158 -32.0026,-12.0005 -13.331,-3.99892 -28.1644,-7.50078 -44.5002,-10.5018 -16.3321,-2.99732 -33.8339,-5.49759 -52.498,-7.49705 -18.6679,-1.99946 -37.3357,-3.00106 -55.9999,-3.00106 -47.3331,0 -88.4995,6.99999 -123.499,21 -34.9999,14 -64.0015,33.1649 -87.0009,57.4985 -22.9994,24.3336 -40.0004,53.167 -50.9994,86.5001 -11.0026,33.3331 -16.5002,69.3346 -16.5002,108.001zm349.999 57.0015c-0.665242,12.6657 -2.83288,24.9989 -6.49919,36.9994 -3.6663,12.0005 -9.3358,22.6668 -17.001,31.9989 -7.66523,9.3358 -17.3337,17.001 -29.0015,22.9994 -11.6642,6.00212 -26.1649,9.00318 -43.4986,9.00318 -16.6684,0 -31.001,-2.83662 -43.0015,-8.50238 -11.9968,-5.66576 -21.9978,-13.1665 -29.9994,-22.4986 -7.99785,-9.3358 -14.1644,-20.1665 -18.4997,-32.4997 -4.33154,-12.3331 -7.50078,-24.8344 -9.50025,-37.5002l197.001 0z"
id="path3863" /></glyph>
<glyph
unicode="s"
horiz-adv-x="484"
id="glyph3869"><path
d="M220.998 106.999c27.3347,0 46.6678,2.66844 58.0031,8.00158 11.3315,5.33314 16.9973,15.6668 16.9973,31.001 0,11.9968 -7.33261,22.4986 -21.9978,31.4981 -14.6689,8.99945 -36.9994,19.1649 -67.0025,30.5002 -23.332,8.66683 -44.5002,17.6663 -63.4969,26.9983 -19.0005,9.3358 -35.1681,20.5029 -48.5028,33.5013 -13.331,13.0021 -23.6647,28.5007 -30.9973,46.4996 -7.33634,17.9989 -11.0026,39.6678 -11.0026,64.9993 0,49.3363 18.3353,88.3351 55.002,117 36.6668,28.6689 87.0009,43.0015 150.999,43.0015 31.9989,0 62.6672,-2.83288 92.0014,-8.49865 29.3342,-5.6695 52.6662,-11.8361 69.9999,-18.5034l-26.0005 -115.999c-17.3337,6.00212 -36.166,11.3353 -56.5007,15.9994 -20.3347,4.6679 -43.166,6.99999 -68.5012,6.99999 -46.6641,0 -69.9999,-12.9984 -69.9999,-38.9988 0,-5.99839 1.0016,-11.3353 3.00106,-15.9994 1.99946,-4.6679 6.00212,-9.16763 12.0005,-13.4992 5.99839,-4.33528 14.1681,-9.00318 24.4981,-14 10.3337,-5.1687 23.5002,-10.67 39.5034,-16.6684 32.6641,-12.1649 59.6662,-24.001 80.9988,-35.8333 21.3326,-11.6679 38.1654,-24.4981 50.4986,-38.001 12.3331,-13.6673 21,-28.8334 26.0005,-45.498 5.00052,-16.6684 7.50078,-35.8333 7.50078,-57.8349 0,-51.8328 -19.5013,-91.1642 -58.5001,-117.834 -38.9988,-26.4975 -94.1653,-39.8323 -165.499,-39.8323 -46.6678,0 -85.5022,3.99892 -116.499,12.0005 -31.001,7.99785 -52.5018,14.6652 -64.5023,19.9984l25.0026 121.003c25.3315,-10.001 51.332,-17.8345 77.9977,-23.5002 26.6657,-5.6695 53.0026,-8.50238 78.9993,-8.50238z"
id="path3867" /></glyph>
<glyph
unicode="B"
horiz-adv-x="671"
id="glyph3873"><path
d="M311 -8.99945c-38.001,0 -75.8338,1.16604 -113.502,3.49812 -37.6646,2.33582 -76.8317,7.83341 -117.497,16.5002l0 672.002c31.9989,5.99839 66.9988,10.4981 105,13.4992 38.001,3.00106 73.3335,4.49972 105.998,4.49972 44.0031,0 84.5006,-3.1655 121.5,-9.50025 37.0031,-6.33474 68.8338,-17.1655 95.5033,-32.4997 26.6657,-15.3342 47.4975,-35.5007 62.4991,-60.4996 14.9978,-24.9989 22.4986,-55.8354 22.4986,-92.5022 0,-55.3309 -26.6657,-98.9977 -80.0009,-130.997 44.0031,-16.6684 74.0025,-39.3352 90.0019,-68.0004 15.9994,-28.6689 24.001,-61.0004 24.001,-97.0019 0,-72.6646 -26.5013,-127.334 -79.5001,-164.001 -53.0026,-36.6668 -131.834,-54.9983 -236.501,-54.9983zm-78.9993 311l0 -179.002c11.3315,-1.33048 23.6647,-2.33208 36.9994,-2.99732 13.331,-0.668979 27.9999,-1.0016 43.9994,-1.0016 46.6678,0 84.3324,6.66736 113.001,20.0021 28.6652,13.331 42.9978,37.9972 42.9978,73.9988 0,31.9989 -12.0005,54.8338 -35.9978,68.5012 -24.001,13.6636 -58.3357,20.4992 -103,20.4992l-97.9998 0zm0 119l75.9982 0c48.002,0 82.333,6.16656 103,18.4997 20.6673,12.3331 31.001,32.167 31.001,59.498 0,27.9999 -10.6663,47.6694 -31.9989,59.0009 -21.3363,11.3353 -52.6699,17.001 -94.0009,17.001 -13.3347,0 -27.6673,-0.168179 -43.0015,-0.5008 -15.3342,-0.332621 -28.9978,-1.16604 -40.9983,-2.50026l0 -150.999z"
id="path3871" /></glyph>
<glyph
unicode=" "
horiz-adv-x="239"
id="glyph3875" />
<glyph
unicode="r"
horiz-adv-x="421"
id="glyph3879"><path
d="M386.999 393.999c-13.331,3.33368 -28.9978,6.83554 -47.0004,10.5018 -17.9989,3.6663 -37.332,5.50132 -57.9993,5.50132 -9.33207,0 -20.4992,-0.833421 -33.4975,-2.50026 -13.0021,-1.66684 -22.835,-3.50186 -29.5023,-5.50132l0 -402 -148.999 0 0 498.001c26.6657,9.33207 58.1675,18.1671 94.5017,26.5013 36.3304,8.33047 76.8317,12.4976 121.5,12.4976 7.99785,0 17.6663,-0.5008 28.9978,-1.49866 11.3353,-1.0016 22.6668,-2.33582 34.0021,-3.99892 11.3315,-1.66684 22.6668,-3.67004 33.9983,-6.00212 11.3353,-2.33208 21,-5.16496 29.0015,-8.49865l-25.0026 -123.002z"
id="path3877" /></glyph>
<glyph
unicode="o"
horiz-adv-x="606"
id="glyph3883"><path
d="M561.998 264c0,-41.3347 -5.99839,-79.1675 -17.9989,-113.498 -12.0005,-34.3347 -29.3342,-63.6688 -52.001,-88.0025 -22.6668,-24.3336 -49.8333,-43.166 -81.4996,-56.5007 -31.6662,-13.331 -67.167,-19.9984 -106.498,-19.9984 -38.6662,0 -73.8343,6.66736 -105.501,19.9984 -31.6662,13.3347 -58.8328,32.167 -81.4996,56.5007 -22.6668,24.3336 -40.3331,53.6678 -52.9988,88.0025 -12.6695,34.3309 -19.0005,72.1638 -19.0005,113.498 0,41.3347 6.49919,78.9993 19.4976,113.001 13.0021,33.9983 31.001,62.9999 54.0004,86.9971 22.9994,24.001 50.3341,42.6689 82.0004,55.9999 31.6662,13.3347 66.1691,20.0021 103.501,20.0021 38.001,0 72.8327,-6.66736 104.499,-20.0021 31.6662,-13.331 58.8328,-31.9989 81.4996,-55.9999 22.6668,-23.9973 40.3331,-52.9988 53.0026,-86.9971 12.6657,-34.0021 18.9968,-71.6667 18.9968,-113.001zm-151.996 0c0,45.9988 -9.16763,82.1685 -27.5029,108.502 -18.3315,26.3331 -44.5002,39.4996 -78.4985,39.4996 -34.0021,0 -60.3352,-13.1665 -78.9993,-39.4996 -18.6679,-26.3331 -27.9999,-62.5028 -27.9999,-108.502 0,-45.9988 9.33207,-82.5012 27.9999,-109.499 18.6641,-27.0021 44.9972,-40.5012 78.9993,-40.5012 33.9983,0 60.167,13.4992 78.4985,40.5012 18.3353,26.9983 27.5029,63.5007 27.5029,109.499z"
id="path3881" /></glyph>
<glyph
unicode="l"
horiz-adv-x="316"
id="glyph3887"><path
d="M279.999 -10.001c-43.3341,0.668979 -78.4985,5.33314 -105.501,14 -26.9983,8.66683 -48.3309,20.8355 -63.9977,36.5023 -15.6668,15.6668 -26.3331,34.6636 -32.0026,56.9977 -5.66576,22.3342 -8.49865,47.5012 -8.49865,75.5012l0 578.999 148.999 24.001 0 -573.001c0,-13.3347 1.0016,-25.3315 3.00106,-35.9978 1.99946,-10.67 5.83394,-19.6695 11.4997,-27.0021 5.66576,-7.33261 13.8318,-13.3347 24.5018,-17.9989 10.6663,-4.6679 24.9989,-7.66896 42.9978,-8.99945l-21 -123.002z"
id="path3885" /></glyph>
<glyph
unicode="i"
horiz-adv-x="288"
id="glyph3891"><path
d="M218.999 0l-148.999 0 0 526 148.999 0 0 -526zm14 678.001c0,-27.3347 -8.83127,-48.8355 -26.4975,-64.5023 -17.6663,-15.6668 -38.5018,-23.5002 -62.5028,-23.5002 -23.9973,0 -44.8328,7.83341 -62.4991,23.5002 -17.6663,15.6668 -26.5013,37.1676 -26.5013,64.5023 0,27.331 8.83501,48.8317 26.5013,64.4985 17.6663,15.6668 38.5018,23.5002 62.4991,23.5002 24.001,0 44.8365,-7.83341 62.5028,-23.5002 17.6663,-15.6668 26.4975,-37.1676 26.4975,-64.4985z"
id="path3889" /></glyph>
</font>
<style
type="text/css"
id="style3894">
<![CDATA[
@font-face { font-family:"Ubuntu";src:url("#FontID0") format(svg)}
.fil0 {fill:none}
.fil2 {fill:#FEFEFE}
.fil7 {fill:#006498}
.fil8 {fill:#0EA5EB}
.fil1 {fill:#2979FF}
.fil4 {fill:#2BBCFF}
.fil5 {fill:#53C6FC}
.fil6 {fill:#BDEAFF}
.fil3 {fill:#332C2B;fill-opacity:0.149020}
.fnt0 {font-weight:bold;font-size:316.03px;font-family:'Ubuntu'}
]]>
</style>
</defs>
<g
id="Layer_x0020_1"
transform="translate(-168.87308,-262.32199)">
<metadata
id="CorelCorpID_0Corel-Layer" />
<g
id="_668933328"
transform="translate(-48.126924,-19.678009)"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<text
x="824"
y="660"
class="fil1 fnt0"
id="text3901"
style="font-weight:bold;font-size:316.02999878px;font-family:Ubuntu;fill:#2979ff">File Browser</text>
<g
id="g3937">
<path
class="fil2"
d="M 474,283 C 616,283 731,398 731,540 731,682 616,797 474,797 333,797 218,682 218,540 218,398 333,283 474,283 Z"
id="path3903"
inkscape:connector-curvature="0"
style="fill:#fefefe" />
<path
class="fil3"
d="M 589,435 698,574 C 701,680 561,805 429,756 L 359,665 464,522 c 0,0 127,-88 125,-87 z"
id="path3905"
inkscape:connector-curvature="0"
style="fill:#332c2b;fill-opacity:0.14902003" />
<path
class="fil4"
d="m 365,412 h 192 l 34,22 v 227 c 0,4 -3,7 -7,7 H 365 c -4,0 -7,-3 -7,-7 V 419 c 0,-4 3,-7 7,-7 z"
id="path3907"
inkscape:connector-curvature="0"
style="fill:#2bbcff" />
<path
class="fil5"
d="m 365,412 h 192 l 34,22 v 2 L 557,415 H 365 c -4,0 -7,3 -7,6 v 242 c 0,-1 0,-1 0,-2 V 419 c 0,-4 3,-7 7,-7 z"
id="path3909"
inkscape:connector-curvature="0"
style="fill:#53c6fc" />
<polygon
class="fil6"
points="433,503 433,413 537,413 537,503 "
id="polygon3911"
style="fill:#bdeaff" />
<path
class="fil6"
d="m 387,552 h 174 c 2,0 4,2 4,4 V 662 H 382 V 556 c 0,-2 2,-4 5,-4 z"
id="path3913"
inkscape:connector-curvature="0"
style="fill:#bdeaff" />
<polygon
class="fil7"
points="382,663 382,651 565,651 565,663 "
id="polygon3915"
style="fill:#006498" />
<path
class="fil7"
d="m 502,426 h 9 c 3,0 5,2 5,5 v 36 c 0,3 -2,5 -5,5 h -9 c -3,0 -5,-2 -5,-5 v -36 c 0,-3 2,-5 5,-5 z"
id="path3917"
inkscape:connector-curvature="0"
style="fill:#006498" />
<path
class="fil2"
d="m 386,426 c 9,0 16,7 16,15 0,9 -7,16 -16,16 -8,0 -15,-7 -15,-16 0,-8 7,-15 15,-15 z"
id="path3919"
inkscape:connector-curvature="0"
style="fill:#fefefe" />
<path
class="fil7"
d="m 398,630 h 152 c 1,0 3,1 3,3 v 0 c 0,1 -2,2 -3,2 H 398 c -2,0 -3,-1 -3,-2 v 0 c 0,-2 1,-3 3,-3 z"
id="path3921"
inkscape:connector-curvature="0"
style="fill:#006498" />
<path
class="fil7"
d="m 398,600 h 152 c 1,0 3,1 3,2 v 0 c 0,2 -2,3 -3,3 H 398 c -2,0 -3,-1 -3,-3 v 0 c 0,-1 1,-2 3,-2 z"
id="path3923"
inkscape:connector-curvature="0"
style="fill:#006498" />
<path
class="fil7"
d="m 398,569 h 152 c 1,0 3,1 3,2 v 0 c 0,2 -2,3 -3,3 H 398 c -2,0 -3,-1 -3,-3 v 0 c 0,-1 1,-2 3,-2 z"
id="path3925"
inkscape:connector-curvature="0"
style="fill:#006498" />
<path
class="fil2"
d="m 369,652 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -2,0 -4,-2 -4,-4 0,-3 2,-5 4,-5 z"
id="path3927"
inkscape:connector-curvature="0"
style="fill:#fefefe" />
<path
class="fil2"
d="m 578,652 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -2,0 -4,-2 -4,-4 0,-3 2,-5 4,-5 z"
id="path3929"
inkscape:connector-curvature="0"
style="fill:#fefefe" />
<polygon
class="fil7"
points="433,503 433,413 414,413 414,503 "
id="polygon3931"
style="fill:#006498" />
<path
class="fil8"
d="m 591,659 v 2 c 0,4 -3,7 -7,7 H 365 c -4,0 -7,-3 -7,-7 v -2 c 0,4 3,7 7,7 h 219 c 4,0 7,-3 7,-7 z"
id="path3933"
inkscape:connector-curvature="0"
style="fill:#0ea5eb" />
<path
class="fil1"
d="M 474,282 C 617,282 732,398 732,540 732,682 617,798 474,798 332,798 217,682 217,540 217,398 332,282 474,282 Z m 0,43 c 119,0 215,96 215,215 0,119 -96,215 -215,215 -118,0 -215,-96 -215,-215 0,-119 97,-215 215,-215 z"
id="path3935"
inkscape:connector-curvature="0"
style="fill:#2979ff" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

BIN
logo/icon.cdr Normal file

Binary file not shown.

BIN
logo/icon.eps Normal file

Binary file not shown.

BIN
logo/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

43
logo/icon.svg Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="700px" height="700px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 700 700"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#FEFEFE}
.fil6 {fill:#006498}
.fil7 {fill:#0EA5EB}
.fil8 {fill:#2979FF}
.fil3 {fill:#2BBCFF}
.fil0 {fill:#455A64}
.fil4 {fill:#53C6FC}
.fil5 {fill:#BDEAFF}
.fil2 {fill:#332C2B;fill-opacity:0.149020}
]]>
</style>
</defs>
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M80 0l540 0c44,0 80,36 80,80l0 540c0,44 -36,80 -80,80l-540 0c-44,0 -80,-36 -80,-80l0 -540c0,-44 36,-80 80,-80z"/>
<path class="fil1" d="M350 71c154,0 279,125 279,279 0,154 -125,279 -279,279 -154,0 -279,-125 -279,-279 0,-154 125,-279 279,-279z"/>
<path class="fil2" d="M475 236l118 151c3,116 -149,252 -292,198l-76 -99 114 -156c0,0 138,-95 136,-94z"/>
<path class="fil3" d="M231 211l208 0 38 24 0 246c0,5 -3,8 -8,8l-238 0c-5,0 -8,-3 -8,-8l0 -262c0,-5 3,-8 8,-8z"/>
<path class="fil4" d="M231 211l208 0 38 24 0 2 -37 -23 -209 0c-4,0 -7,3 -7,7l0 263c-1,-1 -1,-2 -1,-3l0 -262c0,-5 3,-8 8,-8z"/>
<polygon class="fil5" points="305,212 418,212 418,310 305,310 "/>
<path class="fil5" d="M255 363l189 0c3,0 5,2 5,4l0 116 -199 0 0 -116c0,-2 2,-4 5,-4z"/>
<polygon class="fil6" points="250,470 449,470 449,483 250,483 "/>
<path class="fil6" d="M380 226l10 0c3,0 6,2 6,5l0 40c0,3 -3,6 -6,6l-10 0c-3,0 -6,-3 -6,-6l0 -40c0,-3 3,-5 6,-5z"/>
<path class="fil1" d="M254 226c10,0 17,7 17,17 0,9 -7,16 -17,16 -9,0 -17,-7 -17,-16 0,-10 8,-17 17,-17z"/>
<path class="fil6" d="M267 448l165 0c2,0 3,1 3,3l0 0c0,1 -1,3 -3,3l-165 0c-2,0 -3,-2 -3,-3l0 0c0,-2 1,-3 3,-3z"/>
<path class="fil6" d="M267 415l165 0c2,0 3,1 3,3l0 0c0,1 -1,2 -3,2l-165 0c-2,0 -3,-1 -3,-2l0 0c0,-2 1,-3 3,-3z"/>
<path class="fil6" d="M267 381l165 0c2,0 3,2 3,3l0 0c0,2 -1,3 -3,3l-165 0c-2,0 -3,-1 -3,-3l0 0c0,-1 1,-3 3,-3z"/>
<path class="fil1" d="M236 472c3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5z"/>
<path class="fil1" d="M463 472c3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5z"/>
<polygon class="fil6" points="305,212 284,212 284,310 305,310 "/>
<path class="fil7" d="M477 479l0 2c0,5 -3,8 -8,8l-238 0c-5,0 -8,-3 -8,-8l0 -2c0,4 3,8 8,8l238 0c5,0 8,-4 8,-8z"/>
<path class="fil8" d="M350 70c155,0 280,125 280,280 0,155 -125,280 -280,280 -155,0 -280,-125 -280,-280 0,-155 125,-280 280,-280zm0 46c129,0 234,105 234,234 0,129 -105,234 -234,234 -129,0 -234,-105 -234,-234 0,-129 105,-234 234,-234z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
logo/icon_raw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

147
logo/icon_raw.svg Normal file
View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xml:space="preserve"
width="560"
height="560"
version="1.1"
style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 560 560"
id="svg44"
sodipodi:docname="icon_raw.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/umarcor/filebrowser/logo/icon_raw.svg.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><metadata
id="metadata48"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="711"
id="namedview46"
showgrid="false"
inkscape:zoom="0.33714286"
inkscape:cx="-172.33051"
inkscape:cy="280"
inkscape:window-x="0"
inkscape:window-y="20"
inkscape:window-maximized="1"
inkscape:current-layer="svg44" />
<defs
id="defs4">
<style
type="text/css"
id="style2">
<![CDATA[
.fil1 {fill:#FEFEFE}
.fil6 {fill:#006498}
.fil7 {fill:#0EA5EB}
.fil8 {fill:#2979FF}
.fil3 {fill:#2BBCFF}
.fil0 {fill:#455A64}
.fil4 {fill:#53C6FC}
.fil5 {fill:#BDEAFF}
.fil2 {fill:#332C2B;fill-opacity:0.149020}
]]>
</style>
</defs>
<g
id="g85"
transform="translate(-70,-70)"><path
class="fil1"
d="M 350,71 C 504,71 629,196 629,350 629,504 504,629 350,629 196,629 71,504 71,350 71,196 196,71 350,71 Z"
id="path9"
inkscape:connector-curvature="0"
style="fill:#fefefe" /><path
class="fil2"
d="M 475,236 593,387 C 596,503 444,639 301,585 L 225,486 339,330 c 0,0 138,-95 136,-94 z"
id="path11"
inkscape:connector-curvature="0"
style="fill:#332c2b;fill-opacity:0.14902003" /><path
class="fil3"
d="m 231,211 h 208 l 38,24 v 246 c 0,5 -3,8 -8,8 H 231 c -5,0 -8,-3 -8,-8 V 219 c 0,-5 3,-8 8,-8 z"
id="path13"
inkscape:connector-curvature="0"
style="fill:#2bbcff" /><path
class="fil4"
d="m 231,211 h 208 l 38,24 v 2 L 440,214 H 231 c -4,0 -7,3 -7,7 v 263 c -1,-1 -1,-2 -1,-3 V 219 c 0,-5 3,-8 8,-8 z"
id="path15"
inkscape:connector-curvature="0"
style="fill:#53c6fc" /><polygon
class="fil5"
points="305,212 418,212 418,310 305,310 "
id="polygon17"
style="fill:#bdeaff" /><path
class="fil5"
d="m 255,363 h 189 c 3,0 5,2 5,4 V 483 H 250 V 367 c 0,-2 2,-4 5,-4 z"
id="path19"
inkscape:connector-curvature="0"
style="fill:#bdeaff" /><polygon
class="fil6"
points="250,470 449,470 449,483 250,483 "
id="polygon21"
style="fill:#006498" /><path
class="fil6"
d="m 380,226 h 10 c 3,0 6,2 6,5 v 40 c 0,3 -3,6 -6,6 h -10 c -3,0 -6,-3 -6,-6 v -40 c 0,-3 3,-5 6,-5 z"
id="path23"
inkscape:connector-curvature="0"
style="fill:#006498" /><path
class="fil1"
d="m 254,226 c 10,0 17,7 17,17 0,9 -7,16 -17,16 -9,0 -17,-7 -17,-16 0,-10 8,-17 17,-17 z"
id="path25"
inkscape:connector-curvature="0"
style="fill:#fefefe" /><path
class="fil6"
d="m 267,448 h 165 c 2,0 3,1 3,3 v 0 c 0,1 -1,3 -3,3 H 267 c -2,0 -3,-2 -3,-3 v 0 c 0,-2 1,-3 3,-3 z"
id="path27"
inkscape:connector-curvature="0"
style="fill:#006498" /><path
class="fil6"
d="m 267,415 h 165 c 2,0 3,1 3,3 v 0 c 0,1 -1,2 -3,2 H 267 c -2,0 -3,-1 -3,-2 v 0 c 0,-2 1,-3 3,-3 z"
id="path29"
inkscape:connector-curvature="0"
style="fill:#006498" /><path
class="fil6"
d="m 267,381 h 165 c 2,0 3,2 3,3 v 0 c 0,2 -1,3 -3,3 H 267 c -2,0 -3,-1 -3,-3 v 0 c 0,-1 1,-3 3,-3 z"
id="path31"
inkscape:connector-curvature="0"
style="fill:#006498" /><path
class="fil1"
d="m 236,472 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5 z"
id="path33"
inkscape:connector-curvature="0"
style="fill:#fefefe" /><path
class="fil1"
d="m 463,472 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5 z"
id="path35"
inkscape:connector-curvature="0"
style="fill:#fefefe" /><polygon
class="fil6"
points="305,212 284,212 284,310 305,310 "
id="polygon37"
style="fill:#006498" /><path
class="fil7"
d="m 477,479 v 2 c 0,5 -3,8 -8,8 H 231 c -5,0 -8,-3 -8,-8 v -2 c 0,4 3,8 8,8 h 238 c 5,0 8,-4 8,-8 z"
id="path39"
inkscape:connector-curvature="0"
style="fill:#0ea5eb" /><path
class="fil8"
d="M 350,70 C 505,70 630,195 630,350 630,505 505,630 350,630 195,630 70,505 70,350 70,195 195,70 350,70 Z m 0,46 C 479,116 584,221 584,350 584,479 479,584 350,584 221,584 116,479 116,350 116,221 221,116 350,116 Z"
id="path41"
inkscape:connector-curvature="0"
style="fill:#2979ff" /></g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -3,6 +3,6 @@
"author": "File Browser contributors",
"private": true,
"dependencies": {
"filebrowser-frontend": "^1.0.3"
"filebrowser-frontend": "1.5.0"
}
}

View File

@@ -1 +1 @@
48f80ccfd160585c4a9e60e1f90399ec17c185ea
a48cd194336986773da16bd667eb3dbb17ad9b2c

View File

@@ -10,7 +10,7 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
"github.com/hacdias/varutils"
)
@@ -64,7 +64,7 @@ func (h Hugo) Name() string {
}
// Hook is the pre-api handler.
func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (h Hugo) Hook(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// If we are not using HTTP Post, we shall return Method Not Allowed
// since we are only working with this method.
if r.Method != http.MethodPost {
@@ -108,7 +108,7 @@ func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int,
}
// Publish publishes a post.
func (h Hugo) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (h Hugo) Publish(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
filename := filepath.Join(c.User.Scope, r.URL.Path)
// We only run undraft command if it is a file.
@@ -125,7 +125,7 @@ func (h Hugo) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
}
// Preview handles the preview path.
func (h *Hugo) Preview(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (h *Hugo) Preview(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Get a new temporary path if there is none.
if h.previewPath == "" {
path, err := ioutil.TempDir("", "")

View File

@@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
// Jekyll is the Jekyll static website generator.
@@ -39,12 +39,12 @@ func (j Jekyll) SettingsPath() string {
}
// Hook is the pre-api handler.
func (j Jekyll) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (j Jekyll) Hook(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
return 0, nil
}
// Publish publishes a post.
func (j Jekyll) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (j Jekyll) Publish(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
filename := filepath.Join(c.User.Scope, r.URL.Path)
// We only run undraft command if it is a file.
@@ -59,7 +59,7 @@ func (j Jekyll) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (
}
// Preview handles the preview path.
func (j *Jekyll) Preview(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func (j *Jekyll) Preview(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Get a new temporary path if there is none.
if j.previewPath == "" {
path, err := ioutil.TempDir("", "")