mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-25 00:00:52 -04:00
Compare commits
453 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8ce1cc7f1 | |||
| 24c90e7283 | |||
| 9ffc34e8e6 | |||
| d1de8b7a4e | |||
| 7ae0577e4e | |||
| e9b1bccbc9 | |||
| 293fb84e1d | |||
| 9c07944390 | |||
| 173d69eb26 | |||
| 21d8d0e8a7 | |||
| 61e85dd49f | |||
| c778364ca2 | |||
| 7ecdb1c0dd | |||
| a5a7396edd | |||
| 461398d219 | |||
| 0d52544617 | |||
| c3736d222c | |||
| 2091053221 | |||
| 703e6d076b | |||
| 1817efe608 | |||
| 8814778c22 | |||
| 6ab885499c | |||
| 91561ecd6b | |||
| 3c399fac4e | |||
| a101526672 | |||
| eca47e3d32 | |||
| ab3386546d | |||
| 857c11be85 | |||
| b3ea3c6154 | |||
| 84168b4f53 | |||
| 59528de44d | |||
| a29d6754e8 | |||
| 167e207fad | |||
| 3b52d72ebf | |||
| dc5edc0c1b | |||
| 7fa8ffa0bd | |||
| 85b57672e6 | |||
| 9b111b0ee8 | |||
| 8b1c301950 | |||
| 3df4675dd7 | |||
| 312de0e7b5 | |||
| d57ccc8f81 | |||
| fea6c04c4f | |||
| 77df418390 | |||
| 750fbbb8fe | |||
| cfe46b435d | |||
| b2329a79b4 | |||
| 2007f13ed6 | |||
| f70be435f9 | |||
| 1b32dc3de9 | |||
| b83ccf1ccc | |||
| a68783aa21 | |||
| 86beed0c5f | |||
| b6c8386caf | |||
| 27cc669012 | |||
| 4b302af2a1 | |||
| ab29a9eb80 | |||
| e7538bb7f2 | |||
| ecaec307d6 | |||
| b711072492 | |||
| 0f94288bab | |||
| bd2ed1b338 | |||
| 1cd777d27d | |||
| 1ec8dcbfda | |||
| 8fea35fa51 | |||
| 234b29bbdd | |||
| edfef80e5c | |||
| 45ffa3d428 | |||
| 162318cf4a | |||
| d4b58e91d1 | |||
| 546bd0138c | |||
| ab799af866 | |||
| 3a932d7b0a | |||
| 57683d1cfb | |||
| d7afd0969a | |||
| 4eda55552b | |||
| f9254c49a1 | |||
| 6d834e9164 | |||
| 70259d8e50 | |||
| 0fa2bfa744 | |||
| cc33fa6595 | |||
| 921628ba6d | |||
| 1199eb7a03 | |||
| f075511847 | |||
| 80344c3bf0 | |||
| 8a732804ae | |||
| 9df372f784 | |||
| cf7431b8b6 | |||
| 974b6cfe9b | |||
| 4fbe5b471c | |||
| 33e7e31fbc | |||
| 72fae7f5ed | |||
| f50a7e3b3e | |||
| 66c4037f2b | |||
| 2c022a07e7 | |||
| 91362dfc7d | |||
| 97168b65d8 | |||
| 6e04e249e7 | |||
| 16397050dd | |||
| 3f73591dd4 | |||
| ec25109fa5 | |||
| 96f1ef3dde | |||
| b56e16e1e1 | |||
| 9769e760a0 | |||
| 70ab198a33 | |||
| 44a6f822cd | |||
| 2c241a96bb | |||
| 219d4446d1 | |||
| d330db131e | |||
| de193906a2 | |||
| d13cfc045f | |||
| a3b2cdd372 | |||
| f4d7128b59 | |||
| 663c0c0b38 | |||
| 57b2f7c625 | |||
| 9489d6abfd | |||
| 670cf54957 | |||
| 2e09efbd62 | |||
| 523195d649 | |||
| be47f309b0 | |||
| 03e044a1aa | |||
| 4eaf271fa4 | |||
| 4b464ed361 | |||
| a9520d6f26 | |||
| a151ec486d | |||
| 8f1383a818 | |||
| f5933a48d9 | |||
| 7734dae138 | |||
| 8c90b46114 | |||
| cd48b45f11 | |||
| bdbdf9c94b | |||
| 7e36c91ea7 | |||
| 9309f51df6 | |||
| a8f729f5c1 | |||
| 4e8b561f70 | |||
| e6214ddc5d | |||
| 80e13abc4a | |||
| fb43abb950 | |||
| eb3e37b950 | |||
| 0a90e3b333 | |||
| 4409ed8f45 | |||
| 291a340cdd | |||
| 0667f01471 | |||
| d5847bb105 | |||
| 3d295e961e | |||
| e408398523 | |||
| 566cebfcdd | |||
| a190ae3ed6 | |||
| 17d7cefa12 | |||
| eaef0556fa | |||
| 53226eab61 | |||
| ccf558eaa7 | |||
| 0305433e46 | |||
| d2cad6c496 | |||
| 371796cce9 | |||
| d9adb49c27 | |||
| f67e4e6cb9 | |||
| 60a126024c | |||
| da8a485087 | |||
| d809c21ee1 | |||
| ca1e221b10 | |||
| 44d9c51ff9 | |||
| 15a54f4f23 | |||
| 51806f18db | |||
| 79ef7bcd1c | |||
| 5cb85ea857 | |||
| 9807db6ac0 | |||
| 565a535d22 | |||
| c5b6a8b5b9 | |||
| c75c71709f | |||
| 11976b15f9 | |||
| 847f516a65 | |||
| de410f42b8 | |||
| 0fd7caef4b | |||
| 5e919d3e19 | |||
| 9e90aa17b9 | |||
| 0a8fd993e5 | |||
| 365f71cd1d | |||
| 601346b209 | |||
| e988a8c121 | |||
| bf81a4e48b | |||
| 4a09aee177 | |||
| 00c9cc1fcd | |||
| 51a47b5ddd | |||
| 244f97a68e | |||
| 8d84a3c502 | |||
| a26b4b3965 | |||
| f2dd20cdec | |||
| 64d6cd293c | |||
| 08dc0601e8 | |||
| 9c983df7e9 | |||
| efc547f5b2 | |||
| 995ca3b40f | |||
| 864435d3f9 | |||
| 64c145cf80 | |||
| 6549253ed1 | |||
| d9565718a4 | |||
| 400c3024fd | |||
| a703175b3a | |||
| 83b122ab75 | |||
| 1e7d6ba5b1 | |||
| 4d1ad8fb38 | |||
| d544252e3e | |||
| b02b28d3e3 | |||
| d7efe1e553 | |||
| 1973564272 | |||
| 29923f6dc7 | |||
| 4a261d5ff8 | |||
| 31d425d462 | |||
| a21681a6d7 | |||
| 208019a0b9 | |||
| 54e2a54ecb | |||
| 2426ef05ec | |||
| 25b90a8724 | |||
| cd8944ed2d | |||
| 7f0c256fe6 | |||
| 46e6e41bfe | |||
| c9f55e7a8e | |||
| 741c3a4e20 | |||
| f6da20321d | |||
| 2764e955b2 | |||
| 00c15014a1 | |||
| c6fdbfd9fd | |||
| e03bf32358 | |||
| bbf1520c73 | |||
| 8950c3a1ed | |||
| 17837d8a29 | |||
| b4a69425c8 | |||
| a612500b0f | |||
| 9bb7144479 | |||
| ee52c52f46 | |||
| daec2bdac6 | |||
| e9a490676b | |||
| 757f7c8214 | |||
| eed1a9717e | |||
| 8829d2e237 | |||
| eec6ec60bf | |||
| 3a82effa40 | |||
| 0b3e78bcb7 | |||
| cb4e4437a6 | |||
| 6a275286ea | |||
| 2743868438 | |||
| d3f26ecbc9 | |||
| f62344806a | |||
| b7b7e6f718 | |||
| 05b4e77fa9 | |||
| 8aab113aab | |||
| 371c8056e7 | |||
| a9a2c9faa8 | |||
| 011768ed1f | |||
| c36d2608e8 | |||
| 1b25a1fa47 | |||
| df7e2270a4 | |||
| 3c3549a489 | |||
| 8160b0a18e | |||
| a7eff772be | |||
| bf3900f9a2 | |||
| 6fa575cf4f | |||
| 604c5d49a6 | |||
| 7449d19075 | |||
| c5c9305a0b | |||
| fdceab9060 | |||
| c18591c5cf | |||
| bb5cb9b94c | |||
| fb499a5caf | |||
| 154d85e197 | |||
| 933617503e | |||
| 31c6893bbb | |||
| 171125e8ac | |||
| d81334026b | |||
| 2b3b2eb8ba | |||
| ffd5f4454b | |||
| cb25d7ba00 | |||
| 3abd2924d0 | |||
| 21233df754 | |||
| c61eb7554e | |||
| edd9a2e093 | |||
| 1f50785e8f | |||
| 70d418d1a1 | |||
| 45e20c94f9 | |||
| ca8e9a164e | |||
| 4da263c594 | |||
| d67a24809b | |||
| cd268af9dd | |||
| 135fa9fde6 | |||
| 77333aaafd | |||
| 1fad530331 | |||
| a1bd87098c | |||
| a389fa7178 | |||
| b5db508005 | |||
| 30178c42ef | |||
| b712db9e8f | |||
| dd9c75d1c9 | |||
| 2d150c3bf2 | |||
| 40f74ea375 | |||
| adf260bc35 | |||
| 432d6f0cd5 | |||
| 3de314ae9a | |||
| c1c8cca877 | |||
| 07965b98b7 | |||
| 5779d225f6 | |||
| bf18a14016 | |||
| 605dc61777 | |||
| def64d9f98 | |||
| 0ba2409c9a | |||
| 2b0cf41336 | |||
| c51cb28df2 | |||
| 2b079c652d | |||
| 68050a9025 | |||
| 54cd15d542 | |||
| 781de97c68 | |||
| c7be0e0e7c | |||
| 667d390be4 | |||
| 7f76322377 | |||
| 377c4c6554 | |||
| 952aa0c6ca | |||
| bd81c2e005 | |||
| b471ed2fa0 | |||
| 7507ab64ad | |||
| e4587d36bc | |||
| 7d6d3640ad | |||
| 3071d44e32 | |||
| 7a09c9006a | |||
| 959560c7a7 | |||
| ff679b30d8 | |||
| f7a360c2d8 | |||
| 1065b430e3 | |||
| 5abf7032a5 | |||
| 18e8e88c66 | |||
| 44336c546a | |||
| a4c6e6611c | |||
| 0b457a2797 | |||
| 653751bede | |||
| a02bf4a81e | |||
| 5271d12f4c | |||
| c2e2f0b9b3 | |||
| 72d319902e | |||
| bbd0fd68cb | |||
| 0fb1e1598d | |||
| 4645582f5d | |||
| ac9c51dd33 | |||
| f51d27860a | |||
| 4a7439a1ea | |||
| 00e19399d7 | |||
| cb723acef7 | |||
| 794bed12bd | |||
| bae8220e75 | |||
| 0cc5e1626b | |||
| da0ca665a6 | |||
| a91cf21aa9 | |||
| 39b2636711 | |||
| 2618d8412b | |||
| 445ebdf357 | |||
| 60134dc364 | |||
| aa70752244 | |||
| 0f39535097 | |||
| e086bec9da | |||
| dcdcf29114 | |||
| c5c73ddff3 | |||
| f18ee4284f | |||
| 0fbc11386e | |||
| a68282b4bf | |||
| e64908ad06 | |||
| af0913df64 | |||
| 5685dd1cc5 | |||
| af2fd2a66a | |||
| db2a51a26b | |||
| cf930418cb | |||
| 911848ad11 | |||
| 93f745aecb | |||
| 981a1f0226 | |||
| 8188456788 | |||
| 1eace2c64c | |||
| c6ee5409f8 | |||
| b05ed57762 | |||
| 0f1d1099f6 | |||
| 40a24f4247 | |||
| a6862e86d4 | |||
| bfc1b697bd | |||
| 276f62cb76 | |||
| 45a81ad5f6 | |||
| ce88acb9e5 | |||
| bd34b803f1 | |||
| 2559f65f35 | |||
| 93c21ea659 | |||
| 85ad38c321 | |||
| b6a204f5bd | |||
| f7b8e2d852 | |||
| 946017c8bd | |||
| ec5256dabd | |||
| 4e707076a1 | |||
| 66a3cc268b | |||
| 96949905b9 | |||
| 30c0199039 | |||
| 7a7cb78f82 | |||
| 8931ba8c43 | |||
| d50981c151 | |||
| df4deb1415 | |||
| aa5e999ed4 | |||
| 84d4b0c529 | |||
| d3e5691478 | |||
| 1000b02ae0 | |||
| 1f795889a9 | |||
| d33b45233a | |||
| 4f6df5b9a3 | |||
| 341b586cb3 | |||
| 9dcc9665ce | |||
| 1cd90926df | |||
| ac1ff61e6d | |||
| 6ea41f79e9 | |||
| dad02a2a30 | |||
| 280490fb36 | |||
| 455315a362 | |||
| df51406638 | |||
| 531d42ef18 | |||
| 2645e8cd05 | |||
| b2dc44a919 | |||
| c8db397a3b | |||
| 6384d4b77a | |||
| 1039732d87 | |||
| 011123f690 | |||
| e602a35b0c | |||
| 7792d3426e | |||
| b59c8f85ad | |||
| 18834ac28e | |||
| bf68e32ac8 | |||
| 54eb041fe4 | |||
| 57d8c100f9 | |||
| 56d973b99d | |||
| 670e5cdf6a | |||
| 1b35392f9c | |||
| c4e1ffe023 | |||
| 44f4959477 | |||
| 0582b57d60 | |||
| 83d96fd2a1 | |||
| 8ac89c420c | |||
| 968c2f4ad5 | |||
| ad940f30d5 | |||
| 308ad4e063 | |||
| 4d709b7eb5 | |||
| 5760ad924e | |||
| fff171c8c9 | |||
| 44ff566a1d | |||
| 853f422964 | |||
| 3bb0917374 | |||
| a86f0d0f34 | |||
| 16a9d7fc2e | |||
| ee2b4abc85 | |||
| a6c2799521 | |||
| 2370e4d2c6 | |||
| 32b0384ea0 | |||
| 50d4ffdb7b | |||
| 96463641f9 |
@@ -0,0 +1,138 @@
|
|||||||
|
{
|
||||||
|
"projectName": "Mango",
|
||||||
|
"projectOwner": "hkalexling",
|
||||||
|
"repoType": "github",
|
||||||
|
"repoHost": "https://github.com",
|
||||||
|
"files": [
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"imageSize": 100,
|
||||||
|
"commit": false,
|
||||||
|
"commitConvention": "none",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"login": "hkalexling",
|
||||||
|
"name": "Alex Ling",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/7845831?v=4",
|
||||||
|
"profile": "https://github.com/hkalexling/",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"doc",
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "jaredlt",
|
||||||
|
"name": "jaredlt",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/8590311?v=4",
|
||||||
|
"profile": "https://github.com/jaredlt",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"ideas",
|
||||||
|
"design"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "shincurry",
|
||||||
|
"name": "ココロ",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/4946624?v=4",
|
||||||
|
"profile": "https://windisco.com/",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "noirscape",
|
||||||
|
"name": "Valentijn",
|
||||||
|
"avatar_url": "https://avatars0.githubusercontent.com/u/13433513?v=4",
|
||||||
|
"profile": "https://catgirlsin.space/",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "flying-sausages",
|
||||||
|
"name": "flying-sausages",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/23618693?v=4",
|
||||||
|
"profile": "https://github.com/flying-sausages",
|
||||||
|
"contributions": [
|
||||||
|
"doc",
|
||||||
|
"ideas"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "XavierSchiller",
|
||||||
|
"name": "Xavier",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/22575255?v=4",
|
||||||
|
"profile": "https://github.com/XavierSchiller",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "WROIATE",
|
||||||
|
"name": "Jarao",
|
||||||
|
"avatar_url": "https://avatars3.githubusercontent.com/u/44677306?v=4",
|
||||||
|
"profile": "https://github.com/WROIATE",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Leeingnyo",
|
||||||
|
"name": "이인용",
|
||||||
|
"avatar_url": "https://avatars0.githubusercontent.com/u/6760150?v=4",
|
||||||
|
"profile": "https://github.com/Leeingnyo",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "h45h74x",
|
||||||
|
"name": "Simon",
|
||||||
|
"avatar_url": "https://avatars1.githubusercontent.com/u/27204033?v=4",
|
||||||
|
"profile": "http://h45h74x.eu.org",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "davidkna",
|
||||||
|
"name": "David Knaack",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/835177?v=4",
|
||||||
|
"profile": "https://github.com/davidkna",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "lincolnthedev",
|
||||||
|
"name": "i use arch btw",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/41193328?v=4",
|
||||||
|
"profile": "https://lncn.dev",
|
||||||
|
"contributions": [
|
||||||
|
"infra"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "BradleyDS2",
|
||||||
|
"name": "BradleyDS2",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/2174921?v=4",
|
||||||
|
"profile": "https://github.com/BradleyDS2",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "nduja",
|
||||||
|
"name": "Robbo",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/69299134?v=4",
|
||||||
|
"profile": "https://github.com/nduja",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contributorsPerLine": 7,
|
||||||
|
"skipCi": true
|
||||||
|
}
|
||||||
@@ -7,3 +7,8 @@ Lint/UnusedArgument:
|
|||||||
- src/routes/*
|
- src/routes/*
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Layout/LineLength:
|
||||||
|
Enabled: true
|
||||||
|
MaxLength: 80
|
||||||
|
Excluded:
|
||||||
|
- src/routes/api.cr
|
||||||
|
|||||||
@@ -1,2 +1,9 @@
|
|||||||
node_modules
|
node_modules
|
||||||
lib
|
lib
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile.arm32v7
|
||||||
|
Dockerfile.arm64v8
|
||||||
|
README.md
|
||||||
|
.all-contributorsrc
|
||||||
|
env.example
|
||||||
|
.github/
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from_owner:
|
||||||
|
- hkalexling
|
||||||
|
required_labels:
|
||||||
|
- autoapprove
|
||||||
|
apply_labels:
|
||||||
|
- autoapproved
|
||||||
@@ -2,7 +2,7 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master, dev ]
|
branches: [ master, dev, hotfix/* ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, dev ]
|
branches: [ master, dev ]
|
||||||
|
|
||||||
@@ -12,12 +12,12 @@ jobs:
|
|||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: crystallang/crystal:0.34.0-alpine
|
image: crystallang/crystal:1.0.0-alpine
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: apk add --no-cache yarn yaml sqlite-static libarchive-dev libarchive-static acl-static expat-static zstd-static lz4-static bzip2-static libjpeg-turbo-dev libpng-dev tiff-dev
|
run: apk add --no-cache yarn yaml-static sqlite-static libarchive-dev libarchive-static acl-static expat-static zstd-static lz4-static bzip2-static libjpeg-turbo-dev libpng-dev tiff-dev
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make static || make static
|
run: make static || make static
|
||||||
- name: Linter
|
- name: Linter
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Get release version
|
- name: Get release version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
|
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
|
||||||
- name: Publish to Dockerhub
|
- name: Publish to Dockerhub
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -12,3 +12,5 @@ mango
|
|||||||
public/css/uikit.css
|
public/css/uikit.css
|
||||||
public/img/*.svg
|
public/img/*.svg
|
||||||
public/js/*.min.js
|
public/js/*.min.js
|
||||||
|
public/css/*.css
|
||||||
|
public/webfonts
|
||||||
|
|||||||
+4
-4
@@ -1,15 +1,15 @@
|
|||||||
FROM crystallang/crystal:0.34.0-alpine AS builder
|
FROM crystallang/crystal:1.0.0-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /Mango
|
WORKDIR /Mango
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN apk add --no-cache yarn yaml sqlite-static libarchive-dev libarchive-static acl-static expat-static zstd-static lz4-static bzip2-static libjpeg-turbo-dev libpng-dev tiff-dev
|
RUN apk add --no-cache yarn yaml-static sqlite-static libarchive-dev libarchive-static acl-static expat-static zstd-static lz4-static bzip2-static libjpeg-turbo-dev libpng-dev tiff-dev
|
||||||
RUN make static || make static
|
RUN make static || make static
|
||||||
|
|
||||||
FROM library/alpine
|
FROM library/alpine
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
COPY --from=builder /Mango/mango .
|
COPY --from=builder /Mango/mango /usr/local/bin/mango
|
||||||
|
|
||||||
CMD ["./mango"]
|
CMD ["/usr/local/bin/mango"]
|
||||||
|
|||||||
+7
-6
@@ -2,13 +2,14 @@ FROM arm32v7/ubuntu:18.04
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
||||||
|
|
||||||
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.34.0 && make deps && cd ..
|
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 1.0.0 && make deps && cd ..
|
||||||
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.8 && make && cd ..
|
||||||
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v1.0.0 && make && cd ..
|
||||||
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.5.0 && make && cd ..
|
||||||
|
|
||||||
COPY mango-arm32v7.o .
|
COPY mango-arm32v7.o .
|
||||||
|
|
||||||
RUN cc 'mango-arm32v7.o' -o 'mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/arm-linux-gnueabihf/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib
|
RUN cc 'mango-arm32v7.o' -o '/usr/local/bin/mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/arm-linux-gnueabihf/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib
|
||||||
|
|
||||||
|
CMD ["/usr/local/bin/mango"]
|
||||||
|
|
||||||
CMD ["./mango"]
|
|
||||||
|
|||||||
+6
-6
@@ -2,13 +2,13 @@ FROM arm64v8/ubuntu:18.04
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
||||||
|
|
||||||
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.34.0 && make deps && cd ..
|
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 1.0.0 && make deps && cd ..
|
||||||
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.8 && make && cd ..
|
||||||
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v1.0.0 && make && cd ..
|
||||||
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.5.0 && make && cd ..
|
||||||
|
|
||||||
COPY mango-arm64v8.o .
|
COPY mango-arm64v8.o .
|
||||||
|
|
||||||
RUN cc 'mango-arm64v8.o' -o 'mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/arm-linux-gnueabihf/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib
|
RUN cc 'mango-arm64v8.o' -o '/usr/local/bin/mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/aarch64-linux-gnu/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib
|
||||||
|
|
||||||
CMD ["./mango"]
|
CMD ["/usr/local/bin/mango"]
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ test:
|
|||||||
check:
|
check:
|
||||||
crystal tool format --check
|
crystal tool format --check
|
||||||
./bin/ameba
|
./bin/ameba
|
||||||
./dev/linewidth.sh
|
|
||||||
|
|
||||||
arm32v7:
|
arm32v7:
|
||||||
crystal build src/mango.cr --release --progress --error-trace --cross-compile --target='arm-linux-gnueabihf' -o mango-arm32v7
|
crystal build src/mango.cr --release --progress --error-trace --cross-compile --target='arm-linux-gnueabihf' -o mango-arm32v7
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Mango
|
# Mango
|
||||||
|
|
||||||
[](https://www.patreon.com/hkalexling)  [](https://gitter.im/mango-cr/mango?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
[](https://www.patreon.com/hkalexling)  [](https://gitter.im/mango-cr/mango?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](http://discord.com/invite/ezKtacCp9Q)
|
||||||
|
|
||||||
Mango is a self-hosted manga server and reader. Its features include
|
Mango is a self-hosted manga server and reader. Its features include
|
||||||
|
|
||||||
@@ -12,8 +12,8 @@ Mango is a self-hosted manga server and reader. Its features include
|
|||||||
- Supported formats: `.cbz`, `.zip`, `.cbr` and `.rar`
|
- Supported formats: `.cbz`, `.zip`, `.cbr` and `.rar`
|
||||||
- Supports nested folders in library
|
- Supports nested folders in library
|
||||||
- Automatically stores reading progress
|
- Automatically stores reading progress
|
||||||
- Built-in [MangaDex](https://mangadex.org/) downloader
|
- Thumbnail generation
|
||||||
- Supports [plugins](https://github.com/hkalexling/mango-plugins) to download from thrid-party sites
|
- Supports [plugins](https://github.com/hkalexling/mango-plugins) to download from third-party sites
|
||||||
- The web reader is responsive and works well on mobile, so there is no need for a mobile app
|
- The web reader is responsive and works well on mobile, so there is no need for a mobile app
|
||||||
- All the static files are embedded in the binary, so the deployment process is easy and painless
|
- All the static files are embedded in the binary, so the deployment process is easy and painless
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ The official docker images are available on [Dockerhub](https://hub.docker.com/r
|
|||||||
### CLI
|
### CLI
|
||||||
|
|
||||||
```
|
```
|
||||||
Mango - Manga Server and Web Reader. Version 0.12.2
|
Mango - Manga Server and Web Reader. Version 0.26.0
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
@@ -74,25 +74,33 @@ The default config file location is `~/.config/mango/config.yml`. It might be di
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
|
host: 0.0.0.0
|
||||||
port: 9000
|
port: 9000
|
||||||
base_url: /
|
base_url: /
|
||||||
|
session_secret: mango-session-secret
|
||||||
library_path: ~/mango/library
|
library_path: ~/mango/library
|
||||||
db_path: ~/mango/mango.db
|
db_path: ~/mango/mango.db
|
||||||
|
queue_db_path: ~/mango/queue.db
|
||||||
scan_interval_minutes: 5
|
scan_interval_minutes: 5
|
||||||
|
thumbnail_generation_interval_hours: 24
|
||||||
log_level: info
|
log_level: info
|
||||||
upload_path: ~/mango/uploads
|
upload_path: ~/mango/uploads
|
||||||
mangadex:
|
plugin_path: ~/mango/plugins
|
||||||
base_url: https://mangadex.org
|
download_timeout_seconds: 30
|
||||||
api_url: https://mangadex.org/api
|
library_cache_path: ~/mango/library.yml.gz
|
||||||
download_wait_seconds: 5
|
cache_enabled: true
|
||||||
download_retries: 4
|
cache_size_mbs: 50
|
||||||
download_queue_db_path: ~/mango/queue.db
|
cache_log_enabled: true
|
||||||
chapter_rename_rule: '[Vol.{volume} ][Ch.{chapter} ]{title|id}'
|
disable_login: false
|
||||||
manga_rename_rule: '{title}'
|
default_username: ""
|
||||||
|
auth_proxy_header_name: ""
|
||||||
|
plugin_update_interval_hours: 24
|
||||||
```
|
```
|
||||||
|
|
||||||
- `scan_interval_minutes` can be any non-negative integer. Setting it to `0` disables the periodic scan
|
- `scan_interval_minutes`, `thumbnail_generation_interval_hours`, and `plugin_update_interval_hours` can be any non-negative integer. Setting them to `0` disables the periodic tasks
|
||||||
- `log_level` can be `debug`, `info`, `warn`, `error`, `fatal` or `off`. Setting it to `off` disables the logging
|
- `log_level` can be `debug`, `info`, `warn`, `error`, `fatal` or `off`. Setting it to `off` disables the logging
|
||||||
|
- You can disable authentication by setting `disable_login` to true. Note that `default_username` must be set to an existing username for this to work.
|
||||||
|
- By setting `cache_enabled` to `true`, you can enable an experimental feature where Mango caches library metadata to improve page load time. You can further fine-tune the feature with `cache_size_mbs` and `cache_log_enabled`.
|
||||||
|
|
||||||
### Library Structure
|
### Library Structure
|
||||||
|
|
||||||
@@ -142,9 +150,35 @@ Mobile UI:
|
|||||||
## Sponsors
|
## Sponsors
|
||||||
|
|
||||||
<a href="https://casinoshunter.com/online-casinos/"><img src="https://i.imgur.com/EJb3wBo.png" width="150" height="auto"></a>
|
<a href="https://casinoshunter.com/online-casinos/"><img src="https://i.imgur.com/EJb3wBo.png" width="150" height="auto"></a>
|
||||||
|
<a href="https://www.browserstack.com/open-source"><img src="https://i.imgur.com/hGJUJXD.png" width="150" height="auto"></a>
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
Please check the [development guideline](https://github.com/hkalexling/Mango/wiki/Development) if you are interested in code contributions.
|
Please check the [development guideline](https://github.com/hkalexling/Mango/wiki/Development) if you are interested in code contributions.
|
||||||
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/hkalexling/"><img src="https://avatars1.githubusercontent.com/u/7845831?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex Ling</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=hkalexling" title="Code">💻</a> <a href="https://github.com/hkalexling/Mango/commits?author=hkalexling" title="Documentation">📖</a> <a href="#infra-hkalexling" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/jaredlt"><img src="https://avatars1.githubusercontent.com/u/8590311?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jaredlt</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=jaredlt" title="Code">💻</a> <a href="#ideas-jaredlt" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-jaredlt" title="Design">🎨</a></td>
|
||||||
|
<td align="center"><a href="https://windisco.com/"><img src="https://avatars1.githubusercontent.com/u/4946624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ココロ</b></sub></a><br /><a href="#infra-shincurry" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://catgirlsin.space/"><img src="https://avatars0.githubusercontent.com/u/13433513?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Valentijn</b></sub></a><br /><a href="#infra-noirscape" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/flying-sausages"><img src="https://avatars1.githubusercontent.com/u/23618693?v=4?s=100" width="100px;" alt=""/><br /><sub><b>flying-sausages</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=flying-sausages" title="Documentation">📖</a> <a href="#ideas-flying-sausages" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/XavierSchiller"><img src="https://avatars1.githubusercontent.com/u/22575255?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Xavier</b></sub></a><br /><a href="#infra-XavierSchiller" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/WROIATE"><img src="https://avatars3.githubusercontent.com/u/44677306?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jarao</b></sub></a><br /><a href="#infra-WROIATE" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/Leeingnyo"><img src="https://avatars0.githubusercontent.com/u/6760150?v=4?s=100" width="100px;" alt=""/><br /><sub><b>이인용</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=Leeingnyo" title="Code">💻</a></td>
|
||||||
|
<td align="center"><a href="http://h45h74x.eu.org"><img src="https://avatars1.githubusercontent.com/u/27204033?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Simon</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=h45h74x" title="Code">💻</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/davidkna"><img src="https://avatars.githubusercontent.com/u/835177?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Knaack</b></sub></a><br /><a href="#infra-davidkna" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://lncn.dev"><img src="https://avatars.githubusercontent.com/u/41193328?v=4?s=100" width="100px;" alt=""/><br /><sub><b>i use arch btw</b></sub></a><br /><a href="#infra-lincolnthedev" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/BradleyDS2"><img src="https://avatars.githubusercontent.com/u/2174921?v=4?s=100" width="100px;" alt=""/><br /><sub><b>BradleyDS2</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=BradleyDS2" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/nduja"><img src="https://avatars.githubusercontent.com/u/69299134?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robbo</b></sub></a><br /><a href="https://github.com/hkalexling/Mango/commits?author=nduja" title="Code">💻</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/0)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/1)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/2)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/3)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/4)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/5)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/6)[](https://sourcerer.io/fame/hkalexling/hkalexling/Mango/links/7)
|
<!-- markdownlint-restore -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ ! -z "$(grep '.\{80\}' --exclude-dir=lib --include="*.cr" -nr --color=always . | tee /dev/tty)" ] \
|
|
||||||
&& echo "The above lines exceed the 80 characters limit" \
|
|
||||||
|| exit 0
|
|
||||||
+47
-42
@@ -1,28 +1,42 @@
|
|||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const minify = require("gulp-babel-minify");
|
const babel = require('gulp-babel');
|
||||||
|
const minify = require('gulp-babel-minify');
|
||||||
const minifyCss = require('gulp-minify-css');
|
const minifyCss = require('gulp-minify-css');
|
||||||
const less = require('gulp-less');
|
const less = require('gulp-less');
|
||||||
|
|
||||||
gulp.task('copy-uikit-js', () => {
|
gulp.task('copy-img', () => {
|
||||||
return gulp.src([
|
return gulp.src('node_modules/uikit/src/images/backgrounds/*.svg')
|
||||||
'node_modules/uikit/dist/js/uikit.min.js',
|
.pipe(gulp.dest('public/img'));
|
||||||
'node_modules/uikit/dist/js/uikit-icons.min.js'
|
|
||||||
])
|
|
||||||
.pipe(gulp.dest('public/js'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy-fontawesome', () => {
|
gulp.task('copy-font', () => {
|
||||||
return gulp.src([
|
return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff**')
|
||||||
'node_modules/@fortawesome/fontawesome-free/js/fontawesome.min.js',
|
.pipe(gulp.dest('public/webfonts'));
|
||||||
'node_modules/@fortawesome/fontawesome-free/js/solid.min.js'
|
|
||||||
])
|
|
||||||
.pipe(gulp.dest('public/js'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy-js', gulp.series('copy-uikit-js', 'copy-fontawesome'));
|
// Copy files from node_modules
|
||||||
|
gulp.task('node-modules-copy', gulp.parallel('copy-img', 'copy-font'));
|
||||||
|
|
||||||
gulp.task('minify-js', () => {
|
// Compile less
|
||||||
return gulp.src('public/js/*.js')
|
gulp.task('less', () => {
|
||||||
|
return gulp.src([
|
||||||
|
'public/css/mango.less',
|
||||||
|
'public/css/tags.less'
|
||||||
|
])
|
||||||
|
.pipe(less())
|
||||||
|
.pipe(gulp.dest('public/css'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Transpile and minify JS files and output to dist
|
||||||
|
gulp.task('babel', () => {
|
||||||
|
return gulp.src(['public/js/*.js', '!public/js/*.min.js'])
|
||||||
|
.pipe(babel({
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env', {
|
||||||
|
targets: '>0.25%, not dead, ios>=9'
|
||||||
|
}]
|
||||||
|
],
|
||||||
|
}))
|
||||||
.pipe(minify({
|
.pipe(minify({
|
||||||
removeConsole: true,
|
removeConsole: true,
|
||||||
builtIns: false
|
builtIns: false
|
||||||
@@ -30,40 +44,31 @@ gulp.task('minify-js', () => {
|
|||||||
.pipe(gulp.dest('dist/js'));
|
.pipe(gulp.dest('dist/js'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('less', () => {
|
// Minify CSS and output to dist
|
||||||
return gulp.src('public/css/*.less')
|
|
||||||
.pipe(less())
|
|
||||||
.pipe(gulp.dest('public/css'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('minify-css', () => {
|
gulp.task('minify-css', () => {
|
||||||
return gulp.src('public/css/*.css')
|
return gulp.src('public/css/*.css')
|
||||||
.pipe(minifyCss())
|
.pipe(minifyCss())
|
||||||
.pipe(gulp.dest('dist/css'));
|
.pipe(gulp.dest('dist/css'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy-uikit-icons', () => {
|
// Copy static files (includeing images) to dist
|
||||||
return gulp.src('node_modules/uikit/src/images/backgrounds/*.svg')
|
|
||||||
.pipe(gulp.dest('public/img'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('img', () => {
|
|
||||||
return gulp.src('public/img/*')
|
|
||||||
.pipe(gulp.dest('dist/img'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('copy-files', () => {
|
gulp.task('copy-files', () => {
|
||||||
return gulp.src('public/*.*')
|
return gulp.src([
|
||||||
|
'public/*.*',
|
||||||
|
'public/img/**',
|
||||||
|
'public/webfonts/*',
|
||||||
|
'public/js/*.min.js'
|
||||||
|
], {
|
||||||
|
base: 'public'
|
||||||
|
})
|
||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', gulp.parallel(
|
// Set up the public folder for development
|
||||||
gulp.series('copy-js', 'minify-js'),
|
gulp.task('dev', gulp.parallel('node-modules-copy', 'less'));
|
||||||
gulp.series('less', 'minify-css'),
|
|
||||||
gulp.series('copy-uikit-icons', 'img'),
|
|
||||||
'copy-files'
|
|
||||||
));
|
|
||||||
|
|
||||||
gulp.task('dev', gulp.parallel(
|
// Set up the dist folder for deployment
|
||||||
'copy-js', 'less', 'copy-uikit-icons'
|
gulp.task('deploy', gulp.parallel('babel', 'minify-css', 'copy-files'));
|
||||||
));
|
|
||||||
|
// Default task
|
||||||
|
gulp.task('default', gulp.series('dev', 'deploy'));
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
class ForeignKeys < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
-- add foreign key to tags
|
||||||
|
ALTER TABLE tags RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE tags (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
UNIQUE (id, tag),
|
||||||
|
FOREIGN KEY (id) REFERENCES titles (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO tags
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE INDEX tags_id_idx ON tags (id);
|
||||||
|
CREATE INDEX tags_tag_idx ON tags (tag);
|
||||||
|
|
||||||
|
-- add foreign key to thumbnails
|
||||||
|
ALTER TABLE thumbnails RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (id) REFERENCES ids (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO thumbnails
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX tn_index ON thumbnails (id);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- remove foreign key from thumbnails
|
||||||
|
ALTER TABLE thumbnails RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO thumbnails
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX tn_index ON thumbnails (id);
|
||||||
|
|
||||||
|
-- remove foreign key from tags
|
||||||
|
ALTER TABLE tags RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE tags (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
UNIQUE (id, tag)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO tags
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE INDEX tags_id_idx ON tags (id);
|
||||||
|
CREATE INDEX tags_tag_idx ON tags (tag);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class CreateIds < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
CREATE TABLE IF NOT EXISTS ids (
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
is_title INTEGER NOT NULL
|
||||||
|
);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS path_idx ON ids (path);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS id_idx ON ids (id);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
DROP TABLE ids;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
class IDSignature < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
ALTER TABLE ids ADD COLUMN signature TEXT;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- remove signature column from ids
|
||||||
|
ALTER TABLE ids RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE ids (
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
id TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO ids
|
||||||
|
SELECT path, id
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX path_idx ON ids (path);
|
||||||
|
CREATE UNIQUE INDEX id_idx ON ids (id);
|
||||||
|
|
||||||
|
-- recreate the foreign key constraint on thumbnails
|
||||||
|
ALTER TABLE thumbnails RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (id) REFERENCES ids (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO thumbnails
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX tn_index ON thumbnails (id);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
class CreateMangaDexAccount < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
CREATE TABLE md_account (
|
||||||
|
username TEXT NOT NULL PRIMARY KEY,
|
||||||
|
token TEXT NOT NULL,
|
||||||
|
expire INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (username) REFERENCES users (username)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
DROP TABLE md_account;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
class RelativePath < MG::Base
|
||||||
|
def up : String
|
||||||
|
base = Config.current.library_path
|
||||||
|
# Escape single quotes in case the path contains them, and remove the
|
||||||
|
# trailing slash (this is a mistake, fixed in DB version 10)
|
||||||
|
base = base.gsub("'", "''").rstrip "/"
|
||||||
|
|
||||||
|
<<-SQL
|
||||||
|
-- update the path column in ids to relative paths
|
||||||
|
UPDATE ids
|
||||||
|
SET path = REPLACE(path, '#{base}', '');
|
||||||
|
|
||||||
|
-- update the path column in titles to relative paths
|
||||||
|
UPDATE titles
|
||||||
|
SET path = REPLACE(path, '#{base}', '');
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
base = Config.current.library_path
|
||||||
|
base = base.gsub("'", "''").rstrip "/"
|
||||||
|
|
||||||
|
<<-SQL
|
||||||
|
-- update the path column in ids to absolute paths
|
||||||
|
UPDATE ids
|
||||||
|
SET path = '#{base}' || path;
|
||||||
|
|
||||||
|
-- update the path column in titles to absolute paths
|
||||||
|
UPDATE titles
|
||||||
|
SET path = '#{base}' || path;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# In DB version 8, we replaced the absolute paths in DB with relative paths,
|
||||||
|
# but we mistakenly left the starting slashes. This migration removes them.
|
||||||
|
class RelativePathFix < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
-- remove leading slashes from the paths in ids
|
||||||
|
UPDATE ids
|
||||||
|
SET path = SUBSTR(path, 2, LENGTH(path) - 1)
|
||||||
|
WHERE path LIKE '/%';
|
||||||
|
|
||||||
|
-- remove leading slashes from the paths in titles
|
||||||
|
UPDATE titles
|
||||||
|
SET path = SUBSTR(path, 2, LENGTH(path) - 1)
|
||||||
|
WHERE path LIKE '/%';
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- add leading slashes to paths in ids
|
||||||
|
UPDATE ids
|
||||||
|
SET path = '/' || path
|
||||||
|
WHERE path NOT LIKE '/%';
|
||||||
|
|
||||||
|
-- add leading slashes to paths in titles
|
||||||
|
UPDATE titles
|
||||||
|
SET path = '/' || path
|
||||||
|
WHERE path NOT LIKE '/%';
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
class SortTitle < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
-- add sort_title column to ids and titles
|
||||||
|
ALTER TABLE ids ADD COLUMN sort_title TEXT;
|
||||||
|
ALTER TABLE titles ADD COLUMN sort_title TEXT;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- remove sort_title column from ids
|
||||||
|
ALTER TABLE ids RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE ids (
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
signature TEXT,
|
||||||
|
unavailable INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO ids
|
||||||
|
SELECT path, id, signature, unavailable
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX path_idx ON ids (path);
|
||||||
|
CREATE UNIQUE INDEX id_idx ON ids (id);
|
||||||
|
|
||||||
|
-- recreate the foreign key constraint on thumbnails
|
||||||
|
ALTER TABLE thumbnails RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (id) REFERENCES ids (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO thumbnails
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX tn_index ON thumbnails (id);
|
||||||
|
|
||||||
|
-- remove sort_title column from titles
|
||||||
|
ALTER TABLE titles RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE titles (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
signature TEXT,
|
||||||
|
unavailable INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO titles
|
||||||
|
SELECT id, path, signature, unavailable
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX titles_id_idx on titles (id);
|
||||||
|
CREATE UNIQUE INDEX titles_path_idx on titles (path);
|
||||||
|
|
||||||
|
-- recreate the foreign key constraint on tags
|
||||||
|
ALTER TABLE tags RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE tags (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
UNIQUE (id, tag),
|
||||||
|
FOREIGN KEY (id) REFERENCES titles (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO tags
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE INDEX tags_id_idx ON tags (id);
|
||||||
|
CREATE INDEX tags_tag_idx ON tags (tag);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class CreateTags < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
CREATE TABLE IF NOT EXISTS tags (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
UNIQUE (id, tag)
|
||||||
|
);
|
||||||
|
CREATE INDEX IF NOT EXISTS tags_id_idx ON tags (id);
|
||||||
|
CREATE INDEX IF NOT EXISTS tags_tag_idx ON tags (tag);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
DROP TABLE tags;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
class CreateThumbnails < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
CREATE TABLE IF NOT EXISTS thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL
|
||||||
|
);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS tn_index ON thumbnails (id);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
DROP TABLE thumbnails;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
class CreateTitles < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
-- create titles
|
||||||
|
CREATE TABLE titles (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
signature TEXT
|
||||||
|
);
|
||||||
|
CREATE UNIQUE INDEX titles_id_idx on titles (id);
|
||||||
|
CREATE UNIQUE INDEX titles_path_idx on titles (path);
|
||||||
|
|
||||||
|
-- migrate data from ids to titles
|
||||||
|
INSERT INTO titles
|
||||||
|
SELECT id, path, null
|
||||||
|
FROM ids
|
||||||
|
WHERE is_title = 1;
|
||||||
|
|
||||||
|
DELETE FROM ids
|
||||||
|
WHERE is_title = 1;
|
||||||
|
|
||||||
|
-- remove the is_title column from ids
|
||||||
|
ALTER TABLE ids RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE ids (
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
id TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO ids
|
||||||
|
SELECT path, id
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX path_idx ON ids (path);
|
||||||
|
CREATE UNIQUE INDEX id_idx ON ids (id);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- insert the is_title column
|
||||||
|
ALTER TABLE ids ADD COLUMN is_title INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
-- migrate data from titles to ids
|
||||||
|
INSERT INTO ids
|
||||||
|
SELECT path, id, 1
|
||||||
|
FROM titles;
|
||||||
|
|
||||||
|
-- remove titles
|
||||||
|
DROP TABLE titles;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
class UnavailableIDs < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
-- add unavailable column to ids
|
||||||
|
ALTER TABLE ids ADD COLUMN unavailable INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
-- add unavailable column to titles
|
||||||
|
ALTER TABLE titles ADD COLUMN unavailable INTEGER NOT NULL DEFAULT 0;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
-- remove unavailable column from ids
|
||||||
|
ALTER TABLE ids RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE ids (
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
signature TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO ids
|
||||||
|
SELECT path, id, signature
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX path_idx ON ids (path);
|
||||||
|
CREATE UNIQUE INDEX id_idx ON ids (id);
|
||||||
|
|
||||||
|
-- recreate the foreign key constraint on thumbnails
|
||||||
|
ALTER TABLE thumbnails RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE thumbnails (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
data BLOB NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
mime TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY (id) REFERENCES ids (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO thumbnails
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX tn_index ON thumbnails (id);
|
||||||
|
|
||||||
|
-- remove unavailable column from titles
|
||||||
|
ALTER TABLE titles RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE titles (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
path TEXT NOT NULL,
|
||||||
|
signature TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO titles
|
||||||
|
SELECT path, id, signature
|
||||||
|
FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
-- recreate the indices
|
||||||
|
CREATE UNIQUE INDEX titles_id_idx on titles (id);
|
||||||
|
CREATE UNIQUE INDEX titles_path_idx on titles (path);
|
||||||
|
|
||||||
|
-- recreate the foreign key constraint on tags
|
||||||
|
ALTER TABLE tags RENAME TO tmp;
|
||||||
|
|
||||||
|
CREATE TABLE tags (
|
||||||
|
id TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
UNIQUE (id, tag),
|
||||||
|
FOREIGN KEY (id) REFERENCES titles (id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO tags
|
||||||
|
SELECT * FROM tmp;
|
||||||
|
|
||||||
|
DROP TABLE tmp;
|
||||||
|
|
||||||
|
CREATE INDEX tags_id_idx ON tags (id);
|
||||||
|
CREATE INDEX tags_tag_idx ON tags (tag);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
class CreateUsers < MG::Base
|
||||||
|
def up : String
|
||||||
|
<<-SQL
|
||||||
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
password TEXT NOT NULL,
|
||||||
|
token TEXT,
|
||||||
|
admin INTEGER NOT NULL
|
||||||
|
);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS username_idx ON users (username);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS token_idx ON users (token);
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down : String
|
||||||
|
<<-SQL
|
||||||
|
DROP TABLE users;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
+23
-20
@@ -1,22 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "mango",
|
"name": "mango",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "https://github.com/hkalexling/Mango.git",
|
"repository": "https://github.com/hkalexling/Mango.git",
|
||||||
"author": "Alex Ling <hkalexling@gmail.com>",
|
"author": "Alex Ling <hkalexling@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^4.0.2",
|
"@babel/preset-env": "^7.11.5",
|
||||||
"gulp-babel-minify": "^0.5.1",
|
"all-contributors-cli": "^6.19.0",
|
||||||
"gulp-less": "^4.0.1",
|
"gulp": "^4.0.2",
|
||||||
"gulp-minify-css": "^1.2.4",
|
"gulp-babel": "^8.0.0",
|
||||||
"less": "^3.11.3"
|
"gulp-babel-minify": "^0.5.1",
|
||||||
},
|
"gulp-less": "^4.0.1",
|
||||||
"scripts": {
|
"gulp-minify-css": "^1.2.4",
|
||||||
"uglify": "gulp"
|
"less": "^3.11.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"scripts": {
|
||||||
"@fortawesome/fontawesome-free": "^5.14.0",
|
"uglify": "gulp"
|
||||||
"uikit": "^3.5.4"
|
},
|
||||||
}
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "^5.14.0",
|
||||||
|
"uikit": "^3.5.4"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,154 +0,0 @@
|
|||||||
.uk-alert-close {
|
|
||||||
color: black !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-card-body {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-card-media-top {
|
|
||||||
width: 100%;
|
|
||||||
height: 250px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 600px) {
|
|
||||||
.uk-card-media-top {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-card-media-top>img {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-card-title {
|
|
||||||
max-height: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.acard:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-list li:not(.nopointer) {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scan-status {
|
|
||||||
cursor: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reader-bg {
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.break-word {
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-logo>img {
|
|
||||||
height: 90px;
|
|
||||||
width: 90px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-search {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#selectable .ui-selecting {
|
|
||||||
background: #EEE6B9;
|
|
||||||
}
|
|
||||||
|
|
||||||
#selectable .ui-selected {
|
|
||||||
background: #F4E487;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light #selectable .ui-selecting {
|
|
||||||
background: #5E5731;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light #selectable .ui-selected {
|
|
||||||
background: #9D9252;
|
|
||||||
}
|
|
||||||
|
|
||||||
td>.uk-dropdown {
|
|
||||||
white-space: pre-line;
|
|
||||||
}
|
|
||||||
|
|
||||||
#edit-modal .uk-grid>div {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#edit-modal #cover {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
#edit-modal #cover-upload {
|
|
||||||
height: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
#edit-modal .uk-modal-body .uk-inline {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item .uk-card-title {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grayscale {
|
|
||||||
filter: grayscale(100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light .uk-navbar-dropdown,
|
|
||||||
.uk-light .uk-modal-header,
|
|
||||||
.uk-light .uk-modal-body,
|
|
||||||
.uk-light .uk-modal-footer {
|
|
||||||
background: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light .uk-dropdown {
|
|
||||||
background: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light .uk-navbar-dropdown,
|
|
||||||
.uk-light .uk-dropdown {
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-light .uk-nav-header,
|
|
||||||
.uk-light .uk-description-list>dt {
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
[x-cloak] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#select-bar-controls a {
|
|
||||||
transform: scale(1.5, 1.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
#select-bar-controls a:hover {
|
|
||||||
color: orange;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-section {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#totop-wrapper {
|
|
||||||
position: absolute;
|
|
||||||
top: 100vh;
|
|
||||||
right: 2em;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#totop-wrapper a {
|
|
||||||
position: fixed;
|
|
||||||
position: sticky;
|
|
||||||
top: calc(100vh - 5em);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
// UIKit
|
||||||
|
@import "./uikit.less";
|
||||||
|
|
||||||
|
// FontAwesome
|
||||||
|
@import "../../node_modules/@fortawesome/fontawesome-free/less/fontawesome.less";
|
||||||
|
@import "../../node_modules/@fortawesome/fontawesome-free/less/solid.less";
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
src: url('@{fa-font-path}/fa-solid-900.woff2');
|
||||||
|
src: url('@{fa-font-path}/fa-solid-900.woff2') format('woff2'),
|
||||||
|
url('@{fa-font-path}/fa-solid-900.woff') format('woff');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Item cards
|
||||||
|
.item .uk-card {
|
||||||
|
cursor: pointer;
|
||||||
|
.uk-card-media-top {
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
@media (min-width: 600px) {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
|
||||||
|
&.grayscale {
|
||||||
|
filter: grayscale(100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.uk-card-body {
|
||||||
|
padding: 20px;
|
||||||
|
.uk-card-title {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.uk-card-title:not(.free-height) {
|
||||||
|
max-height: 3em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// jQuery selectable
|
||||||
|
#selectable {
|
||||||
|
.ui-selecting {
|
||||||
|
background: #EEE6B9;
|
||||||
|
}
|
||||||
|
.ui-selected {
|
||||||
|
background: #F4E487;
|
||||||
|
}
|
||||||
|
.uk-light & {
|
||||||
|
.ui-selecting {
|
||||||
|
background: #5E5731;
|
||||||
|
}
|
||||||
|
.ui-selected {
|
||||||
|
background: #9D9252;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit modal
|
||||||
|
#edit-modal {
|
||||||
|
.uk-grid > div {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
#cover {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
#cover-upload {
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.uk-modal-body .uk-inline {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dark theme
|
||||||
|
.uk-light {
|
||||||
|
.uk-modal-header,
|
||||||
|
.uk-modal-body,
|
||||||
|
.uk-modal-footer {
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
.uk-navbar-dropdown,
|
||||||
|
.uk-dropdown {
|
||||||
|
color: #ccc;
|
||||||
|
background: #333;
|
||||||
|
}
|
||||||
|
.uk-nav-header,
|
||||||
|
.uk-description-list > dt {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alpine magic
|
||||||
|
[x-cloak] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Batch select bar on title page
|
||||||
|
#select-bar-controls {
|
||||||
|
a {
|
||||||
|
transform: scale(1.5, 1.5);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Totop button
|
||||||
|
#totop-wrapper {
|
||||||
|
position: absolute;
|
||||||
|
top: 100vh;
|
||||||
|
right: 2em;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
a {
|
||||||
|
position: fixed;
|
||||||
|
position: sticky;
|
||||||
|
top: calc(100vh - 5em);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
.uk-alert-close {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
.break-word {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.uk-search {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
@light-gray: #e5e5e5;
|
||||||
|
@gray: #666666;
|
||||||
|
@black: #141414;
|
||||||
|
@blue: rgb(30, 135, 240);
|
||||||
|
@white1: rgba(255, 255, 255, .1);
|
||||||
|
@white2: rgba(255, 255, 255, .2);
|
||||||
|
@white7: rgba(255, 255, 255, .7);
|
||||||
|
|
||||||
|
.select2-container--default {
|
||||||
|
.select2-selection--multiple {
|
||||||
|
border: 1px solid @light-gray;
|
||||||
|
.select2-selection__choice,
|
||||||
|
.select2-selection__choice__remove,
|
||||||
|
.select2-selection__choice__remove:hover
|
||||||
|
{
|
||||||
|
background-color: @blue;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select2-dropdown {
|
||||||
|
.select2-results__option--highlighted.select2-results__option--selectable {
|
||||||
|
background-color: @blue;
|
||||||
|
}
|
||||||
|
.select2-results__option--selected:not(.select2-results__option--highlighted) {
|
||||||
|
background-color: @light-gray
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.uk-light {
|
||||||
|
.select2-container--default {
|
||||||
|
.select2-selection {
|
||||||
|
background-color: @white1;
|
||||||
|
}
|
||||||
|
.select2-selection--multiple {
|
||||||
|
border: 1px solid @white2;
|
||||||
|
.select2-selection__choice,
|
||||||
|
.select2-selection__choice__remove,
|
||||||
|
.select2-selection__choice__remove:hover
|
||||||
|
{
|
||||||
|
background-color: white;
|
||||||
|
color: @gray;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.select2-search__field {
|
||||||
|
color: @white7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select2-dropdown {
|
||||||
|
background-color: @black;
|
||||||
|
.select2-results__option--selected:not(.select2-results__option--highlighted) {
|
||||||
|
background-color: @white2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,3 +43,22 @@
|
|||||||
@internal-list-bullet-image: "../img/list-bullet.svg";
|
@internal-list-bullet-image: "../img/list-bullet.svg";
|
||||||
@internal-accordion-open-image: "../img/accordion-open.svg";
|
@internal-accordion-open-image: "../img/accordion-open.svg";
|
||||||
@internal-accordion-close-image: "../img/accordion-close.svg";
|
@internal-accordion-close-image: "../img/accordion-close.svg";
|
||||||
|
|
||||||
|
.hook-card-default() {
|
||||||
|
.uk-light & {
|
||||||
|
background: @card-secondary-background;
|
||||||
|
color: @card-secondary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hook-card-default-title() {
|
||||||
|
.uk-light & {
|
||||||
|
color: @card-secondary-title-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hook-card-default-hover() {
|
||||||
|
.uk-light & {
|
||||||
|
background-color: @card-secondary-hover-background;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
+56
-38
@@ -1,40 +1,58 @@
|
|||||||
let scanning = false;
|
const component = () => {
|
||||||
|
return {
|
||||||
|
progress: 1.0,
|
||||||
|
generating: false,
|
||||||
|
scanning: false,
|
||||||
|
scanTitles: 0,
|
||||||
|
scanMs: -1,
|
||||||
|
themeSetting: '',
|
||||||
|
|
||||||
const scan = () => {
|
init() {
|
||||||
scanning = true;
|
this.getProgress();
|
||||||
$('#scan-status > div').removeAttr('hidden');
|
setInterval(() => {
|
||||||
$('#scan-status > span').attr('hidden', '');
|
this.getProgress();
|
||||||
const color = $('#scan').css('color');
|
}, 5000);
|
||||||
$('#scan').css('color', 'gray');
|
|
||||||
$.post(base_url + 'api/admin/scan', (data) => {
|
|
||||||
const ms = data.milliseconds;
|
|
||||||
const titles = data.titles;
|
|
||||||
$('#scan-status > span').text('Scanned ' + titles + ' titles in ' + ms + 'ms');
|
|
||||||
$('#scan-status > span').removeAttr('hidden');
|
|
||||||
$('#scan').css('color', color);
|
|
||||||
$('#scan-status > div').attr('hidden', '');
|
|
||||||
scanning = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
String.prototype.capitalize = function() {
|
const setting = loadThemeSetting();
|
||||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
this.themeSetting = setting.charAt(0).toUpperCase() + setting.slice(1);
|
||||||
}
|
},
|
||||||
|
themeChanged(event) {
|
||||||
$(() => {
|
const newSetting = $(event.currentTarget).val().toLowerCase();
|
||||||
$('li').click((e) => {
|
saveThemeSetting(newSetting);
|
||||||
const url = $(e.currentTarget).attr('data-url');
|
setTheme();
|
||||||
if (url) {
|
},
|
||||||
$(location).attr('href', url);
|
scan() {
|
||||||
}
|
if (this.scanning) return;
|
||||||
});
|
this.scanning = true;
|
||||||
|
this.scanMs = -1;
|
||||||
const setting = loadThemeSetting();
|
this.scanTitles = 0;
|
||||||
$('#theme-select').val(setting.capitalize());
|
$.post(`${base_url}api/admin/scan`)
|
||||||
|
.then(data => {
|
||||||
$('#theme-select').change((e) => {
|
this.scanMs = data.milliseconds;
|
||||||
const newSetting = $(e.currentTarget).val().toLowerCase();
|
this.scanTitles = data.titles;
|
||||||
saveThemeSetting(newSetting);
|
})
|
||||||
setTheme();
|
.catch(e => {
|
||||||
});
|
alert('danger', `Failed to trigger a scan. Error: ${e}`);
|
||||||
});
|
})
|
||||||
|
.always(() => {
|
||||||
|
this.scanning = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
generateThumbnails() {
|
||||||
|
if (this.generating) return;
|
||||||
|
this.generating = true;
|
||||||
|
this.progress = 0.0;
|
||||||
|
$.post(`${base_url}api/admin/generate_thumbnails`)
|
||||||
|
.then(() => {
|
||||||
|
this.getProgress()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getProgress() {
|
||||||
|
$.get(`${base_url}api/admin/thumbnail_progress`)
|
||||||
|
.then(data => {
|
||||||
|
this.progress = data.progress;
|
||||||
|
this.generating = data.progress > 0;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
/**
|
||||||
|
* --- Alpine helper functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an alpine.js property
|
||||||
|
*
|
||||||
|
* @function setProp
|
||||||
|
* @param {string} key - Key of the data property
|
||||||
|
* @param {*} prop - The data property
|
||||||
|
* @param {string} selector - The jQuery selector to the root element
|
||||||
|
*/
|
||||||
|
const setProp = (key, prop, selector = '#root') => {
|
||||||
|
$(selector).get(0).__x.$data[key] = prop;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an alpine.js property
|
||||||
|
*
|
||||||
|
* @function getProp
|
||||||
|
* @param {string} key - Key of the data property
|
||||||
|
* @param {string} selector - The jQuery selector to the root element
|
||||||
|
* @return {*} The data property
|
||||||
|
*/
|
||||||
|
const getProp = (key, selector = '#root') => {
|
||||||
|
return $(selector).get(0).__x.$data[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --- Theme related functions
|
||||||
|
* Note: In the comments below we treat "theme" and "theme setting"
|
||||||
|
* differently. A theme can have only two values, either "dark" or
|
||||||
|
* "light", while a theme setting can have the third value "system".
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the system setting prefers dark theme.
|
||||||
|
* from https://flaviocopes.com/javascript-detect-dark-mode/
|
||||||
|
*
|
||||||
|
* @function preferDarkMode
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
const preferDarkMode = () => {
|
||||||
|
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a given string represents a valid theme setting
|
||||||
|
*
|
||||||
|
* @function validThemeSetting
|
||||||
|
* @param {string} theme - The string representing the theme setting
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
const validThemeSetting = (theme) => {
|
||||||
|
return ['dark', 'light', 'system'].indexOf(theme) >= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load theme setting from local storage, or use 'light'
|
||||||
|
*
|
||||||
|
* @function loadThemeSetting
|
||||||
|
* @return {string} A theme setting ('dark', 'light', or 'system')
|
||||||
|
*/
|
||||||
|
const loadThemeSetting = () => {
|
||||||
|
let str = localStorage.getItem('theme');
|
||||||
|
if (!str || !validThemeSetting(str)) str = 'system';
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the current theme (not theme setting)
|
||||||
|
*
|
||||||
|
* @function loadTheme
|
||||||
|
* @return {string} The current theme to use ('dark' or 'light')
|
||||||
|
*/
|
||||||
|
const loadTheme = () => {
|
||||||
|
let setting = loadThemeSetting();
|
||||||
|
if (setting === 'system') {
|
||||||
|
setting = preferDarkMode() ? 'dark' : 'light';
|
||||||
|
}
|
||||||
|
return setting;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save a theme setting
|
||||||
|
*
|
||||||
|
* @function saveThemeSetting
|
||||||
|
* @param {string} setting - A theme setting
|
||||||
|
*/
|
||||||
|
const saveThemeSetting = setting => {
|
||||||
|
if (!validThemeSetting(setting)) setting = 'system';
|
||||||
|
localStorage.setItem('theme', setting);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the current theme. When the current theme setting is 'system', it
|
||||||
|
* will be changed to either 'light' or 'dark'
|
||||||
|
*
|
||||||
|
* @function toggleTheme
|
||||||
|
*/
|
||||||
|
const toggleTheme = () => {
|
||||||
|
const theme = loadTheme();
|
||||||
|
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
||||||
|
saveThemeSetting(newTheme);
|
||||||
|
setTheme(newTheme);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply a theme, or load a theme and then apply it
|
||||||
|
*
|
||||||
|
* @function setTheme
|
||||||
|
* @param {string?} theme - (Optional) The theme to apply. When omitted, use
|
||||||
|
* `loadTheme` to get a theme and apply it.
|
||||||
|
*/
|
||||||
|
const setTheme = (theme) => {
|
||||||
|
if (!theme) theme = loadTheme();
|
||||||
|
if (theme === 'dark') {
|
||||||
|
$('html').css('background', 'rgb(20, 20, 20)');
|
||||||
|
$('body').addClass('uk-light');
|
||||||
|
$('.ui-widget-content').addClass('dark');
|
||||||
|
} else {
|
||||||
|
$('html').css('background', '');
|
||||||
|
$('body').removeClass('uk-light');
|
||||||
|
$('.ui-widget-content').removeClass('dark');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// do it before document is ready to prevent the initial flash of white on
|
||||||
|
// most pages
|
||||||
|
setTheme();
|
||||||
|
$(() => {
|
||||||
|
// hack for the reader page
|
||||||
|
setTheme();
|
||||||
|
|
||||||
|
// on system dark mode setting change
|
||||||
|
if (window.matchMedia) {
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)')
|
||||||
|
.addEventListener('change', event => {
|
||||||
|
if (loadThemeSetting() === 'system')
|
||||||
|
setTheme(event.matches ? 'dark' : 'light');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
+22
-13
@@ -1,17 +1,26 @@
|
|||||||
const truncate = () => {
|
/**
|
||||||
$('.uk-card-title').each((i, e) => {
|
* Truncate a .uk-card-title element
|
||||||
$(e).dotdotdot({
|
*
|
||||||
truncate: 'letter',
|
* @function truncate
|
||||||
watch: true,
|
* @param {object} e - The title element to truncate
|
||||||
callback: (truncated) => {
|
*/
|
||||||
if (truncated) {
|
const truncate = (e) => {
|
||||||
$(e).attr('uk-tooltip', $(e).attr('data-title'));
|
$(e).dotdotdot({
|
||||||
} else {
|
truncate: 'letter',
|
||||||
$(e).removeAttr('uk-tooltip');
|
watch: true,
|
||||||
}
|
callback: (truncated) => {
|
||||||
|
if (truncated) {
|
||||||
|
$(e).attr('uk-tooltip', $(e).attr('data-title'));
|
||||||
|
} else {
|
||||||
|
$(e).removeAttr('uk-tooltip');
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
truncate();
|
$('.uk-card-title').each((i, e) => {
|
||||||
|
// Truncate the title when it first enters the view
|
||||||
|
$(e).one('inview', () => {
|
||||||
|
truncate(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
+109
-138
@@ -1,145 +1,116 @@
|
|||||||
$(() => {
|
const component = () => {
|
||||||
$('input.uk-checkbox').each((i, e) => {
|
return {
|
||||||
$(e).change(() => {
|
jobs: [],
|
||||||
loadConfig();
|
paused: undefined,
|
||||||
});
|
loading: false,
|
||||||
});
|
toggling: false,
|
||||||
loadConfig();
|
ws: undefined,
|
||||||
load();
|
|
||||||
|
|
||||||
const intervalMS = 5000;
|
wsConnect(secure = true) {
|
||||||
setTimeout(() => {
|
const url = `${secure ? 'wss' : 'ws'}://${location.host}${base_url}api/admin/mangadex/queue`;
|
||||||
setInterval(() => {
|
console.log(`Connecting to ${url}`);
|
||||||
if (globalConfig.autoRefresh !== true) return;
|
this.ws = new WebSocket(url);
|
||||||
load();
|
this.ws.onmessage = event => {
|
||||||
}, intervalMS);
|
const data = JSON.parse(event.data);
|
||||||
}, intervalMS);
|
this.jobs = data.jobs;
|
||||||
});
|
this.paused = data.paused;
|
||||||
var globalConfig = {};
|
};
|
||||||
var loading = false;
|
this.ws.onclose = () => {
|
||||||
|
if (this.ws.failed)
|
||||||
const loadConfig = () => {
|
return this.wsConnect(false);
|
||||||
globalConfig.autoRefresh = $('#auto-refresh').prop('checked');
|
alert('danger', 'Socket connection closed');
|
||||||
};
|
};
|
||||||
const remove = (id) => {
|
this.ws.onerror = () => {
|
||||||
var url = base_url + 'api/admin/mangadex/queue/delete';
|
if (secure)
|
||||||
if (id !== undefined)
|
return this.ws.failed = true;
|
||||||
url += '?' + $.param({
|
alert('danger', 'Socket connection failed');
|
||||||
id: id
|
};
|
||||||
});
|
},
|
||||||
console.log(url);
|
init() {
|
||||||
$.ajax({
|
this.wsConnect();
|
||||||
type: 'POST',
|
this.load();
|
||||||
url: url,
|
},
|
||||||
dataType: 'json'
|
load() {
|
||||||
})
|
this.loading = true;
|
||||||
.done(data => {
|
$.ajax({
|
||||||
if (!data.success && data.error) {
|
type: 'GET',
|
||||||
alert('danger', `Failed to remove job from download queue. Error: ${data.error}`);
|
url: base_url + 'api/admin/mangadex/queue',
|
||||||
return;
|
dataType: 'json'
|
||||||
|
})
|
||||||
|
.done(data => {
|
||||||
|
if (!data.success && data.error) {
|
||||||
|
alert('danger', `Failed to fetch download queue. Error: ${data.error}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.jobs = data.jobs;
|
||||||
|
this.paused = data.paused;
|
||||||
|
})
|
||||||
|
.fail((jqXHR, status) => {
|
||||||
|
alert('danger', `Failed to fetch download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||||
|
})
|
||||||
|
.always(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
jobAction(action, event) {
|
||||||
|
let url = `${base_url}api/admin/mangadex/queue/${action}`;
|
||||||
|
if (event) {
|
||||||
|
const id = event.currentTarget.closest('tr').id.split('-').slice(1).join('-');
|
||||||
|
url = `${url}?${$.param({
|
||||||
|
id: id
|
||||||
|
})}`;
|
||||||
}
|
}
|
||||||
load();
|
console.log(url);
|
||||||
})
|
$.ajax({
|
||||||
.fail((jqXHR, status) => {
|
type: 'POST',
|
||||||
alert('danger', `Failed to remove job from download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
url: url,
|
||||||
});
|
dataType: 'json'
|
||||||
};
|
})
|
||||||
const refresh = (id) => {
|
.done(data => {
|
||||||
var url = base_url + 'api/admin/mangadex/queue/retry';
|
if (!data.success && data.error) {
|
||||||
if (id !== undefined)
|
alert('danger', `Failed to ${action} job from download queue. Error: ${data.error}`);
|
||||||
url += '?' + $.param({
|
return;
|
||||||
id: id
|
}
|
||||||
});
|
this.load();
|
||||||
console.log(url);
|
})
|
||||||
$.ajax({
|
.fail((jqXHR, status) => {
|
||||||
type: 'POST',
|
alert('danger', `Failed to ${action} job from download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||||
url: url,
|
});
|
||||||
dataType: 'json'
|
},
|
||||||
})
|
toggle() {
|
||||||
.done(data => {
|
this.toggling = true;
|
||||||
if (!data.success && data.error) {
|
const action = this.paused ? 'resume' : 'pause';
|
||||||
alert('danger', `Failed to restart download job. Error: ${data.error}`);
|
const url = `${base_url}api/admin/mangadex/queue/${action}`;
|
||||||
return;
|
$.ajax({
|
||||||
}
|
type: 'POST',
|
||||||
load();
|
url: url,
|
||||||
})
|
dataType: 'json'
|
||||||
.fail((jqXHR, status) => {
|
})
|
||||||
alert('danger', `Failed to restart download job. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
.fail((jqXHR, status) => {
|
||||||
});
|
alert('danger', `Failed to ${action} download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||||
};
|
})
|
||||||
const toggle = () => {
|
.always(() => {
|
||||||
$('#pause-resume-btn').attr('disabled', '');
|
this.load();
|
||||||
const paused = $('#pause-resume-btn').text() === 'Resume download';
|
this.toggling = false;
|
||||||
const action = paused ? 'resume' : 'pause';
|
});
|
||||||
const url = `${base_url}api/admin/mangadex/queue/${action}`;
|
},
|
||||||
$.ajax({
|
statusClass(status) {
|
||||||
type: 'POST',
|
let cls = 'label ';
|
||||||
url: url,
|
switch (status) {
|
||||||
dataType: 'json'
|
case 'Pending':
|
||||||
})
|
|
||||||
.fail((jqXHR, status) => {
|
|
||||||
alert('danger', `Failed to ${action} download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
|
||||||
})
|
|
||||||
.always(() => {
|
|
||||||
load();
|
|
||||||
$('#pause-resume-btn').removeAttr('disabled');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const load = () => {
|
|
||||||
if (loading) return;
|
|
||||||
loading = true;
|
|
||||||
console.log('fetching');
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: base_url + 'api/admin/mangadex/queue',
|
|
||||||
dataType: 'json'
|
|
||||||
})
|
|
||||||
.done(data => {
|
|
||||||
if (!data.success && data.error) {
|
|
||||||
alert('danger', `Failed to fetch download queue. Error: ${data.error}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(data);
|
|
||||||
const btnText = data.paused ? "Resume download" : "Pause download";
|
|
||||||
$('#pause-resume-btn').text(btnText);
|
|
||||||
$('#pause-resume-btn').removeAttr('hidden');
|
|
||||||
const rows = data.jobs.map(obj => {
|
|
||||||
var cls = 'label ';
|
|
||||||
if (obj.status === 'Pending')
|
|
||||||
cls += 'label-pending';
|
cls += 'label-pending';
|
||||||
if (obj.status === 'Completed')
|
break;
|
||||||
|
case 'Completed':
|
||||||
cls += 'label-success';
|
cls += 'label-success';
|
||||||
if (obj.status === 'Error')
|
break;
|
||||||
|
case 'Error':
|
||||||
cls += 'label-danger';
|
cls += 'label-danger';
|
||||||
if (obj.status === 'MissingPages')
|
break;
|
||||||
|
case 'MissingPages':
|
||||||
cls += 'label-warning';
|
cls += 'label-warning';
|
||||||
|
break;
|
||||||
const info = obj.status_message.length > 0 ? '<span uk-icon="info"></span>' : '';
|
}
|
||||||
const statusSpan = `<span class="${cls}">${obj.status} ${info}</span>`;
|
return cls;
|
||||||
const dropdown = obj.status_message.length > 0 ? `<div uk-dropdown>${obj.status_message}</div>` : '';
|
}
|
||||||
const retryBtn = obj.status_message.length > 0 ? `<a onclick="refresh('${obj.id}')" uk-icon="refresh"></a>` : '';
|
};
|
||||||
return `<tr id="chapter-${obj.id}">
|
|
||||||
<td>${obj.plugin_id ? obj.title : `<a href="${baseURL}/chapter/${obj.id}">${obj.title}</a>`}</td>
|
|
||||||
<td>${obj.plugin_id ? obj.manga_title : `<a href="${baseURL}/manga/${obj.manga_id}">${obj.manga_title}</a>`}</td>
|
|
||||||
<td>${obj.success_count}/${obj.pages}</td>
|
|
||||||
<td>${moment(obj.time).fromNow()}</td>
|
|
||||||
<td>${statusSpan} ${dropdown}</td>
|
|
||||||
<td>${obj.plugin_id || ""}</td>
|
|
||||||
<td>
|
|
||||||
<a onclick="remove('${obj.id}')" uk-icon="trash"></a>
|
|
||||||
${retryBtn}
|
|
||||||
</td>
|
|
||||||
</tr>`;
|
|
||||||
});
|
|
||||||
|
|
||||||
const tbody = `<tbody>${rows.join('')}</tbody>`;
|
|
||||||
$('tbody').remove();
|
|
||||||
$('table').append(tbody);
|
|
||||||
})
|
|
||||||
.fail((jqXHR, status) => {
|
|
||||||
alert('danger', `Failed to fetch download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
|
||||||
})
|
|
||||||
.always(() => {
|
|
||||||
loading = false;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,305 +0,0 @@
|
|||||||
$(() => {
|
|
||||||
$('#search-input').keypress(event => {
|
|
||||||
if (event.which === 13) {
|
|
||||||
search();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('.filter-field').each((i, ele) => {
|
|
||||||
$(ele).change(() => {
|
|
||||||
buildTable();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const selectAll = () => {
|
|
||||||
$('tbody > tr').each((i, e) => {
|
|
||||||
$(e).addClass('ui-selected');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const unselect = () => {
|
|
||||||
$('tbody > tr').each((i, e) => {
|
|
||||||
$(e).removeClass('ui-selected');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const download = () => {
|
|
||||||
const selected = $('tbody > tr.ui-selected');
|
|
||||||
if (selected.length === 0) return;
|
|
||||||
UIkit.modal.confirm(`Download ${selected.length} selected chapters?`).then(() => {
|
|
||||||
$('#download-btn').attr('hidden', '');
|
|
||||||
$('#download-spinner').removeAttr('hidden');
|
|
||||||
const ids = selected.map((i, e) => {
|
|
||||||
return $(e).find('td').first().text();
|
|
||||||
}).get();
|
|
||||||
const chapters = globalChapters.filter(c => ids.indexOf(c.id) >= 0);
|
|
||||||
console.log(ids);
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: base_url + 'api/admin/mangadex/download',
|
|
||||||
data: JSON.stringify({
|
|
||||||
chapters: chapters
|
|
||||||
}),
|
|
||||||
contentType: "application/json",
|
|
||||||
dataType: 'json'
|
|
||||||
})
|
|
||||||
.done(data => {
|
|
||||||
console.log(data);
|
|
||||||
if (data.error) {
|
|
||||||
alert('danger', `Failed to add chapters to the download queue. Error: ${data.error}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const successCount = parseInt(data.success);
|
|
||||||
const failCount = parseInt(data.fail);
|
|
||||||
UIkit.modal.confirm(`${successCount} of ${successCount + failCount} chapters added to the download queue. Proceed to the download manager?`).then(() => {
|
|
||||||
window.location.href = base_url + 'admin/downloads';
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.fail((jqXHR, status) => {
|
|
||||||
alert('danger', `Failed to add chapters to the download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
|
||||||
})
|
|
||||||
.always(() => {
|
|
||||||
$('#download-spinner').attr('hidden', '');
|
|
||||||
$('#download-btn').removeAttr('hidden');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const toggleSpinner = () => {
|
|
||||||
var attr = $('#spinner').attr('hidden');
|
|
||||||
if (attr) {
|
|
||||||
$('#spinner').removeAttr('hidden');
|
|
||||||
$('#search-btn').attr('hidden', '');
|
|
||||||
} else {
|
|
||||||
$('#search-btn').removeAttr('hidden');
|
|
||||||
$('#spinner').attr('hidden', '');
|
|
||||||
}
|
|
||||||
searching = !searching;
|
|
||||||
};
|
|
||||||
var searching = false;
|
|
||||||
var globalChapters;
|
|
||||||
const search = () => {
|
|
||||||
if (searching) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$('#manga-details').attr('hidden', '');
|
|
||||||
$('#filter-form').attr('hidden', '');
|
|
||||||
$('table').attr('hidden', '');
|
|
||||||
$('#selection-controls').attr('hidden', '');
|
|
||||||
$('#filter-notification').attr('hidden', '');
|
|
||||||
toggleSpinner() | |||||||