Compare commits

..

92 Commits

Author SHA1 Message Date
1138-4EB
4c7c507830 chore: version v1.11.0
Former-commit-id: ef29aae8bce2a6f7065f17e5a67a2ae7f0757ecb [formerly 73e46c8be3e8eeb30dbe09e1f32a23f0ad72b0d4] [formerly 4edd4c5782b442132446486132a5adab9d6f15d6 [formerly 663e0608b9]]
Former-commit-id: 2d337b53eff21b0ac7b42ac217a348ae683b75f0 [formerly 6af864c17bec27e4eed20ef2e0cdcd12a65b23cf]
Former-commit-id: 5ea70d7c172c1f40aaa1a718b6972935d3b8c688
2019-01-05 22:26:40 +01:00
1138-4EB
bc8d19feff fix goreleaser work dir, go get
Former-commit-id: 77e16f340827015ab03b517fb573bde6e864e170 [formerly 5cd6823a69867510bc37532c31737107a95d2f26] [formerly b84c196ad4be5a099eb4153f03431b419d6694b6 [formerly 77868b2647]]
Former-commit-id: 906c949ce79f94faee8b795ef66622d557281964 [formerly d401d2ea6393e4ed133563980e4fea3fee0c64e4]
Former-commit-id: b2ce07cb1c0a969a8cb62e823cba5f617b19f0bb
2019-01-05 22:26:28 +01:00
1138-4EB
f77009365f move filebrowser bin to root
Former-commit-id: 26f855618a8be4f28fe05bbd04ffb1c3437d6e45 [formerly f49857b8acd81f2155d5dfcd83d5362f6b91f846] [formerly 27a857c6d63f7dd795613f2af44b563e072c7453 [formerly 3988bdb8fe]]
Former-commit-id: da0d6b6921b340df1ae4a77a3306f56a970cf0c6 [formerly b56f8c43fed299ca73ba155c76c74b76a2347a36]
Former-commit-id: 06329d841c54b4d58a73b59bc5ab8a64e62f35ba
2019-01-02 03:35:35 +01:00
1138-4EB
74e93b8df0 replace gometalinter with golangci-lint (#596)
Former-commit-id: f43cff5a88f9b70f593cf612832428f71decd92f [formerly 7f5f957bc17fb9e03b37224a1cc31ad65af5468c] [formerly 8e8a054716b10a3999bf75deea0f0d3759c1ac42 [formerly 835c37d1e3]]
Former-commit-id: 970cbb1ad8489d7117ee580339709a07652def96 [formerly f7a47fc1f409b3acc390fa039c0076b208931748]
Former-commit-id: ec3c2df078a903c6485dd74207e34bab08f1d9c1
2019-01-02 03:13:53 +01:00
1138-4EB
901dc2c160 allow to set default user with env vars (#591)
Former-commit-id: e0e798642757d7a5017fccf0edd4d65a4181359f [formerly b354327fac46e7b721e2baf6fef5877944afb400] [formerly 3ef64ca1637c2145fd4a776f26afbd1b426d5098 [formerly 0b66d700e8]]
Former-commit-id: 192b543db9d3707eedd8745833020d603fe64c21 [formerly b7b034bd96ff63d185ccf9cd20cbc7673eed7de1]
Former-commit-id: 4fca72efa7aac242fec991da5330e78ef455d12e
2019-01-01 03:18:58 +01:00
helloray
b5ee82c943 fix multi-select files download error when filename contains '+' (#571)
Former-commit-id: fda2e75979b6d48ab77e1486d0d65375cae8ee03 [formerly 0ea1d769d4a591c522e7a642f386e3db579ce913] [formerly 230ee6abca47dd4a212d1481a294fc30972f3545 [formerly 7394f6b9bb]]
Former-commit-id: 3786998d5b87591db765e5388886e217a3c58dc8 [formerly c4954221ab23794024ced09d0f858c65d0d82c23]
Former-commit-id: 42bfe718742895fa9e03bf5dd5c1e53c826c510b
2019-01-01 02:39:45 +01:00
Allen.Guo
8e4805ba69 set threshold for large files (#558)
Former-commit-id: 9b4aa87da78f2a9ad539e4229a5a1114a5716502 [formerly 0767dca86d42737c75bb7575015f9c29e35a55a2] [formerly 65887efb2d961d40c95374ac2336e76e53e3b4b0 [formerly 802bcd8cbd]]
Former-commit-id: 3daab729620942ea0403f618588e731f90717e17 [formerly 5197f129ce4425a8716279e04f4e5b3653901c3d]
Former-commit-id: 0cb78fc0e87cb14ee540f2d3a2264d7b081c8985
2019-01-01 02:22:09 +01:00
helloray
694c750561 fix directories in search results can not be opened by click (#583)
Former-commit-id: ed2a9a08fc9488bf4ad9ad6124d24324dce7bc4c [formerly 8cfcadb62184144e58bba8af3b6c47ace2f6050f] [formerly 040d07180c51944c5f5d713a86db915365c829fa [formerly ea3576da7e]]
Former-commit-id: e653086b78975f878ba0f6f397715c61f8fb53ef [formerly 1b4d65cd703b6c37fe6589da29c25d565783fe27]
Former-commit-id: 1f073a343adb693ee4d9153309a664520027908e
2018-12-30 17:47:45 +00:00
Henrique Dias
efa3b3f198 feat: readd dos2unix
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 7a00285b53dc2a67214cf2a9a8111794801cc7ab [formerly 0dd178342671e6c201a2ea86d6699b52c03fe4c3] [formerly c25ea49026485af46401c2bf359b3dc3883711f7 [formerly c01ebf33ef]]
Former-commit-id: 489505f6219c7ce5476717c8cc054dd7e648e29b [formerly 2d81af6b62d26914f7d3b48d4781a5f5196769af]
Former-commit-id: 8e72aee50d6cd5a158f791c3aa8a1d2f3fa4ca6e
2018-12-28 23:39:46 +00:00
Henrique Dias
998dd9430d fix: move everything to LF (#588)
* fix: move everything to LF

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

* feat: metalinter

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 3e371bf0dc4d8205fd2ab4d1b64328b7659242c0 [formerly 5c776eafad1350b9f55b3417bf63f51d372e1663] [formerly ef8552957375306c1ab58db6cead3fdf92bc1758 [formerly b344efef2d]]
Former-commit-id: b8e19acffb00ef1546a7005b1956a858038199f2 [formerly 2b9920caa1bf71b44f245ee3d246b41170f5aecf]
Former-commit-id: 36c7a82150c1ca5d528aeb7aadae243661966560
2018-12-28 19:19:54 +00:00
1138-4EB
c8b5728743 add go mod support (#586)
Former-commit-id: cbe15cc342afd93705ee0ebd588313dad64ad45e [formerly d8de1b0940a83510fc5af2d35b04bce5d34fec60] [formerly d5b2b44d09de2740ebde690b9eb85d5ac5bbcd0c [formerly 4945635bd6]]
Former-commit-id: a56cc4805870bedf858ca69d9692188d69bf9bef [formerly faec73a01496613eaa0ee1512d77a8d62617cac0]
Former-commit-id: 67b5db918ee3295f5d4223b68e11504ec4f70491
2018-12-26 00:48:43 +01:00
Shodhan
fab33e3ed1 update README.md (#568)
Former-commit-id: 901577a2f334e78051f75b4c4435abe655c634e0 [formerly cd82cd950a318fe28e86621667a8339996e44cff] [formerly a480ec089d539fbc0439181b5505e6dca6455e28 [formerly 59f28638c7]]
Former-commit-id: 5119d459fcdba021f4e23f3705ddc0f9bec0b161 [formerly 8d30555b1c6f7328d4e07c41043cc370c0cc0154]
Former-commit-id: 4a30913f85528107b8cf5f5f62c7a8f6aa3746f3
2018-11-19 03:21:24 +00:00
Henrique Dias
5079f405fc docs: remove old disclaimer and add new one (#533)
Remove old disclaimer and add new one.

Former-commit-id: 26caff0046abe585e1dc58c7f6ca728254b57883 [formerly 9915c1da01cdf3742c49625028de3646f4cc0218] [formerly aad017cd8c74480cfc978c830f83346c5e410bc3 [formerly dae992d4a9]]
Former-commit-id: 0fb7d01241ec6fe633624710bd7d4a2a713ca119 [formerly defcc61802d496705a16de97c30ad5ca2e7d8497]
Former-commit-id: 2dffe9f988673bc9c4b83638190f70ac579b9e38
2018-09-08 20:30:39 +01:00
chinglin
b85a07536d fix: recognize small text files (#531)
Former-commit-id: c4d7475d7fe858562fb5f45dc39164aac2463cbd [formerly da7f7862848b719e71b0b4af9fb4c9813a2c1629] [formerly 264f015d1a736fd5d237e7895d3ee142b0137cee [formerly a0194899c9]]
Former-commit-id: 218bd162ee8f5222fdb0c717b481524c210ded7a [formerly 916f1ca36e2439e32d1b6a8baa0eee7a8efd290c]
Former-commit-id: ad2dd70b88612c8a212c0351abdeae9da442e21d
2018-09-08 19:03:12 +01:00
1138-4EB
7e3a15e073 chore: update frontend
Former-commit-id: 701a87afa3c7a8c7dfd15458fe2c23c2ebffa322 [formerly 743b8fcd60467068ce0bbc7129a6481d3feb740b] [formerly 4f705a9a56af47da1c06cc6e7ce779890dedb7e2 [formerly 43707a68cf]]
Former-commit-id: a856ab9ac4e6e3d2716997e0ef0ad5b62eb55cbc [formerly 21503f038fba99e7ec45fbf9a6de455fe860b009]
Former-commit-id: b3cde7867cd25d02a95a802761aa9956f15ddd58
2018-08-24 00:24:38 +01:00
Equim
aeb4e2aab3 readme: fix ci badge
Former-commit-id: 47ccac39f49f20424b045e69bd41c16b958d75e9 [formerly cfca8143a46299a6044da9fd644aa97444c03f61] [formerly 61a6608b440440ca14dbad171abaa7b581cc430e [formerly 516aa80c86]]
Former-commit-id: 710cf897c71bb8e5fdd3726e68ddc44b66633634 [formerly 8d1f3a87ab4580dfbc051c04d72201ee0cd878af]
Former-commit-id: 3bdf49c3539bc73d8862dbdf19545547a2aba375
2018-08-23 13:47:44 +08:00
Equim
bd65bc9e44 readme: fix ci badge
Former-commit-id: b8e5a0df76108e9d8c8341899e5270c46f4a9ba7 [formerly f86e9cb629e7dfceddb7e1fa3dcd701394d2933d] [formerly 3c80281d4fc173ce9fbde95823344456b8b0ee93 [formerly fc84aa65a3]]
Former-commit-id: 49a0f985fb5c0e78a532300a3192bfe8c1565c9b [formerly 78cdcdcedc20829ed77f6e2759391c75a4352f18]
Former-commit-id: 2edfc4473e44cea69f7f8423109111fa29abc248
2018-08-23 13:45:11 +08:00
Hugo Massing
59468830bb fix: search case sensitiveness (#515)
Former-commit-id: 7d86ecccd2095be6bf7db6fa4b93e226cb590661 [formerly c6e3db510232dad7f175ede09481dd3c14cac26c] [formerly cf4dfe6c7ce811d489292a0896b4de46a89bfdc0 [formerly d16352b0ba]]
Former-commit-id: bfa8e15160d458a77c9a1e5cea759d214716dbdd [formerly 74fa0134bc42399b0f3a6627791efed6f5176fa6]
Former-commit-id: 04d04ac91ad7047afc541d5c43e69f81fae54f2a
2018-08-22 16:25:30 +01:00
1138-4EB
d7c3665e2b chore(goreleaser): adapt main to refactoring (#506)
Former-commit-id: b3489300998867306df6e168ace939c8e5d02906 [formerly 9bef5d82435847fe679a298a6e0bd7ba74361f09] [formerly 4e385aea825abd7f4ee9f2eb9cdad7f6acbbe061 [formerly 3372f0546d]]
Former-commit-id: e221415d23a3f6be129fe921d429414b4199b772 [formerly 8cefe1aabe6f30fb9b415e009cce96cc3b00f019]
Former-commit-id: 17b5db1f79eb41e90fdeac2f85178f5ce777dd33
2018-08-22 13:24:34 +01:00
1138-4EB
679b0f0f4e chore(version): set CLI version from lib
Former-commit-id: 687a0a5f65c1e246110f11832a74aff227aea9b1 [formerly 6066fdbdd709de04a8362868084f70fb04a24c66] [formerly c29860d9846fe01aadffd393753265294749fc3f [formerly 0c53f06c64]]
Former-commit-id: cc10a50da0a49f97455a59a7e6e8145460168407 [formerly ea1aae8d790840e5ac7e86556f59316b476b1218]
Former-commit-id: ccc7c07a75dffcd5306a537bef2a5dce8a8f6051
2018-08-22 13:15:55 +01:00
1138-4EB
7d912dd257 chore(dokerfile): load config file implicitly
Former-commit-id: af5491f1958594a033cceea64bb988e427141952 [formerly 24659c5c4693bb2f7a4930e748a79e329dd6e45c] [formerly 9b3bc71ac1708475648c0ec0207584a5690ac91f [formerly 0f2be941e8]]
Former-commit-id: 9a1f8040210fb026e6741517640bc583915727bb [formerly 971cd99c1c3734d352b6f07664f05245b1672047]
Former-commit-id: 653b6e78a6d562db4374f5e0ce22078cdc670fd8
2018-08-22 13:09:21 +01:00
1138-4EB
a92d7aab8e chore: add version to subcmds
Former-commit-id: a08e327cccff4586578c71b6278b46c9d802f4dc [formerly 0b5e200ece501efd62b80c11f03518f5aac11c87] [formerly defeb96bda2355d30a5fd0d9e6a3b6c427b170b2 [formerly d5fcb555cb]]
Former-commit-id: bf7ccdb941b150562153ba61609db38922191b97 [formerly d6250e9ca18bd318f0fdf742fc32e0404998e2f3]
Former-commit-id: 867dec4689e6ed85b29c6501e37da85801783281
2018-08-22 12:30:55 +01:00
1138-4EB
0536d8342c feat: use cobra to provide subcommands, move sources to lib (#506)
- Use cobra in order to provide subcommands `serve` and `db`.
  - Subdir `cmd` is removed.
  - Subdir `cli` is created, which is a standard cobra structure.
- Sources related to the core are moved to subdir `lib`.
- #497 and #504 are merged.
- Deprecated flags are added. See https://github.com/filebrowser/filebrowser/pull/497#discussion_r209428120.
- [`viper.BindPFlags`](https://godoc.org/github.com/spf13/viper#BindPFlags) is used in order to reduce the verbosity in `serve.go`.


Former-commit-id: 4b37ad82e91e01f7718cd389469814674bdf7032 [formerly c84d7fcf9c362b2aa1f9e5b57196152f53835e61] [formerly 2fef43c0382f3cc7d13e0297ccb467e38fac6982 [formerly 69a3f853bd]]
Former-commit-id: 2f7dc1b8ee6735382cedae2053f40c546c21de45 [formerly b438417178b47ad5f7caf9cb728f4a5011a09f5e]
Former-commit-id: 07bc58ab2e1ab10c30be8d0a5e760288bfc4d4dc
2018-08-22 01:29:51 +01:00
1138-4EB
93acf4a6f7 chore: use commit SHA as version if not release (#505)
Former-commit-id: f94f65a805178a47be814226c69125f2c35b995e [formerly f87abdedd1a0b0a4187d11e6311a1fc5d95b9368] [formerly f0a8303535fdfa4bcb348c21e8576c32908255ed [formerly b1eb90767d]]
Former-commit-id: 31edb3a4cb01d8a091549d3b7a4dcc572b64baa8 [formerly 6b2abc348d488a7066812072a887df19ac70c720]
Former-commit-id: d7fbb8e61646a9fdc55699b0d016d8c13e676dcc
2018-08-20 10:41:06 +01:00
1138-4EB
dd8f47fade chore: fix rice-box import with sed in push_ricebox
Former-commit-id: 8f25251975c4e8a24d8cd7af1a9ab915010cb2ec [formerly 22583d38eff231d75e6fa1bb0a3f30f19201ebe2] [formerly f96b729dcf040693463591f90c602b030c576c1a [formerly 43ab4fa3de]]
Former-commit-id: 1b1a4b9be3b365faf0e18215fb2b5723b644a66f [formerly 6ce724f373ec2ad6738c61589a075ff9de0ed64e]
Former-commit-id: 750ca0440b7fb606e53fc043255fd2b0e0327a17
2018-08-16 10:12:33 +01:00
1138-4EB
3f4db6b81e chore: fix author in push_rice (#514)
Former-commit-id: f2b1df2b3387ae61c9e165de5763a0e06c2eb7d7 [formerly b3b5751c000a722e5d61e20ecfd0f7ef18420b0f] [formerly d951176d0cf0e0f1db255eb9d4fb0f52688c8cb9 [formerly 7afaf59e5d]]
Former-commit-id: 28fa6fdbd6b6414e303cf52ce57288e534a0a50c [formerly 780354453afc8940fec77d9b5765aeacc56dc924]
Former-commit-id: a83f01e72a88cdcc557f85b84f513c38b565f08e
2018-08-16 09:56:06 +01:00
1138-4EB
e471e79d50 fix(config): ensure provided config path is used (#508)
Former-commit-id: 519c027039de94232d801df4a71187096888f6bd [formerly f76f9459eeb7d8038b8d9b31af2e562c2984809e] [formerly 6b532750f58cf0eabaffacb772b623a9ecbf8e5b [formerly 1e12bb7f7c]]
Former-commit-id: 17a85007590f31c7ef1c2e6d125d30191eaa4d7d [formerly 4ee6dc582cc4e1c086f55901902864d784d392d5]
Former-commit-id: 9daf15d9a1131f8f45ce35a9b676dfdc8cd4b099
2018-08-16 09:37:07 +01:00
1138-4EB
6b4bce5daf chore: setting untracked version [ci skip]
Former-commit-id: f1990766e31c6cf01a7b97d1047e494e1ffb5175 [formerly 3f137859a89ca9623cf0ccb5cafdcd732853aa3e] [formerly d97c14c27c0c7e88295dc3114ec497979e3507e0 [formerly 69d1fdc0ac]]
Former-commit-id: 9983703da7f342ac3648fab4e92ce90fa19ea186 [formerly 78ac026abaa38ca16278b80d8f7c23f842d736c9]
Former-commit-id: 3626e4a882a1b28850a579090812347718247597
2018-08-16 07:33:26 +01:00
1138-4EB
b66adcb582 chore: version v1.10.0
Former-commit-id: 74446bfe3c27c860a34021c9fbc072a1d1b82bc5 [formerly cb41bf65c06e12bfdba229e337204dfe5e00c3c6] [formerly 5482d87a53717bc557d984d87f6448a0ee955503 [formerly b579350798]]
Former-commit-id: 38679cbcad1ab3e5bde96897048fc90594bcc5dd [formerly 775d5d1d240ae13649f383bdbc170ea906d969e8]
Former-commit-id: 941367abeb3f691ef5017d59c7a2543cc4caddab
2018-08-16 07:33:20 +01:00
1138-4EB
5ec06fa0cd chore: fix release conditions
Former-commit-id: 6300d99faea5b807ba90ca409bcc683eefb5cf67 [formerly e9ce861912c0b03f64bded2ed44896d6ae79a485] [formerly 8acca6c5ecf8b56e85e22271addaa7ce396bc676 [formerly 714876e3d0]]
Former-commit-id: bcc4154cbe9a0dbe6819b3ac3236d98c3b8f6010 [formerly 00da283ee494ad42a7e886f52fa5c8ec34860c68]
Former-commit-id: 4f8963ab76da8a9230e835ba8ef82b7893516b20
2018-08-16 07:32:46 +01:00
1138-4EB
c163318ce5 chore: make release.sh executable, update frontend
Former-commit-id: 239ec73aad2905eb0ffaf2318b1f6166bb910da1 [formerly 723297d061329c46876a4bfc534c1bd83a1249a4] [formerly 0293f9a819d58f62b00c51894bb7e33d0af9cab9 [formerly 0854c423c3]]
Former-commit-id: 2cb8474af898a81cdcce7d6a0c109854efa7c0c9 [formerly 48013895c67ac2cb22097fb5dde040747a231dfd]
Former-commit-id: 06799635ff5acfa1a79f4c41f22b187aa92b2b98
2018-08-16 04:30:28 +01:00
Henrique Dias
98dabff1e7 docs: update docker iamge
Former-commit-id: fb8c8d07d7c50a916b9142ae674a0d080af4bad5 [formerly 37c016849e2bc83f184eb1cb3b881c3fa300bdb4] [formerly 05c42ceabed6b64d5b4550fa32b07d3d3d976c50 [formerly 10607eb6bb]]
Former-commit-id: 525cbecb6754d4bc3c440053880440dfdb16acd7 [formerly 03e66762e36fb88cf738c21238faa7f72463d486]
Former-commit-id: 723f07c766502c2f49305baf79ebde41e9e15098
2018-08-08 11:50:59 +01:00
maweck
50dcf35eda feat: proxy auth support (#485)
* Change the order of commands to be able to cache more layers in case of multiple builds triggered in a row

* Fix #471

* Format Code

* Revert "Change the order of commands to be able to cache more layers in case of multiple builds triggered in a row"

This reverts commit 29217f66ee6aee63d2c03ac86de4ad437876317d [formerly ebff3e9d79ac9eca44d7b3caf7814be62c784d43] [formerly 9b95d9e986254d55405cd0e9484dcbbadc54c87b [formerly d13fd2878c38a46f91da30de150624200f0b32e9]] [formerly 3ec8fb12d8b6e1942ebae6abb00c5f15b03d6412 [formerly 6a70bdaf457f50896dd9826608666a39babae666] [formerly 063a6fe9d4991b7b6c257ae081288ea40efbe8b5 [formerly 01362f34ee]]].

* Adjustment based on the review

* Rename "login-header" to "loginHeader" and prepare auth.method to accept "none" as a value

* Fixed line break

* Readd "lumberjack.v2" import which was removed by gofmt

Sorry - I do my tests and run "gofmt" before comitting the changes - It sadly seems like it is messing up the imports over and over again.


Former-commit-id: 252e65171f70ee87238b5542e6af81d90bdaed6b [formerly fa843827feaab389550f32ba3a629e1968bcea3d] [formerly 942986226dbb56ef1cb4dff24445406cfa699d2d [formerly ed62451ea0]]
Former-commit-id: e87377dd6f30012b0d602b592100a7deb39a8632 [formerly f8198aa8a51fd5e727c31df0918ab62024520cef]
Former-commit-id: 019de07d53c3da16354e228330c14efb0dfb2122
2018-08-08 10:06:16 +01:00
Henrique Dias
769e634bdd docs: add freenode badge
Former-commit-id: adbba24f2d206e5f70e062c3733dc4737b2be85c [formerly d74e2307695c122fe4ad8118aa73d4af91fc7d5c] [formerly 1428ecc21a5031949b8bb04b43a31db7dbe1ca5c [formerly b90e7b8d26]]
Former-commit-id: ddbb0a87937d4704e1e14fbd16a9a129b26cceb4 [formerly 90a491507a9f9e8dfe78329ae6b51dd722859855]
Former-commit-id: 724bae950c0affd84fd9066ac016e318c5b7c115
2018-08-08 09:14:55 +01:00
1138-4EB
dead024e53 add pull request template (#501)
Related to #477.

Former-commit-id: f3020544c0b03295d5c4c79a678a4a1acc47884e [formerly 10c8b8febfa720d1e719f5e4735259b6427b9df0] [formerly 3d0b90a6b6c62bed99d8347066befff8a29f4525 [formerly 8186e8f02f]]
Former-commit-id: ccbd134d4e7d8eb7a362a2e34fa2828f2b86766d [formerly 2f9b979b97a8086136cdf36c68cdaeb2b36ef7da]
Former-commit-id: 6855aafd45b5c526b91fd3acdd95af4fec68175f
2018-08-07 13:53:51 +01:00
Henrique Dias
f4982cff5e style: fix linting issues
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 10657ab9cff2ee94dd7c0082bfe2cbfa07865022 [formerly 5501af1ace43a089ac4222cf9da2f5176242f817] [formerly 39c72e2e9235a822a30c0b338f55c441f3b3024d [formerly b7022bdfe3]]
Former-commit-id: 5941e4ab1295b90371ba60003f69939559dc8060 [formerly 3513d92ba403133d7b53aa19c92e4356f9e68b75]
Former-commit-id: 3657f6f659e893928bd2b9f64afecdaa41d587a6
2018-08-07 13:34:06 +01:00
1138-4EB
bfbb7b5ee1 chore: move filebrowser/dev img to separate repo (#500)
Former-commit-id: e54327906c7e4923debd36fff1dc31886440463c [formerly 72506b1b7f04ba728532ab6e94bd3e482ce38cda] [formerly 1195ba2763a02f47797bb529a7f89fa625e4c3ca [formerly 5afe2cc52d]]
Former-commit-id: 022049582a495c141024ceaa43516541a8c72628 [formerly 6a29708b0a57ae9aad227fec96983218d50da38b]
Former-commit-id: b9b48ad2b8e5d0b3b96f2b15fefe785a830240dd
2018-08-07 13:29:50 +01:00
1138-4EB
7c09473312 chore(gometalinter): exclude vendor
Former-commit-id: 8e99e3c0802a1f8acbed90047f0143789da771ad [formerly 94a11f954bdbdb4f295ecfb53ed786241a2a7fb5] [formerly 165c7ed873e40b703e3c910678479212f5f78fec [formerly 65ea97b32e]]
Former-commit-id: b144f646b8808e500209056d35994f4b9cb60773 [formerly 964ce718e4661dd15d3a7311637d4105d381b320]
Former-commit-id: ffc4f157a492490b95df3849d52218ae142581fc
2018-08-07 12:31:27 +01:00
1138-4EB
b6a8472722 fix: use './...' when running gometalinter
Former-commit-id: a3f2c975184928b042e09a42a2006c54fc3c9026 [formerly 3f80e808255c869732bc31f981f3a9256f151cc7] [formerly facb7e61332d3fb6fb18e5ac36771141474935c8 [formerly 69f11ed80b]]
Former-commit-id: fd86fb79039c33f22aaf05ca7023c74ad8d0036b [formerly 990a472cde58a891c01d673e1b1fb570b07868f1]
Former-commit-id: 887b84b6134135b268d4aa82d9c65990fc7d86c9
2018-08-07 12:04:43 +01:00
1138-4EB
db01cfa2f0 fix multiple entries in script deploy [travis-ci/travis-ci#7641]
Former-commit-id: 32d1205b18e256f94831485837b868f1cdf30bb1 [formerly 8caae9f4acbfc93df6729a28ecb0f136bff3cc3e] [formerly c988834f5d4a7a08796d538626c2b3f042fbe1eb [formerly 81f05aa894]]
Former-commit-id: 8b2f7f547441f01f853a67d8edca7c54fc6cf0db [formerly d4c50007f20825ef35cf767ce7b31ed76848e341]
Former-commit-id: ff4fab2a46d70189ba0a977c372db7cf7c5c0bd3
2018-08-06 22:14:40 +01:00
Henrique Dias
4267ebf0b4 fix: error at first sign
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 649162e55f57817c6e2fd8cb66fb4de1ada68199 [formerly fe5e1f6df6320c2eb6f24ca64ebffd6cedf6659b] [formerly 2f6eea9879c754d67acdf8f0809dd9c39cc12df0 [formerly 4470e0b450]]
Former-commit-id: 3a3500d1492db1ca7c262c60390452892fccb97b [formerly 2ea468347c670e8dfeda99be204e0b22072ea9c5]
Former-commit-id: be6a317810a0a465db2e852c6839308bf4d346ad
2018-08-06 20:53:48 +01:00
Henrique Dias
d4e9f5ba53 Merge pull request #492 from filebrowser/chore/build
chore: new build process
Former-commit-id: 5c703aea976d95470a5f427a2c2d7b15d08c0e9e [formerly 326fcdd2d11d414c557986c74ec343d5c2221168] [formerly 7a5991c0e85806e82256b201b515a070e0e95ec9 [formerly 8ad626b0bc]]
Former-commit-id: f78d78c109181cd9c52bd91753d4e39e8f65e077 [formerly 05e6b729485ddfa48ad428c389bd85d8ab11f366]
Former-commit-id: e91d24edfdff15c075e4f980a88b3dc8cf9d5254
2018-08-06 20:40:57 +01:00
1138-4EB
4ace991b8a update ricebox in caddy/assets
Former-commit-id: af8d9982d961f4c8e5a301dc0eeb1dc790f35231 [formerly 6f678bfadf1e1db8c8dc5e368087a23a3dba8b65] [formerly 3d06b4d8d6b2ffe209f10b9ae4ce30955839e721 [formerly 6f7fded3f1]]
Former-commit-id: 4016e6b9b12d5f945c67fd0960a3460cd1fbfda1 [formerly 1ead636502f6b0991e1b18f3de5889546cedfa24]
Former-commit-id: 03bb7d11a2062ca3fe4ffd5d3efc702e4652c260
2018-08-06 20:08:56 +01:00
1138-4EB
e0c91bb747 update frontend submodule
Former-commit-id: d1cbaf35191dfbdf499909baed77d16daa54ce4c [formerly edb3f13a7a6fd20a8377bee0c1eb9814dedcb615] [formerly b5566691de3d26ffaaaa0a9df77d517a8290a2cd [formerly 1149092d73]]
Former-commit-id: 642d0481907ba86e2fde0940e02bdfad4e04c898 [formerly 4f90dfe05f65af83234eb32e62fc4476ecdc5a75]
Former-commit-id: c858f5c393bfdc4de23c7fcc50cd1f2145ec44cf
2018-08-06 18:26:59 +01:00
1138-4EB
557e5922d2 fix(publish): fetch all before checking a matching semver in the frontend
Former-commit-id: 922b633d536f4102d8ec3e68a7d7fa12270e21c9 [formerly 7c8b0295aebc6819a162f94d23821e7728ebabc0] [formerly efad5cfea2c8bf1a1617dea5e9e6d0903d2d44d7 [formerly 18a9d977c2]]
Former-commit-id: c48391a56546742845c697d0b6494b1230bdf529 [formerly 4609f232086d4c5096c2a937cdf980f1b1a786cc]
Former-commit-id: 50ac09f7bca6d3541c0b8eb70ad672ed6768b2ca
2018-08-06 12:46:59 +01:00
1138-4EB
cea4d2aae9 fix rice-box dir in travis
Former-commit-id: a4de4d83ab964c11bb0375a66af7b011f39990bc [formerly e93bcfd8f83c089d72245ffa79785860f00b3758] [formerly 364f472f6e27004dab8bffa8674c855e9e6d4213 [formerly ac3ad47a92]]
Former-commit-id: 4c8cebdea67e8cd88c58563702489f7549aaa222 [formerly 1d6a75e82822a33f8edde2d64077196454f460ed]
Former-commit-id: 4230de67e7923ef7450385c8c9d25654f19f18c7
2018-08-06 12:46:59 +01:00
Filebrowser Bot
bb5c041d5c add deploy_key.enc 9ca81b5594f5
Former-commit-id: ed1098dcc37748ac3253be57416ba10aed0786e2 [formerly 4f791e75150f7947ea9bfac6e7e13bf3316f21d7] [formerly 140301afea7e83c08649870eb8cd6ee8bd111353 [formerly 43288e9b86]]
Former-commit-id: a8e5cee586fadff0a107d47cdb10573eb9aa30f5 [formerly 2eaf33fe47c4c56277284733251be36cfc0956e9]
Former-commit-id: 6d7a694ae4b0328c092ee342b96b226f464e526b
2018-08-06 05:01:44 +01:00
1138-4EB
bf1ef5b0f8 setup travis releases with filebrowserbot
Former-commit-id: 0593d1dd3883e25a44588131fa6fe69df815fd87 [formerly 429f789e0c54719595830f2290985be1f5899fb1] [formerly bb5b0328aa951f5534ab29e5070a1aa4da9ec2e2 [formerly 52aebd0444]]
Former-commit-id: 0cd117cb81b2a38b2646cc880c8774fed786d45c [formerly bf046ec317be577c8c3c4613d81272f6ae7fcabc]
Former-commit-id: 5066ef1dc9b898e8cf9909c03dede43690325815
2018-08-06 05:01:42 +01:00
1138-4EB
08ebe0fbb0 release all the files in dist
Former-commit-id: 9ac3858d788425d5c447f5a5ce068db71ba3bac2 [formerly 1eb037fc961dcb2d288d3f9edb7ee0867456aeef] [formerly 8633b5ef520ec3d4873a8b93925f90b4d129713e [formerly 6c98dfc9fc]]
Former-commit-id: 80f9ee49a48f953108813af26d8d576b17793245 [formerly 8cb7931e12674c248c68a90a3de2d5054646e089]
Former-commit-id: 2f0a1639a58ed6c8b56c178675829b05d8b08f30
2018-08-06 05:01:41 +01:00
1138-4EB
bdd7c269ed add docker-credential-pass to dev img and use it in travis
Former-commit-id: 3deff7d6b345fd6c1e9bac71b446730631e891c9 [formerly 2525a27cb90b003f72c7d936e2f0224848e3e49f] [formerly c699da2816b0c61bfdaf0a8b40612b9d50734d73 [formerly 5ab5c7c243]]
Former-commit-id: 7ed9366f3c83f50afef6b40d0006c32256d053f7 [formerly 0fc1beb902fbadc6f6388b10b7ed319e15fcb7d4]
Former-commit-id: 7bd6bacacb114d72808ded8c102f8f14de450625
2018-08-06 05:01:39 +01:00
1138-4EB
292ef7ea8a replace publish.sh with build/release.sh
Former-commit-id: 89636040fe653a0e2917a51fd7e557b0a9d2436c [formerly b052d724fe2381766bfd225d451cc7a077f82db4] [formerly e9e6f9066892058cf2780d33db8e561281bb1597 [formerly 2592c5eb43]]
Former-commit-id: d29d1a3284e7e84c80324d7591623644e5c3fac9 [formerly 3417ad7fe90ed523a0bc9bd67beafbb7b7ff3a80]
Former-commit-id: 5ac4f1ea442c54a401c66203343fa0373b5ffa9c
2018-08-06 05:01:38 +01:00
Henrique Dias
03ab2199d4 update repo
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: c78a96fbc7f65f0504e28ac2a59130d060cfc3d2 [formerly 5b8124120440eef3f81bef7a1354897c1e88e0ef] [formerly bbfcefaad0bd8e345f8463ad6f3ef7e5a65ea152 [formerly c6c915e387]]
Former-commit-id: 4af0f562b1c42e28e50f51c368544b957e3954b7 [formerly fa4050a8f763b7fea686617842610c526ed077b1]
Former-commit-id: 789e64f89019211fc541cbbc2e67655899b294ae
2018-08-06 05:01:36 +01:00
1138-4EB
41489f9e89 chore(gometalinter): gas is renamed to gosec [alecthomas/gometalinter#505]
Former-commit-id: 9d049a2544677a82892d61b046d9ca02719fd64e [formerly 75108904316b277fcdbd28145d0abff61c4c7d04] [formerly c28ae59c1ed7230f7f9ac4c5d6b27a014bac506b [formerly 993bab4687]]
Former-commit-id: b2bcc79aa40cb727315e0ec1007deea3a74358c6 [formerly 35c44ec3706ef141489d1c65309b55e21f03b4a0]
Former-commit-id: bce721ae0ca43b5b9667c31ccb2a3b64b48b7a71
2018-08-06 05:01:35 +01:00
1138-4EB
3bc5f6e0df build docker images with goreleaser
Former-commit-id: 5f8a21053734ba6c507b7d39fca57c0dcb9994fa [formerly 2ecda20825d40484ae2a24fba6dff4dfa63bf5df] [formerly a13bb1c1d1d812c86d8d92521bb48f7102b6725e [formerly 6cb2e30143]]
Former-commit-id: 553cb8f6ac4f89a4ab9574a72a2dd54e384f1072 [formerly 64e289831d826b28cc777c7ee7a79c8938f2a706]
Former-commit-id: 587e569d59adf142a24513bce9bc764841f8a550
2018-08-06 05:01:33 +01:00
1138-4EB
42d33cf595 add docker static client to filebrowser/dev
Former-commit-id: c9e14d35f42c240caf16c7ffaf03b56dac75588f [formerly bf92002b6cac66b3fca8fd68e7a19284983973d1] [formerly 3954699af9e3dad46a0026b07fd5ebb13796fabd [formerly 7459e66b71]]
Former-commit-id: 8f65bfb661773bd587243e84e9381d0e9a77ff50 [formerly 72cb26e555e2dd113a7c7e77fff71ae0abf440de]
Former-commit-id: dfe6091913bbcaf6bd87f8e1f3b06d5d5c84d14e
2018-08-06 05:01:31 +01:00
1138-4EB
0fbde826bf move caddy to separate repo
Former-commit-id: 38db4637c287a3f77a8e3fc39b0344a0d0ea0e94 [formerly aa94394d631efb107b6597e8bf2ec8d68f754fc8] [formerly efcef3211664021f7b23b9e6f1dcb7b5dbfc68a7 [formerly 28952e81bb]]
Former-commit-id: b7c4dbc1a19630c9116d640f96c52eccb6c66ab4 [formerly 5f2c74aa1fd92fdd3cd5917b21b5f6034d024748]
Former-commit-id: 3d6ad271b8f507f479ab9375419ad4b74594e719
2018-08-06 05:01:29 +01:00
1138-4EB
578f3e9bdd ignore rice-box.go
Former-commit-id: d416e0328a439e90100a8898b4eecd0d841094f0 [formerly 2ae0702ee23cb54706f34a01e2adadc8d71af201] [formerly e14ada686593af7f4e51df3631388e2564cc48d8 [formerly 569354c493]]
Former-commit-id: 55f994a485f1c19e0f217ef5a0a9eb929c0cb602 [formerly fc5f991702704d2b39bd3d557a7972a8da0190d7]
Former-commit-id: 0da0e4d08c933641f4212ec5e528da384eee315a
2018-08-06 05:01:27 +01:00
1138-4EB
f1e5cd490e add gometalinter and goreleaser to travis, drop circleci
Former-commit-id: dc44ea15987447b0f179bb2011c000f6d7224898 [formerly 3192a7ad777c6ff93fdd0d62a1d9f4c466c5b06e] [formerly 5bb95d586cf0dbf48355142fe17dfa8d162923c5 [formerly de7a8cee60]]
Former-commit-id: 129d25ece6e5ad704f3ef98bc4a59db70d0c9e10 [formerly f51552b629dbd69810e51142c9a66ab708d96d39]
Former-commit-id: 39d64538f9edcb5933c5cff8904f86691bf75ed3
2018-08-06 05:01:25 +01:00
1138-4EB
40b0cd4b66 add travis
Former-commit-id: a68e501a962cdd7c3a9e5a3d91433cbec34265e3 [formerly ab4763c975794e5997fab6abb51b2e91bda6e08a] [formerly 709e134df8986005308f3e125348fe13cf92919a [formerly 703318c214]]
Former-commit-id: 6672ab0918f84d73819f038cc5a24f1ce22625b4 [formerly 21d926cefe6d46ec2a99eba5e589b264e818d22d]
Former-commit-id: 294b3fa3faae6363f483388ccbedcf091d1f837c
2018-08-06 05:01:16 +01:00
1138-4EB
f9e3923ae7 add filebrowser/frontend as a submodule
Former-commit-id: 689395356dc1860d0f0f5786986cbbc4238a1fe0 [formerly 0c528dae26624fad221c4fa6b273a02dc030e81c] [formerly f353338b249c2ed818611ac6a91939bc87356de9 [formerly a2e293292e]]
Former-commit-id: 647dac9f8eed2df57191a75e4b199aebb18375fc [formerly 000079405f67a4bff2098c2cddc082a4374e0bd5]
Former-commit-id: 89c911c807783e2176994fc6949bf8221ca5e5a3
2018-08-05 10:58:21 +01:00
1138-4EB
32f7efbde5 add filebrowser/filebrowser:dev, move dep execution to build.sh
Former-commit-id: 691201333f6c76d5fe8d7134a1d68c4cc50404a7 [formerly a9973160b528bfe6b26bac2a6e1236e6e9192f0c] [formerly 84f8fdb79bd0929ef84a969a688ef1381e6ac691 [formerly d11aa8de6b]]
Former-commit-id: 5d10ebcf1f43a9854aa8b66b1227220e81e34473 [formerly a6e486b7c3a40fa821c2250bcd9edc1841775887]
Former-commit-id: 7367476016ce2499441cdb2d050fb2f961eed4d0
2018-08-05 10:58:21 +01:00
1138-4EB
56e5005484 drop package.json, use yarn instad of npm, add build_in_docker.sh
Former-commit-id: 1f1ce1a5350eb1d4d12dc3b90bae20d6df6048f9 [formerly fae0cae6f369574aab49ab952e1aa681c97f7067] [formerly 6f8245ec50d0d2485a263e5877a6a353837b1197 [formerly f91ee24858]]
Former-commit-id: b9bb3ad6a460de55851943bbbc62aee74e32028c [formerly 049f6c239d7a936d70493e68f23838c0ec11af88]
Former-commit-id: 81f69427472bbeb3f82e6bd2c3a114e2c5fb47d7
2018-08-05 10:58:21 +01:00
Henrique Dias
6bf0e8c063 chore: disable gosec (#490)
Former-commit-id: 515a160e341e7dcd338c7aea0a73c8dea0a917ca [formerly 85d6e4c2e150055fd8a2ba223bf8a7ee92116f72] [formerly 703c59c0f952f0fb7e43159c98328e53d1a92c04 [formerly 46b5fa013c]]
Former-commit-id: 1f6a9e78cdab0a6a6066248d98464bafd9d3f1c3 [formerly e102d783604d0afaff7e45a6dfd6eed9b7065e0d]
Former-commit-id: 22ffc5fbb93cd96609b04baf437e63db7bbfbe1b
2018-08-04 16:24:16 +01:00
1138-4EB
7445d73cf6 new issue templates (#477)
Former-commit-id: a28d3ceeb4a70ec5c59c7ad159952c4d453c8bca [formerly 1bcbffccb6aa9ccadf8ea43a7ffe4eb14cd7ec2b] [formerly 1d27bddbcf066bf32160c9b422bd927802ae8daa [formerly fb1dbb4276]]
Former-commit-id: 5fca1e72ba88f574059c4cf6ce92a13eac1919ed [formerly 3b928a4ec672b17f72ecfbc71bd7764e7cf7a31c]
Former-commit-id: 613be772339dcf2e4d422d5ddd361b66c95e7b2c
2018-07-29 20:20:24 +01:00
1138-4EB
af095a71e7 add ca-certificates to scratch docker image (#478)
Former-commit-id: aa531b84a518c6e4b48edc1231f663c316f36c23 [formerly 2b724b5f31ddbd39b1f9fb6df7ed4cff481b30db] [formerly 8f803379488acbc1149161b7df0eed4455ba876f [formerly 4e454f4bd2]]
Former-commit-id: 1579bebb11497abcdb83a4141af9da8bf681f8a9 [formerly c3943d81a5e4e66b4c1407ea37f30044b65ce593]
Former-commit-id: b26678c4727c4ad42463e25c53b6982efc18330c
2018-07-29 20:20:06 +01:00
1138-4EB
ab87f76dcb docs: add note about filemanager migration
Close #467.

Former-commit-id: 18d26af7c8a72d6195db73b795734dd18b9b2441 [formerly 87bdb71d011899d5e3e4c8dd9f7da6f629dceb67] [formerly ad1ff095a6e5dcf0c5e9f203f2bc3aa8e515d71d [formerly 6bbedddf51]]
Former-commit-id: 5d27d3e8f271ee437cb119df21334a942687193a [formerly 4ed80cbda3c300b5b18657cbbb4897eeff10f3df]
Former-commit-id: bc9d48ea84661e0607f30af71036d2e4f9a574f1
2018-07-29 20:19:52 +01:00
Dawid 'DeyV' Polak
2cbe941202 updated readme - case sensitive (#481)
Former-commit-id: 2ba295ca7060930f1f84645eed1f402b6f322522 [formerly fc51c3822642127f1d6ef6752bbcf47a3691a630] [formerly 8c38dd9075aed5f7a0d1fd974aa3dcad9fee8445 [formerly 90ad46b881]]
Former-commit-id: c0cc1705d3a215f07635de8809ab53238fccb75f [formerly bb31830df2193330f7266a4c382a57b89301446b]
Former-commit-id: bee1cec2d7892350706b8f2b24481f41a93e1082
2018-07-29 20:18:42 +01:00
Dawid 'DeyV' Polak
5e58c25aa4 natural sort (#474)
Former-commit-id: 9865271f38824fd4762253014a7855ee087d315f [formerly 17c1a5f7e2cbbea4f01ba394f6ae76ded22594f3] [formerly 2087a30cb8fa514b33d99fb9797a0751a8f532cd [formerly 202c9c97e5]]
Former-commit-id: 513ed21a74e590d062f0974b0ea7af7381162df9 [formerly 3fb2617b7aa05abe93460e2ab25ba2369ce68095]
Former-commit-id: a038eda5003c044eeceeea46539f3673ebc16f95
2018-07-29 17:43:23 +01:00
1138-4EB
bdfca1be33 subdir 'logo' moved to separate repo (#473)
Former-commit-id: d8596d836d5f3a126e6c58bab8737ae3902c0e9f [formerly b71f4484566042f6e4450f8ffafbf09f7ac76d48] [formerly e0b9028417b62b2ef00df7ed4ffa5deedef2b4bd [formerly c6f60d298a]]
Former-commit-id: 74e17d4db50e7ce9a2c2e16b706bd9a037832953 [formerly ef09d2f245aac59b54c09d370677294eda305c5a]
Former-commit-id: fa358937f8c8e9ca24e45c2f8d2c9997587dd927
2018-07-28 16:14:41 +01:00
VLEFF
281b8dca23 feat: handle subtitles for video streaming (#468)
Former-commit-id: 4259259f666304a88a808093afd26967059bd702 [formerly c925c803e33aa5486e920291b97b27e15ee9e2b9] [formerly dfe55f167c82ce734968505765104f855284a095 [formerly eb12bf2c2d]]
Former-commit-id: 96c5284c2a8c00c97dce3965893b4820e7ed4e6e [formerly 84f9ed9f1256e89010c5e813dc0b589af6a32d4a]
Former-commit-id: 0c84bae4cefcd2fad3b65f0fbec31e565ca5f27b
2018-07-26 10:47:09 +01:00
Henrique Dias
2761302ddf Update .dockerignore
Former-commit-id: a81be3e8b6e2130c615bb41f67946f940590ab0e [formerly a0c08066d324572fbff46aad1697bb8eb51722ca] [formerly 86886ab818a9fff57402bc5fb2652554d3f3998e [formerly ccf1722e65]]
Former-commit-id: 735ed5b90b2c329b97dd1840f95616d4089c91e6 [formerly 81363b7cbbe2b06e23701460b5842d22d51eaf33]
Former-commit-id: d34170646d7bec7efeeb9558b0b048333b86e096
2018-07-25 10:16:26 +01:00
Henrique Dias
06f0d36dd8 chore: setting untracked version [ci skip]
Former-commit-id: 3f52c0a25429df791e76eb7b157f4fd977193597 [formerly beee01e81d8380725e8f6b351606a9d1121c53fe] [formerly 75a659afa40143517192f3c4e04fa4f2fda5acc7 [formerly 80da59dab0]]
Former-commit-id: 0a74edab781637aa33568654fc7c82574cff069c [formerly d15a8f7f1b994aa8f359b402367da0f9b39c6c8d]
Former-commit-id: 912c7ff7943300c3f4b6b89f021c9071831afd28
2018-07-23 14:54:28 +01:00
Henrique Dias
a8863ec90b chore: version 1.9.0
Former-commit-id: 4dd0b080c6e792a117af9e33c43ac81c767e589a [formerly 3f3e6b6933d063cbcd16d2d14312740571ee908b] [formerly dd9b3423fe513c11916676922fae7a965dfa90e3 [formerly b4eda31788]]
Former-commit-id: 0ae3856cb12a0fdc1eea2acaf297145d93c1f2f9 [formerly 8191100298ba99a599de7c32513a5d010c705c7d]
Former-commit-id: 7b7a6565f30b0000eae8dc096f33ee0044bc99c7
2018-07-23 14:53:42 +01:00
Henrique Dias
3ed5a64cef feat: case insensitive search by default #415
Former-commit-id: e39d951ceaac2a3c9b055b8661c17432d746f5d2 [formerly f6a93dfc39e6edec09f19228d9d8d6cb66fbdac4] [formerly 0cecdec65555f37fab1e8773f066928cf821f6b5 [formerly 43d489c194]]
Former-commit-id: 57fd7a80303a6044846a3e11fabe0c9402557052 [formerly 4ffe639c08a784a05d49ff615994bda5f700ec1a]
Former-commit-id: 0db3b23185991ca9f0c0dc7e3f1eff5f4c2f7a77
2018-07-23 10:24:52 +01:00
Torben Woltjen
013c24733e Update .dockerignore to ignore the .git directory (#462)
Former-commit-id: fde994a6670ee97a1172869daa30645a1b6ea5a3 [formerly 6d7b714941b24f2c7aa92b1592d337957b57398b] [formerly b51eaa45ca829c7d0a6fa10f57edfb01fbc3c765 [formerly 3d3191b154]]
Former-commit-id: 8a25b969af8fe457970ab6151968fcef368dbbfc [formerly 9ed0c187ed77d53538bdc80a179d15f09a3d71fe]
Former-commit-id: ba61b6f861baee637bfacef1f8ce9d0a4f0ef915
2018-07-18 07:20:26 +01:00
Henrique Dias
d9d6fb656a fix: remove default rules (#455)
Former-commit-id: 61306205aa8bbdbd8248fb2cc1b1f2b8d1c9a47d [formerly 01601ea4acb9479b6b1b8f26acf89bec97876f42] [formerly c619c7135b3aa54367c3a9cb857eb647f6f6657a [formerly ec2e8d1f54]]
Former-commit-id: 51e1335b9720aa2825b55dbedabe5040f2c98e85 [formerly 9bdceac017d39acc8f7fb5abebe23c842c646f48]
Former-commit-id: b003d0e8e6b0410c31d80e60a50ba5fa70232304
2018-07-08 08:29:45 +01:00
Henrique Dias
eb72c5d959 chore: set untracked version [ci skip]
Former-commit-id: 34ebd89ab0214e369573f7fd9e830cd5b167aacf [formerly f8c67cb2a5dd1db582b71e1e3a838fd2644cdac8] [formerly 44d8c11057a965cfdbc6cf6e4f32afd6d7ca9c93 [formerly 8e864bfc93]]
Former-commit-id: 8d8d63420a5f135d64906369e98ad24541fab599 [formerly 6ed08fff774a5eb3ef92a81f646984e2504e5a1e]
Former-commit-id: bda207626bcae10499d7db7d68a30bf2ca81d340
2018-06-28 17:39:11 +01:00
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
62 changed files with 1535 additions and 1698 deletions

View File

@@ -1,83 +0,0 @@
version: 2
jobs:
linting:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
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 \
-D errcheck \
-D golint \
-D gas
build:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
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 github.com/filebrowser/filebrowser/cmd/filebrowser
deploy:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/filebrowser/filebrowser
steps:
- checkout
- run:
name: Install Dependencies
command: |
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
workflows:
version: 2
lint-build-deploy:
jobs:
- linting:
filters:
tags:
only: /.*/
branches:
only: /.*/
- build:
filters:
tags:
only: /.*/
branches:
only: /.*/
- deploy:
requires:
- linting
- build
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
branches:
ignore: /.*/

View File

@@ -1,2 +1,3 @@
testdata/
.github/
testdata/
.github/
**.git

View File

@@ -1,24 +0,0 @@
### 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?

22
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,22 @@
---
name: Bug report
about: Create a report to help us improve
---
**Description**
A clear and concise description of what the issue is about. What are you trying to do?
**Expected behaviour**
What did you expect to happen?
**What is happening instead?**
Please, give full error messages and/or log.
**Additional context**
Add any other context about the problem here. If applicable, add screenshots to help explain your problem.
**How to reproduce?**
Tell us how to reproduce this issue. How can someone who is starting from scratch reproduce this behaviour as minimally as possible?
**Files**
A list of relevant files for this issue. Large files can be uploaded one-by-one or in a tarball/zipfile.

View File

@@ -0,0 +1,33 @@
---
name: Caddy related bug report
about: Create a report to help us improve
---
**Are you asking for help with using Caddy or File Browser?**
Please use our forum instead: https://forum.caddyserver.com.
**When did you download File Browser from caddyserver.com?**
**What is your entire Caddyfile?**
```text
(Put Caddyfile here)
```
**Description**
A clear and concise description of what the issue is about. What are you trying to do?
**Expected behaviour**
What did you expect to happen?
**What is happening instead?**
Please, give full error messages and/or log.
**Additional context**
Add any other context about the problem here. If applicable, add screenshots to help explain your problem.
**How to reproduce?**
Tell us how to reproduce this issue. How can someone who is starting from scratch reproduce this behaviour as minimally as possible?
**Files**
A list of relevant files for this issue. Large files can be uploaded one-by-one or in a tarball/zipfile.

View File

@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
Add a clear and concise description of what the problem is. E.g. *I'm always frustrated when [...]*
**Describe the solution you'd like**
Add a clear and concise description of what you want to happen.
**Describe alternatives you've considered**
Add a clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,16 @@
**Description**
Please explain the changes you made here.
If the feature changes current behaviour, explain why your solution is better.
:rotating_light: Before submitting your PR, please read [community](https://github.com/filebrowser/community), and indicate which issues (in any of the repos) are either fixed or closed by this PR. See [GitHub Help: Closing issues using keywords](https://help.github.com/articles/closing-issues-via-commit-messages/).
- [ ] DO make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). Don't request your master!
- [ ] DO make sure you are making a pull request against the **master branch** (left side). Also you should start *your branch* off *our master*.
- [ ] DO make sure that File Browser can be successfully built. See [builds](https://github.com/filebrowser/community/blob/master/builds.md) and [development](https://github.com/filebrowser/community/blob/master/development.md).
- [ ] DO make sure that related issues are opened in other repositories. I.e., the frontend, caddy plugins or the web page need to be updated accordingly.
- [ ] AVOID breaking the continuous integration build.
**Further comments**
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did, what alternatives you considered, etc.
:heart: Thank you!

14
.gitignore vendored
View File

@@ -1,13 +1,15 @@
.DS_Store
node_modules/
*/dist/*
*.db
*.db.lock
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
.vscode
package-lock.json
yarn.lock
Dockerfile
filebrowser
rice-box.go
vendor
npm-debug.log*
package-lock.json
yarn-debug.log*
yarn-error.log*
yarn.lock

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "frontend"]
path = frontend
url = https://github.com/filebrowser/frontend

20
.golangci.yml Normal file
View File

@@ -0,0 +1,20 @@
run:
deadline: 5m
linters:
enable:
- deadcode
- govet
- ineffassign
- interfacer
- maligned
- megacheck
- structcheck
- unconvert
- varcheck
enable-all: false
disable-all: true
# presets:
# - bugs
# - unused
fast: false

View File

@@ -1,33 +1,59 @@
build:
main: cmd/filebrowser/main.go
binary: filebrowser
goos:
- darwin
- linux
- windows
- freebsd
- netbsd
- openbsd
- dragonfly
- solaris
goarch:
- amd64
- 386
- arm
- arm64
ignore:
- goos: openbsd
goarch: arm
goarm: 6
- goos: freebsd
goarch: arm
goarm: 6
- goos: linux
goarch: arm64
archive:
name_template: "{{.Os}}-{{.Arch}}-{{ .ProjectName }}"
format: tar.gz
format_overrides:
- goos: windows
format: zip
project_name: filebrowser
build:
env:
- CGO_ENABLED=0
main: cli/main.go
binary: filebrowser
goos:
- darwin
- linux
- windows
- freebsd
- netbsd
- openbsd
- dragonfly
- solaris
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 5
- 6
- 7
ignore:
- goos: darwin
goarch: 386
- goos: openbsd
goarch: arm
- goos: freebsd
goarch: arm
- goos: netbsd
goarch: arm
- goos: solaris
goarch: arm
archive:
name_template: "{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{ .ProjectName }}"
format: tar.gz
format_overrides:
- goos: windows
format: zip
release:
disable: true
dockers:
-
goos: linux
goarch: amd64
goarm: ''
image: filebrowser/filebrowser
skip_push: true
tag_templates:
- "{{ .Tag }}"
- latest
extra_files:
- Docker.json

50
.travis.yml Normal file
View File

@@ -0,0 +1,50 @@
os: linux
services: docker
language: minimal
install: skip
addons:
apt:
packages:
- docker-ce
- pass
env:
global:
- USE_DOCKER="true"
stages:
- lint
- test
- release
cache:
directories:
- lib/rice-box.go
jobs:
include:
- stage: lint
script: "./build/run_linters.sh"
- stage: test
script: "./build/build_all.sh"
deploy:
provider: script
skip_cleanup: true
script: docker build -t filebrowser/filebrowser . && ./build/docker_login.sh && docker push filebrowser/filebrowser && docker logout
on:
tags: false
repo: filebrowser/filebrowser
branch: master
- stage: release
script:
- docker run --rm -itv $(pwd):/src -w /src -v /var/run/docker.sock:/var/run/docker.sock filebrowser/dev sh -c "go get ./... && goreleaser"
- ./build/push_images.sh
- ./build/push_ricebox.sh
if: tag IS present
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: GCURbl9xmjOmeNc7cYSvfSwbEp46cacWmJRczcsU6rQa0aWqzjELYdyIsl6HWW+o0dzuZvbWRD6muxYqIud92oPLYDuXSnra9tM3mCjswrjiPCJ57bksWkSPBfFQcxIyB6c3o+A/FMnX3nnSE/2r5HYZnPNFbEcBbC7WSgwx9ejXUuyWn1PUFK9YQWANdl6J7b7EKsk+9MxS9Pmw6M2ycBwX8ScUQdofkUPvR/nqlXISm+3hs30VubqQi9Ha6DM9Bw3aFK3/Ts/ujCOxP1ZoMCBZ6tfnaQOElIG96WTwnt77eDYlZezBOLym3Z18iif+Qny+XndFKDbexaiUT06VlWFXCKtt3iLs6HJwRcjmiHmB0Z3v+W4cKPl3cEyxxrU2aal54k1PBhU+5L0Xc8ileKbDMYg5tps88zWHNefeZVfaxYSVrmUHkuygMe481oaBLacDXTxs4t6XEpStREuLmvx9NLTwTFAbWjMNM0PqlueDMxO4bdwNvzXg/TcKLWV9FezqAlre8lFNZK5wX6lKFVSZ3hFjxCfwrJL2cPwg5A8Yd5EOC4Nh81WdgYuFGOxZzMAoSJlaVRvQS1trCUP/++ONnDep3ExSxvw4B7vijGZWeXUhrOMiPQHXu+t6BnrlnDjQ4gi44QTW0y/iM2WC2DBKfgYjAKwyHx13hFrmOCg=
file: "dist/*.*"
file_glob: true
on:
repo: filebrowser/filebrowser
all_branches: true
tags: true

View File

@@ -2,9 +2,11 @@
"port": 80,
"address": "",
"database": "/database.db",
"scope": "/srv",
"allowCommands": true,
"allowEdit": true,
"allowNew": true,
"commands": []
"defaults": {
"scope": "/srv",
"allowCommands": true,
"allowEdit": true,
"allowNew": true,
"commands": []
}
}

View File

@@ -1,25 +1,12 @@
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
COPY --from=filebrowser/dev /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
VOLUME /tmp
VOLUME /srv
EXPOSE 80
COPY Docker.json /config.json
COPY filebrowser /filebrowser
COPY Docker.json /.filebrowser.json
ENTRYPOINT ["/filebrowser"]
CMD ["--config", "/config.json"]

423
Gopkg.lock generated
View File

@@ -1,423 +0,0 @@
# 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

View File

@@ -1,70 +0,0 @@
[[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

161
README.md
View File

@@ -1,75 +1,86 @@
![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).
INFO: **This project is not under active development ATM. A small group of developers keeps the project alive, but due to lack of time, we can't continue adding new features or doing deep changes. Please read [#532](https://github.com/filebrowser/filebrowser/issues/532) for more info!**
INFO: in Q2 2018, this project was renamed from `filemanager` to `filebrowser`, and the main repo was moved from [hacdias/filemanager](https://github.com/hacdias/filemanager) to [filebrowser/filebrowser](https://github.com/filebrowser/filebrowser). At the same time, the official docker image was changed to [`filebrowser/filebrowser`](https://hub.docker.com/r/filebrowser/filebrowser/). Users are encouraged to check their sources and update them accordingly.
---
<p align="center">
<img src="https://raw.githubusercontent.com/filebrowser/logo/master/banner.png" width="550"/>
</p>
![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif)
# filebrowser
[![Travis](https://img.shields.io/travis/com/filebrowser/filebrowser.svg?style=flat-square)](https://travis-ci.com/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)
[![Chat IRC](https://img.shields.io/badge/freenode-%23filebrowser-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23filebrowser)
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 insensitive. Although, you can make a case sensitive search by adding `case:sensitive` to the search terms, like this:
```
this are keywords case:sensitive
```
# Contributing
The contributing guidelines can be found [here](https://github.com/filebrowser/community).

20
build/build.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
cd $(dirname $0)/../cli
go get -v ./...
if [ "$COMMIT_SHA" != "" ]; then
echo "Set version to ($COMMIT_SHA)"
sed -i.bak "s|(untracked)|($COMMIT_SHA)|g" ../lib/filebrowser.go
fi
echo "Build CLI"
go build -a -o filebrowser
if [ "$COMMIT_SHA" != "" ]; then
echo "Reset version to (untracked)"
sed -i "s|($COMMIT_SHA)|(untracked)|g" ../lib/filebrowser.go
fi

37
build/build_all.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
cd $(dirname $0)/..
if [ -d lib/"rice-box.go" ]; then
rm -rf lib/rice-box.go
fi
if [ "$USE_DOCKER" != "" ]; then
if [ -d "frontend/dist" ]; then
rm -rf frontend/dist
fi;
if [ "$(command -v git)" != "" ]; then
COMMIT_SHA="$(git rev-parse HEAD | cut -c1-8)"
else
COMMIT_SHA="untracked"
fi
$(command -v winpty) docker run --rm -it \
-v /$(pwd):/src:z \
-w //src \
-e COMMIT_SHA=$COMMIT_SHA \
filebrowser/dev \
sh -c "\
cd build && \
dos2unix build_assets.sh && \
dos2unix build.sh && \
./build_assets.sh && \
./build.sh &&
mv ../cli/filebrowser ../ \
"
else
set -e
./build/build_assets.sh
./build/build.sh
fi

19
build.sh → build/build_assets.sh Normal file → Executable file
View File

@@ -1,14 +1,23 @@
#!/bin/bash
#!/bin/sh
set -e
cd $(dirname $0)/..
# Clean the dist folder and build the assets
cd frontend
if [ -d "dist" ]; then
rm -rf dist/*
fi;
yarn install
yarn build
cd ..
# Install rice tool if not present
if ! [ -x "$(command -v rice)" ]; then
go get github.com/GeertJohan/go.rice/rice
fi
# Clean the dist folder and build the assets
rm -rf node_modules
npm install
# Embed the assets using rice
cd lib
rice embed-go

BIN
build/deploy_key.enc Normal file

Binary file not shown.

27
build/docker_login.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -e
# init key for pass
gpg --batch --gen-key <<-EOF
%echo Generating a standard key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Meshuggah Rocks
Name-Email: meshuggah@example.com
Expire-Date: 0
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done
EOF
key=$(gpg --no-auto-check-trustdb --list-secret-keys | grep ^sec | cut -d/ -f2 | cut -d" " -f1)
pass init $key
if [ "$(command -v docker-credential-pass)" = "" ]; then
docker run --rm -itv /usr/local/bin:/src filebrowser/dev sh -c "cp /go/bin/docker-credential-pass /src"
fi
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin

14
build/push_images.sh Executable file
View File

@@ -0,0 +1,14 @@
#! /bin/sh
set -e
cd $(dirname $0)
./docker_login.sh
for tag in `echo $(docker images filebrowser/filebrowser* | awk -F ' ' '{print $1 ":" $2}') | cut -d ' ' -f2-`; do
if [ "$tag" = "REPOSITORY:TAG" ]; then break; fi
docker push $tag
done
docker logout

39
build/push_ricebox.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
set -e
cd $(dirname $0)
COMMIT_SHA="$(git rev-parse --verify HEAD | cut -c1-8)"
eval `ssh-agent -s`
openssl aes-256-cbc -K $encrypted_9ca81b5594f5_key -iv $encrypted_9ca81b5594f5_iv -in ./deploy_key.enc -d | ssh-add -
git clone git@github.com:filebrowser/caddy caddy
cd caddy
cp ../../lib/rice-box.go assets/
sed -i 's/package lib/package assets/g' assets/rice-box.go
git checkout -b update-rice-box origin/master
git config --local user.name "Filebrowser Bot"
git config --local user.email "FilebrowserBot@users.noreply.github.com"
git commit -am "update rice-box $COMMIT_SHA"
if [ $(git tag | grep "$TRAVIS_TAG" | wc -l) -ne 0 ]; then
git tag -d "$TRAVIS_TAG"
fi
git tag "$TRAVIS_TAG"
if [ "$(git ls-remote --heads origin update-rice-box)" != "" ]; then
git push -u origin update-rice-box
else
git push origin +update-rice-box
fi
if [ "$(git ls-remote --heads origin update-rice-box)" != "" ]; then
git push origin "$TRAVIS_TAG"
else
git push origin :"$TRAVIS_TAG"
git push origin "$TRAVIS_TAG"
fi

55
build/release.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
echo "> Checking semver format"
if [ $# -ne 1 ]; then
echo "This release script requires a single argument corresponding to the semver to be released. See semver.org"
exit 1
fi
semver=$(grep -P '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' <<< "$1")
if [ $? -ne 0 ]; then
echo "Not valid semver format. See semver.org"
exit 1
fi
echo "> Checking matching $semver in frontend submodule"
cd frontend
git fetch --all
if [ $(git tag | grep "$semver" | wc -l) -eq 0 ]; then
echo "Tag $semver does not exist in submodule 'frontend'. Tag it and run this script again."
exit 1
fi
git rev-parse --verify --quiet release
if [ $? -ne 0 ]; then
git checkout -b release "$semver"
else
git checkout release
git reset --hard "$semver"
fi
cd ..
echo "> Updating submodule ref to $semver"
sed -i "s|(untracked)|$1|g" filebrowser.go
git commit -am "chore: version $semver"
git tag "$1"
git push
git push --tags
echo "> Commiting untracked version notice..."
sed -i "s|$1|(untracked)|g" filebrowser.go
git commit -am "chore: setting untracked version [ci skip]"
git push
echo "> Done!"

13
build/run_linters.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
cd $(dirname $0)/..
if [ "$USE_DOCKER" != "" ]; then
$(command -v winpty) docker run --rm -itv "/$(pwd)://src" -w "//src" filebrowser/dev sh -c "\
go get -v ./... && \
golangci-lint run -v"
else
golangci-lint run -v
fi

View File

@@ -1,52 +0,0 @@
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
}

View File

@@ -1,52 +0,0 @@
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
}

View File

@@ -1,52 +0,0 @@
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
}

View File

@@ -1,312 +0,0 @@
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
}

24
cli/cmd/db.go Normal file
View File

@@ -0,0 +1,24 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// dbCmd represents the db command
var dbCmd = &cobra.Command{
Use: "db",
Version: rootCmd.Version,
Aliases: []string{"database"},
Short: "Manage a filebrowser database",
Long: `This is a CLI tool to ease the management of
filebrowser database files.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("db called. Command not implemented, yet.")
},
}
func init() {
rootCmd.AddCommand(dbCmd)
}

76
cli/cmd/root.go Normal file
View File

@@ -0,0 +1,76 @@
package cmd
import (
"log"
"strings"
fb "github.com/filebrowser/filebrowser/lib"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
v "github.com/spf13/viper"
)
var cfgFile string
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "filebrowser",
Version: fb.Version,
Aliases: []string{"serve"},
Short: "A stylish web-based file manager",
Long: `Command 'serve' is the default. Filebrowser is started
with the provided envvars, flags and/or config file. For example:
filebrowser -c config.json -p 80 -s ./srv
File Browser is a static binary composed of a golang backend and
a Vue.js frontend to create, edit, copy, move, download your files
easily, everywhere, every time.`,
// Run: func(cmd *cobra.Command, args []string) {},
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
checkRootAlias()
if err := rootCmd.Execute(); err != nil {
panic(err)
}
}
func init() {
cobra.OnInitialize(initConfig)
rootCmd.SetVersionTemplate("File Browser {{printf \"version %s\" .Version}}\n")
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (defaults are './.filebrowser[ext]', '$HOME/.filebrowser[ext]' or '/etc/filebrowser/.filebrowser[ext]')")
}
// initConfig reads in config file and ENV variables if set.
func initConfig() {
if cfgFile == "" {
// Find home directory.
home, err := homedir.Dir()
if err != nil {
panic(err)
}
v.AddConfigPath(".")
v.AddConfigPath(home)
v.AddConfigPath("/etc/filebrowser/")
v.SetConfigName(".filebrowser")
} else {
// Use config file from the flag.
v.SetConfigFile(cfgFile)
}
v.SetEnvPrefix("FB")
v.AutomaticEnv()
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
if err := v.ReadInConfig(); err != nil {
if _, ok := err.(v.ConfigParseError); ok {
panic(err)
}
} else {
log.Println("Using config file:", v.ConfigFileUsed())
}
}

46
cli/cmd/rootalias.go Normal file
View File

@@ -0,0 +1,46 @@
package cmd
import (
"log"
"os"
)
// checkRootAlias compares the first argument provided in the CLI with a list of
// subcmds and aliases. If no match is found, the first alias of rootCmd is added.
func checkRootAlias() {
l := len(rootCmd.Aliases)
if l == 0 {
return
}
if l > 1 {
log.Printf("rootCmd.Aliases should contain a single string. '%s' is used.\n", rootCmd.Aliases[0])
}
if len(os.Args) > 1 {
for _, v := range append(nonRootSubCmds(), []string{"--help", "--version"}...) {
if os.Args[1] == v {
return
}
}
}
os.Args = append([]string{os.Args[0], rootCmd.Aliases[0]}, os.Args[1:]...)
}
// nonRootSubCmds traverses the list of subcommands of rootCmd and returns a string
// slice containing the names and aliases of all the subcmds, except the one defined
// in the Aliases field of rootCmd.
func nonRootSubCmds() (l []string) {
for _, c := range rootCmd.Commands() {
isAlias := false
for _, a := range append(c.Aliases, c.Name()) {
if a == rootCmd.Aliases[0] {
isAlias = true
break
}
}
if !isAlias {
l = append(l, c.Name())
l = append(l, c.Aliases...)
}
}
return
}

111
cli/cmd/serve.go Normal file
View File

@@ -0,0 +1,111 @@
package cmd
import (
filebrowser "github.com/filebrowser/filebrowser/lib"
"github.com/spf13/cobra"
v "github.com/spf13/viper"
)
// serveCmd represents the serve command
var serveCmd = &cobra.Command{
Use: "serve",
Version: rootCmd.Version,
Aliases: []string{"server"},
Short: "Start filebrowser service",
Long: rootCmd.Long,
Run: func(cmd *cobra.Command, args []string) {
Serve()
},
Args: cobra.NoArgs,
}
func init() {
rootCmd.AddCommand(serveCmd)
f := serveCmd.PersistentFlags()
flag := func(k string, i interface{}, u string) {
switch y := i.(type) {
case bool:
f.Bool(k, y, u)
case int:
f.Int(k, y, u)
case string:
f.String(k, y, u)
}
v.SetDefault(k, i)
}
flagP := func(k, p string, i interface{}, u string) {
switch y := i.(type) {
case bool:
f.BoolP(k, p, y, u)
case int:
f.IntP(k, p, y, u)
case string:
f.StringP(k, p, y, u)
}
v.SetDefault(k, i)
}
deprecated := func(k string, i interface{}, u, m string) {
switch y := i.(type) {
case bool:
f.Bool(k, y, u)
case int:
f.Int(k, y, u)
case string:
f.String(k, y, u)
}
f.MarkDeprecated(k, m)
}
// Global settings
flagP("port", "p", 0, "HTTP Port (default is random)")
flagP("address", "a", "", "Address to listen to (default is all of them)")
flagP("database", "d", "./filebrowser.db", "Database file")
flagP("log", "l", "stdout", "Errors logger; can use 'stdout', 'stderr' or file")
flagP("baseurl", "b", "", "Base URL")
flag("prefixurl", "", "Prefix URL")
flag("staticgen", "", "Static Generator you want to enable")
// User default settings
f.String("defaults.commands", "git svn hg", "Default commands option for new users")
v.SetDefault("defaults.commands", []string{"git", "svn", "hg"})
flagP("defaults.scope", "s", ".", "Default scope option for new users")
flag("defaults.viewMode", filebrowser.MosaicViewMode, "Default view mode for new users")
flag("defaults.allowCommands", true, "Default allow commands option for new users")
flag("defaults.allowEdit", true, "Default allow edit option for new users")
flag("defaults.allowNew", true, "Default allow new option for new users")
flag("defaults.allowPublish", true, "Default allow publish option for new users")
flag("defaults.locale", "", "Default locale for new users, set it empty to enable auto detect from browser")
// Recaptcha settings
flag("recaptcha.host", "https://www.google.com", "Use another host for ReCAPTCHA. recaptcha.net might be useful in China")
flag("recaptcha.key", "", "ReCaptcha site key")
flag("recaptcha.secret", "", "ReCaptcha secret")
// Auth settings
flag("auth.method", "default", "Switch between 'none', 'default' and 'proxy' authentication")
flag("auth.header", "X-Forwarded-User", "The header name used for proxy authentication")
// Bind the full flag set to the configuration
if err := v.BindPFlags(f); err != nil {
panic(err)
}
// Deprecated flags
deprecated("no-auth", false, "Disables authentication", "use --auth.method='none' instead")
deprecated("alternative-recaptcha", false, "Use recaptcha.net for serving and handling, useful in China", "use --recaptcha.host instead")
deprecated("recaptcha-key", "", "ReCaptcha site key", "use --recaptcha.key instead")
deprecated("recaptcha-secret", "", "ReCaptcha secret", "use --recaptcha.secret instead")
deprecated("scope", ".", "Default scope option for new users", "use --defaults.scope instead")
deprecated("commands", "git svn hg", "Default commands option for new users", "use --defaults.commands instead")
deprecated("view-mode", "mosaic", "Default view mode for new users", "use --defaults.viewMode instead")
deprecated("locale", "", "Default locale for new users, set it empty to enable auto detect from browser", "use --defaults.locale instead")
deprecated("allow-commands", true, "Default allow commands option for new users", "use --defaults.allowCommands instead")
deprecated("allow-edit", true, "Default allow edit option for new users", "use --defaults.allowEdit instead")
deprecated("allow-publish", true, "Default allow publish option for new users", "use --defaults.allowPublish instead")
deprecated("allow-new", true, "Default allow new option for new users", "use --defaults.allowNew instead")
}

150
cli/cmd/server.go Normal file
View File

@@ -0,0 +1,150 @@
package cmd
import (
"io/ioutil"
"log"
"net"
"net/http"
"os"
"path/filepath"
"github.com/asdine/storm"
filebrowser "github.com/filebrowser/filebrowser/lib"
"github.com/filebrowser/filebrowser/lib/bolt"
h "github.com/filebrowser/filebrowser/lib/http"
"github.com/filebrowser/filebrowser/lib/staticgen"
"github.com/hacdias/fileutils"
"github.com/spf13/viper"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
)
func Serve() {
// Set up process log before anything bad happens.
switch l := viper.GetString("log"); l {
case "stdout":
log.SetOutput(os.Stdout)
case "stderr":
log.SetOutput(os.Stderr)
case "":
log.SetOutput(ioutil.Discard)
default:
log.SetOutput(&lumberjack.Logger{
Filename: l,
MaxSize: 100,
MaxAge: 14,
MaxBackups: 10,
})
}
// Validate the provided config before moving forward
{
// Map of valid authentication methods, containing a boolean value to indicate the need of Auth.Header
validMethods := make(map[string]bool)
validMethods["none"] = false
validMethods["default"] = false
validMethods["proxy"] = true
m := viper.GetString("auth.method")
b, ok := validMethods[m]
if !ok {
log.Fatal("The property 'auth.method' needs to be set to 'none', 'default' or 'proxy'.")
}
if b {
if viper.GetString("auth.header") == "" {
log.Fatal("The 'auth.header' needs to be specified when '", m, "' authentication is used.")
}
log.Println("[WARN] Filebrowser authentication is configured to '", m, "' authentication. This can cause a huge security issue if the infrastructure is not configured correctly.")
}
}
// Builds the address and a listener.
laddr := viper.GetString("address") + ":" + viper.GetString("port")
listener, err := net.Listen("tcp", laddr)
if err != nil {
log.Fatal(err)
}
// Tell the user the port in which is listening.
log.Println("Listening on", listener.Addr().String())
// Starts the server.
if err := http.Serve(listener, handler()); err != nil {
log.Fatal(err)
}
}
func handler() http.Handler {
db, err := storm.Open(viper.GetString("database"))
if err != nil {
log.Fatal(err)
}
fb := &filebrowser.FileBrowser{
Auth: &filebrowser.Auth{
Method: viper.GetString("auth.method"),
Header: viper.GetString("auth.header"),
},
ReCaptcha: &filebrowser.ReCaptcha{
Host: viper.GetString("recaptcha.host"),
Key: viper.GetString("recaptcha.key"),
Secret: viper.GetString("recaptcha.secret"),
},
DefaultUser: &filebrowser.User{
AllowCommands: viper.GetBool("defaults.allowCommands"),
AllowEdit: viper.GetBool("defaults.allowEdit"),
AllowNew: viper.GetBool("defaults.allowNew"),
AllowPublish: viper.GetBool("defaults.allowPublish"),
Commands: viper.GetStringSlice("defaults.commands"),
Rules: []*filebrowser.Rule{},
Locale: viper.GetString("defaults.locale"),
CSS: "",
Scope: viper.GetString("defaults.scope"),
FileSystem: fileutils.Dir(viper.GetString("defaults.scope")),
ViewMode: viper.GetString("defaults.viewMode"),
},
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)
},
}
fb.SetBaseURL(viper.GetString("baseurl"))
fb.SetPrefixURL(viper.GetString("prefixurl"))
err = fb.Setup()
if err != nil {
log.Fatal(err)
}
switch viper.GetString("staticgen") {
case "hugo":
hugo := &staticgen.Hugo{
Root: viper.GetString("Scope"),
Public: filepath.Join(viper.GetString("Scope"), "public"),
Args: []string{},
CleanPublic: true,
}
if err = fb.Attach(hugo); err != nil {
log.Fatal(err)
}
case "jekyll":
jekyll := &staticgen.Jekyll{
Root: viper.GetString("Scope"),
Public: filepath.Join(viper.GetString("Scope"), "_site"),
Args: []string{"build"},
CleanPublic: true,
}
if err = fb.Attach(jekyll); err != nil {
log.Fatal(err)
}
}
return h.Handler(fb)
}

28
cli/cmd/version.go Normal file
View File

@@ -0,0 +1,28 @@
package cmd
import (
"text/template"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of File Browser",
Long: `All software has versions. This is File Browser's`,
Run: func(cmd *cobra.Command, args []string) {
// https://github.com/spf13/cobra/issues/724
t := template.New("version")
template.Must(t.Parse(rootCmd.VersionTemplate()))
err := t.Execute(rootCmd.OutOrStdout(), rootCmd)
if err != nil {
rootCmd.Println(err)
}
},
}
func init() {
rootCmd.AddCommand(versionCmd)
serveCmd.AddCommand(versionCmd)
dbCmd.AddCommand(versionCmd)
}

7
cli/main.go Normal file
View File

@@ -0,0 +1,7 @@
package main
import "github.com/filebrowser/filebrowser/cli/cmd"
func main() {
cmd.Execute()
}

View File

@@ -1,259 +0,0 @@
package main
import (
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/asdine/storm"
"gopkg.in/natefinch/lumberjack.v2"
"github.com/filebrowser/filebrowser"
"github.com/filebrowser/filebrowser/bolt"
h "github.com/filebrowser/filebrowser/http"
"github.com/filebrowser/filebrowser/staticgen"
"github.com/hacdias/fileutils"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"
)
var (
addr string
config string
database string
scope string
commands string
logfile string
staticg string
locale string
baseurl string
prefixurl string
viewMode string
recaptchakey string
recaptchasecret string
port int
noAuth bool
allowCommands bool
allowEdit bool
allowNew bool
allowPublish bool
showVer bool
alterRecaptcha bool
)
func init() {
flag.StringVarP(&config, "config", "c", "", "Configuration file")
flag.IntVarP(&port, "port", "p", 0, "HTTP Port (default is random)")
flag.StringVarP(&addr, "address", "a", "", "Address to listen to (default is all of them)")
flag.StringVarP(&database, "database", "d", "./filebrowser.db", "Database file")
flag.StringVarP(&logfile, "log", "l", "stdout", "Errors logger; can use 'stdout', 'stderr' or file")
flag.StringVarP(&scope, "scope", "s", ".", "Default scope option for new users")
flag.StringVarP(&baseurl, "baseurl", "b", "", "Base URL")
flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users")
flag.StringVar(&prefixurl, "prefixurl", "", "Prefix URL")
flag.StringVar(&viewMode, "view-mode", "mosaic", "Default view mode for new users")
flag.StringVar(&recaptchakey, "recaptcha-key", "", "ReCaptcha site key")
flag.StringVar(&recaptchasecret, "recaptcha-secret", "", "ReCaptcha secret")
flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users")
flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users")
flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users")
flag.BoolVar(&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")
}
func setupViper() {
viper.SetDefault("Address", "")
viper.SetDefault("Port", "0")
viper.SetDefault("Database", "./filebrowser.db")
viper.SetDefault("Scope", ".")
viper.SetDefault("Logger", "stdout")
viper.SetDefault("Commands", []string{"git", "svn", "hg"})
viper.SetDefault("AllowCommmands", true)
viper.SetDefault("AllowEdit", true)
viper.SetDefault("AllowNew", true)
viper.SetDefault("AllowPublish", true)
viper.SetDefault("StaticGen", "")
viper.SetDefault("Locale", "")
viper.SetDefault("NoAuth", false)
viper.SetDefault("BaseURL", "")
viper.SetDefault("PrefixURL", "")
viper.SetDefault("ViewMode", filebrowser.MosaicViewMode)
viper.SetDefault("AlternativeRecaptcha", false)
viper.SetDefault("ReCaptchaKey", "")
viper.SetDefault("ReCaptchaSecret", "")
viper.BindPFlag("Port", flag.Lookup("port"))
viper.BindPFlag("Address", flag.Lookup("address"))
viper.BindPFlag("Database", flag.Lookup("database"))
viper.BindPFlag("Scope", flag.Lookup("scope"))
viper.BindPFlag("Logger", flag.Lookup("log"))
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("AllowPublish", flag.Lookup("allow-publish"))
viper.BindPFlag("Locale", flag.Lookup("locale"))
viper.BindPFlag("StaticGen", flag.Lookup("staticgen"))
viper.BindPFlag("NoAuth", flag.Lookup("no-auth"))
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"))
viper.SetConfigName("filebrowser")
viper.AddConfigPath(".")
}
func printVersion() {
fmt.Println("filebrowser version", filebrowser.Version)
os.Exit(0)
}
func main() {
setupViper()
flag.Parse()
if showVer {
printVersion()
}
// Add a configuration file if set.
if config != "" {
ext := filepath.Ext(config)
dir := filepath.Dir(config)
config = strings.TrimSuffix(config, ext)
if dir != "" {
viper.AddConfigPath(dir)
config = strings.TrimPrefix(config, dir)
}
viper.SetConfigName(config)
}
// Read configuration from a file if exists.
err := viper.ReadInConfig()
if err != nil {
if _, ok := err.(viper.ConfigParseError); ok {
panic(err)
}
}
// Set up process log before anything bad happens.
switch viper.GetString("Logger") {
case "stdout":
log.SetOutput(os.Stdout)
case "stderr":
log.SetOutput(os.Stderr)
case "":
log.SetOutput(ioutil.Discard)
default:
log.SetOutput(&lumberjack.Logger{
Filename: logfile,
MaxSize: 100,
MaxAge: 14,
MaxBackups: 10,
})
}
// Builds the address and a listener.
laddr := viper.GetString("Address") + ":" + viper.GetString("Port")
listener, err := net.Listen("tcp", laddr)
if err != nil {
log.Fatal(err)
}
// Tell the user the port in which is listening.
fmt.Println("Listening on", listener.Addr().String())
// Starts the server.
if err := http.Serve(listener, handler()); err != nil {
log.Fatal(err)
}
}
func handler() http.Handler {
db, err := storm.Open(viper.GetString("Database"))
if err != nil {
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{
AllowCommands: viper.GetBool("AllowCommands"),
AllowEdit: viper.GetBool("AllowEdit"),
AllowNew: viper.GetBool("AllowNew"),
AllowPublish: viper.GetBool("AllowPublish"),
Commands: viper.GetStringSlice("Commands"),
Rules: []*filebrowser.Rule{},
Locale: viper.GetString("Locale"),
CSS: "",
Scope: viper.GetString("Scope"),
FileSystem: fileutils.Dir(viper.GetString("Scope")),
ViewMode: viper.GetString("ViewMode"),
},
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 = fm.Setup()
if err != nil {
log.Fatal(err)
}
switch viper.GetString("StaticGen") {
case "hugo":
hugo := &staticgen.Hugo{
Root: viper.GetString("Scope"),
Public: filepath.Join(viper.GetString("Scope"), "public"),
Args: []string{},
CleanPublic: true,
}
if err = fm.Attach(hugo); err != nil {
log.Fatal(err)
}
case "jekyll":
jekyll := &staticgen.Jekyll{
Root: viper.GetString("Scope"),
Public: filepath.Join(viper.GetString("Scope"), "_site"),
Args: []string{"build"},
CleanPublic: true,
}
if err = fm.Attach(jekyll); err != nil {
log.Fatal(err)
}
}
return h.Handler(fm)
}

1
frontend Submodule

Submodule frontend added at 2642333928

36
go.mod Normal file
View File

@@ -0,0 +1,36 @@
module github.com/filebrowser/filebrowser
require (
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da
github.com/Sereal/Sereal v0.0.0-20181211220259-509a78ddbda3 // indirect
github.com/asdine/storm v2.1.2+incompatible
github.com/boltdb/bolt v1.3.1 // indirect
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 // indirect
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
github.com/gohugoio/hugo v0.49.2
github.com/golang/protobuf v1.2.0 // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/uuid v1.1.0 // indirect
github.com/gorilla/websocket v1.4.0
github.com/hacdias/fileutils v0.0.0-20181202104838-227b317161a1
github.com/hacdias/varutils v0.0.0-20171121224303-82d3b57f667a
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/maruel/natural v0.0.0-20180416170133-dbcb3e2e8cf1
github.com/mholt/archiver v2.1.0+incompatible
github.com/mholt/caddy v0.11.1
github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/mapstructure v1.1.2
github.com/nwaples/rardecode v1.0.0 // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
github.com/spf13/cobra v0.0.3
github.com/spf13/viper v1.3.1
github.com/ulikunitz/xz v0.5.5 // indirect
github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
go.etcd.io/bbolt v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
gopkg.in/natefinch/lumberjack.v2 v2.0.0
)

167
go.sum Normal file
View File

@@ -0,0 +1,167 @@
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69/go.mod h1:L1AbZdiDllfyYH5l5OkAaZtk7VkWe89bPJFmnDBNHxg=
github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64 h1:BuYewlQyh/jroxY8qx41SrzD8Go17GkyCyAeVmprvQI=
github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da h1:UVU3a9pRUyLdnBtn60WjRl0s4SEyJc2ChCY56OAR6wI=
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da/go.mod h1:DgrzXonpdQbfN3uYaGz1EG4Sbhyum/MMIn6Cphlh2bw=
github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Sereal/Sereal v0.0.0-20181211220259-509a78ddbda3/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
github.com/alecthomas/chroma v0.5.0 h1:PI0RlRSWL+8GSMuIMMA5KIND4CeJ5KXUQA60LLp/SjA=
github.com/alecthomas/chroma v0.5.0/go.mod h1:MmozekIi2rfQSzDcdEZ2BoJ9Pxs/7uc2Y4Boh+hIeZo=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/asdine/storm v2.1.2+incompatible h1:dczuIkyqwY2LrtXPz8ixMrU/OFgZp71kbKTHGrXYt/Q=
github.com/asdine/storm v2.1.2+incompatible/go.mod h1:RarYDc9hq1UPLImuiXK3BIWPJLdIygvV3PsInK0FbVQ=
github.com/bep/debounce v1.1.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/bep/gitmap v1.0.0/go.mod h1:g9VRETxFUXNWzMiuxOwcudo6DfZkW9jOsOW0Ft4kYaY=
github.com/bep/go-tocss v0.5.0/go.mod h1:c/+hEVoVvkufrV9Is/CPRHWGGdpcTwNuB48hfxzyYBI=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/chaseadamsio/goorgeous v1.1.0 h1:J9UrYDhzucUMHXsCKG+kICvpR5dT1cqZdVFTYvSlUBk=
github.com/chaseadamsio/goorgeous v1.1.0/go.mod h1:6QaC0vFoKWYDth94dHFNgRT2YkT5FHdQp/Yx15aAAi0=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY=
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb h1:tUf55Po0vzOendQ7NWytcdK0VuzQmfAgvGBUOQvN0WA=
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb/go.mod h1:U0vRfAucUOohvdCxt5MWLF+TePIL0xbCkbKIiV8TQCE=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/disintegration/imaging v1.5.0/go.mod h1:9B/deIUIrliYkyMTuXJd6OUFLcrZ2tf+3Qlwnaf/CjU=
github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg=
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 h1:eX+pdPPlD279OWgdx7f6KqIRSONuK7egk+jDx7OM3Ac=
github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76/go.mod h1:KjxHHirfLaw19iGT70HvVjHQsL1vq1SRQB4yOsAfy2s=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gohugoio/hugo v0.49.2 h1:cj62OqvM3tV12G06J9QQkN2GrO0hOq5m0xtREC7Z9NQ=
github.com/gohugoio/hugo v0.49.2/go.mod h1:Mh0VDogJpLC4OWpv/wIE4+tJZ1wFPUfMJDNaoJ1yuFA=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s=
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/hacdias/fileutils v0.0.0-20181202104838-227b317161a1 h1:2MkEawJQTmAr6YI7T7j7SKxdTmYJOcaJZfzeVPr56PM=
github.com/hacdias/fileutils v0.0.0-20181202104838-227b317161a1/go.mod h1:lwnswzFVSy7B/k81M5rOLUU0fOBKHrDRIkPIBZd7PBo=
github.com/hacdias/varutils v0.0.0-20171121224303-82d3b57f667a h1:BAjqcm8I/EO0WVwhNcZ/Zcv0Gd/7BrhCp2zi8oqXZh4=
github.com/hacdias/varutils v0.0.0-20171121224303-82d3b57f667a/go.mod h1:VfbRoVIe7I1Hz8CEW4K80fCz+lQ6Budq0WiI0MrqEdM=
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jdkato/prose v1.1.0 h1:LpvmDGwbKGTgdCH3a8VJL56sr7p/wOFPw/R4lM4PfFg=
github.com/jdkato/prose v1.1.0/go.mod h1:jkF0lkxaX5PFSlk9l4Gh9Y+T57TqUZziWT7uZbW5ADg=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kyokomi/emoji v1.5.1 h1:qp9dub1mW7C4MlvoRENH6EAENb9skEFOvIEbp1Waj38=
github.com/kyokomi/emoji v1.5.1/go.mod h1:mZ6aGCD7yk8j6QY6KICwnZ2pxoszVseX1DNoGtU2tBA=
github.com/magefile/mage v1.4.0/go.mod h1:IUDi13rsHje59lecXokTfGX0QIzO45uVPlXnJYsXepA=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/markbates/inflect v1.0.0/go.mod h1:oTeZL2KHA7CUX6X+fovmK9OvIOFuqu0TwdQrZjLTh88=
github.com/maruel/natural v0.0.0-20180416170133-dbcb3e2e8cf1 h1:PEhRT94KBTY4E0KdCYmhvDGWjSFBxc68j2M6PMRix8U=
github.com/maruel/natural v0.0.0-20180416170133-dbcb3e2e8cf1/go.mod h1:wI697HNhDFM/vBruYM3ckbszQ2+DOIeH9qdBKMdf288=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mholt/archiver v2.1.0+incompatible h1:1ivm7KAHPtPere1YDOdrY6xGdbMNGRWThZbYh5lWZT0=
github.com/mholt/archiver v2.1.0+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
github.com/mholt/caddy v0.11.1 h1:oNfejqftVesLoFxw53Gh17aBPNbTxQ9xJw1pn4IiAPk=
github.com/mholt/caddy v0.11.1/go.mod h1:Wb1PlT4DAYSqOEd03MsqkdkXnTxA8v9pKjdpxbqM1kY=
github.com/miekg/mmark v1.3.6 h1:t47x5vThdwgLJzofNsbsAl7gmIiJ7kbDQN5BxwBmwvY=
github.com/miekg/mmark v1.3.6/go.mod h1:w7r9mkTvpS55jlfyn22qJ618itLryxXBhA7Jp3FIlkw=
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/muesli/smartcrop v0.0.0-20180228075044-f6ebaa786a12/go.mod h1:i2fCI/UorTfgEpPPLWiFBv4pye+YAG78RwcQLUkocpI=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q=
github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs=
github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84 h1:fiKJgB4JDUd43CApkmCeTSQlWjtTtABrU2qsgbuP0BI=
github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/russross/blackfriday v0.0.0-20180804101149-46c73eb196ba h1:8Vzt8HxRjy7hp1eqPKVoAEPK9npQFW2510qlobGzvi0=
github.com/russross/blackfriday v0.0.0-20180804101149-46c73eb196ba/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 h1:/vdW8Cb7EXrkqWGufVMES1OH2sU9gKVb2n9/1y5NMBY=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/fsync v0.0.0-20170320142552-12a01e648f05/go.mod h1:jdsEoy1w+v0NpuwXZEaRAH6ADTDmzfRnE2eVwshwFrM=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/nitro v0.0.0-20131003134307-24d7ef30a12d/go.mod h1:jU8A+8xL+6n1OX4XaZtCj4B3mIa64tULUsD6YegdpFo=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.2.0/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI=
github.com/spf13/viper v1.3.1 h1:5+8j8FTpnFV4nEImW/ofkzEt8VoOiLXxdYIDsB73T38=
github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/tdewolff/minify v2.3.5+incompatible/go.mod h1:9Ov578KJUmAWpS6NeZwRZyT56Uf6o3Mcz9CEsg8USYs=
github.com/tdewolff/parse v2.3.3+incompatible/go.mod h1:8oBwCsVmUkgHO8M5iCzSIDtpzXOT0WXX9cWhz+bIzJQ=
github.com/tdewolff/test v0.0.0-20171106182207-265427085153/go.mod h1:DiQUlutnqlEvdvhSn2LPGy4TFwRauAaYDsL+683RNX4=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/wellington/go-libsass v0.0.0-20180624165032-615eaa47ef79/go.mod h1:mxgxgam0N0E+NAUMHLcu20Ccfc3mVpDkyrLDayqfiTs=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0=
go.etcd.io/bbolt v1.3.0 h1:oY10fI923Q5pVCVt1GBTZMn8LHo5M+RCInFpeMnV4QI=
go.etcd.io/bbolt v1.3.0/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@@ -2,7 +2,7 @@ package bolt
import (
"github.com/asdine/storm"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
// 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/lib"
)
// 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

@@ -4,7 +4,7 @@ import (
"reflect"
"github.com/asdine/storm"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
// UsersStore is a users store.
@@ -13,11 +13,11 @@ type UsersStore struct {
}
// Get gets a user with a certain id from the database.
func (u UsersStore) Get(id int, builder fm.FSBuilder) (*fm.User, error) {
var us fm.User
func (u UsersStore) Get(id int, builder fb.FSBuilder) (*fb.User, error) {
var us fb.User
err := u.DB.One("ID", id, &us)
if err == storm.ErrNotFound {
return nil, fm.ErrNotExist
return nil, fb.ErrNotExist
}
if err != nil {
@@ -29,11 +29,11 @@ func (u UsersStore) Get(id int, builder fm.FSBuilder) (*fm.User, error) {
}
// GetByUsername gets a user with a certain username from the database.
func (u UsersStore) GetByUsername(username string, builder fm.FSBuilder) (*fm.User, error) {
var us fm.User
func (u UsersStore) GetByUsername(username string, builder fb.FSBuilder) (*fb.User, error) {
var us fb.User
err := u.DB.One("Username", username, &us)
if err == storm.ErrNotFound {
return nil, fm.ErrNotExist
return nil, fb.ErrNotExist
}
if err != nil {
@@ -45,11 +45,11 @@ func (u UsersStore) GetByUsername(username string, builder fm.FSBuilder) (*fm.Us
}
// Gets gets all the users from the database.
func (u UsersStore) Gets(builder fm.FSBuilder) ([]*fm.User, error) {
var us []*fm.User
func (u UsersStore) Gets(builder fb.FSBuilder) ([]*fb.User, error) {
var us []*fb.User
err := u.DB.All(&us)
if err == storm.ErrNotFound {
return nil, fm.ErrNotExist
return nil, fb.ErrNotExist
}
if err != nil {
@@ -64,7 +64,7 @@ func (u UsersStore) Gets(builder fm.FSBuilder) ([]*fm.User, error) {
}
// Update updates the whole user object or only certain fields.
func (u UsersStore) Update(us *fm.User, fields ...string) error {
func (u UsersStore) Update(us *fb.User, fields ...string) error {
if len(fields) == 0 {
return u.Save(us)
}
@@ -80,11 +80,11 @@ func (u UsersStore) Update(us *fm.User, fields ...string) error {
}
// Save saves a user to the database.
func (u UsersStore) Save(us *fm.User) error {
func (u UsersStore) Save(us *fb.User) error {
return u.DB.Save(us)
}
// Delete deletes a user from the database.
func (u UsersStore) Delete(id int) error {
return u.DB.DeleteStruct(&fm.User{ID: id})
return u.DB.DeleteStruct(&fb.User{ID: id})
}

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"
@@ -16,6 +16,10 @@ to import "github.com/filebrowser/filebrowser/bolt".
m := &fm.FileBrowser{
NoAuth: false,
Auth: {
Method: "default",
LoginHeader: "X-Fowarded-User"
},
DefaultUser: &fm.User{
AllowCommands: true,
AllowEdit: true,
@@ -49,11 +53,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 +66,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.
@@ -70,4 +74,4 @@ One simple implementation for this, at port 80, in the root of the domain, would
http.ListenAndServe(":80", h.Handler(m))
*/
package filebrowser
package lib

View File

@@ -1,4 +1,4 @@
package filebrowser
package lib
import (
"bytes"
@@ -20,8 +20,13 @@ import (
"time"
"github.com/gohugoio/hugo/parser"
"github.com/maruel/natural"
)
// The size of the loaded text can be rendered in the browser. Avoiding files that are too large causes browsers to crash.
// Currently set to 10MB, 10 * 1024 * 1024 = 10485760 byte
const textExtensionsRenderMaxSize int64 = 10485760
// File contains the information about a particular file or directory.
type File struct {
// Indicates the Kind of view on the front-end (Listing, editor or preview).
@@ -222,14 +227,14 @@ func (i *File) GetFileType(checkContent bool) error {
// Only the first 512 bytes are used to sniff the content type.
buffer := make([]byte, 512)
_, err = file.Read(buffer)
n, err := file.Read(buffer)
if err != nil && err != io.EOF {
return err
}
// Tries to get the file mimetype using its first
// 512 bytes.
mimetype = http.DetectContentType(buffer)
mimetype = http.DetectContentType(buffer[:n])
}
if strings.HasPrefix(mimetype, "video") {
@@ -267,7 +272,7 @@ func (i *File) GetFileType(checkContent bool) error {
End:
// If the file type is text, save its content.
if i.Type == "text" {
if i.Type == "text" && i.Size <= textExtensionsRenderMaxSize { // Avoiding files that are too large causes browsers to crash
if len(content) == 0 {
content, err = ioutil.ReadFile(i.Path)
if err != nil {
@@ -372,7 +377,7 @@ func (l byName) Less(i, j int) bool {
return false
}
return strings.ToLower(l.Items[i].Name) < strings.ToLower(l.Items[j].Name)
return natural.Less(l.Items[i].Name, l.Items[j].Name)
}
// By Size

63
filebrowser.go → lib/filebrowser.go Normal file → Executable file
View File

@@ -1,4 +1,4 @@
package filebrowser
package lib
import (
"crypto/rand"
@@ -15,15 +15,16 @@ import (
"golang.org/x/crypto/bcrypt"
"github.com/GeertJohan/go.rice"
rice "github.com/GeertJohan/go.rice"
"github.com/hacdias/fileutils"
"github.com/mholt/caddy"
"github.com/robfig/cron"
"github.com/spf13/viper"
)
const (
// Version is the current File Manager version.
Version = "1.7.0"
// Version is the current File Browser version.
Version = "v1.11.0"
ListViewMode = "list"
MosaicViewMode = "mosaic"
@@ -41,6 +42,25 @@ var (
ErrInvalidOption = errors.New("invalid option")
)
// ReCaptcha settings.
type ReCaptcha struct {
Host string
Key string
Secret string
}
// Auth settings.
type Auth struct {
// Define if which of the following authentication mechansims should be used:
// - 'default', which requires a user and a password.
// - 'proxy', which requires a valid user and the user name has to be provided through an
// http header.
// - 'none', which allows anyone to access the filebrowser instance.
Method string
// If 'Method' is set to 'proxy' the header configured below is used to identify the user.
Header string
}
// FileBrowser is a file manager instance. It should be creating using the
// 'New' function and not directly.
type FileBrowser struct {
@@ -58,7 +78,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
@@ -67,14 +87,11 @@ type FileBrowser struct {
// edited directly. Use SetBaseURL.
BaseURL string
// NoAuth disables the authentication. When the authentication is disabled,
// there will only exist one user, called "admin".
NoAuth bool
// Authentication configuration.
Auth *Auth
// ReCaptcha host, key and secret.
ReCaptchaHost string
ReCaptchaKey string
ReCaptchaSecret string
ReCaptcha *ReCaptcha
// StaticGen is the static websit generator handler.
StaticGen StaticGen
@@ -115,11 +132,11 @@ 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.Assets = rice.MustFindBox("../frontend/dist")
m.Cron = cron.New()
// Tries to get the encryption key from the database.
@@ -189,14 +206,18 @@ func (m *FileBrowser) Setup() error {
// If there are no users in the database, it creates a new one
// based on 'base' User that must be provided by the function caller.
if len(users) == 0 {
u := *m.DefaultUser
u.Username = "admin"
viper.SetDefault("DEFAULT_USERNAME", "admin")
// Hashes the password.
u.Password, err = HashPassword("admin")
defaultPassword, err := HashPassword("admin")
if err != nil {
return err
}
viper.SetDefault("DEFAULT_PASSWORD_HASH", defaultPassword)
u := *m.DefaultUser
u.Username = viper.GetString("DEFAULT_USERNAME")
u.Password = viper.GetString("DEFAULT_PASSWORD_HASH")
// The first user must be an administrator.
u.Admin = true
@@ -221,7 +242,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
}
@@ -235,7 +256,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, "/")
@@ -244,7 +265,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")
@@ -290,7 +311,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,7 +9,7 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
const reCaptchaAPI = "/recaptcha/api/siteverify"
@@ -50,26 +50,38 @@ func reCaptcha(host, secret, response string) (bool, error) {
}
// authHandler processes the authentication for the user.
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// NoAuth instances shouldn't call this method.
if c.NoAuth {
func authHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if c.Auth.Method == "none" {
// NoAuth instances shouldn't call this method.
return 0, nil
}
if c.Auth.Method == "proxy" {
// Receive the Username from the Header and check if it exists.
u, err := c.Store.Users.GetByUsername(r.Header.Get(c.Auth.Header), c.NewFS)
if err != nil {
return http.StatusForbidden, nil
}
c.User = u
return printToken(c, w)
}
// Receive the credentials from the request and unmarshal them.
var cred cred
if r.Body == nil {
return http.StatusForbidden, nil
}
err := json.NewDecoder(r.Body).Decode(&cred)
if err != nil {
return http.StatusForbidden, nil
return http.StatusForbidden, err
}
// If ReCaptcha is enabled, check the code.
if len(c.ReCaptchaSecret) > 0 {
ok, err := reCaptcha(c.ReCaptchaHost, c.ReCaptchaSecret, cred.ReCaptcha)
if len(c.ReCaptcha.Secret) > 0 {
ok, err := reCaptcha(c.ReCaptcha.Host, c.ReCaptcha.Secret, cred.ReCaptcha)
if err != nil {
return http.StatusForbidden, err
}
@@ -86,7 +98,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 +108,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 +120,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 +137,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,12 +177,22 @@ 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) {
if c.NoAuth {
func validateAuth(c *fb.Context, r *http.Request) (bool, *fb.User) {
if c.Auth.Method == "none" {
c.User = c.DefaultUser
return true, c.User
}
// If proxy auth is used do not verify the JWT token if the header is provided.
if c.Auth.Method == "proxy" {
u, err := c.Store.Users.GetByUsername(r.Header.Get(c.Auth.Header), c.NewFS)
if err != nil {
return false, nil
}
c.User = u
return true, c.User
}
keyFunc := func(token *jwt.Token) (interface{}, error) {
return c.Key, nil
}

View File

@@ -7,14 +7,14 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
"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 {
@@ -30,7 +30,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
if len(names) != 0 {
for _, name := range names {
// Unescape the name.
name, err := url.QueryUnescape(name)
name, err := url.QueryUnescape(strings.Replace(name, "+", "%2B", -1))
if err != nil {
return http.StatusInternalServerError, err
}
@@ -77,13 +77,12 @@ 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()
if err != nil {
return http.StatusInternalServerError, err
}
defer file.Close()
stat, err := file.Stat()
if err != nil {

View File

@@ -10,13 +10,13 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
// 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)
}
@@ -137,9 +137,9 @@ func apiHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, err
}
}
if c.Router == "checksum" || c.Router == "download" {
if c.Router == "checksum" || c.Router == "download" || c.Router == "subtitle" || c.Router == "subtitles" {
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
}
@@ -165,6 +165,10 @@ func apiHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, err
code, err = settingsHandler(c, w, r)
case "share":
code, err = shareHandler(c, w, r)
case "subtitles":
code, err = subtitlesHandler(c, w, r)
case "subtitle":
code, err = subtitleHandler(c, w, r)
default:
code = http.StatusNotFound
}
@@ -173,11 +177,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 +209,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,17 +227,17 @@ 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,
"baseurl": c.RootURL(),
"NoAuth": c.Auth.Method == "none",
"Version": fb.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaHost": c.ReCaptchaHost,
"ReCaptchaKey": c.ReCaptchaKey,
"ReCaptcha": c.ReCaptcha.Key != "" && c.ReCaptcha.Secret != "",
"ReCaptchaHost": c.ReCaptcha.Host,
"ReCaptchaKey": c.ReCaptcha.Key,
}
if c.StaticGen != nil {
data["StaticGen"] = c.StaticGen.Name()
data["staticgen"] = c.StaticGen.Name()
}
err := tpl.Execute(w, data)
@@ -246,9 +250,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")
}
@@ -271,7 +275,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(),
@@ -287,7 +291,7 @@ func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, erro
w.Header().Set("Content-Type", "text/html; charset=utf-8")
err := tpl.Execute(w, map[string]interface{}{
"BaseURL": c.RootURL(),
"baseurl": c.RootURL(),
"File": c.File,
})

View File

@@ -13,7 +13,7 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
"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,7 +6,7 @@ import (
"net/http"
"reflect"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
"github.com/mitchellh/mapstructure"
)
@@ -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

@@ -8,10 +8,10 @@ import (
"strings"
"time"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
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(6)
bytes, err := fb.GenerateRandomBytes(6)
if err != nil {
return http.StatusInternalServerError, err
}
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
}

83
lib/http/subtitle.go Normal file
View File

@@ -0,0 +1,83 @@
package http
import (
"bytes"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"regexp"
fb "github.com/filebrowser/filebrowser/lib"
)
func subtitlesHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
files, err := readDir(filepath.Dir(c.File.Path))
if err != nil {
return http.StatusInternalServerError, err
}
subtitles := make([]map[string]string, 0)
for _, file := range files {
ext := filepath.Ext(file.Name())
if ext == ".vtt" || ext == ".srt" {
sub := make(map[string]string)
sub["src"] = filepath.Dir(c.File.Path) + "/" + file.Name()
sub["kind"] = "subtitles"
sub["label"] = file.Name()
subtitles = append(subtitles, sub)
}
}
return renderJSON(w, subtitles)
}
func subtitleHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
str, err := cleanSubtitle(c.File.Path)
if err != nil {
return http.StatusInternalServerError, err
}
file, err := os.Open(c.File.Path)
if err != nil {
return http.StatusInternalServerError, err
}
defer file.Close()
stat, err := file.Stat()
if err != nil {
return http.StatusInternalServerError, err
}
w.Header().Set("Content-Disposition", "inline")
w.Header().Set("Content-Type", "text/vtt")
http.ServeContent(w, r, stat.Name(), stat.ModTime(), bytes.NewReader([]byte(str)))
return 0, nil
}
func cleanSubtitle(filename string) (string, error) {
b, err := ioutil.ReadFile(filename)
if err != nil {
return "", err
}
str := string(b) // convert content to a 'string'
ext := filepath.Ext(filename)
if ext == ".srt" {
re := regexp.MustCompile("([0-9]{2}:[0-9]{2}:[0-9]{2}),([0-9]{3})")
str = "WEBVTT\n\n" + re.ReplaceAllString(str, "$1.$2")
}
return str, err
}
func readDir(dirname string) ([]os.FileInfo, error) {
f, err := os.Open(dirname)
if err != nil {
return nil, err
}
list, err := f.Readdir(-1)
f.Close()
if err != nil {
return nil, err
}
return list, nil
}

View File

@@ -9,7 +9,7 @@ import (
"strconv"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
type modifyRequest struct {
@@ -19,12 +19,12 @@ type modifyRequest struct {
type modifyUserRequest struct {
modifyRequest
Data *fm.User `json:"data"`
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
@@ -276,7 +276,7 @@ func usersPutHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
// If we're updating the default user. Only for NoAuth
// implementations. Used to change the viewMode.
if id == 0 && c.NoAuth {
if id == 0 && c.Auth.Method == "none" {
c.DefaultUser.ViewMode = u.ViewMode
return http.StatusOK, 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/lib"
"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
@@ -146,9 +147,9 @@ var (
type condition func(path string) bool
type searchOptions struct {
CaseInsensitive bool
Conditions []condition
Terms []string
CaseSensitive bool
Conditions []condition
Terms []string
}
func extensionCondition(extension string) condition {
@@ -180,9 +181,9 @@ func videoCondition(path string) bool {
func parseSearch(value string) *searchOptions {
opts := &searchOptions{
CaseInsensitive: strings.Contains(value, "case:insensitive"),
Conditions: []condition{},
Terms: []string{},
CaseSensitive: strings.Contains(value, "case:sensitive"),
Conditions: []condition{},
Terms: []string{},
}
// removes the options from the value
@@ -214,7 +215,7 @@ func parseSearch(value string) *searchOptions {
}
// If it's canse insensitive, put everything in lowercase.
if opts.CaseInsensitive {
if !opts.CaseSensitive {
value = strings.ToLower(value)
}
@@ -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
@@ -275,14 +276,20 @@ func search(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error)
scope = filepath.Clean(scope)
err = filepath.Walk(scope, func(path string, f os.FileInfo, err error) error {
if search.CaseInsensitive {
path = strings.ToLower(path)
}
var (
originalPath string
)
path = strings.TrimPrefix(path, scope)
path = strings.TrimPrefix(path, "/")
path = strings.Replace(path, "\\", "/", -1)
originalPath = path
if !search.CaseSensitive {
path = strings.ToLower(path)
}
// Only execute if there are conditions to meet.
if len(search.Conditions) > 0 {
match := false
@@ -322,10 +329,13 @@ func search(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error)
return nil
}
}
if f.IsDir() {
originalPath = originalPath + "/"
}
response, _ := json.Marshal(map[string]interface{}{
"dir": f.IsDir(),
"path": path,
"path": originalPath,
})
return conn.WriteMessage(websocket.TextMessage, response)

View File

@@ -10,7 +10,7 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
"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("", "")
@@ -187,9 +187,6 @@ func (h Hugo) undraft(file string) error {
// Setup sets up the plugin.
func (h *Hugo) Setup() error {
var err error
if h.Exe, err = exec.LookPath("hugo"); err != nil {
return err
}
return nil
h.Exe, err = exec.LookPath("hugo")
return err
}

View File

@@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser/lib"
)
// 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("", "")

View File

@@ -1,8 +0,0 @@
{
"name": "filebrowser",
"author": "File Browser contributors",
"private": true,
"dependencies": {
"filebrowser-frontend": "1.2.0"
}
}

View File

@@ -1,21 +0,0 @@
#!/bin/bash
set -e
echo "Building assets"
./build.sh
echo "Updating version number to $1..."
sed -i "s|(untracked)|$1|g" filebrowser.go
git add -A
git commit -m "chore: version $1"
git tag "v$1"
git push
git push --tags
echo "Commiting untracked version notice..."
sed -i "s|$1|(untracked)|g" filebrowser.go
git add -A
git commit -m "chore: setting untracked version [ci skip]"
git push
echo "Done!"

View File

@@ -1 +0,0 @@
1cc4a2b953e20dc9d36a8a240d446b5fa179dc26