Compare commits
659 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cc35e56d9 | ||
|
|
8d71c5bff3 | ||
|
|
43d5bc5224 | ||
|
|
77dc3c28f3 | ||
|
|
49a5e26155 | ||
|
|
e9faddc96f | ||
|
|
a79b993fbd | ||
|
|
fcb4139d68 | ||
|
|
f2b6f12fcb | ||
|
|
de3da8acf8 | ||
|
|
bccaac3c24 | ||
|
|
7da60e252a | ||
|
|
7bfdd4ab79 | ||
|
|
5f37eebf87 | ||
|
|
015676648b | ||
|
|
b1ac5422b8 | ||
|
|
9c1359b5d4 | ||
|
|
761cc038e4 | ||
|
|
0ecb194a45 | ||
|
|
700fabd970 | ||
|
|
12eb271873 | ||
|
|
65cff92b52 | ||
|
|
61b587f2b5 | ||
|
|
abdf02d9c5 | ||
|
|
77dc221578 | ||
|
|
2ca71a31c6 | ||
|
|
df64f26fa5 | ||
|
|
8218833448 | ||
|
|
4deacc6471 | ||
|
|
7b92b594c5 | ||
|
|
bf2e645daa | ||
|
|
3a15a1fcf3 | ||
|
|
14a21b1051 | ||
|
|
78e16e7210 | ||
|
|
b7e06e89cb | ||
|
|
4efd9449d6 | ||
|
|
a670e1c7cd | ||
|
|
3d51e9a084 | ||
|
|
e92efc3e20 | ||
|
|
da4d56f44d | ||
|
|
56fc8f9a6d | ||
|
|
6bd2d1105e | ||
|
|
3573a63dfd | ||
|
|
1cbc29f96a | ||
|
|
58d9854b79 | ||
|
|
34cdb22ae8 | ||
|
|
9151d37754 | ||
|
|
a0561ec0f7 | ||
|
|
2a594255a4 | ||
|
|
8e5ffd45db | ||
|
|
132b805ff3 | ||
|
|
cbe5392d5f | ||
|
|
ced4296fae | ||
|
|
e7b168ca09 | ||
|
|
bdbcacb3ee | ||
|
|
9e1cdb7017 | ||
|
|
7e8ac47cdf | ||
|
|
8dd43a635b | ||
|
|
0f0f06d6aa | ||
|
|
bd5aa6652d | ||
|
|
313be6bfd1 | ||
|
|
57cb165d55 | ||
|
|
589b3170b1 | ||
|
|
c5c6c35799 | ||
|
|
3e94d66b29 | ||
|
|
2a4dcb0f24 | ||
|
|
b32b5035b8 | ||
|
|
d7c80a844c | ||
|
|
4cc501feaf | ||
|
|
39db7af384 | ||
|
|
7869123930 | ||
|
|
d50f1304c5 | ||
|
|
ec26b46f76 | ||
|
|
e76e01df46 | ||
|
|
0963c69a2b | ||
|
|
4206bef69b | ||
|
|
fde2528df1 | ||
|
|
51ed969702 | ||
|
|
b73ee4a841 | ||
|
|
967ad751b4 | ||
|
|
7ca22198b3 | ||
|
|
28283725e0 | ||
|
|
8f17d9f3ca | ||
|
|
ff4598cc84 | ||
|
|
715374711c | ||
|
|
7f84100c22 | ||
|
|
7ff57561c2 | ||
|
|
4084293d46 | ||
|
|
76b1b2dfd6 | ||
|
|
13eab72944 | ||
|
|
490937a271 | ||
|
|
3d84a63145 | ||
|
|
118d40d3c6 | ||
|
|
49427ed00d | ||
|
|
199dd66c8b | ||
|
|
9f28b570d5 | ||
|
|
19b8c412fa | ||
|
|
89c337fe31 | ||
|
|
36df9897cc | ||
|
|
7875a57af0 | ||
|
|
4bf572e71f | ||
|
|
6b37f517c9 | ||
|
|
c5ca279227 | ||
|
|
71d91d2a8e | ||
|
|
ad4ed78b76 | ||
|
|
1df63a0716 | ||
|
|
1c76730528 | ||
|
|
be67c21bea | ||
|
|
e435e09b6d | ||
|
|
2cd4764cbd | ||
|
|
f6297e8be3 | ||
|
|
f28784583f | ||
|
|
0fb10cce85 | ||
|
|
4d67618390 | ||
|
|
4cc657d818 | ||
|
|
7e43d855f2 | ||
|
|
8c5e19a9b7 | ||
|
|
35bc9a48c0 | ||
|
|
56c3d7359c | ||
|
|
0ed81a4c07 | ||
|
|
39aed8afb8 | ||
|
|
3ad8d5039e | ||
|
|
ce9e01c2c2 | ||
|
|
fabff3a32c | ||
|
|
cc1d4df640 | ||
|
|
d8ebb596e5 | ||
|
|
1c39526afb | ||
|
|
9bd6b6b12b | ||
|
|
c8af048473 | ||
|
|
71947f0c5e | ||
|
|
57cf3956a2 | ||
|
|
bed0bee507 | ||
|
|
0a2bce9d78 | ||
|
|
3c132aeb3c | ||
|
|
32a777b997 | ||
|
|
c4b4cb0e6d | ||
|
|
204e9ad1ea | ||
|
|
ee98dcb58b | ||
|
|
d8ada044ce | ||
|
|
45a85644ca | ||
|
|
e68a51399a | ||
|
|
1b63898e8b | ||
|
|
a54a709c65 | ||
|
|
f078ae8f19 | ||
|
|
571efea41e | ||
|
|
83b3c8a1d9 | ||
|
|
303a138107 | ||
|
|
a0cbacd6c6 | ||
|
|
740857065c | ||
|
|
37acecddca | ||
|
|
86a305ce7c | ||
|
|
2c84ff0c62 | ||
|
|
b0cc1cb760 | ||
|
|
f6918f4bc1 | ||
|
|
5d433c7788 | ||
|
|
64298ff10d | ||
|
|
b258b67f1b | ||
|
|
5194b085a3 | ||
|
|
b52d9dccc4 | ||
|
|
3720645775 | ||
|
|
b200e933b6 | ||
|
|
6074dac1d5 | ||
|
|
d032ae36d1 | ||
|
|
df514c0fbe | ||
|
|
86679f6398 | ||
|
|
f907a97358 | ||
|
|
73608972c6 | ||
|
|
45018f9747 | ||
|
|
5e867d8558 | ||
|
|
cbab1b2c71 | ||
|
|
f9105e5433 | ||
|
|
d611e4662d | ||
|
|
16c57f1fb6 | ||
|
|
d89b007c9e | ||
|
|
4969644374 | ||
|
|
f481bf7c09 | ||
|
|
ace3860226 | ||
|
|
9a7ea1f888 | ||
|
|
ead30618f8 | ||
|
|
95ed1aeaf1 | ||
|
|
12155eaabb | ||
|
|
aabab32413 | ||
|
|
a9415e59c0 | ||
|
|
9dcdaf20c2 | ||
|
|
3cbb5e108e | ||
|
|
163e6d580f | ||
|
|
0cd0db7e53 | ||
|
|
0a2fbfec45 | ||
|
|
56a1cfbc98 | ||
|
|
361ca69f42 | ||
|
|
0db7c3bbd4 | ||
|
|
a5fa723db1 | ||
|
|
342327b14a | ||
|
|
a9db439a26 | ||
|
|
00dae69e9b | ||
|
|
d8c2a25a34 | ||
|
|
9b2df7646b | ||
|
|
1cb234a368 | ||
|
|
9f414cd7d3 | ||
|
|
48f87a25d5 | ||
|
|
8b88e23594 | ||
|
|
c78b18c5e8 | ||
|
|
5330207f12 | ||
|
|
4486212fa9 | ||
|
|
b985a265b0 | ||
|
|
1eef1f25fe | ||
|
|
d06c20ae52 | ||
|
|
8d500252c6 | ||
|
|
51a2a6d736 | ||
|
|
bb9f7a79d0 | ||
|
|
14720a07c6 | ||
|
|
1f82dc8fa9 | ||
|
|
11f8c58739 | ||
|
|
8523232899 | ||
|
|
5ddfc8338e | ||
|
|
c2ad19261b | ||
|
|
0b64e43432 | ||
|
|
9a230b302d | ||
|
|
df57e3bc60 | ||
|
|
ef48ac12e5 | ||
|
|
869f012734 | ||
|
|
fd01257bdf | ||
|
|
bc35557ebd | ||
|
|
d632ad5b49 | ||
|
|
a6eebe4ebd | ||
|
|
936ff5daae | ||
|
|
6dfc5f70e9 | ||
|
|
393276c9e2 | ||
|
|
e767d8b0cc | ||
|
|
0adb515873 | ||
|
|
a22d5d16ef | ||
|
|
0037dc2231 | ||
|
|
c4ee54beba | ||
|
|
c5ff2a0104 | ||
|
|
12a08f9bb7 | ||
|
|
b0662b4b1c | ||
|
|
612a13ad99 | ||
|
|
035e1dfdac | ||
|
|
fb9ec3da12 | ||
|
|
d10ba49228 | ||
|
|
696c32c5a8 | ||
|
|
bebd53468c | ||
|
|
ec8074ff16 | ||
|
|
e1e2fe14be | ||
|
|
11d069821f | ||
|
|
516f26d765 | ||
|
|
db2b0a738a | ||
|
|
7ba810057e | ||
|
|
d3ce9a629d | ||
|
|
7157869fe8 | ||
|
|
94e62ebe48 | ||
|
|
fa44f15776 | ||
|
|
2b49145d24 | ||
|
|
1542dccf54 | ||
|
|
42977a921b | ||
|
|
8ff16ace6d | ||
|
|
c9a0a98fee | ||
|
|
c7f3431798 | ||
|
|
7c738fa01e | ||
|
|
e16bc903d4 | ||
|
|
a6e669c0ec | ||
|
|
db5d8f4362 | ||
|
|
d4d51af0e2 | ||
|
|
2d6178c7e8 | ||
|
|
4c00e289ed | ||
|
|
8df081c2ec | ||
|
|
5ac86b8c98 | ||
|
|
b76ce678df | ||
|
|
d2335b1e15 | ||
|
|
e1dbf1bd66 | ||
|
|
3ff14a94c6 | ||
|
|
40fee5ffcc | ||
|
|
eee9c549ab | ||
|
|
4da12bfd5d | ||
|
|
2fca2c4d4f | ||
|
|
a095f91d37 | ||
|
|
47a9076474 | ||
|
|
124e97f0a7 | ||
|
|
78d6037272 | ||
|
|
10c385e60f | ||
|
|
13ab7ec214 | ||
|
|
acce767c88 | ||
|
|
1034966ab4 | ||
|
|
667062031e | ||
|
|
ce3665f2d8 | ||
|
|
180ca53ac5 | ||
|
|
6a5937bd8c | ||
|
|
db9020fde2 | ||
|
|
b880c99be3 | ||
|
|
7c9ffab987 | ||
|
|
e3c96176d0 | ||
|
|
6057f8d57e | ||
|
|
f483e75e08 | ||
|
|
5161ebf368 | ||
|
|
5f82f0649f | ||
|
|
41994fe7fb | ||
|
|
ef4303810f | ||
|
|
34f9a196ea | ||
|
|
b7c7c0866f | ||
|
|
433b474ead | ||
|
|
0f0cf183f9 | ||
|
|
6b32ae67e3 | ||
|
|
6c4be388a2 | ||
|
|
e10fef4b3d | ||
|
|
494b06b3d0 | ||
|
|
ac1e51a736 | ||
|
|
0e6270ac88 | ||
|
|
5dbe5821dc | ||
|
|
61688bc2ac | ||
|
|
5de442010b | ||
|
|
df0c1328c5 | ||
|
|
bbc58c4e0c | ||
|
|
75668d1f1b | ||
|
|
a53c13073e | ||
|
|
4f65b9135c | ||
|
|
8b372a3d3e | ||
|
|
b8683300b4 | ||
|
|
70a4995bf8 | ||
|
|
36b11b91bb | ||
|
|
080a7721d0 | ||
|
|
841a8ac149 | ||
|
|
e0723f10d9 | ||
|
|
fff664e35f | ||
|
|
0f49f36dcd | ||
|
|
cb0388fef9 | ||
|
|
cf49796b0b | ||
|
|
904e5912b0 | ||
|
|
7edfbc3a1e | ||
|
|
db0b9b6b69 | ||
|
|
b37b48922d | ||
|
|
fd951a2acc | ||
|
|
eb542299fe | ||
|
|
0c2614e6c4 | ||
|
|
b74a53c4c5 | ||
|
|
a6fa96f61e | ||
|
|
ad4a6f9cbe | ||
|
|
14476a19aa | ||
|
|
0128ce7efe | ||
|
|
9d98c00dd6 | ||
|
|
37266b88e8 | ||
|
|
e95aef43dc | ||
|
|
0fb7535cee | ||
|
|
86492ed76f | ||
|
|
86cfff1ec7 | ||
|
|
445afd1320 | ||
|
|
3846de3d9d | ||
|
|
6616b9347e | ||
|
|
d5b9c8dee7 | ||
|
|
5862e4d69b | ||
|
|
f61c702f7b | ||
|
|
0cabb00499 | ||
|
|
93513b6a74 | ||
|
|
a06df5c6c5 | ||
|
|
1daa949534 | ||
|
|
0fd3e29ec9 | ||
|
|
a8a73ee9cc | ||
|
|
e17dcb4a6f | ||
|
|
9b1ec67e69 | ||
|
|
c21139af1f | ||
|
|
4b44230d20 | ||
|
|
b3db378790 | ||
|
|
6a8d0cbea8 | ||
|
|
b079e7978d | ||
|
|
66218b8996 | ||
|
|
7039262404 | ||
|
|
9be05949fc | ||
|
|
7ba2b2591f | ||
|
|
3bcb910be8 | ||
|
|
6f953a3e03 | ||
|
|
d02396334e | ||
|
|
adeb19c2b2 | ||
|
|
1d21f493c3 | ||
|
|
c94b34c563 | ||
|
|
95e0274384 | ||
|
|
7323c9ee2d | ||
|
|
a3efe63b59 | ||
|
|
e09dcd1d9d | ||
|
|
ba3f6f87f5 | ||
|
|
30578016b0 | ||
|
|
9cfdd02b91 | ||
|
|
d28681d44c | ||
|
|
e5cda31e78 | ||
|
|
6a8cb28c6a | ||
|
|
2a12814fa1 | ||
|
|
d1a2f714de | ||
|
|
7957f2ff11 | ||
|
|
2ce33ff530 | ||
|
|
7bb83a8dd5 | ||
|
|
adcb93abfd | ||
|
|
e8376c69c3 | ||
|
|
cc00aca737 | ||
|
|
4712ae95b0 | ||
|
|
91861ccf02 | ||
|
|
8086d0571f | ||
|
|
7c8b50aab0 | ||
|
|
581997444e | ||
|
|
d768b613a3 | ||
|
|
67d19eb324 | ||
|
|
cbcc021209 | ||
|
|
7251f468e5 | ||
|
|
c28872572a | ||
|
|
5d52386670 | ||
|
|
6386b97262 | ||
|
|
a6638ef05c | ||
|
|
9acf663f33 | ||
|
|
9c24904021 | ||
|
|
94f8fafc6b | ||
|
|
c595dd7224 | ||
|
|
27ec83d858 | ||
|
|
68253334b5 | ||
|
|
ccb0e1ac83 | ||
|
|
3a4a2fd7e1 | ||
|
|
de6a09ca7d | ||
|
|
68ab42c22e | ||
|
|
5cf2357976 | ||
|
|
f88cca3e29 | ||
|
|
5fcd5937e6 | ||
|
|
08cdae43b7 | ||
|
|
62b21bd380 | ||
|
|
848726bd23 | ||
|
|
1d05a71b39 | ||
|
|
a50b78590f | ||
|
|
246e713c6e | ||
|
|
3eb349c31e | ||
|
|
32d1d03d11 | ||
|
|
1923be429a | ||
|
|
7921e87c49 | ||
|
|
9770eb9976 | ||
|
|
3d3dcf9e1d | ||
|
|
f0c1e952ac | ||
|
|
c0977e0cb3 | ||
|
|
4ab2d359ec | ||
|
|
fdec580314 | ||
|
|
eeed27ffcf | ||
|
|
0ef55b1f34 | ||
|
|
d9236f9ffa | ||
|
|
0a6f446e2d | ||
|
|
3ad7a987a2 | ||
|
|
25ba650161 | ||
|
|
d32c579896 | ||
|
|
e1f6caabdc | ||
|
|
11ccef2287 | ||
|
|
4f9fbb8806 | ||
|
|
5a6ea08db8 | ||
|
|
c07ca0f56f | ||
|
|
575aedf453 | ||
|
|
38c43ee93f | ||
|
|
22878b4e27 | ||
|
|
ee12892ae0 | ||
|
|
333f02120f | ||
|
|
cf6f3093ff | ||
|
|
7b71cd925d | ||
|
|
13bed67f4a | ||
|
|
a5c465c636 | ||
|
|
582ee42e4d | ||
|
|
e9d97ee9fa | ||
|
|
ba34c0d12a | ||
|
|
ccb05122ec | ||
|
|
84b0a557a7 | ||
|
|
1386b5f8e0 | ||
|
|
c32d4f9888 | ||
|
|
99842902cc | ||
|
|
3d807ebe55 | ||
|
|
087075a9fd | ||
|
|
96cac8180e | ||
|
|
53b9f5590b | ||
|
|
e9775843e6 | ||
|
|
806633fc33 | ||
|
|
76f3140f05 | ||
|
|
5abd6faa7a | ||
|
|
696e2c2193 | ||
|
|
248ff4f3c1 | ||
|
|
98a9c25ada | ||
|
|
5f67d3c109 | ||
|
|
d44ae0dce8 | ||
|
|
3ca45b5192 | ||
|
|
c344d54190 | ||
|
|
ec9d9ab28c | ||
|
|
eb21eff4cf | ||
|
|
2c67c9ee7d | ||
|
|
13c83bf297 | ||
|
|
67407a5693 | ||
|
|
3dcf5abb9b | ||
|
|
41d85a15a9 | ||
|
|
14f33029c3 | ||
|
|
8902833ee3 | ||
|
|
6eb67d0467 | ||
|
|
af8147a22b | ||
|
|
1451553617 | ||
|
|
372288cfa4 | ||
|
|
249444899f | ||
|
|
a8cd6201ce | ||
|
|
33f9124cc9 | ||
|
|
7b3020bf35 | ||
|
|
aeee8f74e5 | ||
|
|
082444f2a7 | ||
|
|
31c371f828 | ||
|
|
fc8bab640b | ||
|
|
2862b0235c | ||
|
|
bcbb01fcf2 | ||
|
|
16fa806db5 | ||
|
|
5c592b2b30 | ||
|
|
a1ca14caf8 | ||
|
|
7a2367f4a5 | ||
|
|
6017ab1dab | ||
|
|
2f9db0fe54 | ||
|
|
4dbf3817a6 | ||
|
|
34e3a39688 | ||
|
|
a23a855655 | ||
|
|
059f2e6df9 | ||
|
|
984d00b725 | ||
|
|
6d8027cb39 | ||
|
|
d68aa05a0b | ||
|
|
6abc544d01 | ||
|
|
ad53734aff | ||
|
|
453c79fa4e | ||
|
|
947ac1cac5 | ||
|
|
963db909d8 | ||
|
|
f54e5cb076 | ||
|
|
13c4526f2a | ||
|
|
0433d0242f | ||
|
|
5d41354145 | ||
|
|
95fcaeb454 | ||
|
|
db08cff1a1 | ||
|
|
6e426630f4 | ||
|
|
92e5207e3a | ||
|
|
c0d1f97c89 | ||
|
|
7f8dd7841e | ||
|
|
36fa2e3313 | ||
|
|
17498e8e69 | ||
|
|
58209181bf | ||
|
|
2c3af49f76 | ||
|
|
ebc65133ed | ||
|
|
51e2e53649 | ||
|
|
c03a795a59 | ||
|
|
c5d0dce864 | ||
|
|
3908e54ba1 | ||
|
|
393626f619 | ||
|
|
88d05a75a9 | ||
|
|
777794d488 | ||
|
|
e43b55549b | ||
|
|
67ce45c437 | ||
|
|
f61874e665 | ||
|
|
d760761bba | ||
|
|
01e3bb7810 | ||
|
|
4ea889951b | ||
|
|
e412bda820 | ||
|
|
b1e81af397 | ||
|
|
6fc485143f | ||
|
|
96609ba479 | ||
|
|
78895e05f5 | ||
|
|
6e3b2caed4 | ||
|
|
01e5af9b23 | ||
|
|
ef6a79114d | ||
|
|
527e288732 | ||
|
|
2967fb8afd | ||
|
|
7a1793c3db | ||
|
|
4f797de139 | ||
|
|
1f8a13bd22 | ||
|
|
b9f3042e1f | ||
|
|
35fa5f11f8 | ||
|
|
d0593e8907 | ||
|
|
6a5347dfd2 | ||
|
|
c995b5a8db | ||
|
|
45b03c068a | ||
|
|
4cabb017cb | ||
|
|
00e398948e | ||
|
|
712717e587 | ||
|
|
67c7bf3cc9 | ||
|
|
8bb711a911 | ||
|
|
de69850d03 | ||
|
|
17a1f12463 | ||
|
|
35da5a2ca6 | ||
|
|
42d4c1c4fa | ||
|
|
f5cd3d745e | ||
|
|
b140fbc03d | ||
|
|
58e5721642 | ||
|
|
01fb2aad90 | ||
|
|
472bc08353 | ||
|
|
1bb771992f | ||
|
|
941abeeeff | ||
|
|
fb1630511a | ||
|
|
0af1a464a5 | ||
|
|
5600485f4d | ||
|
|
a67a204cd1 | ||
|
|
3b3f278d1e | ||
|
|
a2903a26ba | ||
|
|
9ee56128e3 | ||
|
|
ec21cf5bef | ||
|
|
df7a82e9c3 | ||
|
|
71cd8e9157 | ||
|
|
686d1aceda | ||
|
|
3dad5ef491 | ||
|
|
e9335b1f6f | ||
|
|
874d99e78f | ||
|
|
cfc03593fa | ||
|
|
af3f311232 | ||
|
|
8b77da7400 | ||
|
|
33d13c4649 | ||
|
|
374eb9158e | ||
|
|
f0a7f8d402 | ||
|
|
8d158944b5 | ||
|
|
b598067245 | ||
|
|
42e345f095 | ||
|
|
541dc831e6 | ||
|
|
75e819f6ae | ||
|
|
e23e7f9c72 | ||
|
|
9cbdfd876b | ||
|
|
e3c64e1ead | ||
|
|
4bc6981ca7 | ||
|
|
127b57416f | ||
|
|
0c0f29f295 | ||
|
|
12e1636981 | ||
|
|
6ef13b00db | ||
|
|
88e7b56c86 | ||
|
|
0a282027a6 | ||
|
|
0f14a90a9b | ||
|
|
beab364ac9 | ||
|
|
499d8aadbe | ||
|
|
ee480d992b | ||
|
|
1a309d74f9 | ||
|
|
e09053bb27 | ||
|
|
053c4adb10 | ||
|
|
bc528c5cac | ||
|
|
df3fc91704 | ||
|
|
d3c68d00d8 | ||
|
|
d4b82958c4 | ||
|
|
215692ae8b | ||
|
|
7cf537827e | ||
|
|
b7eef76204 | ||
|
|
bffcc306f4 | ||
|
|
0bea618803 | ||
|
|
13e98f12fc | ||
|
|
f1f2fe39bb | ||
|
|
a0d57b782d | ||
|
|
9ad8c1d1c1 | ||
|
|
18ef3153db | ||
|
|
65bd321f4a | ||
|
|
5cdcfda4a1 | ||
|
|
e307e5bde5 | ||
|
|
32568cc32b | ||
|
|
e279ca2c88 | ||
|
|
9f164a5a54 | ||
|
|
c2b367f8d5 | ||
|
|
3081976587 | ||
|
|
3260b7ce8e | ||
|
|
e3d373c38f | ||
|
|
ee1afbe910 | ||
|
|
15beef8963 | ||
|
|
2ef05e3d4e | ||
|
|
3320b94d77 | ||
|
|
afd6b86f22 | ||
|
|
057dd6a94a | ||
|
|
ddb756ee96 | ||
|
|
7d257d43f3 | ||
|
|
ad33093ec0 | ||
|
|
dc456d2749 | ||
|
|
4826f0735a | ||
|
|
1f742452a4 |
45
.eslintrc
|
|
@ -1,45 +0,0 @@
|
|||
{
|
||||
"globals": {
|
||||
"launchQueue": "readonly",
|
||||
"FileSystemHandle": "readonly",
|
||||
"FileSystemFileHandle": "readonly",
|
||||
"FileSystemDirectoryHandle": "readonly",
|
||||
"FileSystemWritableFileStream": "readonly",
|
||||
"ClipboardItem": "readonly",
|
||||
"queryLocalFonts": "readonly"
|
||||
},
|
||||
"env": {
|
||||
"es2022": true,
|
||||
"browser": true,
|
||||
"worker": true,
|
||||
"node": true,
|
||||
"serviceworker": true
|
||||
},
|
||||
"extends": ["plugin:svelte/recommended", "standard"],
|
||||
"plugins": ["svelte"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"ignorePatterns": ["*.min.*", "*.build.*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.svelte"],
|
||||
"parser": "svelte-eslint-parser",
|
||||
"rules": {
|
||||
"svelte/indent": ["error", { "indent": 2, "indentScript": true }],
|
||||
"no-self-assign": 0,
|
||||
"a11y-media-has-caption": 0,
|
||||
"no-use-before-define": 0,
|
||||
"svelte/html-self-closing": ["error", "always"],
|
||||
"svelte/html-closing-bracket-spacing": ["error", { "startTag": "never", "endTag": "never", "selfClosingTag": "always" }],
|
||||
"svelte/html-quotes": [
|
||||
"error",
|
||||
{
|
||||
"prefer": "single",
|
||||
"dynamic": { "quoted": false, "avoidInvalidUnquotedInHTML": false }
|
||||
}
|
||||
],
|
||||
"svelte/shorthand-attribute": ["warn", { "prefer": "always" }],
|
||||
"svelte/spaced-html-comment": ["error", "always"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
7
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -12,17 +12,17 @@ body:
|
|||
options:
|
||||
- label: >-
|
||||
I have searched the [issue
|
||||
tracker](https://github.com/ThaUnknown/miru/issues) for a bug report
|
||||
tracker](https://github.com/hayase-app/ui/issues) for a bug report
|
||||
that matches the one I want to file, without success.
|
||||
required: true
|
||||
- label: >-
|
||||
I have searched the [frequently asked
|
||||
questions](https://github.com/ThaUnknown/miru/blob/master/docs/faq.md)
|
||||
questions](https://hayase.watch/faq) for a solution to my problem,
|
||||
for a solution that fixes this problem, without success.
|
||||
required: true
|
||||
- label: >-
|
||||
I have checked that I'm using the [latest
|
||||
stable](https://github.com/ThaUnknown/miru/releases/latest) version
|
||||
stable](https://github.com/hayase-app/ui/releases/latest) version
|
||||
of the app.
|
||||
required: true
|
||||
- type: input
|
||||
|
|
@ -43,6 +43,7 @@ body:
|
|||
- Windows
|
||||
- Linux
|
||||
- MacOS
|
||||
- Android
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
|
|
|||
6
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -12,17 +12,17 @@ body:
|
|||
options:
|
||||
- label: >-
|
||||
I have searched the [issue
|
||||
tracker](https://github.com/ThaUnknown/miru/issues) for a bug report
|
||||
tracker](https://github.com/hayase-app/ui/issues) for a bug report
|
||||
that matches the one I want to file, without success.
|
||||
required: true
|
||||
- label: >-
|
||||
I have searched the [features
|
||||
list](https://github.com/ThaUnknown/miru#features) for this feature,
|
||||
list](https://hayase.watch/features) for this feature,
|
||||
and I couldn't find it.
|
||||
required: true
|
||||
- label: >-
|
||||
I have checked that I'm using the [latest
|
||||
stable](https://github.com/ThaUnknown/miru/releases/latest) version
|
||||
stable](https://github.com/hayase-app/ui/releases/latest) version
|
||||
of the app.
|
||||
required: true
|
||||
- type: textarea
|
||||
|
|
|
|||
39
.github/workflows/check.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
name: Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22.19
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Sync
|
||||
run: pnpm run sync
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Check GQL
|
||||
run: pnpm run gql:check
|
||||
|
||||
- name: Check Svelte and TypeScript
|
||||
run: pnpm run check
|
||||
41
.github/workflows/main.yml
vendored
|
|
@ -1,41 +0,0 @@
|
|||
name: Build/release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- name: Install Setuptools for Python
|
||||
run: pip3 install setuptools
|
||||
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v2.2.2
|
||||
with:
|
||||
version: 8.6.3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: cd electron && pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build and Publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: cd electron && npm run publish
|
||||
14
.github/workflows/winget.yml
vendored
|
|
@ -1,14 +0,0 @@
|
|||
name: Publish to WinGet
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: WinGet Releaser
|
||||
uses: vedantmgoyal2009/winget-releaser@v2
|
||||
with:
|
||||
identifier: ThaUnknown.Miru
|
||||
installers-regex: '\.exe$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
29
.gitignore
vendored
|
|
@ -1,11 +1,26 @@
|
|||
# OS Specific
|
||||
node_modules
|
||||
|
||||
# Output
|
||||
.output
|
||||
.vercel
|
||||
/.svelte-kit
|
||||
/build
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
build/
|
||||
# Env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test
|
||||
ideas.todo
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
package-lock.json
|
||||
*.mkv
|
||||
*.webm
|
||||
*src/routes/test/**
|
||||
|
|
|
|||
2
.npmrc
|
|
@ -1 +1 @@
|
|||
node-linker=hoisted
|
||||
engine-strict=true
|
||||
|
|
|
|||
13
.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"usernamehw.errorlens",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"GraphQL.vscode-graphql-syntax",
|
||||
"bierner.comment-tagged-templates",
|
||||
"YoavBls.pretty-ts-errors",
|
||||
"svelte.svelte-vscode", // 109.5.2 or older NOT NEWER
|
||||
"ardenivanov.svelte-intellisense",
|
||||
"Gruntfuggly.todo-tree",
|
||||
"bradlc.vscode-tailwindcss"
|
||||
]
|
||||
}
|
||||
39
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Chromium",
|
||||
"port": 8412,
|
||||
"request": "launch",
|
||||
"type": "chrome",
|
||||
"url": "http://localhost:7344/",
|
||||
"webRoot": "${workspaceFolder}/src",
|
||||
"timeout": 60000,
|
||||
"presentation": {
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug Renderer Process",
|
||||
"port": 9222,
|
||||
"request": "attach",
|
||||
"type": "chrome",
|
||||
"webRoot": "${workspaceFolder}/src",
|
||||
"timeout": 60000,
|
||||
"presentation": {
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"compounds": [
|
||||
{
|
||||
"name": "Attach",
|
||||
"configurations": [
|
||||
"Launch Chromium"
|
||||
],
|
||||
"presentation": {
|
||||
"order": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
43
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "always"
|
||||
},
|
||||
"editor.formatOnSave": true,
|
||||
"editor.linkedEditing": true,
|
||||
"editor.tabSize": 2,
|
||||
"eslint.format.enable": true,
|
||||
"eslint.probe": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"svelte",
|
||||
"html"
|
||||
],
|
||||
"eslint.useESLintClass": true,
|
||||
"eslint.useFlatConfig": true,
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"svelte",
|
||||
"html"
|
||||
],
|
||||
"javascript.preferences.importModuleSpecifierEnding": "minimal",
|
||||
"javascript.preferences.quoteStyle": "single",
|
||||
"javascript.suggest.autoImports": true,
|
||||
"javascript.updateImportsOnFileMove.enabled": "always",
|
||||
"javascript.validate.enable": true,
|
||||
"extensions.ignoreRecommendations": false,
|
||||
"svelte.plugin.svelte.format.config.singleQuote": true,
|
||||
"svelte.plugin.svelte.format.enable": false,
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"typescript.experimental.expandableHover": true,
|
||||
"typescript.preferences.importModuleSpecifierEnding": "minimal",
|
||||
"typescript.preferences.quoteStyle": "single",
|
||||
"typescript.suggest.autoImports": true,
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.validate.enable": true
|
||||
}
|
||||
166
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
# Contributing Guidelines
|
||||
|
||||
*Pull requests, bug reports, and all other forms of contribution are welcomed and highly encouraged!* :octocat:
|
||||
|
||||
### Contents
|
||||
|
||||
* [Opening an Issue](#inbox_tray-opening-an-issue)
|
||||
* [Feature Requests](#love_letter-feature-requests)
|
||||
* [Triaging Issues](#mag-triaging-issues)
|
||||
* [Submitting Pull Requests](#repeat-submitting-pull-requests)
|
||||
* [Writing Commit Messages](#memo-writing-commit-messages)
|
||||
* [Code Review](#white_check_mark-code-review)
|
||||
* [Coding Style](#nail_care-coding-style)
|
||||
* [Certificate of Origin](#medal_sports-certificate-of-origin)
|
||||
* [Credits](#pray-credits)
|
||||
|
||||
> **This guide serves to set clear expectations for everyone involved with the project so that we can improve it together while also creating a welcoming space for everyone to participate. Following these guidelines will help ensure a positive experience for contributors and maintainers.**
|
||||
|
||||
## :inbox\_tray: Opening an Issue
|
||||
|
||||
Before [creating an issue](https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue), check if you are using the latest version of the project. If you are not up-to-date, see if updating fixes your issue first.
|
||||
|
||||
### :lock: Reporting Security Issues
|
||||
|
||||
Review our [Security Policy](./SECURITY.md). **Do not** file a public issue for security vulnerabilities.
|
||||
|
||||
### :beetle: Bug Reports and Other Issues
|
||||
|
||||
A great way to contribute to the project is to send a detailed issue when you encounter a problem. We always appreciate a well-written, thorough bug report. :v:
|
||||
|
||||
In short, since you are most likely a developer, **provide a ticket that you would like to receive**.
|
||||
|
||||
* **Review the documentation and [Support Guide](./SUPPORT.md)** before opening a new issue.
|
||||
|
||||
* **Do not open a duplicate issue!** Search through existing issues to see if your issue has previously been reported. If your issue exists, comment with any additional information you have. You may simply note "I have this problem too", which helps prioritize the most common problems and requests.
|
||||
|
||||
* **Prefer using [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)**, not comments, if you simply want to "+1" an existing issue.
|
||||
|
||||
* **Fully complete the provided issue template.** The bug report template requests all the information we need to quickly and efficiently address your issue. Be clear, concise, and descriptive. Provide as much information as you can, including steps to reproduce, stack traces, compiler errors, library versions, OS versions, and screenshots (if applicable).
|
||||
|
||||
* **Use [GitHub-flavored Markdown](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax).** Especially put code blocks and console outputs in backticks (\`\`\`). This improves readability.
|
||||
|
||||
## :love\_letter: Feature Requests
|
||||
|
||||
Feature requests are welcome! While we will consider all requests, we cannot guarantee your request will be accepted. We want to avoid [feature creep](https://en.wikipedia.org/wiki/Feature_creep). Your idea may be great, but also out-of-scope for the project. If accepted, we cannot make any commitments regarding the timeline for implementation and release. However, you are welcome to submit a pull request to help!
|
||||
|
||||
* **Do not open a duplicate feature request.** Search for existing feature requests first. If you find your feature (or one very similar) previously requested, comment on that issue.
|
||||
|
||||
* **Fully complete the provided issue template.** The feature request template asks for all necessary information for us to begin a productive conversation.
|
||||
|
||||
* Be precise about the proposed outcome of the feature and how it relates to existing features. Include implementation details if possible.
|
||||
|
||||
## :mag: Triaging Issues
|
||||
|
||||
You can triage issues which may include reproducing bug reports or asking for additional information, such as version numbers or reproduction instructions. Any help you can provide to quickly resolve an issue is very much appreciated!
|
||||
|
||||
## :repeat: Submitting Pull Requests
|
||||
|
||||
We **love** pull requests! Before [forking the repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) for non-trivial changes, it is usually best to first open an issue to discuss the changes, or discuss your intended approach for solving the problem in the comments for an existing issue.
|
||||
|
||||
For most contributions, after your first pull request is accepted and merged, you will be [invited to the project](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository) and given **push access**. :tada:
|
||||
|
||||
*Note: All contributions will be licensed under the project's license.*
|
||||
|
||||
* **Smaller is better.** Submit **one** pull request per bug fix or feature. A pull request should contain isolated changes pertaining to a single bug fix or feature implementation. **Do not** refactor or reformat code that is unrelated to your change. It is better to **submit many small pull requests** rather than a single large one. Enormous pull requests will take enormous amounts of time to review, or may be rejected altogether.
|
||||
|
||||
* **Coordinate bigger changes.** For large and non-trivial changes, open an issue to discuss a strategy with the maintainers. Otherwise, you risk doing a lot of work for nothing!
|
||||
|
||||
* **Prioritize understanding over cleverness.** Write code clearly and concisely. Remember that source code usually gets written once and read often. Ensure the code is clear to the reader. The purpose and logic should be obvious to a reasonably skilled developer, otherwise you should add a comment that explains it.
|
||||
|
||||
* **Follow existing coding style and conventions.** Keep your code consistent with the style, formatting, and conventions in the rest of the code base. When possible, these will be enforced with a linter. Consistency makes it easier to review and modify in the future.
|
||||
|
||||
* **Include test coverage.** Add unit tests or UI tests when possible. Follow existing patterns for implementing tests.
|
||||
|
||||
* **Update the example project** if one exists to exercise any new functionality you have added.
|
||||
|
||||
* **Add documentation.** Document your changes with code doc comments or in existing guides.
|
||||
|
||||
* **Use the repo's default branch.** Branch from and [submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) to the repo's default branch. Usually this is `main`, but it could be `dev`, `develop`, or `master`.
|
||||
|
||||
* **[Resolve any merge conflicts](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github)** that occur.
|
||||
|
||||
* **Promptly address any CI failures**. If your pull request fails to build or pass tests, please push another commit to fix it.
|
||||
|
||||
* When writing comments, use properly constructed sentences, including punctuation.
|
||||
|
||||
* Use spaces, not tabs.
|
||||
|
||||
## :memo: Writing Commit Messages
|
||||
|
||||
Please [write a great commit message](https://chris.beams.io/posts/git-commit/).
|
||||
|
||||
1. Separate subject from body with a blank line
|
||||
2. Limit the subject line to 50 characters
|
||||
3. Capitalize the subject line
|
||||
4. Do not end the subject line with a period
|
||||
5. Use the imperative mood in the subject line (example: "Fix networking issue")
|
||||
6. Wrap the body at about 72 characters
|
||||
7. Use the body to explain **why**, *not what and how* (the code shows that!)
|
||||
8. If applicable, prefix the title with the relevant component name in a semantic way. (examples: "fix: typo", "feat: add avatar")
|
||||
|
||||
```
|
||||
docs: Short summary of changes in 50 chars or less
|
||||
|
||||
Add a more detailed explanation here, if necessary. Possibly give
|
||||
some background about the issue being fixed, etc. The body of the
|
||||
commit message can be several paragraphs. Further paragraphs come
|
||||
after blank lines and please do proper word-wrap.
|
||||
|
||||
Wrap it to about 72 characters or so. In some contexts,
|
||||
the first line is treated as the subject of the commit and the
|
||||
rest of the text as the body. The blank line separating the summary
|
||||
from the body is critical (unless you omit the body entirely);
|
||||
various tools like `log`, `shortlog` and `rebase` can get confused
|
||||
if you run the two together.
|
||||
|
||||
Explain the problem that this commit is solving. Focus on why you
|
||||
are making this change as opposed to how or what. The code explains
|
||||
how or what. Reviewers and your future self can read the patch,
|
||||
but might not understand why a particular solution was implemented.
|
||||
Are there side effects or other unintuitive consequences of this
|
||||
change? Here's the place to explain them.
|
||||
|
||||
- Bullet points are okay, too
|
||||
|
||||
- A hyphen or asterisk should be used for the bullet, preceded
|
||||
by a single space, with blank lines in between
|
||||
|
||||
Note the fixed or relevant GitHub issues at the end:
|
||||
|
||||
Resolves: #123
|
||||
See also: #456, #789
|
||||
```
|
||||
|
||||
## :white\_check\_mark: Code Review
|
||||
|
||||
* **Review the code, not the author.** Look for and suggest improvements without disparaging or insulting the author. Provide actionable feedback and explain your reasoning.
|
||||
|
||||
* **You are not your code.** When your code is critiqued, questioned, or constructively criticized, remember that you are not your code. Do not take code review personally.
|
||||
|
||||
* **Always do your best.** No one writes bugs on purpose. Do your best, and learn from your mistakes.
|
||||
|
||||
* Kindly note any violations to the guidelines specified in this document.
|
||||
|
||||
## :nail\_care: Coding Style
|
||||
|
||||
Consistency is the most important. Following the existing style, formatting, and naming conventions of the file you are modifying and of the overall project. Failure to do so will result in a prolonged review process that has to focus on updating the superficial aspects of your code, rather than improving its functionality and performance.
|
||||
|
||||
For example, if all private properties are prefixed with an underscore `_`, then new ones you add should be prefixed in the same way. Or, if methods are named using camelcase, like `thisIsMyNewMethod`, then do not diverge from that by writing `this_is_my_new_method`. You get the idea. If in doubt, please ask or search the codebase for something similar.
|
||||
|
||||
When possible, style and format will be enforced with a linter.
|
||||
|
||||
## :medal\_sports: Certificate of Origin
|
||||
|
||||
*Developer's Certificate of Origin 1.1*
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
> 1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
|
||||
> 2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
|
||||
> 3. The contribution was provided directly to me by some other person who certified (1), (2) or (3) and I have not modified it.
|
||||
> 4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the source license(s) involved.
|
||||
|
||||
## [No Brown M\&M's](https://en.wikipedia.org/wiki/Van_Halen#Contract_riders)
|
||||
|
||||
If you are reading this, bravo dear user and (hopefully) contributor for making it this far! You are awesome. :100:
|
||||
699
LICENSE
|
|
@ -1,674 +1,47 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
Business Source License 1.1
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Terms
|
||||
|
||||
Preamble
|
||||
The Licensor hereby grants you the right to copy, modify, create derivative
|
||||
works, redistribute, and make non-production use of the Licensed Work. The
|
||||
Licensor may make an Additional Use Grant, above, permitting limited
|
||||
production use.
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
Effective on the Change Date, or the fourth anniversary of the first publicly
|
||||
available distribution of a specific version of the Licensed Work under this
|
||||
License, whichever comes first, the Licensor hereby grants you rights under
|
||||
the terms of the Change License, and the rights granted in the paragraph
|
||||
above terminate.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
If your use of the Licensed Work does not comply with the requirements
|
||||
currently in effect as described in this License, you must purchase a
|
||||
commercial license from the Licensor, its affiliated entities, or authorized
|
||||
resellers, or you must refrain from using the Licensed Work.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
All copies of the original and modified Licensed Work, and derivative works
|
||||
of the Licensed Work, are subject to this License. This License applies
|
||||
separately for each version of the Licensed Work and the Change Date may vary
|
||||
for each version of the Licensed Work released by Licensor.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
You must conspicuously display this License on each original or modified copy
|
||||
of the Licensed Work. If you receive the Licensed Work in original or
|
||||
modified form from a third party, the terms and conditions set forth in this
|
||||
License apply to your use of that work.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
Any use of the Licensed Work in violation of this License will automatically
|
||||
terminate your rights under this License for the current and all other
|
||||
versions of the Licensed Work.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
This License does not grant you any right in any trademark or logo of
|
||||
Licensor or its affiliates (provided that you may use a trademark or logo of
|
||||
Licensor as expressly required by this License).
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
||||
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
||||
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
||||
TITLE.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
Change Date: 2029-04-01
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license GPL-3.0.
|
||||
|
|
|
|||
235
README.md
|
|
@ -1,133 +1,158 @@
|
|||
<h1 align="center">
|
||||
<a href="https://github.com/ThaUnknown/miru">
|
||||
<img src="./docs/logo.png" width="200">
|
||||
<p align="center">
|
||||
<a href="https://github.com/hayase-app/ui">
|
||||
<img src="./static/logo_white.svg" width="300">
|
||||
</a>
|
||||
</h1>
|
||||
</p>
|
||||
<h1 align="center"><b>Hayase</b></h1>
|
||||
|
||||
<h4 align="center"><b>Stream anime torrents, real-time with no waiting for downloads</b></h4>
|
||||
<h4 align="center"><b>Stream anime torrents instantly, real-time with no waiting for downloads to finish! 🍿</b></h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="#about">About</a> •
|
||||
<a href="#features">Features</a> •
|
||||
<a href="./docs/faq.md">Frequently Asked Questions</a> •
|
||||
<a href="#building-and-development">Building and Development</a> •
|
||||
<a href="https://github.com/ThaUnknown/miru/releases/latest">Download</a>
|
||||
<a href="https://hayase.watch/#about">About</a> •
|
||||
<a href="https://hayase.watch/features/">Features</a> •
|
||||
<a href="https://hayase.watch/faq/">Frequently Asked Questions</a> •
|
||||
<a href="https://hayase.watch/download/">Download</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="./docs/show.gif" alt="chat"><br>
|
||||
<a href="https://discord.gg/Z87Nh7c4Ac">
|
||||
<img src="https://img.shields.io/discord/953341991134064651?style=flat-square" alt="chat">
|
||||
</a>
|
||||
<a href="https://github.com/ThaUnknown/miru/releases/latest">
|
||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/ThaUnknown/miru/total?style=flat-square">
|
||||
<a href="https://hayase.watch/download/">
|
||||
<img alt="Download" src="https://img.shields.io/github/downloads/hayase-app/ui/total?style=flat-square">
|
||||
</a>
|
||||
|
||||
</p>
|
||||
|
||||
## **About**
|
||||
A pure JS BitTorrent streaming environment, with a built-in list manager. Imagine qBit + Taiga + MPV, all in a single package, but streamed real-time. Completly ad free with no tracking/data collection.
|
||||
https://github.com/user-attachments/assets/bbbe2966-b773-4ebb-9d69-08248ae77ae4
|
||||
|
||||
This app is meant to feel look, work and perform like a streaming website/app, while providing all the advantages of torrenting, like file downloads, higher download speeds, better video quality and quicker releases.
|
||||
<p align="center">Formerly known as Miru.</p>
|
||||
|
||||
Unlike qBit's sequential, seeking into undownloaded data will prioritise downloading that data, instead of flat out closing MPV.
|
||||
## **Features**
|
||||
### **Anime:**
|
||||
- full AniList integration
|
||||
- filter anime by name, genre, season, year, format, status
|
||||
- view anime on your planning and watching list
|
||||
- add and remove anime from your planning list
|
||||
- automatically mark episodes as complete as you watch them
|
||||
- view trailers/previews for anime
|
||||
- score anime
|
||||
- view anime relations
|
||||
- automatically find torrents for desired episodes
|
||||
- automatically detect what anime a torrent is
|
||||
- view latest releases on any custom RSS
|
||||
- airing schedule
|
||||
- find anime by image [just paste an image into the app]
|
||||
### **Video:**
|
||||
- full subtitle support
|
||||
- support for softcoded subtitles
|
||||
- support for external subtitle files
|
||||
- support for VTT, SSA, ASS, SUB, TXT subtitles
|
||||
- subtitle display in PiP
|
||||
- keybinds for all functions:
|
||||
- **,** - seek 1 frame backwards
|
||||
- **.** - seek 1 frame forwards
|
||||
- **S** - seek forwards 90 seconds [skip opening]
|
||||
- **R** - seek backwards 90 seconds
|
||||
- **→** - seek forwards 2 seconds
|
||||
- **←** - seek backwards 2 seconds
|
||||
- **↑** - increase volume
|
||||
- **↓** - decrease volume
|
||||
- **M** - mute volume
|
||||
- **C** - cycle through subtitle tracks
|
||||
- **N** - play next episode [if available]
|
||||
- **F** - toggle fullscreen
|
||||
- **P** - toggle picture in picture
|
||||
- **[** - increase playback speed
|
||||
- **]** - decrease playback speed
|
||||
- **\\** - reset playback speed to 1
|
||||
- **I** - view video stats for nerds
|
||||
- **`** - open keybinds UI
|
||||
- editable keybinds **`** allows drag dropping any key
|
||||
- miniplayer
|
||||
- media session display
|
||||
- media keys support
|
||||
- Discord rich pressence
|
||||
- preview thumbnails
|
||||
- pause on lost focus
|
||||
- autoplay next episode
|
||||
- multi-audio support
|
||||
- torrent download progress on the seek bar
|
||||
### **Torrent:**
|
||||
- select downloads folder
|
||||
- specify download/upload speeds
|
||||
- support for most popular BEP's
|
||||
- support for custom torrent RSS feeds for latest releases
|
||||
- change what resolution to find torrents in
|
||||
- stream real-time with no waiting for downloads
|
||||
## ✨ About
|
||||
|
||||
## **Linux Installation**
|
||||
**Hayase** is a modern app for streaming anime torrents in real-time, with no waiting for downloads to finish.
|
||||
|
||||
### Arch
|
||||
It is meant to feel look, work and perform like a premium streaming service, but with all the benefits of both streaming and torrenting, like file downloads, higher download speeds, better video quality, instant access to new releases, and features you won’t find on typical streaming sites.
|
||||
|
||||
If you use paru:
|
||||
```bash
|
||||
paru -S miru-bin
|
||||
```
|
||||
## 🌟 Highlights
|
||||
|
||||
If you use yay:
|
||||
* 📚 **Anime list integration:** Sync with AniList, Kitsu, ~~MAL~~, or use local storage.
|
||||
* ⚡ **Instant torrent streaming:** Watch as you download, with extension support for custom sources.
|
||||
* 📴 **Offline viewing:** Enjoy already-downloaded torrents anytime.
|
||||
* 🎬 **Advanced video player:** Full support for all subtitle formats, softcoded and external tracks, and more.
|
||||
* 👥 **Social features:** Connect with friends, join discussions, and watch together.
|
||||
|
||||
```bash
|
||||
yay -S miru-bin
|
||||
```
|
||||
***
|
||||
|
||||
### Debian/Ubuntu
|
||||
## 🏆 Features
|
||||
|
||||
- Download the `linux-Miru-version.deb` from the [releases](https://github.com/ThaUnknown/miru/releases/latest) page.
|
||||
- Install the deb file with package manager.
|
||||
```bash
|
||||
apt install linux-Miru-*.deb
|
||||
```
|
||||
### 🎞️ Anime Management
|
||||
|
||||
* Effortlessly manage your anime list with support for AniList, Kitsu, ~~MAL~~, and local storage.
|
||||
* Automatically track watched episodes.
|
||||
* See what you’re behind on, and discover sequels you’ve missed.
|
||||
* Keep up to date and browse upcoming episodes with airing calendars.
|
||||
* Edit entries (score, progress, status, favorite, etc.) even while offline.
|
||||
* Search by image, name, genre, year, season, and more.
|
||||
* View trailers, OP/ED themes, and detailed episode lists with thumbnails, descriptions and filler indicators.
|
||||
|
||||
<p align="center">
|
||||
<img src='https://raw.githubusercontent.com/hayase-app/website/main/static/viewanime.webp' width='400px'></img>
|
||||
</p>
|
||||
|
||||
### 🤝 Social & Community
|
||||
|
||||
* Instantly see which friends are following an anime or episode.
|
||||
* See friends profiles and watch progress in the episodes list.
|
||||
* Track your friends’ watch progress in real time.
|
||||
* Join episode discussions and forums, even offline.
|
||||
* Global app chat.
|
||||
* Discord rich pressence.
|
||||
* Host or join Watch Together lobbies with synced playback and chat.
|
||||
|
||||
### 🎥 Video Experience
|
||||
|
||||
* Full subtitle support.
|
||||
* Softcoded, external and manually added subtitles.
|
||||
* VTT, SSA, ASS, SUB, TXT formats.
|
||||
* Subtitle display in PiP.
|
||||
* Override default dialog styles.
|
||||
* Override default fonts for Asian languages \[fix for bad torrents].
|
||||
* Picture In Picture.
|
||||
* PiP on lost visiblity.
|
||||
* Pause on lost visibility.
|
||||
* Specify preferred language for video and subtitle tracks.
|
||||
* Remove video compression artifacts.
|
||||
* Miniplayer.
|
||||
* Media Session display.
|
||||
* Media Keys support.
|
||||
* Discord rich pressence.
|
||||
* Seek and preview thumbnails.
|
||||
* Autoplay next episode.
|
||||
* Skip intro/outro, manually or automatically.
|
||||
* Skip filler episodes automatically.
|
||||
* Change playback rate.
|
||||
* Browse playlist.
|
||||
* Multi-track support for video, audio and subtitles.
|
||||
* Editable keybinds for all player functions.
|
||||
* Exponential volume \[better control at lower volumes].
|
||||
* External player support.
|
||||
|
||||
<p align="center">
|
||||
<img src='https://raw.githubusercontent.com/hayase-app/website/main/static/videoplayer.webp' width='400px'></img>
|
||||
</p>
|
||||
|
||||
### 🧲 Torrents
|
||||
|
||||
* Stream torrents instantly, no waiting for full downloads.
|
||||
* Download only what you need for playback.
|
||||
* Choose your downloads folder and set speed/connection limits.
|
||||
* Support for custom extensions, sources, and trackers.
|
||||
* Specify download/upload speeds, ports and connections.
|
||||
* Support for most popular BEP's.
|
||||
* Persist torrents, cache progress, and rescan instantly.
|
||||
* View detailed torrent and peer info.
|
||||
* Batch downloads.
|
||||
|
||||
<p align="center">
|
||||
<img src='https://raw.githubusercontent.com/hayase-app/website/main/static/modal.webp' width='400px'></img>
|
||||
</p>
|
||||
|
||||
### ⚙️ Performance & Security
|
||||
|
||||
* Highly secure.
|
||||
* Operates on a Zero Trust model.
|
||||
* Protects data integrity and settings from external attacks.
|
||||
* Protects from attacks via malicious torrent extensions.
|
||||
* Uses up to date best security practices for native apps.
|
||||
* Insanely performant.
|
||||
* Fully hardware/GPU accelerated.
|
||||
* GPU based shaders, animations and paints.
|
||||
* Very low resource utilisation.
|
||||
* Only loads code as required by user navigation.
|
||||
* Unloads code not in use.
|
||||
* Doesn't render unnecessary UI updates.
|
||||
* Disables rendering when not visible.
|
||||
* Doesn't render any UI when immersed in fullscreen video.
|
||||
* Minimise to tray.
|
||||
* In-app changelog.
|
||||
* Custom themes.
|
||||
|
||||
<p align="center">
|
||||
<img src='https://raw.githubusercontent.com/hayase-app/website/main/static/simple.webp' width='400px'></img>
|
||||
</p>
|
||||
|
||||
## **Building and Development**
|
||||
|
||||
Dependencies:
|
||||
- Node 16 or above
|
||||
- PNPM
|
||||
Requires `Node 20` or above and `pnpm`. VSCode is recommended.
|
||||
|
||||
To build/develop, in the root folder of the repo you need to first run:
|
||||
```bash
|
||||
pnpm install
|
||||
```js
|
||||
pnpm i // to install
|
||||
pnpm run dev // to develop
|
||||
pnpm run build // to build
|
||||
pnpm run sync && pnpm run lint && pnpm run gql:check && pnpm run check // to test
|
||||
```
|
||||
|
||||
To build for your OS just run:
|
||||
```bash
|
||||
pnpm run build
|
||||
```
|
||||
***
|
||||
|
||||
To run the development server run:
|
||||
```bash
|
||||
pnpm start
|
||||
```
|
||||
<h2 align="center">
|
||||
<b>Enjoy streaming anime the way it should be! 🍿</b>
|
||||
</h2>
|
||||
|
|
|
|||
13
SECURITY.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Security Policy
|
||||
|
||||
If you discover a security issue, please bring it to our attention right away!
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please **DO NOT** file a public issue to report a security vulberability, instead send your report privately to **casistaken@gmail.com**. This will help ensure that any vulnerabilities that are found can be [disclosed responsibly](https://en.wikipedia.org/wiki/Responsible_disclosure) to any affected parties.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Project versions that are currently being supported with security updates vary per project.
|
||||
Please see specific project repositories for details.
|
||||
If nothing is specified, only the latest major versions are supported.
|
||||
31
SUPPORT.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Support and Help
|
||||
|
||||
Need help getting started or using a project? Here's how.
|
||||
|
||||
## How to get help
|
||||
|
||||
Generally, we do not use GitHub as a support forum. For any usage questions that are not specific to the project itself, please ask on [Stack Overflow](https://stackoverflow.com) instead. By doing so, you are more likely to quickly solve your problem, and you will allow anyone else with the same question to find the answer. This also allows maintainers to focus on improving the project for others.
|
||||
|
||||
Please seek support in the following ways:
|
||||
|
||||
1. :book: **Read the documentation and other guides** for the project to see if you can figure it out on your own. These should be located in a root `docs/` directory. If there is an example project, explore that to learn how it works to see if you can answer your question.
|
||||
|
||||
2. :bulb: **Search for answers and ask questions on [Stack Overflow](https://stackoverflow.com).** This is the most appropriate place for debugging issues specific to your use of the project, or figuring out how to use the project in a specific way.
|
||||
|
||||
3. :memo: As a **last resort**, you may open an issue on GitHub to ask for help. However, please clearly explain what you are trying to do, and list what you have already attempted to solve the problem. Provide code samples, but **do not** attach your entire project for someone else to debug. Review our [contributing guidelines](./CONTRIBUTING.md).
|
||||
|
||||
## What NOT to do
|
||||
|
||||
Please **do not** do any the following:
|
||||
|
||||
1. :x: Do not reach out to the author or contributor on Twitter (or other social media) by tweeting or sending a direct message.
|
||||
|
||||
2. :x: Do not email the author or contributor.
|
||||
|
||||
3. :x: Do not open duplicate issues or litter an existing issue with +1's.
|
||||
|
||||
These are not appropriate avenues for seeking help or support with an open-source project. Please follow the guidelines in the previous section. Public questions get public answers, which benefits everyone in the community. ✌️
|
||||
|
||||
## Customer Support
|
||||
|
||||
I do not provide any sort of "customer support" for open-source projects. However, I am available for hire.
|
||||
BIN
assets/Molot-webfont.woff
Normal file
5
assets/logo.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="430" height="430" viewBox="0 0 113.50625 113.50625" fill="currentColor">
|
||||
<path d="M89.693749 72.830671v-19.84375l-18.520833-10.31875-14.552084-8.202083-33.072916 18.520833v19.84375l33.072916-18.520833ZM23.547916 47.695254l23.547916-13.229167L23.547916 21.23692Z" />
|
||||
<path d="m23.547916 77.990044 33.072916 18.52084 33.072917-18.52084-18.520833-10.318746-14.552084 8.202083-14.552083-8.202083S23.547916 78.122337 23.547916 77.990044z" />
|
||||
<path d="m56.620832 59.601503 10.054167 5.55625v.000001l-10.054167 5.55625-10.054166-5.55625v-.000001z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 617 B |
5
assets/logo_cropped.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="250" height="284.50003" viewBox="0 0 66.145833 75.273966" fill="currentColor">
|
||||
<path d="M66.145833 51.593751v-19.84375c-11.042319-6.141466-22.077514-12.295645-33.072917-18.520833C22.048611 19.402779 11.024305 25.57639 0 31.750001v19.84375c11.024305-6.173611 22.048611-12.347222 33.072916-18.520833 11.024306 6.173611 22.048611 12.347222 33.072917 18.520833ZM0 26.458334c7.849305-4.409722 15.698611-8.819445 23.547916-13.229167C15.698611 8.819445 7.849305 4.409722 0 0v26.458334Z"/>
|
||||
<path d="M0 56.753124c11.024305 6.173613 22.048611 12.347227 33.072916 18.52084 11.024306-6.173613 22.048611-12.347227 33.072917-18.52084L47.625 46.434378c-4.850695 2.734028-9.701389 5.468055-14.552084 8.202083-4.850694-2.734028-9.701389-5.468055-14.552083-8.202083C12.352694 49.88272 6.229007 53.417285 0 56.753124Z"/>
|
||||
<path d="M33.072916 38.364583c3.351389 1.852084 6.70278 3.704166 10.054167 5.556251-3.35139 1.852082-6.702778 3.704167-10.054167 5.55625-3.351388-1.852084-6.702779-3.704166-10.054166-5.556251 3.35139-1.852082 6.702777-3.704167 10.054166-5.55625z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/twemoji.woff2
Normal file
21
capacitor/.gitignore
vendored
|
|
@ -1,21 +0,0 @@
|
|||
/node_modules/
|
||||
android/*
|
||||
!android/app
|
||||
android/app/*
|
||||
!android/app/src
|
||||
android/app/src/*
|
||||
!android/app/src/main
|
||||
android/app/src/main/*
|
||||
!android/app/src/main/AndroidManifest.xml
|
||||
!android/app/src/main/java
|
||||
android/app/src/main/java/*
|
||||
!android/app/src/main/java/watch
|
||||
android/app/src/main/java/watch/*
|
||||
!android/app/src/main/java/watch/miru
|
||||
android/app/src/main/java/watch/miru/*
|
||||
!android/app/src/main/java/watch/miru/MainActivity.java
|
||||
ios/
|
||||
|
||||
package-lock.json
|
||||
.env
|
||||
.DS_Store
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||
android:launchMode="singleTask"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- added scheme rest is generated -->
|
||||
<intent-filter>
|
||||
<data android:scheme="miru" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package watch.miru;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.ServiceWorkerClient;
|
||||
import android.webkit.ServiceWorkerController;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebResourceResponse;
|
||||
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
// this isn't generated! required patch to be able to register service workers
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
|
||||
ServiceWorkerController swController = null;
|
||||
swController = ServiceWorkerController.getInstance();
|
||||
|
||||
swController.setServiceWorkerClient(new ServiceWorkerClient() {
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
|
||||
if (request.getUrl().toString().contains("index.html")) {
|
||||
request.getRequestHeaders().put("Accept", "text/html");
|
||||
}
|
||||
return bridge.getLocalServer().shouldInterceptRequest(request);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
const mode = process.env.NODE_ENV?.trim() || 'development'
|
||||
|
||||
const config = {
|
||||
appId: 'watch.miru',
|
||||
appName: 'Miru',
|
||||
webDir: 'build',
|
||||
bundledWebRuntime: false,
|
||||
android: {
|
||||
buildOptions: {
|
||||
keystorePath: './watch.miru',
|
||||
keystorePassword: '',
|
||||
keystoreAlias: 'watch.miru'
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
SplashScreen: { launchShowDuration: 0 },
|
||||
CapacitorHttp: { enabled: false }
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === 'development') {
|
||||
config.server = {
|
||||
url: 'http://localhost:5001/index.html',
|
||||
cleartext: true
|
||||
}
|
||||
}
|
||||
module.exports = config
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"name": "capacitor",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:app": "cross-env NODE_ENV=production run-s build:web build:assets build:android",
|
||||
"build:web": "webpack build",
|
||||
"build:android": "cap build android",
|
||||
"build:ios": "cap build ios",
|
||||
"build:assets": "capacitor-assets generate --iconBackgroundColor #17191c --iconBackgroundColorDark #17191c --splashBackgroundColor #17191c --splashBackgroundColorDark #17191c --android",
|
||||
"dev:adb-port": "adb reverse tcp:5001 tcp:5001",
|
||||
"dev:ios": "run-p dev:start cap-run:ios",
|
||||
"dev:android": "cap run android",
|
||||
"dev:android-port": "run-s dev:android dev:adb-port",
|
||||
"dev:preview": "vite preview",
|
||||
"dev:start": "run-p dev:webpack dev:android-port",
|
||||
"dev:webpack": "webpack serve",
|
||||
"test:e2e": "cross-env NODE_ENV=production run-s build:web dev:android"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/assets": "^3.0.1",
|
||||
"assert": "^2.1.0",
|
||||
"buffer": "^6.0.3",
|
||||
"chrome-dgram": "^3.0.6",
|
||||
"chrome-net": "^3.3.4",
|
||||
"cordova-res": "^0.15.4",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"hybrid-chunk-store": "^1.2.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"path-esm": "^1.0.0",
|
||||
"querystring": "^0.2.1",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"stream-http": "^3.2.0",
|
||||
"timers-browserify": "^2.0.12",
|
||||
"util": "^0.12.5",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^5.5.1",
|
||||
"@capacitor/app": "^5.0.6",
|
||||
"@capacitor/browser": "^5.1.0",
|
||||
"@capacitor/cli": "^5.5.1",
|
||||
"@capacitor/core": "^5.5.1",
|
||||
"@capacitor/ios": "^5.5.1",
|
||||
"@capacitor/status-bar": "^5.0.6",
|
||||
"@superfrogbe/cordova-plugin-chrome-apps-sockets-udp": "github:superfrogbe/cordova-plugin-chrome-apps-sockets-udp",
|
||||
"capacitor-default-gateway": "github:funniray/capacitor-default-gateway",
|
||||
"capacitor-dns": "github:funniray/capacitor-dns",
|
||||
"capacitor-os-interfaces-hack": "github:funniray/capacitor-os-interfaces-hack",
|
||||
"capacitor-plugin-safe-area": "^2.0.5",
|
||||
"common": "workspace:*",
|
||||
"cordova-plugin-chrome-apps-common": "^1.0.7",
|
||||
"cordova-plugin-chrome-apps-sockets-tcp": "github:KoenLav/cordova-plugin-chrome-apps-sockets-tcp",
|
||||
"cordova-plugin-navigationbar": "^1.0.31",
|
||||
"cordova-plugin-screen-orientation": "^3.0.4",
|
||||
"es6-promise-plugin": "^4.2.2",
|
||||
"webpack-merge": "^5.10.0"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
|
@ -1,62 +0,0 @@
|
|||
/* globals navigationbar */
|
||||
import { StatusBar, Style } from '@capacitor/status-bar'
|
||||
import { SafeArea } from 'capacitor-plugin-safe-area'
|
||||
import { App } from '@capacitor/app'
|
||||
import { Browser } from '@capacitor/browser'
|
||||
import { ipcRendererUI, main } from './ipc.js'
|
||||
|
||||
main.on('open', url => Browser.open({ url }))
|
||||
|
||||
App.addListener('appUrlOpen', ({ url }) => handleProtocol(url))
|
||||
|
||||
// schema: miru://key/value
|
||||
const protocolMap = {
|
||||
auth: token => sendToken(token),
|
||||
anime: id => ipcRendererUI.emit('open-anime', id),
|
||||
w2g: link => ipcRendererUI.emit('w2glink', link),
|
||||
schedule: () => ipcRendererUI.emit('schedule'),
|
||||
donate: () => Browser.open({ url: 'https://github.com/sponsors/ThaUnknown/' })
|
||||
}
|
||||
|
||||
const protocolRx = /miru:\/\/([a-z0-9]+)\/(.*)/i
|
||||
|
||||
function handleProtocol (text) {
|
||||
const match = text.match(protocolRx)
|
||||
if (match) protocolMap[match[1]]?.(match[2])
|
||||
}
|
||||
|
||||
function sendToken (line) {
|
||||
let token = line.split('access_token=')[1].split('&token_type')[0]
|
||||
if (token) {
|
||||
if (token.endsWith('/')) token = token.slice(0, -1)
|
||||
ipcRendererUI.emit('altoken', token)
|
||||
}
|
||||
}
|
||||
|
||||
App.getLaunchUrl().then(res => {
|
||||
if (location.hash !== '#skipAlLogin') {
|
||||
location.hash = '#skipAlLogin'
|
||||
if (res) handleProtocol(res.url)
|
||||
} else {
|
||||
location.hash = ''
|
||||
}
|
||||
})
|
||||
|
||||
SafeArea.addListener('safeAreaChanged', updateInsets)
|
||||
screen.orientation.addEventListener('change', updateInsets)
|
||||
|
||||
async function updateInsets () {
|
||||
const { insets } = await SafeArea.getSafeAreaInsets()
|
||||
for (const [key, value] of Object.entries(insets)) {
|
||||
document.documentElement.style.setProperty(`--safe-area-${key}`, `${value}px`)
|
||||
}
|
||||
}
|
||||
updateInsets()
|
||||
|
||||
StatusBar.hide()
|
||||
StatusBar.setStyle({ style: Style.Dark })
|
||||
StatusBar.setOverlaysWebView({ overlay: true })
|
||||
|
||||
navigationbar.setUp(true)
|
||||
|
||||
// cordova screen orientation plugin is also used, and it patches global screen.orientation.lock
|
||||
|
|
@ -1,466 +0,0 @@
|
|||
// @ts-nocheck
|
||||
/*! chrome-dgram. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
/* global chrome */
|
||||
|
||||
/**
|
||||
* UDP / Datagram Sockets
|
||||
* ======================
|
||||
*
|
||||
* Datagram sockets are available through require('chrome-dgram').
|
||||
*/
|
||||
const EventEmitter = require('events')
|
||||
const series = require('run-series')
|
||||
|
||||
const BIND_STATE_UNBOUND = 0
|
||||
const BIND_STATE_BINDING = 1
|
||||
const BIND_STATE_BOUND = 2
|
||||
|
||||
// Track open sockets to route incoming data (via onReceive) to the right handlers.
|
||||
const sockets = {}
|
||||
|
||||
const noop = () => {}
|
||||
|
||||
// Thorough check for Chrome App since both Edge and Chrome implement dummy chrome object
|
||||
if (typeof chrome?.sockets?.udp === 'object') {
|
||||
chrome.sockets.udp.onReceive.addListener(onReceive)
|
||||
chrome.sockets.udp.onReceiveError.addListener(onReceiveError)
|
||||
}
|
||||
|
||||
function onReceive (info) {
|
||||
if (info.socketId in sockets) {
|
||||
sockets[info.socketId]._onReceive(info)
|
||||
} else {
|
||||
console.error('Unknown socket id: ' + info.socketId)
|
||||
}
|
||||
}
|
||||
|
||||
function onReceiveError (info) {
|
||||
if (info.socketId in sockets) {
|
||||
sockets[info.socketId]._onReceiveError(info.resultCode)
|
||||
} else {
|
||||
console.error('Unknown socket id: ' + info.socketId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dgram.createSocket(type, [callback])
|
||||
*
|
||||
* Creates a datagram Socket of the specified types. Valid types are `udp4`
|
||||
* and `udp6`.
|
||||
*
|
||||
* Takes an optional callback which is added as a listener for message events.
|
||||
*
|
||||
* Call socket.bind if you want to receive datagrams. socket.bind() will bind
|
||||
* to the "all interfaces" address on a random port (it does the right thing
|
||||
* for both udp4 and udp6 sockets). You can then retrieve the address and port
|
||||
* with socket.address().address and socket.address().port.
|
||||
*
|
||||
* @param {string} type Either 'udp4' or 'udp6'
|
||||
* @param {function} listener Attached as a listener to message events.
|
||||
* Optional
|
||||
* @return {Socket} Socket object
|
||||
*/
|
||||
exports.createSocket = function (type, listener) {
|
||||
return new Socket(type, listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* Class: dgram.Socket
|
||||
*
|
||||
* The dgram Socket class encapsulates the datagram functionality. It should
|
||||
* be created via `dgram.createSocket(type, [callback])`.
|
||||
*
|
||||
* Event: 'message'
|
||||
* - msg Buffer object. The message
|
||||
* - rinfo Object. Remote address information
|
||||
* Emitted when a new datagram is available on a socket. msg is a Buffer and
|
||||
* rinfo is an object with the sender's address information and the number
|
||||
* of bytes in the datagram.
|
||||
*
|
||||
* Event: 'listening'
|
||||
* Emitted when a socket starts listening for datagrams. This happens as soon
|
||||
* as UDP sockets are created.
|
||||
*
|
||||
* Event: 'close'
|
||||
* Emitted when a socket is closed with close(). No new message events will
|
||||
* be emitted on this socket.
|
||||
*
|
||||
* Event: 'error'
|
||||
* - exception Error object
|
||||
* Emitted when an error occurs.
|
||||
*/
|
||||
class Socket extends EventEmitter {
|
||||
constructor (options, listener) {
|
||||
super()
|
||||
if (typeof options === 'string') options = { type: options }
|
||||
if (options.type !== 'udp4' && options.type !== 'udp6') throw new Error('Bad socket type specified. Valid types are: udp4')
|
||||
|
||||
if (typeof listener === 'function') this.on('message', listener)
|
||||
|
||||
this._destroyed = false
|
||||
this._bindState = BIND_STATE_UNBOUND
|
||||
this._bindTasks = []
|
||||
}
|
||||
|
||||
/**
|
||||
* socket.bind(port, [address], [callback])
|
||||
*
|
||||
* For UDP sockets, listen for datagrams on a named port and optional address.
|
||||
* If address is not specified, the OS will try to listen on all addresses.
|
||||
* After binding is done, a "listening" event is emitted and the callback(if
|
||||
* specified) is called. Specifying both a "listening" event listener and
|
||||
* callback is not harmful but not very useful.
|
||||
*
|
||||
* A bound datagram socket keeps the node process running to receive
|
||||
* datagrams.
|
||||
*
|
||||
* If binding fails, an "error" event is generated. In rare case (e.g. binding
|
||||
* a closed socket), an Error may be thrown by this method.
|
||||
*
|
||||
* @param {number} port
|
||||
* @param {string} address Optional
|
||||
* @param {function} callback Function with no parameters, Optional. Callback
|
||||
* when binding is done.
|
||||
*/
|
||||
bind (port, address, callback) {
|
||||
if (typeof address === 'function') {
|
||||
callback = address
|
||||
address = undefined
|
||||
}
|
||||
|
||||
if (!address) address = '0.0.0.0'
|
||||
|
||||
if (!port) port = 0
|
||||
|
||||
if (this._bindState !== BIND_STATE_UNBOUND) throw new Error('Socket is already bound')
|
||||
|
||||
this._bindState = BIND_STATE_BINDING
|
||||
|
||||
if (typeof callback === 'function') this.once('listening', callback)
|
||||
|
||||
chrome.sockets.udp.create(createInfo => {
|
||||
this.id = createInfo.socketId
|
||||
|
||||
sockets[this.id] = this
|
||||
|
||||
const bindFns = this._bindTasks.map(({ fn }) => fn)
|
||||
|
||||
series(bindFns, err => {
|
||||
if (err) return this.emit('error', err)
|
||||
chrome.sockets.udp.bind(this.id, address, port, result => {
|
||||
if (result < 0) {
|
||||
this.emit('error', new Error('Socket ' + this.id + ' failed to bind. ' +
|
||||
chrome.runtime.lastError.message))
|
||||
return
|
||||
}
|
||||
chrome.sockets.udp.getInfo(this.id, socketInfo => {
|
||||
if (!socketInfo.localPort || !socketInfo.localAddress) {
|
||||
this.emit('error', new Error('Cannot get local port/address for Socket ' + this.id))
|
||||
return
|
||||
}
|
||||
|
||||
this._port = socketInfo.localPort
|
||||
this._address = socketInfo.localAddress
|
||||
|
||||
this._bindState = BIND_STATE_BOUND
|
||||
this.emit('listening')
|
||||
|
||||
for (const t of this._bindTasks) {
|
||||
t.callback()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function to receive new messages and emit `message` events.
|
||||
*/
|
||||
_onReceive (info) {
|
||||
const buf = Buffer.from(new Uint8Array(info.data))
|
||||
const rinfo = {
|
||||
address: info.remoteAddress,
|
||||
family: 'IPv4',
|
||||
port: info.remotePort,
|
||||
size: buf.length
|
||||
}
|
||||
this.emit('message', buf, rinfo)
|
||||
}
|
||||
|
||||
_onReceiveError (resultCode) {
|
||||
this.emit('error', new Error('Socket ' + this.id + ' receive error ' + resultCode))
|
||||
}
|
||||
|
||||
/**
|
||||
* socket.send(buf, offset, length, port, address, [callback])
|
||||
*
|
||||
* For UDP sockets, the destination port and IP address must be
|
||||
* specified. A string may be supplied for the address parameter, and it will
|
||||
* be resolved with DNS. An optional callback may be specified to detect any
|
||||
* DNS errors and when buf may be re-used. Note that DNS lookups will delay
|
||||
* the time that a send takes place, at least until the next tick. The only
|
||||
* way to know for sure that a send has taken place is to use the callback.
|
||||
*
|
||||
* If the socket has not been previously bound with a call to bind, it's
|
||||
* assigned a random port number and bound to the "all interfaces" address
|
||||
* (0.0.0.0 for udp4 sockets, ::0 for udp6 sockets).
|
||||
*
|
||||
* @param {Buffer|Arrayish|string} buf Message to be sent
|
||||
* @param {number} offset Offset in the buffer where the message starts. Optional.
|
||||
* @param {number} length Number of bytes in the message. Optional.
|
||||
* @param {number} port destination port
|
||||
* @param {string} address destination IP
|
||||
* @param {function} callback Callback when message is done being delivered.
|
||||
* Optional.
|
||||
*
|
||||
* Valid combinations:
|
||||
* send(buffer, offset, length, port, address, callback)
|
||||
* send(buffer, offset, length, port, address)
|
||||
* send(buffer, offset, length, port)
|
||||
* send(bufferOrList, port, address, callback)
|
||||
* send(bufferOrList, port, address)
|
||||
* send(bufferOrList, port)
|
||||
*
|
||||
*/
|
||||
send (buffer, offset, length, port, address, callback = noop) {
|
||||
let list
|
||||
const cb = callback || noop
|
||||
|
||||
if (address || (port && typeof port !== 'function')) {
|
||||
buffer = this.sliceBuffer(buffer, offset, length)
|
||||
} else {
|
||||
callback = port
|
||||
port = offset
|
||||
address = length
|
||||
}
|
||||
|
||||
if (!Array.isArray(buffer)) {
|
||||
if (typeof buffer === 'string') {
|
||||
list = [Buffer.from(buffer)]
|
||||
} else if (!(buffer instanceof Uint8Array)) {
|
||||
throw new TypeError('First argument must be a buffer or a string')
|
||||
} else {
|
||||
list = [Buffer.from(buffer)]
|
||||
}
|
||||
} else if (!(list = this.fixBufferList(buffer))) {
|
||||
throw new TypeError('Buffer list arguments must be buffers or strings')
|
||||
}
|
||||
|
||||
port = port >>> 0
|
||||
if (port === 0 || port > 65535) {
|
||||
throw new RangeError('Port should be > 0 and < 65536')
|
||||
}
|
||||
|
||||
if (this._bindState === BIND_STATE_UNBOUND) this.bind(0)
|
||||
|
||||
// If the socket hasn't been bound yet, push the outbound packet onto the
|
||||
// send queue and send after binding is complete.
|
||||
if (this._bindState !== BIND_STATE_BOUND) {
|
||||
// If the send queue hasn't been initialized yet, do it, and install an
|
||||
// event handler that flishes the send queue after binding is done.
|
||||
if (!this._sendQueue) {
|
||||
this._sendQueue = []
|
||||
this.once('listening', () => {
|
||||
// Flush the send queue.
|
||||
for (let i = 0; i < this._sendQueue.length; i++) {
|
||||
this.send.apply(this, this._sendQueue[i])
|
||||
}
|
||||
this._sendQueue = undefined
|
||||
})
|
||||
}
|
||||
this._sendQueue.push([buffer, offset, length, port, address, callback])
|
||||
return
|
||||
}
|
||||
|
||||
const ab = Buffer.concat(list).buffer
|
||||
|
||||
chrome.sockets.udp.send(this.id, ab, address, port, sendInfo => {
|
||||
if (sendInfo.resultCode < 0) {
|
||||
const err = new Error('Socket ' + this.id + ' send error ' + sendInfo.resultCode)
|
||||
cb(err)
|
||||
this.emit('error', err)
|
||||
} else {
|
||||
cb(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
sliceBuffer (buffer, offset, length) {
|
||||
buffer = Buffer.from(buffer)
|
||||
|
||||
offset = offset >>> 0
|
||||
length = length >>> 0
|
||||
|
||||
// assuming buffer is browser implementation (`buffer` package on npm)
|
||||
let buf = buffer.buffer
|
||||
if (buffer.byteOffset || buffer.byteLength !== buf.byteLength) {
|
||||
buf = buf.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)
|
||||
}
|
||||
if (offset || length !== buffer.length) {
|
||||
buf = buf.slice(offset, length)
|
||||
}
|
||||
|
||||
return Buffer.from(buf)
|
||||
}
|
||||
|
||||
fixBufferList (list) {
|
||||
const newlist = new Array(list.length)
|
||||
|
||||
for (let i = 0, l = list.length; i < l; i++) {
|
||||
const buf = list[i]
|
||||
if (typeof buf === 'string') {
|
||||
newlist[i] = Buffer.from(buf)
|
||||
} else if (!(buf instanceof Uint8Array)) {
|
||||
return null
|
||||
} else {
|
||||
newlist[i] = Buffer.from(buf)
|
||||
}
|
||||
}
|
||||
|
||||
return newlist
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the underlying socket and stop listening for data on it.
|
||||
*/
|
||||
close () {
|
||||
if (this._destroyed) return
|
||||
|
||||
delete sockets[this.id]
|
||||
chrome.sockets.udp.close(this.id)
|
||||
this._destroyed = true
|
||||
|
||||
this.emit('close')
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object containing the address information for a socket. For UDP
|
||||
* sockets, this object will contain address, family and port.
|
||||
*
|
||||
* @return {Object} information
|
||||
*/
|
||||
address () {
|
||||
return {
|
||||
address: this._address,
|
||||
port: this._port,
|
||||
family: 'IPv4'
|
||||
}
|
||||
}
|
||||
|
||||
setBroadcast (flag) {
|
||||
// No chrome.sockets equivalent
|
||||
}
|
||||
|
||||
setTTL (ttl) {
|
||||
// No chrome.sockets equivalent
|
||||
}
|
||||
|
||||
// NOTE: Multicast code is untested. Pull requests accepted for bug fixes and to
|
||||
// add tests!
|
||||
/**
|
||||
* Sets the IP_MULTICAST_TTL socket option. TTL stands for "Time to Live," but
|
||||
* in this context it specifies the number of IP hops that a packet is allowed
|
||||
* to go through, specifically for multicast traffic. Each router or gateway
|
||||
* that forwards a packet decrements the TTL. If the TTL is decremented to 0
|
||||
* by a router, it will not be forwarded.
|
||||
*
|
||||
* The argument to setMulticastTTL() is a number of hops between 0 and 255.
|
||||
* The default on most systems is 1.
|
||||
*
|
||||
* NOTE: The Chrome version of this function is async, whereas the node
|
||||
* version is sync. Keep this in mind.
|
||||
*
|
||||
* @param {number} ttl
|
||||
* @param {function} callback CHROME-SPECIFIC: Called when the configuration
|
||||
* operation is done.
|
||||
*/
|
||||
setMulticastTTL (ttl, callback = noop) {
|
||||
const setMulticastTTL = callback => {
|
||||
chrome.sockets.udp.setMulticastTimeToLive(this.id, ttl, callback)
|
||||
}
|
||||
if (this._bindState === BIND_STATE_BOUND) {
|
||||
setMulticastTTL(callback)
|
||||
} else {
|
||||
this._bindTasks.push({
|
||||
fn: setMulticastTTL,
|
||||
callback
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or clears the IP_MULTICAST_LOOP socket option. When this option is
|
||||
* set, multicast packets will also be received on the local interface.
|
||||
*
|
||||
* NOTE: The Chrome version of this function is async, whereas the node
|
||||
* version is sync. Keep this in mind.
|
||||
*
|
||||
* @param {boolean} flag
|
||||
* @param {function} callback CHROME-SPECIFIC: Called when the configuration
|
||||
* operation is done.
|
||||
*/
|
||||
setMulticastLoopback (flag, callback = noop) {
|
||||
const setMulticastLoopback = callback => {
|
||||
chrome.sockets.udp.setMulticastLoopbackMode(this.id, flag, callback)
|
||||
}
|
||||
if (this._bindState === BIND_STATE_BOUND) {
|
||||
setMulticastLoopback(callback)
|
||||
} else {
|
||||
this._bindTasks.push({
|
||||
fn: setMulticastLoopback,
|
||||
callback
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the kernel to join a multicast group with IP_ADD_MEMBERSHIP socket
|
||||
* option.
|
||||
*
|
||||
* If multicastInterface is not specified, the OS will try to add membership
|
||||
* to all valid interfaces.
|
||||
*
|
||||
* NOTE: The Chrome version of this function is async, whereas the node
|
||||
* version is sync. Keep this in mind.
|
||||
*
|
||||
* @param {string} multicastAddress
|
||||
* @param {string} [multicastInterface] Optional
|
||||
* @param {function} callback CHROME-SPECIFIC: Called when the configuration
|
||||
* operation is done.
|
||||
*/
|
||||
addMembership (multicastAddress, multicastInterface, callback = noop) {
|
||||
chrome.sockets.udp.joinGroup(this.id, multicastAddress, callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* Opposite of addMembership - tells the kernel to leave a multicast group
|
||||
* with IP_DROP_MEMBERSHIP socket option. This is automatically called by the
|
||||
* kernel when the socket is closed or process terminates, so most apps will
|
||||
* never need to call this.
|
||||
*
|
||||
* NOTE: The Chrome version of this function is async, whereas the node
|
||||
* version is sync. Keep this in mind.
|
||||
*
|
||||
* If multicastInterface is not specified, the OS will try to drop membership
|
||||
* to all valid interfaces.
|
||||
*
|
||||
* @param {[type]} multicastAddress
|
||||
* @param {[type]} multicastInterface Optional
|
||||
* @param {function} callback CHROME-SPECIFIC: Called when the configuration
|
||||
* operation is done.
|
||||
*/
|
||||
dropMembership (multicastAddress, multicastInterface, callback = noop) {
|
||||
chrome.sockets.udp.leaveGroup(this.id, multicastAddress, callback)
|
||||
}
|
||||
|
||||
unref () {
|
||||
// No chrome.sockets equivalent
|
||||
}
|
||||
|
||||
ref () {
|
||||
// No chrome.sockets equivalent
|
||||
}
|
||||
}
|
||||
|
||||
exports.Socket = Socket
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import { gateway4async } from 'capacitor-default-gateway'
|
||||
|
||||
let v4Gateway
|
||||
|
||||
export const v4 = () => {}
|
||||
v4.sync = () => v4Gateway
|
||||
export const ready = gateway4async().then(gateway => {
|
||||
v4Gateway = gateway
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
import EventEmitter from 'events'
|
||||
import { ready } from './gateway.js'
|
||||
|
||||
export const ipcRendererUI = new EventEmitter()
|
||||
|
||||
export const main = new EventEmitter()
|
||||
|
||||
export default {
|
||||
emit: (event, data) => {
|
||||
main.emit(event, data)
|
||||
},
|
||||
on: (event, callback) => {
|
||||
ipcRendererUI.on(event, (...args) => callback(...args))
|
||||
},
|
||||
once: (event, callback) => {
|
||||
ipcRendererUI.once(event, (...args) => callback(...args))
|
||||
},
|
||||
off: event => {
|
||||
ipcRendererUI.removeAllListeners(event)
|
||||
}
|
||||
}
|
||||
|
||||
main.on('portRequest', portRequest)
|
||||
|
||||
async function portRequest (data) {
|
||||
const { port1, port2 } = new MessageChannel()
|
||||
globalThis.port = {
|
||||
onmessage: cb => {
|
||||
port2.onmessage = ({ type, data }) => cb({ type, data })
|
||||
},
|
||||
postMessage: (a, b) => {
|
||||
port2.postMessage(a, b)
|
||||
}
|
||||
}
|
||||
await globalThis.controller
|
||||
await globalThis.prefetchNetworkInterfaces
|
||||
await ready
|
||||
await new Promise(resolve => setTimeout(() => resolve(), 50))
|
||||
ipcRendererUI.emit('port', { ports: [port2] })
|
||||
ipcRendererWebTorrent.emit('port', { ports: [port1] })
|
||||
}
|
||||
|
||||
export const ipcRendererWebTorrent = new EventEmitter()
|
||||
|
||||
const [_platform, arch] = navigator.platform.split(' ')
|
||||
|
||||
globalThis.version = {
|
||||
platform: globalThis.cordova?.platformId,
|
||||
arch,
|
||||
version: globalThis.cordova?.version
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import './webtorrent.js'
|
||||
import './capacitor.js'
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// feature support list, overriden per environment, capacitor
|
||||
|
||||
export const SUPPORTS = {
|
||||
offscreenRender: false,
|
||||
update: false,
|
||||
angle: false,
|
||||
doh: false,
|
||||
dht: true,
|
||||
discord: false,
|
||||
torrentPort: false,
|
||||
torrentPath: false,
|
||||
torrentPersist: false
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import TorrentClient from 'common/modules/webtorrent.js'
|
||||
import { ipcRendererWebTorrent } from './ipc.js'
|
||||
import { prefetchNetworkInterfaces } from 'os'
|
||||
import { ready } from './gateway.js'
|
||||
|
||||
globalThis.chrome.runtime = { lastError: false, id: 'something' }
|
||||
|
||||
const controller = (async () => {
|
||||
const reg = await navigator.serviceWorker.register(new URL('webtorrent/dist/sw.min.js', import.meta.url))
|
||||
|
||||
const worker = reg.active || reg.waiting || reg.installing
|
||||
if (!worker) throw new Error('No worker registration')
|
||||
return new Promise(resolve => {
|
||||
function checkState ({ state }) {
|
||||
if (state === 'activated') {
|
||||
resolve(reg)
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (!checkState(worker)) worker.addEventListener('statechange', ({ target }) => checkState(target))
|
||||
})
|
||||
})()
|
||||
globalThis.prefetchNetworkInterfaces = await prefetchNetworkInterfaces()
|
||||
globalThis.controller = controller
|
||||
|
||||
async function storageQuota () {
|
||||
const { quota, usage } = await navigator.storage.estimate()
|
||||
return quota - usage
|
||||
}
|
||||
|
||||
await prefetchNetworkInterfaces
|
||||
await ready
|
||||
|
||||
globalThis.client = new TorrentClient(ipcRendererWebTorrent, storageQuota, 'browser', controller, { torrentPort: Math.floor(Math.random() * 65535 + 1) })
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
const webpack = require('webpack')
|
||||
const commonConfig = require('common/webpack.config.cjs')
|
||||
const { merge } = require('webpack-merge')
|
||||
const { join, resolve } = require('path')
|
||||
|
||||
const mode = process.env.NODE_ENV?.trim() || 'development'
|
||||
|
||||
/** @type {import('webpack').Configuration} */
|
||||
const capacitorConfig = {
|
||||
entry: [join(__dirname, 'src', 'main.js')],
|
||||
mode,
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'webtorrent/polyfills/process-fast.js',
|
||||
Buffer: ['buffer', 'Buffer']
|
||||
}),
|
||||
new webpack.DefinePlugin({ global: 'globalThis' })
|
||||
],
|
||||
devServer: {
|
||||
devMiddleware: { writeToDisk: true },
|
||||
hot: true,
|
||||
client: {
|
||||
overlay: { errors: true, warnings: false, runtimeErrors: false }
|
||||
},
|
||||
port: 5001
|
||||
}
|
||||
}
|
||||
const alias = {
|
||||
fs: false,
|
||||
ws: false,
|
||||
'default-gateway': join(__dirname, 'src', 'gateway.js'),
|
||||
'load-ip-set': false,
|
||||
'node-fetch': false,
|
||||
'webtorrent/lib/utp.cjs': false,
|
||||
'@/modules/ipc.js': join(__dirname, 'src', 'ipc.js'),
|
||||
'@/modules/support.js': join(__dirname, 'src', 'support.js'),
|
||||
net: join(__dirname, 'src', 'chrome-net.js'),
|
||||
dgram: join(__dirname, 'src', 'chrome-dgram.js'),
|
||||
os: 'capacitor-os-interfaces-hack',
|
||||
dns: 'capacitor-dns',
|
||||
http: 'stream-http',
|
||||
https: 'stream-http',
|
||||
'utp-native': false,
|
||||
socks: false,
|
||||
assert: 'assert',
|
||||
ut_pex: 'ut_pex',
|
||||
path: 'path-esm',
|
||||
'fs-chunk-store': 'hybrid-chunk-store',
|
||||
stream: 'stream-browserify',
|
||||
timers: 'timers-browserify',
|
||||
crypto: 'crypto-browserify',
|
||||
buffer: 'buffer',
|
||||
'@silentbot1/nat-api': '@silentbot1/nat-api',
|
||||
'bittorrent-tracker': 'bittorrent-tracker',
|
||||
querystring: 'querystring',
|
||||
zlib: 'webtorrent/polyfills/inflate-sync-web.js',
|
||||
'bittorrent-tracker/server.js': false,
|
||||
'cross-fetch-ponyfill': resolve('../node_modules/cross-fetch-ponyfill/browser.js'),
|
||||
'abort-controller': false,
|
||||
'bittorrent-tracker/lib/client/http-tracker.js': resolve('../node_modules/bittorrent-tracker/lib/client/http-tracker.js')
|
||||
}
|
||||
|
||||
module.exports = merge(commonConfig(__dirname, alias, 'node', 'index'), capacitorConfig)
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<script context='module'>
|
||||
import { setContext } from 'svelte'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
import { alRequest } from '@/modules/anilist.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
|
||||
export const page = writable('home')
|
||||
export const view = writable(null)
|
||||
export async function handleAnime (anime) {
|
||||
view.set(null)
|
||||
view.set((await alRequest({ method: 'SearchIDSingle', id: anime })).data.Media)
|
||||
}
|
||||
IPC.on('open-anime', handleAnime)
|
||||
IPC.on('schedule', () => {
|
||||
page.set('schedule')
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Sidebar from './components/Sidebar.svelte'
|
||||
import Router from './Router.svelte'
|
||||
import ViewAnime from './views/ViewAnime/ViewAnime.svelte'
|
||||
import RSSView from './views/RSSView.svelte'
|
||||
import Menubar from './components/Menubar.svelte'
|
||||
import IspBlock from './views/IspBlock.svelte'
|
||||
import { Toaster } from 'svelte-sonner'
|
||||
import Logout from './components/Logout.svelte'
|
||||
import Navbar from './components/Navbar.svelte'
|
||||
|
||||
setContext('view', view)
|
||||
</script>
|
||||
|
||||
<div class='page-wrapper with-transitions bg-dark position-relative' data-sidebar-type='overlayed-all'>
|
||||
<IspBlock />
|
||||
<Menubar bind:page={$page} />
|
||||
<ViewAnime />
|
||||
<Logout />
|
||||
<Sidebar bind:page={$page} />
|
||||
<div class='overflow-hidden content-wrapper h-full z-10'>
|
||||
<Toaster visibleToasts={6} position='top-right' theme='dark' richColors duration={10000} closeButton />
|
||||
<RSSView />
|
||||
<Router bind:page={$page} />
|
||||
</div>
|
||||
<Navbar bind:page={$page} />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.content-wrapper {
|
||||
will-change: width;
|
||||
top: 0 !important;
|
||||
}
|
||||
|
||||
.page-wrapper > .content-wrapper {
|
||||
margin-left: var(--sidebar-minimised) !important;
|
||||
width: calc(100% - var(--sidebar-minimised)) !important;
|
||||
transition: none !important;
|
||||
}
|
||||
.page-wrapper {
|
||||
height: calc(100% - var(--navbar-height)) !important;
|
||||
}
|
||||
@media (min-width: 769px) {
|
||||
.page-wrapper {
|
||||
padding-left: max(var(--safe-area-left), env(safe-area-inset-left, 0)) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<script>
|
||||
import Home from './views/Home/Home.svelte'
|
||||
import MediaHandler from './views/Player/MediaHandler.svelte'
|
||||
import Settings from '@/views/Settings/Settings.svelte'
|
||||
import WatchTogether from './views/WatchTogether/WatchTogether.svelte'
|
||||
import Miniplayer from 'svelte-miniplayer'
|
||||
import Search from './views/Search.svelte'
|
||||
import AiringSchedule from './views/AiringSchedule.svelte'
|
||||
|
||||
export let page = 'home'
|
||||
</script>
|
||||
|
||||
<div class='w-full h-full position-absolute overflow-hidden'>
|
||||
<Miniplayer active={page !== 'player'} class='bg-dark-light z-10 {page === 'player' ? 'h-full' : ''}' minwidth='35rem' maxwidth='60rem' width='300px' padding='2rem'>
|
||||
<MediaHandler miniplayer={page !== 'player'} bind:page />
|
||||
</Miniplayer>
|
||||
</div>
|
||||
{#if page === 'settings'}
|
||||
<Settings />
|
||||
{:else if page === 'home'}
|
||||
<Home />
|
||||
{:else if page === 'search'}
|
||||
<Search />
|
||||
{:else if page === 'schedule'}
|
||||
<AiringSchedule />
|
||||
{:else if page === 'watchtogether'}
|
||||
<WatchTogether />
|
||||
{/if}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<script context='module'>
|
||||
import { click } from '@/modules/click.js'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
|
||||
export const logout = writable(false)
|
||||
|
||||
function confirm () {
|
||||
localStorage.removeItem('ALtoken')
|
||||
location.hash = ''
|
||||
location.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let modal
|
||||
function close () {
|
||||
$logout = false
|
||||
}
|
||||
function checkClose ({ keyCode }) {
|
||||
if (keyCode === 27) close()
|
||||
}
|
||||
$: $logout && modal?.focus()
|
||||
</script>
|
||||
|
||||
<div class='modal z-40' class:show={$logout}>
|
||||
<div class='modal-dialog' on:pointerup|self={close} on:keydown={checkClose} tabindex='-1' role='button' bind:this={modal}>
|
||||
<div class='modal-content d-flex justify-content-center flex-column'>
|
||||
<button class='close pointer z-30 top-20 right-0 position-absolute' type='button' use:click={close}> × </button>
|
||||
<h5 class='modal-title'>Log Out</h5>
|
||||
<p>
|
||||
Are You Sure You Want To Sign Out?
|
||||
</p>
|
||||
<div class='text-right mt-20'>
|
||||
<button class='btn mr-5' type='button' on:click={close}>Cancel</button>
|
||||
<button class='btn btn-danger' type='button' on:click={confirm}>Sign Out</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.close {
|
||||
top: 4rem !important;
|
||||
left: unset !important;
|
||||
right: 2.5rem !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { click } from '@/modules/click.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
|
||||
export let page
|
||||
const view = getContext('view')
|
||||
function close () {
|
||||
$view = null
|
||||
page = 'home'
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='w-full z-101 navbar bg-transparent border-0 p-0 d-flex'>
|
||||
<div class='d-flex h-full draggable align-items-center text-center'>
|
||||
{#if window.version.platform !== 'darwin'}
|
||||
<img src='./logo.ico' class='position-absolute w-50 h-50 m-10 pointer d-md-block d-none' alt='ico' use:click={close} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class='h-full bg-dark flex-grow-1'>
|
||||
{#if window.version.platform === 'linux'}
|
||||
<div class='d-flex align-items-center close h-full' use:click={() => IPC.emit('close')}>
|
||||
<svg viewBox='0 0 24 24'>
|
||||
<path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z' />
|
||||
</svg>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.navbar {
|
||||
--navbar-height: 28px !important;
|
||||
}
|
||||
.z-101 {
|
||||
z-index: 101 !important
|
||||
}
|
||||
.draggable {
|
||||
-webkit-app-region: drag;
|
||||
color: var(--dm-text-muted-color);
|
||||
font-size: 11.2px;
|
||||
width: calc(env(titlebar-area-width, 100%) - 1px);
|
||||
}
|
||||
img {
|
||||
top: 0;
|
||||
-webkit-app-region: no-drag
|
||||
}
|
||||
.close {
|
||||
width: 40px;
|
||||
}
|
||||
.close:hover {
|
||||
background-color: #e81123 !important;
|
||||
}
|
||||
svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 100%;
|
||||
}
|
||||
path {
|
||||
fill: currentColor;
|
||||
}
|
||||
.navbar {
|
||||
left: unset !important
|
||||
}
|
||||
@media (pointer: none), (pointer: coarse) {
|
||||
.navbar {
|
||||
display: none !important;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { alID } from '@/modules/anilist.js'
|
||||
import { media } from '../views/Player/MediaHandler.svelte'
|
||||
import { platformMap } from '@/views/Settings/Settings.svelte'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { click } from '@/modules/click.js'
|
||||
import { logout } from './Logout.svelte'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
const view = getContext('view')
|
||||
export let page
|
||||
const links = [
|
||||
{
|
||||
click: () => {
|
||||
if (alID) {
|
||||
$logout = true
|
||||
} else {
|
||||
IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=4254&response_type=token') // Change redirect_url to miru://auth
|
||||
if (platformMap[window.version.platform] === 'Linux') {
|
||||
toast('Support Notification', {
|
||||
description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.",
|
||||
duration: 300000
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
icon: 'login',
|
||||
text: 'Login With AniList',
|
||||
css: 'ml-auto'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'home'
|
||||
},
|
||||
page: 'home',
|
||||
icon: 'home',
|
||||
text: 'Home'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'search'
|
||||
},
|
||||
page: 'search',
|
||||
icon: 'search',
|
||||
text: 'Search'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'schedule'
|
||||
},
|
||||
page: 'schedule',
|
||||
icon: 'schedule',
|
||||
text: 'Schedule'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
if ($media) $view = $media.media
|
||||
},
|
||||
icon: 'queue_music',
|
||||
text: 'Now Playing'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'watchtogether'
|
||||
},
|
||||
page: 'watchtogether',
|
||||
icon: 'groups',
|
||||
text: 'Watch Together'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/')
|
||||
},
|
||||
icon: 'favorite',
|
||||
text: 'Support This App',
|
||||
css: 'ml-auto donate'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'settings'
|
||||
},
|
||||
page: 'settings',
|
||||
icon: 'settings',
|
||||
text: 'Settings'
|
||||
}
|
||||
]
|
||||
if (alID) {
|
||||
alID.then(result => {
|
||||
if (result?.data?.Viewer) {
|
||||
links[0].image = result.data.Viewer.avatar.medium
|
||||
links[0].text = 'Logout'
|
||||
}
|
||||
})
|
||||
}
|
||||
function close () {
|
||||
$view = null
|
||||
page = 'home'
|
||||
}
|
||||
</script>
|
||||
|
||||
<nav class='navbar navbar-fixed-bottom d-block d-md-none border-0 bg-dark'>
|
||||
<div class='navbar-menu h-full d-flex flex-row justify-content-center align-items-center m-0 pb-5' class:animate={page !== 'player'}>
|
||||
<img src='./logo.ico' class='w-50 h-50 m-10 pointer' alt='ico' use:click={close} />
|
||||
{#each links as { click: _click, icon, text, image, css, page: _page }, i (i)}
|
||||
<div
|
||||
class='navbar-link navbar-link-with-icon pointer overflow-hidden {css}'
|
||||
use:click={_click}>
|
||||
{#if image}
|
||||
<span class='material-symbols-outlined rounded' class:filled={page === _page}>
|
||||
<img src={image} class='h-30 rounded' alt='logo' />
|
||||
</span>
|
||||
{:else}
|
||||
<span class='material-symbols-outlined rounded' class:filled={page === _page}>{icon}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<style>
|
||||
nav {
|
||||
height: var(--navbar-height);
|
||||
}
|
||||
@keyframes glow {
|
||||
from {
|
||||
text-shadow: 0 0 2rem #fa68b6;
|
||||
}
|
||||
to {
|
||||
text-shadow: 0 0 1rem #fa68b6;
|
||||
}
|
||||
}
|
||||
.animate .donate .material-symbols-outlined {
|
||||
animation: glow 1s ease-in-out infinite alternate;
|
||||
}
|
||||
.donate:hover .material-symbols-outlined {
|
||||
background: #fff;
|
||||
color: #fa68b6 !important;
|
||||
}
|
||||
.donate .material-symbols-outlined {
|
||||
font-variation-settings: 'FILL' 1;
|
||||
color: #fa68b6;
|
||||
text-shadow: 0 0 1rem #fa68b6;
|
||||
}
|
||||
/* .sidebar-menu {
|
||||
padding-top: 10rem;
|
||||
} */
|
||||
.text {
|
||||
opacity: 1;
|
||||
transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.navbar-link > span {
|
||||
color: #fff;
|
||||
border-radius: 0.3rem;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
color: #fff;
|
||||
transition: background .8s cubic-bezier(0.25, 0.8, 0.25, 1), color .8s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
}
|
||||
|
||||
.navbar-link:hover > span {
|
||||
background: #fff;
|
||||
color: var(--dark-color);
|
||||
}
|
||||
|
||||
.navbar-link {
|
||||
font-size: 1.4rem;
|
||||
padding: 0.75rem;
|
||||
height: 5.5rem;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
font-size: 2.2rem;
|
||||
min-width: 4rem;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.navbar-link img {
|
||||
font-size: 2.2rem;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
margin: 0.5rem;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
img {
|
||||
margin-right: var(--sidebar-brand-image-margin-right);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
<script context='module'>
|
||||
const badgeKeys = ['search', 'genre', 'season', 'year', 'format', 'status', 'sort']
|
||||
|
||||
export function searchCleanup (search) {
|
||||
return Object.fromEntries(Object.entries(search).map((entry) => {
|
||||
return badgeKeys.includes(entry[0]) && entry
|
||||
}).filter(a => a?.[1]))
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { traceAnime } from '@/modules/anime.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
import { page } from '@/App.svelte'
|
||||
import { toast } from 'svelte-sonner'
|
||||
|
||||
export let search
|
||||
let searchTextInput
|
||||
let form
|
||||
|
||||
$: sanitisedSearch = Object.values(searchCleanup(search))
|
||||
|
||||
function searchClear () {
|
||||
search = {
|
||||
search: '',
|
||||
genre: '',
|
||||
season: '',
|
||||
year: null,
|
||||
format: '',
|
||||
status: '',
|
||||
sort: ''
|
||||
}
|
||||
searchTextInput.focus()
|
||||
form.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
$page = 'search'
|
||||
}
|
||||
|
||||
function handleFile ({ target }) {
|
||||
const { files } = target
|
||||
if (files?.[0]) {
|
||||
toast.promise(traceAnime(files[0]), {
|
||||
description: 'You can also paste an URL to an image.',
|
||||
loading: 'Looking up anime for image...',
|
||||
success: 'Found anime for image!',
|
||||
error: 'Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.'
|
||||
})
|
||||
target.value = null
|
||||
}
|
||||
}
|
||||
function changeCardMode (type) {
|
||||
$settings.cards = type
|
||||
form.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
}
|
||||
</script>
|
||||
|
||||
<form class='container-fluid py-20 px-50 bg-dark pb-0 position-sticky top-0 search-container z-40' on:input bind:this={form}>
|
||||
<div class='row'>
|
||||
<div class='col-lg col-4 p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>title</div>
|
||||
Title
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<div class='input-group-prepend'>
|
||||
<span class='input-group-text d-flex material-symbols-outlined bg-dark-light pr-0 font-size-18'>search</span>
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<input
|
||||
bind:this={searchTextInput}
|
||||
autofocus
|
||||
type='search'
|
||||
class='form-control bg-dark-light border-left-0 text-capitalize'
|
||||
autocomplete='off'
|
||||
bind:value={search.search}
|
||||
data-option='search'
|
||||
disabled={search.disableSearch}
|
||||
placeholder='Any' />
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-lg col-4 p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>theater_comedy</div>
|
||||
Genre
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light' required bind:value={search.genre} disabled={search.disableSearch}>
|
||||
<option value selected disabled hidden>Any</option>
|
||||
<option value='Action'>Action</option>
|
||||
<option value='Adventure'>Adventure</option>
|
||||
<option value='Comedy'>Comedy</option>
|
||||
<option value='Drama'>Drama</option>
|
||||
<option value='Ecchi'>Ecchi</option>
|
||||
<option value='Fantasy'>Fantasy</option>
|
||||
<option value='Horror'>Horror</option>
|
||||
<option value='Mahou Shoujo'>Mahou Shoujo</option>
|
||||
<option value='Mecha'>Mecha</option>
|
||||
<option value='Music'>Music</option>
|
||||
<option value='Mystery'>Mystery</option>
|
||||
<option value='Psychological'>Psychological</option>
|
||||
<option value='Romance'>Romance</option>
|
||||
<option value='Sci-Fi'>Sci-Fi</option>
|
||||
<option value='Slice of Life'>Slice of Life</option>
|
||||
<option value='Sports'>Sports</option>
|
||||
<option value='Supernatural'>Supernatural</option>
|
||||
<option value='Thriller'>Thriller</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-lg col-4 p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>spa</div>
|
||||
Season
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light border-right-dark' required bind:value={search.season} disabled={search.disableSearch}>
|
||||
<option value selected disabled hidden>Any</option>
|
||||
<option value='WINTER'>Winter</option>
|
||||
<option value='SPRING'>Spring</option>
|
||||
<option value='SUMMER'>Summer</option>
|
||||
<option value='FALL'>Fall</option>
|
||||
</select>
|
||||
<datalist id='search-year'>
|
||||
{#each Array(new Date().getFullYear() - 1940 + 2) as _, i}
|
||||
{@const year = new Date().getFullYear() + 2 - i}
|
||||
<option>{year}</option>
|
||||
{/each}
|
||||
</datalist>
|
||||
<input type='number' placeholder='Any' min='1940' max='2100' list='search-year' class='bg-dark-light form-control' disabled={search.disableSearch} bind:value={search.year} />
|
||||
</div>
|
||||
</div>
|
||||
<div class='col p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>monitor</div>
|
||||
Format
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light' required bind:value={search.format} disabled={search.disableSearch}>
|
||||
<option value selected disabled hidden>Any</option>
|
||||
<option value='TV'>TV Show</option>
|
||||
<option value='MOVIE'>Movie</option>
|
||||
<option value='TV_SHORT'>TV Short</option>
|
||||
<option value='OVA'>OVA</option>
|
||||
<option value='ONA'>ONA</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>live_tv</div>
|
||||
Status
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light' required bind:value={search.status} disabled={search.disableSearch}>
|
||||
<option value selected disabled hidden>Any</option>
|
||||
<option value='RELEASING'>Airing</option>
|
||||
<option value='FINISHED'>Finished</option>
|
||||
<option value='NOT_YET_RELEASED'>Not Yet Aired</option>
|
||||
<option value='CANCELLED'>Cancelled</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col p-10 d-flex flex-column justify-content-end'>
|
||||
<div class='pb-10 font-size-24 font-weight-semi-bold d-flex'>
|
||||
<div class='material-symbols-outlined mr-10 font-size-30'>sort</div>
|
||||
Sort
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<select class='form-control bg-dark-light' required bind:value={search.sort} disabled={search.disableSearch}>
|
||||
<option value selected disabled hidden>Name</option>
|
||||
<option value='START_DATE_DESC'>Release Date</option>
|
||||
<option value='SCORE_DESC'>Score</option>
|
||||
<option value='POPULARITY_DESC'>Popularity</option>
|
||||
<option value='TRENDING_DESC'>Trending</option>
|
||||
<option value='UPDATED_TIME_DESC' disabled hidden>Updated Date</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type='file' class='d-none' id='search-image' accept='image/*' on:input|preventDefault|stopPropagation={handleFile} />
|
||||
<div class='col-auto p-10 d-flex'>
|
||||
<div class='align-self-end'>
|
||||
<button class='btn btn-square bg-dark-light material-symbols-outlined font-size-18 px-5 align-self-end border-0' type='button'>
|
||||
<label for='search-image' class='pointer mb-0'>
|
||||
image
|
||||
</label>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-auto p-10 d-flex'>
|
||||
<div class='align-self-end'>
|
||||
<button class='btn btn-square bg-dark-light material-symbols-outlined font-size-18 px-5 align-self-end border-0' type='button' use:click={searchClear} class:text-primary={!!sanitisedSearch?.length || search.disableSearch || search.clearNext}>
|
||||
delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='w-full px-10 pt-10 h-50 d-flex flex-colum align-items-center'>
|
||||
{#if sanitisedSearch?.length}
|
||||
<span class='material-symbols-outlined font-size-24 mr-20 filled text-dark-light'>sell</span>
|
||||
{#each sanitisedSearch as badge}
|
||||
<span class='badge bg-light border-0 py-5 px-10 text-capitalize mr-20 text-white text-nowrap'>{('' + badge).replace(/_/g, ' ').toLowerCase()}</span>
|
||||
{/each}
|
||||
{/if}
|
||||
<span class='material-symbols-outlined font-size-24 mr-10 filled ml-auto text-dark-light pointer' class:text-muted={$settings.cards === 'small'} use:click={() => changeCardMode('small')}>grid_on</span>
|
||||
<span class='material-symbols-outlined font-size-24 filled text-dark-light pointer' class:text-muted={$settings.cards === 'full'} use:click={() => changeCardMode('full')}>grid_view</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<style>
|
||||
.text-dark-light {
|
||||
color: var(--gray-color-light);
|
||||
}
|
||||
.input-group,
|
||||
.container-fluid button, .pointer {
|
||||
transition: scale 0.2s ease;
|
||||
}
|
||||
|
||||
.input-group:hover, .pointer:hover {
|
||||
scale: 1.08;
|
||||
}
|
||||
|
||||
.container-fluid button:hover {
|
||||
scale: 1.20;
|
||||
}
|
||||
input:not(:focus):invalid {
|
||||
box-shadow: 0 0 0 0.2rem var(--danger-color) !important;
|
||||
}
|
||||
select.form-control:invalid {
|
||||
color: var(--dm-input-placeholder-text-color);
|
||||
}
|
||||
.font-size-30 {
|
||||
font-size: 3rem !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { alID } from '@/modules/anilist.js'
|
||||
import { media } from '../views/Player/MediaHandler.svelte'
|
||||
import { platformMap } from '@/views/Settings/Settings.svelte'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { click } from '@/modules/click.js'
|
||||
import { logout } from './Logout.svelte'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
const view = getContext('view')
|
||||
export let page
|
||||
const links = [
|
||||
{
|
||||
click: () => {
|
||||
if (alID) {
|
||||
$logout = true
|
||||
} else {
|
||||
IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=4254&response_type=token') // Change redirect_url to miru://auth
|
||||
if (platformMap[window.version.platform] === 'Linux') {
|
||||
toast('Support Notification', {
|
||||
description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.",
|
||||
duration: 300000
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
icon: 'login',
|
||||
text: 'Login With AniList',
|
||||
css: 'mt-auto'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'home'
|
||||
},
|
||||
page: 'home',
|
||||
icon: 'home',
|
||||
text: 'Home'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'search'
|
||||
},
|
||||
page: 'search',
|
||||
icon: 'search',
|
||||
text: 'Search'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'schedule'
|
||||
},
|
||||
page: 'schedule',
|
||||
icon: 'schedule',
|
||||
text: 'Schedule'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
if ($media) $view = $media.media
|
||||
},
|
||||
icon: 'queue_music',
|
||||
text: 'Now Playing'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'watchtogether'
|
||||
},
|
||||
page: 'watchtogether',
|
||||
icon: 'groups',
|
||||
text: 'Watch Together'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/')
|
||||
},
|
||||
icon: 'favorite',
|
||||
text: 'Support This App',
|
||||
css: 'mt-auto donate'
|
||||
},
|
||||
{
|
||||
click: () => {
|
||||
page = 'settings'
|
||||
},
|
||||
page: 'settings',
|
||||
icon: 'settings',
|
||||
text: 'Settings'
|
||||
}
|
||||
]
|
||||
if (alID) {
|
||||
alID.then(result => {
|
||||
if (result?.data?.Viewer) {
|
||||
links[0].image = result.data.Viewer.avatar.medium
|
||||
links[0].text = 'Logout'
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='sidebar z-30 d-md-block' class:animated={$settings.expandingSidebar}>
|
||||
<div class='sidebar-overlay pointer-events-none h-full position-absolute' />
|
||||
<div class='sidebar-menu h-full d-flex flex-column justify-content-center align-items-center m-0 pb-5' class:animate={page !== 'player'}>
|
||||
{#each links as { click: _click, icon, text, image, css, page: _page }, i (i)}
|
||||
<div
|
||||
class='sidebar-link sidebar-link-with-icon pointer overflow-hidden {css}'
|
||||
use:click={_click}>
|
||||
<span class='text-nowrap d-flex align-items-center w-full h-full'>
|
||||
{#if image}
|
||||
<span class='material-symbols-outlined rounded' class:filled={page === _page}>
|
||||
<img src={image} class='h-30 rounded' alt='logo' />
|
||||
</span>
|
||||
<span class='text ml-20'>{text}</span>
|
||||
{:else}
|
||||
<span class='material-symbols-outlined rounded' class:filled={page === _page}>{icon}</span>
|
||||
<span class='text ml-20'>{text}</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes glow {
|
||||
from {
|
||||
text-shadow: 0 0 2rem #fa68b6;
|
||||
}
|
||||
to {
|
||||
text-shadow: 0 0 1rem #fa68b6;
|
||||
}
|
||||
}
|
||||
.animate .donate .material-symbols-outlined {
|
||||
animation: glow 1s ease-in-out infinite alternate;
|
||||
}
|
||||
.donate:hover .material-symbols-outlined {
|
||||
background: #fff;
|
||||
color: #fa68b6 !important;
|
||||
}
|
||||
.donate .material-symbols-outlined {
|
||||
font-variation-settings: 'FILL' 1;
|
||||
color: #fa68b6;
|
||||
text-shadow: 0 0 1rem #fa68b6;
|
||||
}
|
||||
.sidebar-menu {
|
||||
padding-top: 10rem;
|
||||
}
|
||||
.text {
|
||||
opacity: 1;
|
||||
transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sidebar-link > span {
|
||||
color: #fff;
|
||||
border-radius: 0.3rem;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
color: #fff;
|
||||
transition: background .8s cubic-bezier(0.25, 0.8, 0.25, 1), color .8s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
}
|
||||
|
||||
.sidebar-link:hover > span > *:nth-child(1) {
|
||||
background: #fff;
|
||||
color: var(--dark-color);
|
||||
}
|
||||
|
||||
.sidebar-link {
|
||||
width: 100%;
|
||||
font-size: 1.4rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
height: 5.5rem;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
font-size: 2.2rem;
|
||||
min-width: 4rem;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sidebar-link img {
|
||||
font-size: 2.2rem;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
margin: 0.5rem;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
img {
|
||||
margin-right: var(--sidebar-brand-image-margin-right);
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
transition: width .8s cubic-bezier(0.25, 0.8, 0.25, 1), left .8s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
|
||||
background: none !important;
|
||||
overflow-y: unset;
|
||||
overflow-x: visible;
|
||||
left: unset;
|
||||
}
|
||||
.sidebar.animated:hover {
|
||||
width: 22rem
|
||||
}
|
||||
.sidebar-overlay {
|
||||
width: var(--sidebar-width);
|
||||
transition: width .8s cubic-bezier(0.25, 0.8, 0.25, 1), left .8s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
|
||||
background: linear-gradient(90deg, #17191D 15.62%, rgba(23, 25, 29, 0.92) 36.46%, rgba(23, 25, 29, 0.619632) 70.83%, rgba(23, 25, 29, 0) 100%);
|
||||
backdrop-filter: blur(2px);
|
||||
z-index: -1;
|
||||
}
|
||||
.sidebar.animated:hover .sidebar-overlay {
|
||||
width: 63rem
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { TABS } from './Tabs.svelte'
|
||||
|
||||
const panel = {}
|
||||
const { registerPanel, selectedPanel } = getContext(TABS)
|
||||
|
||||
registerPanel(panel)
|
||||
</script>
|
||||
|
||||
{#if $selectedPanel === panel}
|
||||
<slot />
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
slot {
|
||||
margin-bottom: 10px;
|
||||
padding: 40px;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 0 0 .5rem .5rem;
|
||||
border-top: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { TABS } from './Tabs.svelte'
|
||||
import { click } from '@/modules/click.js'
|
||||
|
||||
const tab = {}
|
||||
const { registerTab, selectTab, selectedTab } = getContext(TABS)
|
||||
|
||||
registerTab(tab)
|
||||
</script>
|
||||
|
||||
<div class={'pointer my-5 rounded ' + ($selectedTab === tab ? 'bg-dark-light font-weight-bold' : '')} use:click={() => selectTab(tab)}>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
transition: background .2s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export { default as Tabs } from './Tabs.svelte'
|
||||
export { default as TabLabel } from './TabLabel.svelte'
|
||||
export { default as Tab } from './Tab.svelte'
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<script context='module'>
|
||||
export const TABS = {}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { setContext, onDestroy } from 'svelte'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
|
||||
const tabs = []
|
||||
const panels = []
|
||||
const selectedTab = writable(null)
|
||||
const selectedPanel = writable(null)
|
||||
|
||||
setContext(TABS, {
|
||||
registerTab: tab => {
|
||||
tabs.push(tab)
|
||||
selectedTab.update(current => current || tab)
|
||||
|
||||
onDestroy(() => {
|
||||
const i = tabs.indexOf(tab)
|
||||
tabs.splice(i, 1)
|
||||
selectedTab.update(current => (current === tab ? tabs[i] || tabs[tabs.length - 1] : current))
|
||||
})
|
||||
},
|
||||
|
||||
registerPanel: panel => {
|
||||
panels.push(panel)
|
||||
selectedPanel.update(current => current || panel)
|
||||
|
||||
onDestroy(() => {
|
||||
const i = panels.indexOf(panel)
|
||||
panels.splice(i, 1)
|
||||
selectedPanel.update(current => (current === panel ? panels[i] || panels[panels.length - 1] : current))
|
||||
})
|
||||
},
|
||||
|
||||
selectTab: tab => {
|
||||
const i = tabs.indexOf(tab)
|
||||
selectedTab.set(tab)
|
||||
selectedPanel.set(panels[i])
|
||||
},
|
||||
|
||||
selectedTab,
|
||||
selectedPanel
|
||||
})
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<script>
|
||||
import FullBanner from './FullBanner.svelte'
|
||||
import SkeletonBanner from './SkeletonBanner.svelte'
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<div class='w-full h-450 position-relative gradient'>
|
||||
{#await data}
|
||||
<SkeletonBanner />
|
||||
{:then { data }}
|
||||
<FullBanner media={data.Page.media[0]} />
|
||||
{/await}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.gradient {
|
||||
background: linear-gradient(0deg, #17191D 0%, #0000 15%, #0000 100%), linear-gradient(90deg, #17191D 0%, rgba(23, 25, 29, 0.885417) 15%, rgba(25, 28, 32, 0) 72%);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
<script>
|
||||
import { formatMap, setStatus, playMedia } from '@/modules/anime.js'
|
||||
import { alRequest } from '@/modules/anilist.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
export let media
|
||||
|
||||
async function toggleStatus () {
|
||||
if (!media.mediaListEntry) {
|
||||
// add
|
||||
const res = await setStatus('PLANNING', {}, media)
|
||||
media.mediaListEntry = res.data.SaveMediaListEntry
|
||||
} else {
|
||||
// delete
|
||||
alRequest({
|
||||
method: 'Delete',
|
||||
id: media.mediaListEntry.id
|
||||
})
|
||||
media.mediaListEntry = undefined
|
||||
}
|
||||
}
|
||||
function toggleFavourite () {
|
||||
alRequest({
|
||||
method: 'Favourite',
|
||||
id: media.id
|
||||
})
|
||||
media.isFavourite = !media.isFavourite
|
||||
}
|
||||
</script>
|
||||
|
||||
<img src={media.bannerImage || ''} alt='banner' class='img-cover w-full h-full position-absolute' />
|
||||
<div class='pl-20 pb-20 justify-content-end d-flex flex-column h-full w-600 mw-full banner'>
|
||||
<div class='text-white font-weight-bold font-size-40 title overflow-hidden'>
|
||||
{media.title.userPreferred}
|
||||
</div>
|
||||
<div class='details text-white text-capitalize pt-15 pb-10 d-flex'>
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{#if media.format}
|
||||
{formatMap[media.format]}
|
||||
{/if}
|
||||
</span>
|
||||
{#if media.episodes && media.episodes !== 1}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{#if media.mediaListEntry?.status === 'CURRENT' && media.mediaListEntry?.progress }
|
||||
{media.mediaListEntry.progress} / {media.episodes} Episodes
|
||||
{:else}
|
||||
{media.episodes} Episodes
|
||||
{/if}
|
||||
</span>
|
||||
{:else if media.duration}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{media.duration + ' Minutes'}
|
||||
</span>
|
||||
{/if}
|
||||
{#if media.season || media.seasonYear}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{[media.season?.toLowerCase(), media.seasonYear].filter(s => s).join(' ')}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class='text-muted description overflow-hidden'>
|
||||
{media.description?.replace(/<[^>]*>/g, '')}
|
||||
</div>
|
||||
<div class='details text-white text-capitalize pt-15 pb-10 d-flex'>
|
||||
{#each media.genres as genre}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{genre}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
<div class='d-flex flex-row pb-20'>
|
||||
<button class='btn bg-dark-light px-20 shadow-none border-0'
|
||||
use:click={() => playMedia(media)}>
|
||||
Watch Now
|
||||
</button>
|
||||
<button class='btn bg-dark-light btn-square ml-10 material-symbols-outlined font-size-16 shadow-none border-0' class:filled={media.isFavourite} use:click={toggleFavourite}>
|
||||
favorite
|
||||
</button>
|
||||
<button class='btn bg-dark-light btn-square ml-10 material-symbols-outlined font-size-16 shadow-none border-0' class:filled={media.mediaListEntry} use:click={toggleStatus}>
|
||||
bookmark
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.details span + span::before {
|
||||
content: '•';
|
||||
padding: 0 .5rem;
|
||||
font-size: .6rem;
|
||||
align-self: center;
|
||||
white-space: normal;
|
||||
color: var(--dm-muted-text-color) !important;
|
||||
}
|
||||
.description {
|
||||
display: -webkit-box !important;
|
||||
-webkit-line-clamp: 4;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.title {
|
||||
display: -webkit-box !important;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
img {
|
||||
z-index: -1;
|
||||
}
|
||||
.font-size-40 {
|
||||
font-size: 4rem;
|
||||
}
|
||||
.banner, img {
|
||||
animation: fadeIn ease .8s;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
button:hover {
|
||||
background: #292d33 !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<div class='pl-20 pb-20 justify-content-end d-flex flex-column h-full w-600 mw-full banner'>
|
||||
<div class='h-25 skeloader bg-dark-light w-500 mb-15 rounded'><div class='skeleloader-swipe' /></div>
|
||||
<div class='my-20 d-flex h-10 w-250 skeloader bg-dark-light rounded'><div class='skeleloader-swipe' /></div>
|
||||
<div class='h-10 w-450 skeloader bg-dark-light rounded mb-10'><div class='skeleloader-swipe' /></div>
|
||||
<div class='h-10 w-350 skeloader bg-dark-light rounded mb-10'><div class='skeleloader-swipe' /></div>
|
||||
<div class='h-10 w-300 skeloader bg-dark-light rounded mb-10'><div class='skeleloader-swipe' /></div>
|
||||
<div class='h-10 w-250 skeloader bg-dark-light rounded mb-10'><div class='skeleloader-swipe' /></div>
|
||||
<div class='my-20 d-flex h-10 w-150 skeloader bg-dark-light rounded'><div class='skeleloader-swipe' /></div>
|
||||
<div class='mb-20 h-25 w-200 skeloader bg-dark-light rounded'><div class='skeleloader-swipe' /></div>
|
||||
</div>
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<script>
|
||||
import SkeletonCard from './SkeletonCard.svelte'
|
||||
import SmallCard from './SmallCard.svelte'
|
||||
import EpisodeSkeletonCard from './EpisodeSkeletonCard.svelte'
|
||||
import FullCard from './FullCard.svelte'
|
||||
import EpisodeCard from './EpisodeCard.svelte'
|
||||
import FullSkeletonCard from './FullSkeletonCard.svelte'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
|
||||
export let card
|
||||
|
||||
const type = card.type || $settings.cards
|
||||
</script>
|
||||
|
||||
{#if type === 'episode'}
|
||||
|
||||
{#await card.data}
|
||||
<EpisodeSkeletonCard />
|
||||
{:then data}
|
||||
{#if data}
|
||||
<EpisodeCard {data} />
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
{:else if type === 'full'}
|
||||
|
||||
{#await card.data}
|
||||
<FullSkeletonCard />
|
||||
{:then media}
|
||||
{#if media}
|
||||
<FullCard {media} />
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
{:else} <!-- type === 'small' -->
|
||||
|
||||
{#await card.data}
|
||||
<SkeletonCard />
|
||||
{:then media}
|
||||
{#if media}
|
||||
<SmallCard {media} />
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
{/if}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
<script>
|
||||
import { statusColorMap } from '@/modules/anime.js'
|
||||
import EpisodePreviewCard from './EpisodePreviewCard.svelte'
|
||||
import { hoverClick } from '@/modules/click.js'
|
||||
import { since } from '@/modules/util'
|
||||
import { getContext } from 'svelte'
|
||||
export let data
|
||||
|
||||
let preview = false
|
||||
|
||||
const episodeThumbnail = data.episodeData?.image || data.media?.bannerImage || data.media?.coverImage?.extraLarge || ' '
|
||||
|
||||
const view = getContext('view')
|
||||
function viewMedia () {
|
||||
$view = data.media
|
||||
}
|
||||
function setHoverState (state) {
|
||||
preview = state
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='d-flex p-20 pb-10 position-relative' use:hoverClick={[data.onclick || viewMedia, setHoverState]}>
|
||||
{#if preview}
|
||||
<EpisodePreviewCard {data} />
|
||||
{/if}
|
||||
<div class='item d-flex flex-column h-full pointer content-visibility-auto'>
|
||||
<div class='image h-200 w-full position-relative rounded overflow-hidden d-flex justify-content-between align-items-end text-white' class:bg-black={episodeThumbnail === ' '}>
|
||||
<img loading='lazy' src={episodeThumbnail} alt='cover' class='cover-img w-full h-full position-absolute' style:--color={data.media?.coverImage?.color || '#1890ff'} />
|
||||
<div class='pl-10 pb-10 material-symbols-outlined filled z-10'>play_arrow</div>
|
||||
<div class='pr-15 pb-10 font-size-16 font-weight-medium z-10'>
|
||||
{#if data.media?.duration}
|
||||
{data.media.duration}m
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class='row pt-15'>
|
||||
<div class='col pr-10'>
|
||||
<div class='text-white font-weight-very-bold font-size-16 title overflow-hidden'>
|
||||
{#if data.media?.mediaListEntry?.status}
|
||||
<div style:--statusColor={statusColorMap[data.media.mediaListEntry.status]} class='list-status-circle d-inline-flex overflow-hidden mr-5' title={data.media.mediaListEntry.status} />
|
||||
{/if}
|
||||
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
||||
</div>
|
||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||
{data.episodeData?.title?.en || ''}
|
||||
</div>
|
||||
</div>
|
||||
{#if data.episode}
|
||||
<div class='col-auto d-flex flex-column align-items-end text-right'>
|
||||
<div class='text-white font-weight-bold'>
|
||||
Episode {data.episode}
|
||||
</div>
|
||||
{#if data.date}
|
||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||
{since(data.date)}
|
||||
</div>
|
||||
{:else if data.similarity}
|
||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||
{parseInt(data.similarity * 100)}%
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.material-symbols-outlined {
|
||||
font-size: 3rem;
|
||||
}
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.image:after {
|
||||
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 77.08%, rgba(0, 0, 0, 0.7) 100%);
|
||||
content:'';
|
||||
position:absolute;
|
||||
left:0; top:0;
|
||||
width:100%; height:100%;
|
||||
}
|
||||
.item {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 36rem;
|
||||
contain-intrinsic-height: 25.7rem;
|
||||
}
|
||||
.cover-img {
|
||||
background-color: var(--color) !important;
|
||||
}
|
||||
.list-status-circle {
|
||||
background: var(--statusColor);
|
||||
height: 1.1rem;
|
||||
width: 1.1rem;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
<script>
|
||||
import { statusColorMap, formatMap } from '@/modules/anime.js'
|
||||
import { since } from '@/modules/util'
|
||||
export let data
|
||||
|
||||
const media = data.media
|
||||
|
||||
const episodeThumbnail = data.episodeData?.image || media?.bannerImage || media?.coverImage.extraLarge || ' '
|
||||
let hide = true
|
||||
</script>
|
||||
|
||||
<div class='position-absolute w-400 mh-400 absolute-container top-0 m-auto bg-dark-light z-30 rounded overflow-hidden pointer d-flex flex-column'>
|
||||
<div class='image h-200 w-full position-relative d-flex justify-content-between align-items-end text-white' class:bg-black={episodeThumbnail === ' '}>
|
||||
<img loading='lazy' src={episodeThumbnail} alt='cover' class='img-cover w-full h-full position-absolute' style:--color={media?.coverImage.color || '#1890ff'} />
|
||||
{#if data.episodeData?.video}
|
||||
<video src={data.episodeData.video}
|
||||
class='w-full position-absolute left-0'
|
||||
class:d-none={hide}
|
||||
playsinline
|
||||
preload='none'
|
||||
loop
|
||||
muted
|
||||
on:loadeddata={() => { hide = false }}
|
||||
autoplay />
|
||||
{/if}
|
||||
<div class='pl-15 pb-10 material-symbols-outlined filled z-10'>play_arrow</div>
|
||||
<div class='pr-20 pb-10 font-size-16 font-weight-medium z-10'>
|
||||
{#if media?.duration}
|
||||
{media.duration}m
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class='w-full d-flex flex-column flex-grow-1 px-20 pb-15'>
|
||||
<div class='row pt-15'>
|
||||
<div class='col pr-10'>
|
||||
<div class='text-white font-weight-very-bold font-size-16 title overflow-hidden' title={data.media?.title.userPreferred || data.parseObject.anime_title}>
|
||||
{#if media?.mediaListEntry?.status}
|
||||
<div style:--statusColor={statusColorMap[media.mediaListEntry.status]} class='list-status-circle d-inline-flex overflow-hidden mr-5' title={media.mediaListEntry.status} />
|
||||
{/if}
|
||||
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
||||
</div>
|
||||
<div class='text-muted font-size-12 title overflow-hidden' title={data.episodeData?.title?.en}>
|
||||
{data.episodeData?.title?.en || ''}
|
||||
</div>
|
||||
</div>
|
||||
{#if data.episode}
|
||||
<div class='col-auto d-flex flex-column align-items-end text-right'>
|
||||
<div class='text-white font-weight-bold'>
|
||||
Episode {data.episode}
|
||||
</div>
|
||||
{#if data.date}
|
||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||
{since(data.date)}
|
||||
</div>
|
||||
{:else if data.similarity}
|
||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||
{parseInt(data.similarity * 100)}%
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class='w-full text-muted description overflow-hidden pt-15'>
|
||||
{data.episodeData?.description || media?.description?.replace(/<[^>]*>/g, '') || ''}
|
||||
</div>
|
||||
{#if media}
|
||||
<div class='d-flex flex-row pt-15 font-weight-medium justify-content-between w-full text-muted'>
|
||||
<div class='d-flex align-items-center' style='margin-left: -3px'>
|
||||
<span class='material-symbols-outlined font-size-24 pr-5'>calendar_month</span>
|
||||
{media.seasonYear || 'N/A'}
|
||||
</div>
|
||||
<div class='d-flex align-items-center'>
|
||||
{formatMap[media.format]}
|
||||
<span class='material-symbols-outlined font-size-24 pl-5'>monitor</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.material-symbols-outlined {
|
||||
font-size: 3rem;
|
||||
}
|
||||
.description {
|
||||
display: -webkit-box !important;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
@keyframes load-in {
|
||||
from {
|
||||
top: 1.2rem;
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
to {
|
||||
top: 0;
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.absolute-container {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
left: -100%;
|
||||
right: -100%;
|
||||
}
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.image:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0 ; bottom: 0;
|
||||
width: 100%; height: 100%;
|
||||
background: linear-gradient(180deg, #0000 0%, #25292f00 80%, #25292f 95%, #25292f 100%);
|
||||
}
|
||||
.list-status-circle {
|
||||
background: var(--statusColor);
|
||||
height: 1.1rem;
|
||||
width: 1.1rem;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<div class='d-flex p-20 pb-10 position-relative wrapper content-visibility-auto'>
|
||||
<div class='item d-flex flex-column h-full'>
|
||||
<div class='image h-200 w-full rounded skeloader bg-dark-light'><div class='skeleloader-swipe' /></div>
|
||||
<div class='row pt-15'>
|
||||
<div class='col-7'>
|
||||
<div class='h-10 skeloader w-150 bg-dark-light rounded '><div class='skeleloader-swipe' /></div>
|
||||
</div>
|
||||
<div class='col-5 d-flex flex-column align-items-end'>
|
||||
<div class='h-10 skeloader w-100 bg-dark-light mb-5 rounded'><div class='skeleloader-swipe' /></div>
|
||||
<div class='h-10 skeloader w-50 bg-dark-light rounded'><div class='skeleloader-swipe' /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.item {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 36rem
|
||||
}
|
||||
.wrapper {
|
||||
height: 28.7rem;
|
||||
contain-intrinsic-height: 28.7rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<script>
|
||||
export let promise
|
||||
</script>
|
||||
|
||||
{#await promise then data}
|
||||
{#if !data}
|
||||
<div class='p-20 d-flex align-items-center justify-content-center w-full' style='height:35rem;'>
|
||||
<div>
|
||||
<h1 class='mb-5 text-white font-weight-bold text-center'>
|
||||
Ooops!
|
||||
</h1>
|
||||
<div class='font-size-20 text-center text-muted'>
|
||||
Looks like there's nothing here.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{:catch error}
|
||||
<div class='p-20 d-flex align-items-center justify-content-center w-full' style='height:35rem;'>
|
||||
<div>
|
||||
<h1 class='mb-5 text-white font-weight-bold text-center'>
|
||||
Ooops!
|
||||
</h1>
|
||||
<div class='font-size-20 text-center text-muted'>
|
||||
Looks like something went wrong!.
|
||||
</div>
|
||||
<div class='font-size-20 text-center text-muted'>
|
||||
{error.message}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import { formatMap, statusColorMap } from '@/modules/anime.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
import { countdown } from '@/modules/util.js'
|
||||
import { page } from '@/App.svelte'
|
||||
export let media
|
||||
|
||||
const view = getContext('view')
|
||||
function viewMedia () {
|
||||
$view = media
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='d-flex px-20 py-10 position-relative' use:click={viewMedia}>
|
||||
<div class='card m-0 p-0 overflow-hidden pointer content-visibility-auto'
|
||||
style:--color={media.coverImage.color || '#1890ff'}>
|
||||
<div class='row h-full'>
|
||||
<div class='col-4'>
|
||||
<img loading='lazy' src={media.coverImage.extraLarge || ''} alt='cover' class='cover-img w-full h-full' />
|
||||
</div>
|
||||
<div class='col-8 h-full card-grid'>
|
||||
<div class='px-15 py-10 bg-very-dark'>
|
||||
<h5 class='m-0 text-white text-capitalize font-weight-bold'>
|
||||
{#if media.mediaListEntry?.status}
|
||||
<div style:--statusColor={statusColorMap[media.mediaListEntry.status]} class='list-status-circle d-inline-flex overflow-hidden mr-5' title={media.mediaListEntry.status} />
|
||||
{/if}
|
||||
{media.title.userPreferred}
|
||||
</h5>
|
||||
{#if $page === 'schedule'}
|
||||
<div class='py-5'>
|
||||
{#if media.airingSchedule?.nodes?.[0]?.airingAt}
|
||||
Episode {media.airingSchedule.nodes[0].episode } in
|
||||
<span class='font-weight-bold text-light'>
|
||||
{countdown(media.airingSchedule.nodes[0].airingAt - Date.now() / 1000)}
|
||||
</span>
|
||||
{:else}
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<p class='text-muted m-0 text-capitalize details'>
|
||||
<span class='text-nowrap'>
|
||||
{#if media.format === 'TV'}
|
||||
TV Show
|
||||
{:else if media.format}
|
||||
{formatMap[media.format]}
|
||||
{/if}
|
||||
</span>
|
||||
{#if media.episodes && media.episodes !== 1}
|
||||
<span class='text-nowrap'>
|
||||
{#if media.mediaListEntry?.status === 'CURRENT' && media.mediaListEntry?.progress }
|
||||
{media.mediaListEntry.progress} / {media.episodes} Episodes
|
||||
{:else}
|
||||
{media.episodes} Episodes
|
||||
{/if}
|
||||
</span>
|
||||
{:else if media.duration}
|
||||
<span class='text-nowrap'>{media.duration + ' Minutes'}</span>
|
||||
{/if}
|
||||
{#if media.status}
|
||||
<span class='text-nowrap'>{media.status?.toLowerCase().replace(/_/g, ' ')}</span>
|
||||
{/if}
|
||||
{#if media.season || media.seasonYear}
|
||||
<span class='text-nowrap'>
|
||||
{[media.season?.toLowerCase(), media.seasonYear].filter(s => s).join(' ')}
|
||||
</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<div class='overflow-y-auto px-15 pb-5 bg-very-dark card-desc pre-wrap'>
|
||||
{media.description?.replace(/<[^>]*>/g, '') || ''}
|
||||
</div>
|
||||
{#if media.genres.length}
|
||||
<div class='px-15 pb-10 pt-5 genres'>
|
||||
{#each media.genres.slice(0, 3) as genre}
|
||||
<span class='badge badge-pill badge-color text-dark mt-5 mr-5 font-weight-bold'>{genre}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.pre-wrap {
|
||||
white-space: pre-wrap
|
||||
}
|
||||
.details span + span::before {
|
||||
content: ' • ';
|
||||
white-space: normal;
|
||||
}
|
||||
.card {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 50rem !important;
|
||||
height: 27rem !important;
|
||||
box-shadow: rgba(0, 4, 12, 0.3) 0px 7px 15px, rgba(0, 4, 12, 0.05) 0px 4px 4px;
|
||||
contain-intrinsic-height: 27rem;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
.card:hover{
|
||||
transform: scale(1.05);
|
||||
}
|
||||
.card-grid {
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
}
|
||||
.badge-color {
|
||||
background-color: var(--color) !important;
|
||||
border-color: var(--color) !important;
|
||||
}
|
||||
.cover-img {
|
||||
background-color: var(--color) !important;
|
||||
}
|
||||
.list-status-circle {
|
||||
background: var(--statusColor);
|
||||
height: 1.1rem;
|
||||
width: 1.1rem;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<div class='d-flex px-20 py-10 position-relative content-visibility-auto'>
|
||||
<div class='card m-0 p-0 overflow-hidden'>
|
||||
<div class='row h-full'>
|
||||
<div class='col-4 skeloader bg-dark-light'><div class='skeleloader-swipe' /></div>
|
||||
<div class='col-8 bg-very-dark px-15 py-10'>
|
||||
<div class='skeloader bg-dark-light w-300 h-25 rounded bg-dark mt-15'><div class='skeleloader-swipe' /></div>
|
||||
<div class='skeloader bg-dark-light w-150 h-10 rounded bg-dark mt-15'><div class='skeleloader-swipe' /></div>
|
||||
<div class='skeloader bg-dark-light w-150 h-10 rounded bg-dark mt-15'><div class='skeleloader-swipe' /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.card {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 50rem !important;
|
||||
height: 27rem !important;
|
||||
contain-intrinsic-height: 27rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
<script>
|
||||
import { formatMap, setStatus, playMedia } from '@/modules/anime.js'
|
||||
import { alRequest } from '@/modules/anilist.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
export let media
|
||||
|
||||
let hide = true
|
||||
|
||||
function getPlayButtonText (media) {
|
||||
if (media.mediaListEntry) {
|
||||
const { status, progress } = media.mediaListEntry
|
||||
if (progress) {
|
||||
if (status === 'COMPLETED') {
|
||||
return 'Rewatch Now'
|
||||
} else {
|
||||
return 'Continue Now'
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'Watch Now'
|
||||
}
|
||||
const playButtonText = getPlayButtonText(media)
|
||||
async function toggleStatus () {
|
||||
if (!media.mediaListEntry) {
|
||||
// add
|
||||
const res = await setStatus('PLANNING', {}, media)
|
||||
media.mediaListEntry = res.data.SaveMediaListEntry
|
||||
} else {
|
||||
// delete
|
||||
alRequest({
|
||||
method: 'Delete',
|
||||
id: media.mediaListEntry.id
|
||||
})
|
||||
media.mediaListEntry = undefined
|
||||
}
|
||||
}
|
||||
function toggleFavourite () {
|
||||
alRequest({
|
||||
method: 'Favourite',
|
||||
id: media.id
|
||||
})
|
||||
media.isFavourite = !media.isFavourite
|
||||
}
|
||||
function play () {
|
||||
if (media.status === 'NOT_YET_RELEASED') return
|
||||
playMedia(media)
|
||||
}
|
||||
|
||||
function volume (video) {
|
||||
video.volume = 0.1
|
||||
}
|
||||
let muted = true
|
||||
function toggleMute () {
|
||||
muted = !muted
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='position-absolute w-350 h-400 absolute-container top-0 bottom-0 m-auto bg-dark-light z-30 rounded overflow-hidden pointer'>
|
||||
<div class='banner position-relative overflow-hidden bg-black'>
|
||||
<img src={media.bannerImage || ' '} alt='banner' class='img-cover w-full h-full' />
|
||||
{#if media.trailer?.id}
|
||||
<div class='material-symbols-outlined filled position-absolute z-10 top-0 right-0 p-15 font-size-22' class:d-none={hide} use:click={toggleMute}>{muted ? 'volume_off' : 'volume_up'}</div>
|
||||
<!-- for now we use some invidious instance, would be nice to somehow get these links outselves, this redirects straight to some google endpoint -->
|
||||
<!-- eslint-disable-next-line svelte/valid-compile -->
|
||||
<video src={`https://yewtu.be/latest_version?id=${media.trailer.id}&itag=18`}
|
||||
class='w-full position-absolute left-0'
|
||||
class:d-none={hide}
|
||||
playsinline
|
||||
preload='none'
|
||||
loop
|
||||
use:volume
|
||||
bind:muted
|
||||
on:loadeddata={() => { hide = false }}
|
||||
autoplay />
|
||||
<!-- <iframe
|
||||
class='w-full border-0 position-absolute left-0'
|
||||
class:d-none={hide}
|
||||
title={media.title.userPreferred}
|
||||
allow='autoplay'
|
||||
on:load={() => { hide = false }}
|
||||
src={`https://www.youtube-nocookie.com/embed/${media.trailer?.id}?autoplay=1&controls=0&mute=1&disablekb=1&loop=1&vq=medium&playlist=${media.trailer?.id}`}
|
||||
/> -->
|
||||
{/if}
|
||||
</div>
|
||||
<div class='w-full px-20'>
|
||||
<div class='font-size-24 font-weight-bold text-truncate d-inline-block w-full text-white' title={media.title.userPreferred}>
|
||||
{media.title.userPreferred}
|
||||
</div>
|
||||
<div class='d-flex flex-row pt-5'>
|
||||
<button class='btn btn-secondary flex-grow-1 text-dark font-weight-bold shadow-none border-0 d-flex align-items-center justify-content-center'
|
||||
use:click={play}
|
||||
disabled={media.status === 'NOT_YET_RELEASED'}>
|
||||
<span class='material-symbols-outlined font-size-20 filled pr-10'>
|
||||
play_arrow
|
||||
</span>
|
||||
{playButtonText}
|
||||
</button>
|
||||
<button class='btn btn-square ml-10 material-symbols-outlined font-size-16 shadow-none border-0' class:filled={media.isFavourite} use:click={toggleFavourite}>
|
||||
favorite
|
||||
</button>
|
||||
<button class='btn btn-square ml-10 material-symbols-outlined font-size-16 shadow-none border-0' class:filled={media.mediaListEntry} use:click={toggleStatus}>
|
||||
bookmark
|
||||
</button>
|
||||
</div>
|
||||
<div class='details text-white text-capitalize pt-15 pb-10 d-flex'>
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{#if media.format}
|
||||
{formatMap[media.format]}
|
||||
{/if}
|
||||
</span>
|
||||
{#if media.episodes && media.episodes !== 1}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{#if media.mediaListEntry?.status === 'CURRENT' && media.mediaListEntry?.progress }
|
||||
{media.mediaListEntry.progress} / {media.episodes} Episodes
|
||||
{:else}
|
||||
{media.episodes} Episodes
|
||||
{/if}
|
||||
</span>
|
||||
{:else if media.duration}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{media.duration + ' Minutes'}
|
||||
</span>
|
||||
{/if}
|
||||
{#if media.season || media.seasonYear}
|
||||
<span class='text-nowrap d-flex align-items-center'>
|
||||
{[media.season?.toLowerCase(), media.seasonYear].filter(s => s).join(' ')}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class='w-full h-full text-muted description overflow-hidden'>
|
||||
{media.description?.replace(/<[^>]*>/g, '')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.description {
|
||||
display: -webkit-box !important;
|
||||
-webkit-line-clamp: 4;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.details span + span::before {
|
||||
content: '•';
|
||||
padding: 0 .5rem;
|
||||
font-size: .6rem;
|
||||
align-self: center;
|
||||
white-space: normal;
|
||||
color: var(--dm-muted-text-color) !important;
|
||||
}
|
||||
.banner {
|
||||
height: 45%
|
||||
}
|
||||
.banner::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0 ; bottom: 0;
|
||||
width: 100%; height: 100% ;
|
||||
background: linear-gradient(180deg, #0000 0%, #25292f00 80%, #25292fe3 95%, #25292f 100%);
|
||||
}
|
||||
@keyframes load-in {
|
||||
from {
|
||||
bottom: -1.2rem;
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.absolute-container {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
left: -100%;
|
||||
right: -100%;
|
||||
}
|
||||
/* @keyframes delayedShow {
|
||||
to {
|
||||
visibility: visible;
|
||||
}
|
||||
} */
|
||||
|
||||
/* iframe {
|
||||
height: 200%;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
visibility: hidden;
|
||||
animation: 0s linear 0.5s forwards delayedShow ;
|
||||
} */
|
||||
</style>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<div class='d-flex p-20 wrapper content-visibility-auto'>
|
||||
<div class='item d-flex flex-column h-full'>
|
||||
<div class='img w-full rounded skeloader bg-dark-light'><div class='skeleloader-swipe' /></div>
|
||||
<div class='skeloader rounded bg-dark-light h-10 w-150 mt-15'><div class='skeleloader-swipe' /></div>
|
||||
<div class='skeloader rounded bg-dark-light h-10 w-100 mt-15'><div class='skeleloader-swipe' /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.img {
|
||||
height: 27rem;
|
||||
}
|
||||
.item {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 19rem
|
||||
}
|
||||
.wrapper {
|
||||
height: 40.6rem;
|
||||
contain-intrinsic-height: 40.6rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
<script>
|
||||
import { getContext } from 'svelte'
|
||||
import PreviewCard from './PreviewCard.svelte'
|
||||
import { formatMap, statusColorMap } from '@/modules/anime.js'
|
||||
import { hoverClick } from '@/modules/click.js'
|
||||
import { countdown } from '@/modules/util.js'
|
||||
|
||||
import { page } from '@/App.svelte'
|
||||
|
||||
export let media
|
||||
let preview = false
|
||||
|
||||
const view = getContext('view')
|
||||
function viewMedia () {
|
||||
$view = media
|
||||
}
|
||||
function setHoverState (state) {
|
||||
preview = state
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='d-flex p-20 position-relative first-check' use:hoverClick={[viewMedia, setHoverState]}>
|
||||
{#if preview}
|
||||
<PreviewCard {media} />
|
||||
{/if}
|
||||
<div class='item d-flex flex-column h-full pointer content-visibility-auto'>
|
||||
{#if $page === 'schedule'}
|
||||
<div class='w-full text-center pb-10'>
|
||||
{#if media.airingSchedule?.nodes?.[0]?.airingAt}
|
||||
Episode {media.airingSchedule.nodes[0].episode } in
|
||||
<span class='font-weight-bold text-light'>
|
||||
{countdown(media.airingSchedule.nodes[0].airingAt - Date.now() / 1000)}
|
||||
</span>
|
||||
{:else}
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<img loading='lazy' src={media.coverImage.extraLarge || ''} alt='cover' class='cover-img w-full rounded' style:--color={media.coverImage.color || '#1890ff'} />
|
||||
<div class='text-white font-weight-very-bold font-size-16 pt-15 title overflow-hidden'>
|
||||
{#if media.mediaListEntry?.status}
|
||||
<div style:--statusColor={statusColorMap[media.mediaListEntry.status]} class='list-status-circle d-inline-flex overflow-hidden mr-5' title={media.mediaListEntry.status} />
|
||||
{/if}
|
||||
{media.title.userPreferred}
|
||||
</div>
|
||||
<div class='d-flex flex-row mt-auto pt-10 font-weight-medium justify-content-between w-full text-muted'>
|
||||
<div class='d-flex align-items-center' style='margin-left: -3px'>
|
||||
<span class='material-symbols-outlined font-size-24 pr-5'>calendar_month</span>
|
||||
{media.seasonYear || 'N/A'}
|
||||
</div>
|
||||
<div class='d-flex align-items-center'>
|
||||
{formatMap[media.format]}
|
||||
<span class='material-symbols-outlined font-size-24 pl-5'>monitor</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.first-check:first-child :global(.absolute-container) {
|
||||
left: -48% !important
|
||||
}
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
img {
|
||||
height: 27rem;
|
||||
}
|
||||
.item {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
width: 19rem;
|
||||
contain-intrinsic-height: 36.7rem;
|
||||
}
|
||||
.cover-img {
|
||||
background-color: var(--color) !important;
|
||||
}
|
||||
.list-status-circle {
|
||||
background: var(--statusColor);
|
||||
height: 1.1rem;
|
||||
width: 1.1rem;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
198
common/css.css
|
|
@ -1,198 +0,0 @@
|
|||
:root {
|
||||
--accent-color: #e5204c;
|
||||
--dm-link-text-color: var(--dm-muted-text-color) !important;
|
||||
--dm-link-text-color-hover: var(--dm-text-color) !important;
|
||||
--base-html-font-size: 50%;
|
||||
--base-html-font-size-1600: 50%;
|
||||
--base-html-font-size-1920: 62.5%;
|
||||
--tooltip-width: 17rem;
|
||||
--card-border-width: 0;
|
||||
--sidebar-border-width: 0;
|
||||
--input-border-width: 0;
|
||||
--sidebar-minimised: 0px;
|
||||
--sidebar-width: 0px;
|
||||
--navbar-height: 7rem;
|
||||
--dark-color-base-hue: 220deg !important;
|
||||
--dark-color-base-saturation: 10% !important;
|
||||
--dark-color-hsl: var(--dark-color-base-hue), var(--dark-color-base-saturation), 10% !important;
|
||||
--dark-color-light: #25292F !important;
|
||||
--dm-shadow: 0px 4px 7px rgba(0, 0, 0, 0.25);
|
||||
--dm-input-border-color: none;
|
||||
--gray-color-light: hsl(var(--gray-color-light-hsl));
|
||||
--gray-color-light-hsl: var(--gray-color-base-hue), 10%, 28%;
|
||||
--gray-color-base-hue: 216;
|
||||
--safe-area-top: 0px;
|
||||
--safe-area-left: 0px;
|
||||
color-scheme: dark;
|
||||
}
|
||||
.dark-mode {
|
||||
background-color: var(--dark-color) !important;
|
||||
}
|
||||
|
||||
@media (min-width: 769px) {
|
||||
:root {
|
||||
--sidebar-minimised: 7rem;
|
||||
--sidebar-width: 7rem;
|
||||
--navbar-height: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
--dm-button-secondary-bg-color: #fff !important;
|
||||
--dm-button-secondary-bg-color-hover: #ddd !important;
|
||||
--dm-button-secondary-bg-color-focus: var(--dm-button-secondary-bg-color) !important;
|
||||
}
|
||||
|
||||
[data-sonner-toaster][data-theme='dark'] {
|
||||
--normal-bg: var(--dark-color) !important;
|
||||
--normal-border: none !important;
|
||||
--normal-text: var(--dm-base-text-color) !important;
|
||||
|
||||
/* --success-bg: var(--success-color) !important; */
|
||||
--success-border: none !important;
|
||||
/* --success-text: var(--lm-base-text-color) !important; */
|
||||
|
||||
/* --error-bg: hsl(358, 76%, 10%); */
|
||||
--error-border: none !important;
|
||||
/* --error-text: hsl(358, 100%, 81%); */
|
||||
}
|
||||
|
||||
.z-100 {
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
font-family: "Material Symbols Outlined Variable";
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-feature-settings: "liga";
|
||||
font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 64;
|
||||
}
|
||||
|
||||
.filled {
|
||||
font-variation-settings: 'FILL' 1;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.h-10 {
|
||||
height: 1rem !important;
|
||||
}
|
||||
.h-25 {
|
||||
height: 2.5rem !important;
|
||||
}
|
||||
|
||||
body {
|
||||
scroll-behavior: smooth;
|
||||
overscroll-behavior: none;
|
||||
user-select: none;
|
||||
font-family: 'Nunito Variable'
|
||||
}
|
||||
|
||||
.font-weight-very-bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.bg-black {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
img {
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
.select-all {
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
img[src=''], img[src=' '] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
*:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: var(--dm-button-primary-box-shadow-focus) !important;
|
||||
}
|
||||
|
||||
.modal:focus-visible {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.root {
|
||||
animation: 0.3s ease 0s 1 load-in;
|
||||
}
|
||||
|
||||
.content-visibility-auto {
|
||||
content-visibility: auto;
|
||||
}
|
||||
|
||||
.nav-hidden > .content-wrapper {
|
||||
left: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
@keyframes skeleloader {
|
||||
from {
|
||||
background-position-x: 200%;
|
||||
}
|
||||
|
||||
to {
|
||||
background-position-x: -100%;
|
||||
}
|
||||
}
|
||||
@keyframes load-in {
|
||||
from {
|
||||
transform: translateY(1.2rem) scale(0.95);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: none
|
||||
}
|
||||
}
|
||||
|
||||
.skeloader {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.skeloader .skeleloader-swipe {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: linear-gradient(to right, transparent 0%, #17191c 50%, transparent 100%);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 200% 100%;
|
||||
animation: skeleloader 1s infinite cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.align-content-start {
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.cover-img {
|
||||
object-fit: cover;
|
||||
}
|
||||
.pre-wrap {
|
||||
white-space: pre-wrap
|
||||
}
|
||||
|
||||
.px-50 {
|
||||
padding-left: 5rem;
|
||||
padding-right: 5rem;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
},
|
||||
"checkJs": true,
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"module": "ESNext",
|
||||
"types": ["./types.d.ts"],
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"exclude": ["node_modules/**", "**/node_modules", "dist", "build"]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import App from './App.svelte'
|
||||
import 'quartermoon/css/quartermoon-variables.css'
|
||||
import '@fontsource-variable/material-symbols-outlined/full.css'
|
||||
import '@fontsource-variable/nunito'
|
||||
import '@fontsource/roboto'
|
||||
import './css.css'
|
||||
|
||||
export default new App({ target: document.body })
|
||||
|
|
@ -1,540 +0,0 @@
|
|||
import lavenshtein from 'js-levenshtein'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
import Bottleneck from 'bottleneck'
|
||||
|
||||
import { alToken } from '@/modules/settings.js'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { sleep } from './util.js'
|
||||
|
||||
const codes = {
|
||||
400: 'Bad Request',
|
||||
401: 'Unauthorized',
|
||||
402: 'Payment Required',
|
||||
403: 'Forbidden',
|
||||
404: 'Not Found',
|
||||
405: 'Method Not Allowed',
|
||||
406: 'Not Acceptable',
|
||||
407: 'Proxy Authentication Required',
|
||||
408: 'Request Time-out',
|
||||
409: 'Conflict',
|
||||
410: 'Gone',
|
||||
411: 'Length Required',
|
||||
412: 'Precondition Failed',
|
||||
413: 'Request Entity Too Large',
|
||||
414: 'Request-URI Too Large',
|
||||
415: 'Unsupported Media Type',
|
||||
416: 'Requested Range Not Satisfiable',
|
||||
417: 'Expectation Failed',
|
||||
418: 'I\'m a teapot',
|
||||
422: 'Unprocessable Entity',
|
||||
423: 'Locked',
|
||||
424: 'Failed Dependency',
|
||||
425: 'Unordered Collection',
|
||||
426: 'Upgrade Required',
|
||||
428: 'Precondition Required',
|
||||
429: 'Too Many Requests',
|
||||
431: 'Request Header Fields Too Large',
|
||||
500: 'Internal Server Error',
|
||||
501: 'Not Implemented',
|
||||
502: 'Bad Gateway',
|
||||
503: 'Service Unavailable',
|
||||
504: 'Gateway Time-out',
|
||||
505: 'HTTP Version Not Supported',
|
||||
506: 'Variant Also Negotiates',
|
||||
507: 'Insufficient Storage',
|
||||
509: 'Bandwidth Limit Exceeded',
|
||||
510: 'Not Extended',
|
||||
511: 'Network Authentication Required'
|
||||
}
|
||||
|
||||
const limiter = new Bottleneck({
|
||||
reservoir: 90,
|
||||
reservoirRefreshAmount: 90,
|
||||
reservoirRefreshInterval: 60 * 1000,
|
||||
maxConcurrent: 10,
|
||||
minTime: 100
|
||||
})
|
||||
|
||||
let rl = null
|
||||
|
||||
limiter.on('failed', async (error, jobInfo) => {
|
||||
printError(error)
|
||||
|
||||
if (!error.statusText) {
|
||||
if (!rl) rl = sleep(61 * 1000).then(() => { rl = null })
|
||||
return 61 * 1000
|
||||
}
|
||||
const time = ((error.headers.get('retry-after') || 60) + 1) * 1000
|
||||
if (!rl) rl = sleep(time).then(() => { rl = null })
|
||||
return time
|
||||
})
|
||||
|
||||
const handleRequest = limiter.wrap(async opts => {
|
||||
await rl
|
||||
let res = {}
|
||||
try {
|
||||
res = await fetch('https://graphql.anilist.co', opts)
|
||||
} catch (e) {
|
||||
if (!res || res.status !== 404) throw e
|
||||
}
|
||||
if (!res.ok && res.status === 429) {
|
||||
throw res
|
||||
}
|
||||
let json = null
|
||||
try {
|
||||
json = await res.json()
|
||||
} catch (error) {
|
||||
if (res.ok) printError(error)
|
||||
}
|
||||
if (!res.ok) {
|
||||
if (json) {
|
||||
for (const error of json?.errors || []) {
|
||||
printError(error)
|
||||
}
|
||||
} else {
|
||||
printError(res)
|
||||
}
|
||||
}
|
||||
return json
|
||||
})
|
||||
|
||||
export let alID = null
|
||||
if (alToken) {
|
||||
alID = alRequest({ method: 'Viewer', token: alToken }).then(result => {
|
||||
const lists = result?.data?.Viewer?.mediaListOptions?.animeList?.customLists || []
|
||||
if (!lists.includes('Watched using Miru')) {
|
||||
alRequest({ method: 'CustomList', lists })
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
function printError (error) {
|
||||
console.warn(error)
|
||||
toast.error('Search Failed', {
|
||||
description: `Failed making request to anilist!\nTry again in a minute.\n${error.status || 429} - ${error.message || codes[error.status || 429]}`,
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
|
||||
export async function alEntry (filemedia) {
|
||||
// check if values exist
|
||||
if (filemedia.media && alToken) {
|
||||
const { media } = filemedia
|
||||
// check if media can even be watched, ex: it was resolved incorrectly
|
||||
if (media.status === 'FINISHED' || media.status === 'RELEASING') {
|
||||
// some anime/OVA's can have a single episode, or some movies can have multiple episodes
|
||||
const singleEpisode = (!media.episodes || (media.format === 'MOVIE' && media.episodes === 1)) && 1
|
||||
const videoEpisode = Number(filemedia.episode) || singleEpisode
|
||||
const mediaEpisode = media.episodes || media.nextAiringEpisode?.episode || singleEpisode
|
||||
// check episode range
|
||||
if (videoEpisode && mediaEpisode && (mediaEpisode >= videoEpisode)) {
|
||||
// check user's own watch progress
|
||||
const lists = media.mediaListEntry?.customLists.filter(list => list.enabled).map(list => list.name) || []
|
||||
|
||||
const status = media.mediaListEntry?.status === 'REPEATING' ? 'REPEATING' : 'CURRENT'
|
||||
|
||||
if (!media.mediaListEntry || (media.mediaListEntry?.progress <= videoEpisode) || singleEpisode) {
|
||||
const variables = {
|
||||
method: 'Entry',
|
||||
repeat: media.mediaListEntry?.repeat || 0,
|
||||
id: media.id,
|
||||
status,
|
||||
episode: videoEpisode,
|
||||
lists
|
||||
}
|
||||
if (videoEpisode === mediaEpisode) {
|
||||
variables.status = 'COMPLETED'
|
||||
if (media.mediaListEntry?.status === 'REPEATING') variables.repeat = media.mediaListEntry.repeat + 1
|
||||
}
|
||||
if (!lists.includes('Watched using Miru')) {
|
||||
variables.lists.push('Watched using Miru')
|
||||
}
|
||||
await alRequest(variables)
|
||||
userLists.value = alRequest({ method: 'UserLists' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const date = new Date()
|
||||
export const currentSeason = ['WINTER', 'SPRING', 'SUMMER', 'FALL'][Math.floor((date.getMonth() / 12) * 4) % 4]
|
||||
export const currentYear = date.getFullYear()
|
||||
|
||||
function getDistanceFromTitle (media, name) {
|
||||
if (media) {
|
||||
const titles = Object.values(media.title).filter(v => v).map(title => lavenshtein(title.toLowerCase(), name.toLowerCase()))
|
||||
const synonyms = media.synonyms.filter(v => v).map(title => lavenshtein(title.toLowerCase(), name.toLowerCase()) + 2)
|
||||
const distances = [...titles, ...synonyms]
|
||||
const min = distances.reduce((prev, curr) => prev < curr ? prev : curr)
|
||||
media.lavenshtein = min
|
||||
return media
|
||||
}
|
||||
}
|
||||
|
||||
export async function alSearch (method) {
|
||||
const res = await alRequest(method)
|
||||
const media = res.data.Page.media.map(media => getDistanceFromTitle(media, method.name))
|
||||
if (!media.length) return res
|
||||
const lowest = media.reduce((prev, curr) => prev.lavenshtein <= curr.lavenshtein ? prev : curr)
|
||||
return { data: { Page: { media: [lowest] } } }
|
||||
}
|
||||
|
||||
const queryObjects = /* js */`
|
||||
id,
|
||||
idMal,
|
||||
title {
|
||||
romaji,
|
||||
english,
|
||||
native,
|
||||
userPreferred
|
||||
},
|
||||
description(asHtml: false),
|
||||
season,
|
||||
seasonYear,
|
||||
format,
|
||||
status,
|
||||
episodes,
|
||||
duration,
|
||||
averageScore,
|
||||
genres,
|
||||
isFavourite,
|
||||
coverImage{
|
||||
extraLarge,
|
||||
medium,
|
||||
color
|
||||
},
|
||||
countryOfOrigin,
|
||||
isAdult,
|
||||
bannerImage,
|
||||
synonyms,
|
||||
nextAiringEpisode{
|
||||
timeUntilAiring,
|
||||
episode
|
||||
},
|
||||
startDate{
|
||||
year,
|
||||
month,
|
||||
day
|
||||
},
|
||||
trailer{
|
||||
id,
|
||||
site
|
||||
},
|
||||
streamingEpisodes{
|
||||
title,
|
||||
thumbnail
|
||||
},
|
||||
mediaListEntry{
|
||||
id,
|
||||
progress,
|
||||
repeat,
|
||||
status,
|
||||
customLists(asArray: true),
|
||||
score(format: POINT_10)
|
||||
},
|
||||
source,
|
||||
studios(isMain: true){
|
||||
nodes {
|
||||
name
|
||||
}
|
||||
},
|
||||
airingSchedule(page: 1, perPage: 1, notYetAired: true){
|
||||
nodes {
|
||||
episode,
|
||||
airingAt
|
||||
}
|
||||
},
|
||||
relations {
|
||||
edges {
|
||||
relationType(version:2),
|
||||
node {
|
||||
id,
|
||||
title{userPreferred},
|
||||
coverImage{medium},
|
||||
type,
|
||||
status,
|
||||
format,
|
||||
episodes,
|
||||
synonyms,
|
||||
season,
|
||||
seasonYear,
|
||||
startDate{
|
||||
year,
|
||||
month,
|
||||
day
|
||||
},
|
||||
endDate{
|
||||
year,
|
||||
month,
|
||||
day
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
recommendations{
|
||||
edges{
|
||||
node{
|
||||
mediaRecommendation{
|
||||
id,
|
||||
title{
|
||||
userPreferred
|
||||
},
|
||||
coverImage{
|
||||
medium
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
export async function alRequest (opts) {
|
||||
let query
|
||||
const variables = {
|
||||
...opts,
|
||||
sort: opts.sort || 'TRENDING_DESC',
|
||||
page: opts.page || 1,
|
||||
perPage: opts.perPage || 30,
|
||||
status_in: opts.status_in || '[CURRENT,PLANNING]'
|
||||
}
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
}
|
||||
}
|
||||
if (alToken) options.headers.Authorization = alToken
|
||||
switch (opts.method) {
|
||||
case 'SearchName': {
|
||||
variables.search = opts.name
|
||||
variables.isAdult = variables.isAdult ?? false
|
||||
query = /* js */`
|
||||
query($page: Int, $perPage: Int, $sort: [MediaSort], $search: String, $status: [MediaStatus], $year: Int, $isAdult: Boolean){
|
||||
Page(page: $page, perPage: $perPage){
|
||||
pageInfo{
|
||||
hasNextPage
|
||||
},
|
||||
media(type: ANIME, search: $search, sort: $sort, status_in: $status, isAdult: $isAdult, format_not: MUSIC, seasonYear: $year){
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'SearchIDSingle': {
|
||||
query = /* js */`
|
||||
query($id: Int){
|
||||
Media(id: $id, type: ANIME){
|
||||
${queryObjects}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'SearchIDS': {
|
||||
query = /* js */`
|
||||
query($id: [Int], $page: Int, $perPage: Int, $status: [MediaStatus], $onList: Boolean, $sort: [MediaSort], $search: String, $season: MediaSeason, $year: Int, $genre: String, $format: MediaFormat){
|
||||
Page(page: $page, perPage: $perPage){
|
||||
pageInfo{
|
||||
hasNextPage
|
||||
},
|
||||
media(id_in: $id, type: ANIME, status_in: $status, onList: $onList, search: $search, sort: $sort, season: $season, seasonYear: $year, genre: $genre, format: $format){
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Viewer': {
|
||||
variables.id = alToken
|
||||
query = /* js */`
|
||||
query{
|
||||
Viewer{
|
||||
avatar{
|
||||
medium
|
||||
},
|
||||
name,
|
||||
id,
|
||||
mediaListOptions{
|
||||
animeList{
|
||||
customLists
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'UserLists': {
|
||||
const userId = (await alID)?.data?.Viewer.id
|
||||
variables.id = userId
|
||||
query = /* js */`
|
||||
query($id: Int){
|
||||
MediaListCollection(userId: $id, type: ANIME, forceSingleCompletedList: true) {
|
||||
lists {
|
||||
status,
|
||||
entries {
|
||||
media {
|
||||
id,
|
||||
status,
|
||||
mediaListEntry {
|
||||
progress
|
||||
},
|
||||
nextAiringEpisode {
|
||||
episode
|
||||
},
|
||||
relations {
|
||||
edges {
|
||||
relationType(version:2)
|
||||
node {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'SearchIDStatus': {
|
||||
const userId = (await alID)?.data?.Viewer.id
|
||||
variables.id = userId
|
||||
variables.mediaId = opts.id
|
||||
query = /* js */`
|
||||
query($id: Int, $mediaId: Int){
|
||||
MediaList(userId: $id, mediaId: $mediaId){
|
||||
status,
|
||||
progress,
|
||||
repeat
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'AiringSchedule': {
|
||||
variables.to = (variables.from + 7 * 24 * 60 * 60)
|
||||
query = /* js */`
|
||||
query($page: Int, $perPage: Int, $from: Int, $to: Int){
|
||||
Page(page: $page, perPage: $perPage){
|
||||
pageInfo{
|
||||
hasNextPage
|
||||
},
|
||||
airingSchedules(airingAt_greater: $from, airingAt_lesser: $to){
|
||||
episode,
|
||||
timeUntilAiring,
|
||||
airingAt,
|
||||
media{
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Episodes': {
|
||||
query = /* js */`
|
||||
query($id: Int){
|
||||
Page(page: 1, perPage: 1000){
|
||||
airingSchedules(mediaId: $id){
|
||||
airingAt,
|
||||
episode
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Search': {
|
||||
variables.sort = opts.sort || 'SEARCH_MATCH'
|
||||
query = /* js */`
|
||||
query($page: Int, $perPage: Int, $sort: [MediaSort], $search: String, $onList: Boolean, $status: MediaStatus, $season: MediaSeason, $year: Int, $genre: String, $format: MediaFormat){
|
||||
Page(page: $page, perPage: $perPage){
|
||||
pageInfo{
|
||||
hasNextPage
|
||||
},
|
||||
media(type: ANIME, search: $search, sort: $sort, onList: $onList, status: $status, season: $season, seasonYear: $year, genre: $genre, format: $format, format_not: MUSIC){
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Entry': {
|
||||
query = /* js */`
|
||||
mutation($lists: [String], $id: Int, $status: MediaListStatus, $episode: Int, $repeat: Int, $score: Int){
|
||||
SaveMediaListEntry(mediaId: $id, status: $status, progress: $episode, repeat: $repeat, scoreRaw: $score, customLists: $lists){
|
||||
id,
|
||||
status,
|
||||
progress,
|
||||
repeat
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'EpisodeDate': {
|
||||
query = /* js */`
|
||||
query($id: Int, $ep: Int) {
|
||||
AiringSchedule(mediaId: $id, episode: $ep) {
|
||||
airingAt
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Delete': {
|
||||
query = /* js */`
|
||||
mutation($id: Int){
|
||||
DeleteMediaListEntry(id: $id){
|
||||
deleted
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'Favourite': {
|
||||
query = /* js */`
|
||||
mutation($id: Int){
|
||||
ToggleFavourite(animeId: $id){ anime { nodes { id } } }
|
||||
}`
|
||||
break
|
||||
} case 'Following': {
|
||||
query = /* js */`
|
||||
query($id: Int){
|
||||
Page{
|
||||
pageInfo{
|
||||
total,
|
||||
perPage,
|
||||
currentPage,
|
||||
lastPage,
|
||||
hasNextPage
|
||||
},
|
||||
mediaList(mediaId: $id, isFollowing: true, sort: UPDATED_TIME_DESC){
|
||||
id,
|
||||
status,
|
||||
score,
|
||||
progress,
|
||||
user{
|
||||
id,
|
||||
name,
|
||||
avatar{
|
||||
medium
|
||||
},
|
||||
mediaListOptions{
|
||||
scoreFormat
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
break
|
||||
} case 'CustomList':{
|
||||
variables.lists = [...opts.lists, 'Watched using Miru']
|
||||
query = /* js */`
|
||||
mutation($lists: [String]){
|
||||
UpdateUser(animeListOptions: { customLists: $lists }){
|
||||
id
|
||||
}
|
||||
}`
|
||||
break
|
||||
}
|
||||
}
|
||||
options.body = JSON.stringify({
|
||||
query: query.replace(/\s/g, ''),
|
||||
variables
|
||||
})
|
||||
|
||||
return handleRequest(options)
|
||||
}
|
||||
|
||||
export const userLists = writable(alToken && alRequest({ method: 'UserLists' }))
|
||||
|
||||
if (alToken) {
|
||||
// update userLists every 15 mins
|
||||
setInterval(() => { userLists.value = alRequest({ method: 'UserLists' }) }, 1000 * 60 * 15)
|
||||
}
|
||||
|
|
@ -1,461 +0,0 @@
|
|||
import { DOMPARSER, PromiseBatch, binarySearch } from './util.js'
|
||||
import { alRequest, alSearch } from './anilist.js'
|
||||
import _anitomyscript from 'anitomyscript'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import SectionsManager from './sections.js'
|
||||
import { page } from '@/App.svelte'
|
||||
import clipboard from './clipboard.js'
|
||||
|
||||
import { search, key } from '@/views/Search.svelte'
|
||||
|
||||
import { playAnime } from '../views/RSSView.svelte'
|
||||
|
||||
const imageRx = /\.(jpeg|jpg|gif|png|webp)/i
|
||||
|
||||
clipboard.on('files', ({ detail }) => {
|
||||
for (const file of detail) {
|
||||
if (file.type.startsWith('image')) {
|
||||
toast.promise(traceAnime(file), {
|
||||
description: 'You can also paste an URL to an image.',
|
||||
loading: 'Looking up anime for image...',
|
||||
success: 'Found anime for image!',
|
||||
error: 'Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
clipboard.on('text', ({ detail }) => {
|
||||
for (const { type, text } of detail) {
|
||||
let src = null
|
||||
if (type === 'text/html') {
|
||||
src = DOMPARSER(text, 'text/html').querySelectorAll('img')[0]?.src
|
||||
} else if (imageRx.exec(text)) {
|
||||
src = text
|
||||
}
|
||||
if (src) {
|
||||
toast.promise(traceAnime(src), {
|
||||
description: 'You can also paste an URL to an image.',
|
||||
loading: 'Looking up anime for image...',
|
||||
success: 'Found anime for image!',
|
||||
error: 'Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export async function traceAnime (image) { // WAIT lookup logic
|
||||
let options
|
||||
let url = `https://api.trace.moe/search?cutBorders&url=${image}`
|
||||
if (image instanceof Blob) {
|
||||
options = {
|
||||
method: 'POST',
|
||||
body: image,
|
||||
headers: { 'Content-type': image.type }
|
||||
}
|
||||
url = 'https://api.trace.moe/search'
|
||||
}
|
||||
const res = await fetch(url, options)
|
||||
const { result } = await res.json()
|
||||
|
||||
if (result?.length) {
|
||||
const ids = result.map(({ anilist }) => anilist)
|
||||
search.value = {
|
||||
clearNext: true,
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) }).then(res => {
|
||||
for (const index in res.data?.Page?.media) {
|
||||
const media = res.data.Page.media[index]
|
||||
const counterpart = result.find(({ anilist }) => anilist === media.id)
|
||||
res.data.Page.media[index] = {
|
||||
media,
|
||||
episode: counterpart.episode,
|
||||
similarity: counterpart.similarity,
|
||||
episodeData: {
|
||||
image: counterpart.image,
|
||||
video: counterpart.video
|
||||
}
|
||||
}
|
||||
}
|
||||
res.data?.Page?.media.sort((a, b) => b.similarity - a.similarity)
|
||||
return res
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, result.length, 'episode')
|
||||
}
|
||||
}
|
||||
key.value = {}
|
||||
page.value = 'search'
|
||||
} else {
|
||||
throw new Error('Search Failed \n Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.')
|
||||
}
|
||||
}
|
||||
|
||||
function constructChapters (results, duration) {
|
||||
const chapters = results.map(result => {
|
||||
const diff = duration - result.episodeLength
|
||||
return {
|
||||
start: (result.interval.startTime + diff) * 1000,
|
||||
end: (result.interval.endTime + diff) * 1000,
|
||||
text: result.skipType.toUpperCase()
|
||||
}
|
||||
})
|
||||
const ed = chapters.find(({ text }) => text === 'ED')
|
||||
const recap = chapters.find(({ text }) => text === 'RECAP')
|
||||
if (recap) recap.text = 'Recap'
|
||||
|
||||
chapters.sort((a, b) => a - b)
|
||||
if ((chapters[0].start | 0) !== 0) {
|
||||
chapters.unshift({ start: 0, end: chapters[0].start, text: chapters[0].text === 'OP' ? 'Intro' : 'Episode' })
|
||||
}
|
||||
if (ed) {
|
||||
if ((ed.end | 0) + 5000 - duration * 1000 < 0) {
|
||||
chapters.push({ start: ed.end, end: duration * 1000, text: 'Preview' })
|
||||
}
|
||||
} else if ((chapters[chapters.length - 1].end | 0) + 5000 - duration * 1000 < 0) {
|
||||
chapters.push({
|
||||
start: chapters[chapters.length - 1].end,
|
||||
end: duration * 1000,
|
||||
text: 'Episode'
|
||||
})
|
||||
}
|
||||
|
||||
for (let i = 0, len = chapters.length - 2; i <= len; ++i) {
|
||||
const current = chapters[i]
|
||||
const next = chapters[i + 1]
|
||||
if ((current.end | 0) !== (next.start | 0)) {
|
||||
chapters.push({
|
||||
start: current.end,
|
||||
end: next.start,
|
||||
text: 'Episode'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
chapters.sort((a, b) => a.start - b.start)
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
||||
export async function getChaptersAniSkip (file, duration) {
|
||||
const resAccurate = await fetch(`https://api.aniskip.com/v2/skip-times/${file.media.media.idMal}/${file.media.episode}/?episodeLength=${duration}&types=op&types=ed&types=recap`)
|
||||
const jsonAccurate = await resAccurate.json()
|
||||
|
||||
const resRough = await fetch(`https://api.aniskip.com/v2/skip-times/${file.media.media.idMal}/${file.media.episode}/?episodeLength=0&types=op&types=ed&types=recap`)
|
||||
const jsonRough = await resRough.json()
|
||||
|
||||
const map = {}
|
||||
for (const result of [...jsonAccurate.results, ...jsonRough.results]) {
|
||||
map[result.skipType] ||= result
|
||||
}
|
||||
|
||||
const results = Object.values(map)
|
||||
if (!results.length) return []
|
||||
return constructChapters(results, duration)
|
||||
}
|
||||
|
||||
export function getMediaMaxEp (media, playable) {
|
||||
if (playable) {
|
||||
return media.nextAiringEpisode?.episode - 1 || media.airingSchedule?.nodes?.[0]?.episode - 1 || media.episodes
|
||||
} else {
|
||||
return media.episodes || media.nextAiringEpisode?.episode - 1 || media.airingSchedule?.nodes?.[0]?.episode - 1
|
||||
}
|
||||
}
|
||||
|
||||
// resolve anime name based on file name and store it
|
||||
const postfix = {
|
||||
1: 'st',
|
||||
2: 'nd',
|
||||
3: 'rd'
|
||||
}
|
||||
|
||||
async function resolveTitle (parseObject) {
|
||||
const name = parseObject.anime_title
|
||||
const method = { name, method: 'SearchName', perPage: 10, status: ['RELEASING', 'FINISHED'], sort: 'SEARCH_MATCH' }
|
||||
if (parseObject.anime_year) method.year = parseObject.anime_year
|
||||
|
||||
// inefficient but readable
|
||||
|
||||
let media = null
|
||||
try {
|
||||
// change S2 into Season 2 or 2nd Season
|
||||
const match = method.name.match(/ S(\d+)/)
|
||||
const oldname = method.name
|
||||
if (match) {
|
||||
if (Number(match[1]) === 1) { // if this is S1, remove the " S1" or " S01"
|
||||
method.name = method.name.replace(/ S(\d+)/, '')
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
} else {
|
||||
method.name = method.name.replace(/ S(\d+)/, ` ${Number(match[1])}${postfix[Number(match[1])] || 'th'} Season`)
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
if (!media) {
|
||||
method.name = oldname.replace(/ S(\d+)/, ` Season ${Number(match[1])}`)
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
}
|
||||
|
||||
// remove - :
|
||||
if (!media) {
|
||||
const match = method.name.match(/[-:]/g)
|
||||
if (match) {
|
||||
method.name = method.name.replace(/[-:]/g, '')
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
}
|
||||
}
|
||||
// remove (TV)
|
||||
if (!media) {
|
||||
const match = method.name.match(/\(TV\)/)
|
||||
if (match) {
|
||||
method.name = method.name.replace('(TV)', '')
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
}
|
||||
}
|
||||
// check adult
|
||||
if (!media) {
|
||||
method.isAdult = true
|
||||
media = (await alSearch(method)).data.Page.media[0]
|
||||
}
|
||||
} catch (e) { }
|
||||
|
||||
if (media) relations[getRelationKey(parseObject)] = media
|
||||
}
|
||||
|
||||
// utility method for correcting anitomyscript woes for what's needed
|
||||
export async function anitomyscript (...args) {
|
||||
// @ts-ignore
|
||||
const res = await _anitomyscript(...args)
|
||||
|
||||
const parseObjs = Array.isArray(res) ? res : [res]
|
||||
|
||||
for (const obj of parseObjs) {
|
||||
obj.anime_title ??= ''
|
||||
const seasonMatch = obj.anime_title.match(/S(\d{2})E(\d{2})/)
|
||||
if (seasonMatch) {
|
||||
obj.anime_season = seasonMatch[1]
|
||||
obj.episode_number = seasonMatch[2]
|
||||
obj.anime_title = obj.anime_title.replace(/S(\d{2})E(\d{2})/, '')
|
||||
}
|
||||
const yearMatch = obj.anime_title.match(/ (19[5-9]\d|20\d{2})/)
|
||||
if (yearMatch && Number(yearMatch[1]) <= (new Date().getUTCFullYear() + 1)) {
|
||||
obj.anime_year = yearMatch[1]
|
||||
obj.anime_title = obj.anime_title.replace(/ (19[5-9]\d|20\d{2})/, '')
|
||||
}
|
||||
if (Number(obj.anime_season) > 1) obj.anime_title += ' S' + obj.anime_season
|
||||
}
|
||||
|
||||
return parseObjs
|
||||
}
|
||||
|
||||
function getRelationKey (obj) {
|
||||
let key = obj.anime_title
|
||||
if (obj.anime_year) key += obj.anime_year
|
||||
return key
|
||||
}
|
||||
|
||||
// TODO: anidb aka true episodes need to be mapped to anilist episodes a bit better
|
||||
export async function resolveFileMedia (fileName) {
|
||||
const parseObjs = await anitomyscript(fileName)
|
||||
|
||||
// batches promises in 10 at a time, because of CF burst protection, which still sometimes gets triggered :/
|
||||
const uniq = {}
|
||||
for (const obj of parseObjs) {
|
||||
const key = getRelationKey(obj)
|
||||
if (key in relations) continue
|
||||
uniq[key] = obj
|
||||
}
|
||||
await PromiseBatch(resolveTitle, Object.values(uniq), 10)
|
||||
|
||||
const fileMedias = []
|
||||
for (const parseObj of parseObjs) {
|
||||
let failed = false
|
||||
let episode
|
||||
let media = relations[getRelationKey(parseObj)]
|
||||
// resolve episode, if movie, dont.
|
||||
const maxep = media?.nextAiringEpisode?.episode || media?.episodes
|
||||
if ((media?.format !== 'MOVIE' || maxep) && parseObj.episode_number) {
|
||||
if (Array.isArray(parseObj.episode_number)) {
|
||||
// is an episode range
|
||||
if (parseInt(parseObj.episode_number[0]) === 1) {
|
||||
// if it starts with #1 and overflows then it includes more than 1 season in a batch, cant fix this cleanly, name is parsed per file basis so this shouldnt be an issue
|
||||
episode = `${parseObj.episode_number[0]} ~ ${parseObj.episode_number[1]}`
|
||||
} else {
|
||||
if (maxep && parseInt(parseObj.episode_number[1]) > maxep) {
|
||||
// get root media to start at S1, instead of S2 or some OVA due to parsing errors
|
||||
// this is most likely safe, if it was relative episodes then it would likely use an accurate title for the season
|
||||
// if they didnt use an accurate title then its likely an absolute numbering scheme
|
||||
// parent check is to break out of those incorrectly resolved OVA's
|
||||
// if we used anime season to resolve anime name, then there's no need to march into prequel!
|
||||
const prequel = !parseObj.anime_season && (findEdge(media, 'PREQUEL')?.node || ((media.format === 'OVA' || media.format === 'ONA') && findEdge(media, 'PARENT')?.node))
|
||||
const root = prequel && (await resolveSeason({ media: (await alRequest({ method: 'SearchIDSingle', id: prequel.id })).data.Media, force: true })).media
|
||||
|
||||
// if highest value is bigger than episode count or latest streamed episode +1 for safety, parseint to math.floor a number like 12.5 - specials - in 1 go
|
||||
const result = await resolveSeason({ media: root || media, episode: parseObj.episode_number[1], increment: !parseObj.anime_season ? null : true })
|
||||
media = result.rootMedia
|
||||
const diff = parseObj.episode_number[1] - result.episode
|
||||
episode = `${parseObj.episode_number[0] - diff} ~ ${result.episode}`
|
||||
failed = result.failed
|
||||
} else {
|
||||
// cant find ep count or range seems fine
|
||||
episode = `${Number(parseObj.episode_number[0])} ~ ${Number(parseObj.episode_number[1])}`
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (maxep && parseInt(parseObj.episode_number) > maxep) {
|
||||
// see big comment above
|
||||
const prequel = !parseObj.anime_season && (findEdge(media, 'PREQUEL')?.node || ((media.format === 'OVA' || media.format === 'ONA') && findEdge(media, 'PARENT')?.node))
|
||||
const root = prequel && (await resolveSeason({ media: (await alRequest({ method: 'SearchIDSingle', id: prequel.id })).data.Media, force: true })).media
|
||||
|
||||
// value bigger than episode count
|
||||
const result = await resolveSeason({ media: root || media, episode: parseInt(parseObj.episode_number), increment: !parseObj.anime_season ? null : true })
|
||||
media = result.rootMedia
|
||||
episode = result.episode
|
||||
failed = result.failed
|
||||
} else {
|
||||
// cant find ep count or episode seems fine
|
||||
episode = Number(parseObj.episode_number)
|
||||
}
|
||||
}
|
||||
}
|
||||
fileMedias.push({
|
||||
episode: episode || parseObj.episode_number,
|
||||
parseObject: parseObj,
|
||||
media,
|
||||
failed
|
||||
})
|
||||
}
|
||||
return fileMedias
|
||||
}
|
||||
|
||||
export function findEdge (media, type, formats = ['TV', 'TV_SHORT'], skip) {
|
||||
let res = media.relations.edges.find(edge => {
|
||||
if (edge.relationType === type) {
|
||||
return formats.includes(edge.node.format)
|
||||
}
|
||||
return false
|
||||
})
|
||||
// this is hit-miss
|
||||
if (!res && !skip && type === 'SEQUEL') res = findEdge(media, type, formats = ['TV', 'TV_SHORT', 'OVA'], true)
|
||||
return res
|
||||
}
|
||||
|
||||
// note: this doesnt cover anime which uses partially relative and partially absolute episode number, BUT IT COULD!
|
||||
export async function resolveSeason (opts) {
|
||||
// media, episode, increment, offset, force
|
||||
if (!opts.media || !(opts.episode || opts.force)) throw new Error('No episode or media for season resolve!')
|
||||
|
||||
let { media, episode, increment, offset = 0, rootMedia = opts.media, force } = opts
|
||||
|
||||
const rootHighest = (rootMedia.nextAiringEpisode?.episode || rootMedia.episodes)
|
||||
|
||||
const prequel = !increment && findEdge(media, 'PREQUEL')?.node
|
||||
const sequel = !prequel && (increment || increment == null) && findEdge(media, 'SEQUEL')?.node
|
||||
const edge = prequel || sequel
|
||||
increment = increment ?? !prequel
|
||||
|
||||
if (!edge) {
|
||||
const obj = { media, episode: episode - offset, offset, increment, rootMedia, failed: true }
|
||||
if (!force) {
|
||||
console.warn('Error in parsing!', obj)
|
||||
toast('Parsing Error', {
|
||||
description: `Failed resolving anime episode!\n${media.title.userPreferred} - ${episode - offset}`
|
||||
})
|
||||
}
|
||||
return obj
|
||||
}
|
||||
media = (await alRequest({ method: 'SearchIDSingle', id: edge.id })).data.Media
|
||||
|
||||
const highest = media.nextAiringEpisode?.episode || media.episodes
|
||||
|
||||
const diff = episode - (highest + offset)
|
||||
offset += increment ? rootHighest : highest
|
||||
if (increment) rootMedia = media
|
||||
|
||||
// force marches till end of tree, no need for checks
|
||||
if (!force && diff <= rootHighest) {
|
||||
episode -= offset
|
||||
return { media, episode, offset, increment, rootMedia }
|
||||
}
|
||||
|
||||
return resolveSeason({ media, episode, increment, offset, rootMedia, force })
|
||||
}
|
||||
|
||||
const relations = {}
|
||||
|
||||
export const formatMap = {
|
||||
TV: 'TV Series',
|
||||
TV_SHORT: 'TV Short',
|
||||
MOVIE: 'Movie',
|
||||
SPECIAL: 'Special',
|
||||
OVA: 'OVA',
|
||||
ONA: 'ONA',
|
||||
MUSIC: 'Music',
|
||||
undefined: 'N/A',
|
||||
null: 'N/A'
|
||||
}
|
||||
|
||||
export const statusColorMap = {
|
||||
CURRENT: 'rgb(61,180,242)',
|
||||
PLANNING: 'rgb(247,154,99)',
|
||||
COMPLETED: 'rgb(123,213,85)',
|
||||
PAUSED: 'rgb(250,122,122)',
|
||||
REPEATING: '#3baeea',
|
||||
DROPPED: 'rgb(232,93,117)'
|
||||
}
|
||||
|
||||
export async function playMedia (media) {
|
||||
let ep = 1
|
||||
if (media.mediaListEntry) {
|
||||
const { status, progress } = media.mediaListEntry
|
||||
if (progress) {
|
||||
if (status === 'COMPLETED') {
|
||||
await setStatus('REPEATING', { episode: 0 }, media)
|
||||
} else {
|
||||
ep = Math.min(getMediaMaxEp(media, true), progress + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
playAnime(media, ep, true)
|
||||
media = null
|
||||
}
|
||||
|
||||
export function setStatus (status, other = {}, media) {
|
||||
const variables = {
|
||||
method: 'Entry',
|
||||
id: media.id,
|
||||
status,
|
||||
...other
|
||||
}
|
||||
return alRequest(variables)
|
||||
}
|
||||
|
||||
const episodeMetadataMap = {}
|
||||
|
||||
export async function getEpisodeMetadataForMedia (media) {
|
||||
if (episodeMetadataMap[media.id]) return episodeMetadataMap[media.id]
|
||||
const res = await fetch('https://api.ani.zip/mappings?anilist_id=' + media.id)
|
||||
const { episodes } = await res.json()
|
||||
episodeMetadataMap[media.id] = episodes
|
||||
return episodes
|
||||
}
|
||||
|
||||
let seadex = []
|
||||
requestIdleCallback(async () => {
|
||||
const res = await fetch('https://sneedex.moe/api/public/nyaa')
|
||||
const json = await res.json()
|
||||
seadex = json.flatMap(({ nyaaIDs }) => nyaaIDs).sort((a, b) => a - b) // sort for binary search
|
||||
})
|
||||
|
||||
export function mapBestRelease (entries) {
|
||||
return entries.map(entry => {
|
||||
if (entry.id) {
|
||||
if (entry.id === '?') return entry
|
||||
if (binarySearch(seadex, entry.id)) entry.best = true
|
||||
return entry
|
||||
}
|
||||
const match = entry.link.match(/\d+/i)
|
||||
if (match && binarySearch(seadex, Number(match[0]))) entry.best = true
|
||||
return entry
|
||||
})
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
let lastTapElement = null
|
||||
let lastHoverElement = null
|
||||
|
||||
const noop = _ => {}
|
||||
|
||||
document.addEventListener('pointerup', () => {
|
||||
setTimeout(() => {
|
||||
lastTapElement?.(false)
|
||||
lastTapElement = null
|
||||
lastHoverElement?.(false)
|
||||
lastHoverElement = null
|
||||
})
|
||||
})
|
||||
|
||||
export function click (node, cb = noop) {
|
||||
node.tabIndex = 0
|
||||
node.role = 'button'
|
||||
node.addEventListener('click', e => {
|
||||
e.stopPropagation()
|
||||
cb(e)
|
||||
})
|
||||
node.addEventListener('pointerup', e => {
|
||||
e.stopPropagation()
|
||||
})
|
||||
node.addEventListener('pointerleave', e => {
|
||||
e.stopPropagation()
|
||||
})
|
||||
node.addEventListener('keydown', e => { if (e.key === 'Enter') cb(e) })
|
||||
}
|
||||
|
||||
export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
||||
let pointerType = 'mouse'
|
||||
node.tabIndex = 0
|
||||
node.role = 'button'
|
||||
node.addEventListener('pointerenter', e => {
|
||||
lastHoverElement?.(false)
|
||||
lastTapElement?.(false)
|
||||
hoverUpdate(true)
|
||||
lastHoverElement = hoverUpdate
|
||||
pointerType = e.pointerType
|
||||
})
|
||||
node.addEventListener('click', e => {
|
||||
e.stopPropagation()
|
||||
if (pointerType === 'mouse') return cb(e)
|
||||
lastTapElement?.(false)
|
||||
if (lastTapElement === hoverUpdate) {
|
||||
lastTapElement = null
|
||||
cb(e)
|
||||
} else {
|
||||
lastTapElement = hoverUpdate
|
||||
}
|
||||
})
|
||||
node.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
lastTapElement?.(false)
|
||||
if (lastTapElement === hoverUpdate) {
|
||||
lastTapElement = null
|
||||
cb(e)
|
||||
} else {
|
||||
hoverUpdate(true)
|
||||
lastTapElement = hoverUpdate
|
||||
}
|
||||
}
|
||||
})
|
||||
node.addEventListener('pointerup', e => {
|
||||
e.stopPropagation()
|
||||
if (e.pointerType === 'mouse') setTimeout(() => hoverUpdate(false))
|
||||
})
|
||||
node.addEventListener('pointerleave', e => {
|
||||
lastHoverElement = hoverUpdate
|
||||
if (e.pointerType === 'mouse') hoverUpdate(false)
|
||||
})
|
||||
}
|
||||
|
||||
const Directions = { up: 1, right: 2, down: 3, left: 4 }
|
||||
|
||||
function getDirection (anchor, relative) {
|
||||
return Math.round((Math.atan2(relative.y - anchor.y, relative.x - anchor.x) * 180 / Math.PI + 180) / 90)
|
||||
}
|
||||
|
||||
function getDistance (anchor, relative) {
|
||||
return Math.hypot(relative.x - anchor.x, relative.y - anchor.y)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets keyboard-focusable elements within a specified element
|
||||
* @param {Element} [element=document.body] element
|
||||
* @returns {Element[]}
|
||||
*/
|
||||
function getKeyboardFocusableElements (element = document.body) {
|
||||
return [...element.querySelectorAll('a[href], button:not([disabled]), fieldset:not([disabled]), input:not([disabled]), optgroup:not([disabled]), option:not([disabled]), select:not([disabled]), textarea:not([disabled]), details, [tabindex]:not([tabindex="-1"]), [contenteditable], [controls]')].filter(
|
||||
el => !el.getAttribute('aria-hidden')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Element} element
|
||||
*/
|
||||
function getElementPosition (element) {
|
||||
const { x, y, width, height } = element.getBoundingClientRect()
|
||||
if (width || height) {
|
||||
return { element, x: x + width * 0.5, y: y + height * 0.5 }
|
||||
}
|
||||
}
|
||||
|
||||
function getFocusableElementPositions () {
|
||||
const elements = []
|
||||
for (const element of getKeyboardFocusableElements()) {
|
||||
const position = getElementPosition(element)
|
||||
if (position) elements.push(position)
|
||||
}
|
||||
return elements
|
||||
}
|
||||
|
||||
function navigateDPad (direction = 'up') {
|
||||
const keyboardFocusable = getFocusableElementPositions()
|
||||
const currentElement = !document.activeElement || document.activeElement === document.body ? keyboardFocusable[0] : getElementPosition(document.activeElement)
|
||||
|
||||
const elementsInDesiredDirection = keyboardFocusable.filter(position => {
|
||||
return position.element !== currentElement.element && getDirection(currentElement, position) === Directions[direction]
|
||||
})
|
||||
|
||||
const closestElement = elementsInDesiredDirection.reduce((reducer, position) => {
|
||||
const distance = getDistance(currentElement, position)
|
||||
if (distance < reducer.distance) return { distance, element: position.element }
|
||||
return reducer
|
||||
}, { distance: Infinity, element: null })
|
||||
|
||||
closestElement.element.focus()
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import 'browser-event-target-emitter'
|
||||
|
||||
export default new class extends EventTarget {
|
||||
constructor () {
|
||||
super()
|
||||
window.on('drop', this.handleTransfer.bind(this))
|
||||
window.on('paste', this.handleTransfer.bind(this))
|
||||
window.on('dragover', e => e.preventDefault())
|
||||
}
|
||||
|
||||
async handleTransfer ({ dataTransfer, clipboardData }) {
|
||||
const promises = [...(dataTransfer || clipboardData).items].map(item => {
|
||||
const type = item.type
|
||||
return new Promise(resolve => item.kind === 'string' ? item.getAsString(text => resolve({ text, type })) : resolve(item.getAsFile()))
|
||||
})
|
||||
|
||||
const items = await Promise.all(promises)
|
||||
|
||||
const files = []
|
||||
const text = []
|
||||
for (const item of items) {
|
||||
if (item instanceof Blob) {
|
||||
files.push(item)
|
||||
} else {
|
||||
text.push(item)
|
||||
}
|
||||
}
|
||||
if (files.length) this.emit('files', files)
|
||||
if (text.length) this.emit('text', text)
|
||||
}
|
||||
}()
|
||||
|
|
@ -1 +0,0 @@
|
|||
export default window.IPC
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
import { fontRx } from './util.js'
|
||||
import Metadata from 'matroska-metadata'
|
||||
|
||||
export default class Parser {
|
||||
parsed = false
|
||||
/** @type {Metadata} */
|
||||
metadata = null
|
||||
client = null
|
||||
file = null
|
||||
destroyed = false
|
||||
constructor (client, file) {
|
||||
this.client = client
|
||||
this.file = file
|
||||
this.metadata = new Metadata(file)
|
||||
|
||||
this.metadata.getTracks().then(tracks => {
|
||||
if (this.destroyed) return
|
||||
if (!tracks.length) {
|
||||
this.parsed = true
|
||||
this.destroy()
|
||||
} else {
|
||||
this.client.dispatch('tracks', tracks)
|
||||
}
|
||||
})
|
||||
|
||||
this.metadata.getChapters().then(chapters => {
|
||||
if (this.destroyed) return
|
||||
this.client.dispatch('chapters', chapters)
|
||||
})
|
||||
|
||||
this.metadata.getAttachments().then(files => {
|
||||
if (this.destroyed) return
|
||||
for (const file of files) {
|
||||
if (fontRx.test(file.filename) || file.mimetype.toLowerCase().includes('font')) {
|
||||
const data = new Uint8Array(file.data)
|
||||
this.client.dispatch('file', { data }, [data.buffer])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.metadata.on('subtitle', (subtitle, trackNumber) => {
|
||||
if (this.destroyed) return
|
||||
this.client.dispatch('subtitle', { subtitle, trackNumber })
|
||||
})
|
||||
|
||||
if (this.file.name.endsWith('.mkv') || this.file.name.endsWith('.webm')) {
|
||||
this.file.on('iterator', ({ iterator }, cb) => {
|
||||
if (this.destroyed) return cb(iterator)
|
||||
cb(this.metadata.parseStream(iterator))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async parseSubtitles () {
|
||||
if (this.file.name.endsWith('.mkv') || this.file.name.endsWith('.webm')) {
|
||||
console.log('Sub parsing started')
|
||||
await this.metadata.parseFile()
|
||||
console.log('Sub parsing finished')
|
||||
}
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this.destroyed = true
|
||||
this.metadata?.destroy()
|
||||
this.metadata = undefined
|
||||
}
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
import { alRequest } from '@/modules/anilist.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { findEdge, resolveSeason, getMediaMaxEp, mapBestRelease } from '../anime.js'
|
||||
import { exclusions, getRSSContent, parseRSSNodes } from '../rss.js'
|
||||
|
||||
export default async function getRSSEntries ({ media, episode, mode, ignoreQuality }) {
|
||||
// mode cuts down on the amt of queries made 'check' || 'batch'
|
||||
const titles = createTitle(media).join(')|(')
|
||||
|
||||
const prequel = findEdge(media, 'PREQUEL')?.node
|
||||
const sequel = findEdge(media, 'SEQUEL')?.node
|
||||
const isBatch = media.status === 'FINISHED' && media.episodes !== 1
|
||||
|
||||
// if media has multiple seasons, and this S is > 1, then get the absolute episode number of the episode
|
||||
const absolute = prequel && !mode && (await resolveSeason({ media, episode, force: true }))
|
||||
const absoluteep = absolute?.offset + episode
|
||||
const episodes = [episode]
|
||||
|
||||
// only use absolute episode number if its smaller than max episodes this series has, ex:
|
||||
// looking for E1 of S2, S1 has 12 ep and S2 has 13, absolute will be 13
|
||||
// so this would find the 13th ep of the 2nd season too if this check wasnt here
|
||||
if (absolute && absoluteep < (getMediaMaxEp(media) || episode)) {
|
||||
episodes.push(absoluteep)
|
||||
}
|
||||
|
||||
let ep = ''
|
||||
if (media.episodes !== 1 && mode !== 'batch') {
|
||||
if (isBatch) {
|
||||
const digits = Math.max(2, Math.log(media.episodes) * Math.LOG10E + 1 | 0)
|
||||
ep = `"${zeropad(1, digits)}-${zeropad(media.episodes, digits)}"|"${zeropad(1, digits)}~${zeropad(media.episodes, digits)}"|"Batch"|"Complete"|"${zeropad(episode)}+"|"${zeropad(episode)}v"`
|
||||
} else {
|
||||
ep = `(${episodes.map(epstring).join('|')})`
|
||||
}
|
||||
}
|
||||
|
||||
const excl = exclusions.join('|')
|
||||
const quality = (!ignoreQuality && (`"${settings.value.rssQuality}"` || '"1080"')) || ''
|
||||
const url = new URL(`${settings.value.catURL}/?page=rss&c=1_2&f=0&s=seeders&o=desc&q=(${titles})${ep}${quality}-(${excl})`)
|
||||
|
||||
let nodes = [...(await getRSSContent(url)).querySelectorAll('item')]
|
||||
|
||||
if (absolute) {
|
||||
// if this is S > 1 aka absolute ep number exists get entries for S1title + absoluteEP
|
||||
// the reason this isnt done with recursion like sequelEntries is because that would include the S1 media dates
|
||||
// we want the dates of the target media as the S1 title might be used for SX releases
|
||||
const titles = createTitle(absolute.media).join(')|(')
|
||||
|
||||
const url = new URL(`${settings.value.catURL}/?page=rss&c=1_2&f=0&s=seeders&o=desc&q=(${titles})${epstring(absoluteep)}${quality}-(${excl})`)
|
||||
nodes = [...nodes, ...(await getRSSContent(url)).querySelectorAll('item')]
|
||||
}
|
||||
|
||||
let entries = parseRSSNodes(nodes)
|
||||
|
||||
const checkSequelDate = media.status === 'FINISHED' && (sequel?.status === 'FINISHED' || sequel?.status === 'RELEASING') && sequel.startDate
|
||||
|
||||
const sequelStartDate = checkSequelDate && new Date(Object.values(checkSequelDate).join(' '))
|
||||
|
||||
// recursive, get all entries for media sequel, and its sequel, and its sequel
|
||||
const sequelEntries =
|
||||
(sequel?.status === 'FINISHED' || sequel?.status === 'RELEASING') &&
|
||||
(await getRSSEntries({ media: (await alRequest({ method: 'SearchIDSingle', id: sequel.id })).data.Media, episode, mode: mode || 'check' }))
|
||||
|
||||
const checkPrequelDate = (media.status === 'FINISHED' || media.status === 'RELEASING') && prequel?.status === 'FINISHED' && prequel?.endDate
|
||||
|
||||
const prequelEndDate = checkPrequelDate && new Date(Object.values(checkPrequelDate).join(' '))
|
||||
|
||||
// 1 month in MS, a bit of jitter for pre-releases and releasers being late as fuck, lets hope it doesnt cause issues
|
||||
const month = 2674848460
|
||||
|
||||
if (prequelEndDate) {
|
||||
entries = entries.filter(entry => entry.date > new Date(+prequelEndDate + month))
|
||||
}
|
||||
|
||||
if (sequelStartDate && media.format === 'TV') {
|
||||
entries = entries.filter(entry => entry.date < new Date(+sequelStartDate - month))
|
||||
}
|
||||
|
||||
if (sequelEntries?.length) {
|
||||
if (mode === 'check') {
|
||||
entries = [...entries, ...sequelEntries]
|
||||
} else {
|
||||
entries = entries.filter(entry => !sequelEntries.find(sequel => sequel.link === entry.link))
|
||||
}
|
||||
}
|
||||
|
||||
// this gets entries without any episode limiting, and for batches
|
||||
const batchEntries = !mode && isBatch && (await getRSSEntries({ media, episode, ignoreQuality, mode: 'batch' })).filter(entry => {
|
||||
return !epNumRx.test(entry.title)
|
||||
})
|
||||
|
||||
if (batchEntries?.length) {
|
||||
entries = [...entries, ...batchEntries]
|
||||
}
|
||||
|
||||
// some archaic shows only have shit DVD's in weird qualities, so try to look up without any quality restrictions when there are no results
|
||||
if (!entries.length && !ignoreQuality && !mode) {
|
||||
entries = await getRSSEntries({ media, episode, ignoreQuality: true })
|
||||
}
|
||||
|
||||
// dedupe
|
||||
const ids = entries.map(e => e.link)
|
||||
return mapBestRelease(entries.filter(({ link }, index) => !ids.includes(link, index + 1)))
|
||||
}
|
||||
|
||||
// padleft a variable with 0 ex: 1 => '01'
|
||||
function zeropad (v = 1, l = 2) {
|
||||
return (typeof v === 'string' ? v : v.toString()).padStart(l, '0')
|
||||
}
|
||||
|
||||
const epstring = ep => `"E${zeropad(ep)}+"|"E${zeropad(ep)}v"|"+${zeropad(ep)}+"|"+${zeropad(ep)}v"`
|
||||
// [EO]?[-EPD _—]\d{2}(?:[-v _.—]|$)
|
||||
// /[EO]?[-EPD]\d{2}(?:[-v.]|$)|[EO]?[EPD ]\d{2}(?:[v .]|$)|[EO]?[EPD_]\d{2}(?:[v_.]|$)|[EO]?[EPD—]\d{2}(?:[v.—]|$)|\d{2} ?[-~—] ?\d{2}/i
|
||||
// matches: OP01 ED01 EP01 E01 01v 01. -01- _01_ with spaces and stuff
|
||||
const epNumRx = /[EO]?[-EPD]\d{2}(?:[-v.]|$)|[EO]?[EPD ]\d{2}(?:[v .]|$)|[EO]?[EPD_]\d{2}(?:[v_.]|$)|[EO]?[EPD—]\d{2}(?:[v.—]|$)|\d{2} ?[-~—] ?\d{2}/i
|
||||
|
||||
// create an array of potentially valid titles from a given media
|
||||
function createTitle (media) {
|
||||
// group and de-duplicate
|
||||
const grouped = [
|
||||
...new Set(
|
||||
Object.values(media.title)
|
||||
.concat(media.synonyms)
|
||||
.filter(name => name != null && name.length > 3)
|
||||
)
|
||||
]
|
||||
const titles = []
|
||||
const appendTitle = t => {
|
||||
// replace & with encoded
|
||||
const title = t.replace(/&/g, '%26').replace(/\?/g, '%3F').replace(/#/g, '%23')
|
||||
titles.push(title)
|
||||
|
||||
// replace Season 2 with S2, else replace 2nd Season with S2, but keep the original title
|
||||
const match1 = title.match(/(\d)(?:nd|rd|th) Season/i)
|
||||
const match2 = title.match(/Season (\d)/i)
|
||||
|
||||
if (match2) {
|
||||
titles.push(title.replace(/Season \d/i, `S${match2[1]}`))
|
||||
} else if (match1) {
|
||||
titles.push(title.replace(/(\d)(?:nd|rd|th) Season/i, `S${match1[1]}`))
|
||||
}
|
||||
}
|
||||
for (const t of grouped) {
|
||||
appendTitle(t)
|
||||
if (t.includes('-')) appendTitle(t.replaceAll('-', ''))
|
||||
}
|
||||
return titles
|
||||
}
|
||||
|
|
@ -1,311 +0,0 @@
|
|||
import { mapBestRelease, anitomyscript } from '../anime.js'
|
||||
import { fastPrettyBytes, sleep } from '../util.js'
|
||||
import { exclusions } from '../rss.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { alRequest } from '../anilist.js'
|
||||
import { client } from '@/modules/torrent.js'
|
||||
|
||||
export default async function ({ media, episode }) {
|
||||
const json = await getAniDBFromAL(media)
|
||||
|
||||
if (typeof json !== 'object') throw new Error(json || 'No mapping found.')
|
||||
|
||||
const aniDBEpisode = await getAniDBEpisodeFromAL({ media, episode }, json)
|
||||
|
||||
const movie = isMovie(media) // don't query movies with qualities, to allow 4k
|
||||
|
||||
let entries = await getToshoEntries(media, aniDBEpisode, json, !movie && settings.value.rssQuality)
|
||||
|
||||
if (!entries.length && !movie) entries = await getToshoEntries(media, aniDBEpisode, json)
|
||||
|
||||
const mapped = mapBestRelease(mapTosho2dDeDupedEntry(entries))
|
||||
|
||||
if (!mapped?.length) throw new Error('No entries found.')
|
||||
|
||||
const parseObjects = await anitomyscript(mapped.map(({ title }) => title))
|
||||
|
||||
for (const i in parseObjects) mapped[i].parseObject = parseObjects[i]
|
||||
|
||||
const id = crypto.randomUUID()
|
||||
|
||||
const updated = await Promise.race([
|
||||
new Promise(resolve => {
|
||||
function check ({ detail }) {
|
||||
if (detail.id !== id) return
|
||||
client.removeListener('scrape', check)
|
||||
resolve(detail.result)
|
||||
console.log(detail)
|
||||
}
|
||||
client.on('scrape', check)
|
||||
client.send('scrape', { id, infoHashes: mapped.map(({ hash }) => hash) })
|
||||
}),
|
||||
sleep(5000)
|
||||
])
|
||||
for (const { hash, complete, downloaded, incomplete } of updated || []) {
|
||||
const found = mapped.find(mapped => mapped.hash === hash)
|
||||
found.downloads = downloaded
|
||||
found.leechers = incomplete
|
||||
found.seeders = complete
|
||||
}
|
||||
|
||||
return mapped
|
||||
}
|
||||
|
||||
async function getAniDBFromAL (media) {
|
||||
console.log('getting AniDB ID from AL')
|
||||
const mappingsResponse = await fetch('https://api.ani.zip/mappings?anilist_id=' + media.id)
|
||||
const json = await mappingsResponse.json()
|
||||
if (json.mappings?.anidb_id) return json
|
||||
|
||||
console.log('failed getting AniDB ID, checking via parent')
|
||||
|
||||
const parentID = getParentForSpecial(media)
|
||||
|
||||
if (!parentID) return
|
||||
|
||||
console.log('found via parent')
|
||||
|
||||
const parentResponse = await fetch('https://api.ani.zip/mappings?anilist_id=' + parentID)
|
||||
return parentResponse.json()
|
||||
}
|
||||
|
||||
function getParentForSpecial (media) {
|
||||
if (!['SPECIAL', 'OVA', 'ONA'].some(format => media.format === format)) return false
|
||||
const animeRelations = media.relations.edges.filter(({ node }) => node.type === 'ANIME')
|
||||
|
||||
return getRelation(animeRelations, 'PARENT') || getRelation(animeRelations, 'PREQUEL') || getRelation(animeRelations, 'SEQUEL')
|
||||
}
|
||||
|
||||
function getRelation (list, type) {
|
||||
return list.find(({ relationType }) => relationType === type)?.node.id
|
||||
}
|
||||
|
||||
// TODO: https://anilist.co/anime/13055/
|
||||
async function getAniDBEpisodeFromAL ({ media, episode }, { episodes, episodeCount, specialCount }) {
|
||||
console.log('getting AniDB EpID for Mal EP', { episode, episodes })
|
||||
if (!episode || !Object.values(episodes).length) return
|
||||
// if media has no specials or their episode counts don't match
|
||||
if (!specialCount || (media.episodes && media.episodes === episodeCount && episodes[Number(episode)])) return episodes[Number(episode)]
|
||||
console.log('EP count doesn\'t match, checking by air date')
|
||||
const res = await alRequest({ method: 'EpisodeDate', id: media.id, ep: episode })
|
||||
// TODO: if media only has one episode, and airdate doesn't exist use start/release/end dates
|
||||
const alDate = new Date((res.data.AiringSchedule?.airingAt || 0) * 1000)
|
||||
|
||||
return getEpisodeNumberByAirDate(alDate, episodes, episode)
|
||||
}
|
||||
|
||||
export function getEpisodeNumberByAirDate (alDate, episodes, episode) {
|
||||
if (!+alDate) return episodes[Number(episode)] || episodes[1] // what the fuck, are you braindead anilist?, the source episode number to play is from an array created from AL ep count, so how come it's missing?
|
||||
// 1 is key for episod 1, not index
|
||||
|
||||
// find closest episodes by air date, multiple episodes can have the same air date distance
|
||||
// ineffcient but reliable
|
||||
const closestEpisodes = Object.values(episodes).reduce((prev, curr) => {
|
||||
if (!prev[0]) return [curr]
|
||||
const prevDate = Math.abs(+new Date(prev[0]?.airdate) - alDate)
|
||||
const currDate = Math.abs(+new Date(curr.airdate) - alDate)
|
||||
if (prevDate === currDate) {
|
||||
prev.push(curr)
|
||||
return prev
|
||||
}
|
||||
if (currDate < prevDate) return [curr]
|
||||
return prev
|
||||
}, [])
|
||||
|
||||
console.log({ closestEpisodes })
|
||||
|
||||
return closestEpisodes.reduce((prev, curr) => {
|
||||
return Math.abs(curr.episodeNumber - episode) < Math.abs(prev.episodeNumber - episode) ? curr : prev
|
||||
})
|
||||
}
|
||||
|
||||
async function getToshoEntries (media, episode, { mappings }, quality) {
|
||||
const promises = []
|
||||
|
||||
if (episode) {
|
||||
const { anidbEid } = episode
|
||||
|
||||
console.log('fetching episode', anidbEid, quality)
|
||||
|
||||
promises.push(fetchSingleEpisode({ id: anidbEid, quality }))
|
||||
} else {
|
||||
// TODO: look for episodes via.... title?
|
||||
}
|
||||
|
||||
// look for batches and movies
|
||||
const movie = isMovie(media)
|
||||
if (mappings.anidb_id && media.status === 'FINISHED' && (movie || media.episodes !== 1)) {
|
||||
promises.push(fetchBatches({ episodeCount: media.episodes, id: mappings.anidb_id, quality, movie }))
|
||||
console.log('fetching batch', quality, movie)
|
||||
if (!movie) {
|
||||
const courRelation = getSplitCourRelation(media)
|
||||
if (courRelation) {
|
||||
console.log('found split cour!')
|
||||
const episodeCount = (media.episodes || 0) + (courRelation.episodes || 0)
|
||||
try {
|
||||
const mappingsResponse = await fetch('https://api.ani.zip/mappings?anilist_id=' + courRelation.id)
|
||||
const json = await mappingsResponse.json()
|
||||
console.log('found mappings for split cour', !!json.mappings.anidb_id)
|
||||
if (json.mappings.anidb_id) promises.push(fetchBatches({ episodeCount, id: json.mappings.anidb_id, quality }))
|
||||
} catch (e) {
|
||||
console.error('failed getting split-cour data', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (await Promise.all(promises)).flat()
|
||||
}
|
||||
|
||||
function getSplitCourRelation (media) {
|
||||
// Part 2 / Cour 3 / 4th Cour
|
||||
if (isTitleSplitCour(media)) return getCourPrequel(media)
|
||||
|
||||
// Part 1 of split cour which usually doesn't get labeled as split cour
|
||||
// sequel can not exist
|
||||
return getCourSequel(media)
|
||||
}
|
||||
|
||||
const courRegex = /[2-9](?:nd|rd|th) Cour|Cour [2-9]|Part [2-9]/i
|
||||
|
||||
function isTitleSplitCour (media) {
|
||||
const titles = [...Object.values(media.title), ...media.synonyms]
|
||||
|
||||
console.log('checking cour titles', titles)
|
||||
|
||||
return titles.some(title => courRegex.test(title))
|
||||
}
|
||||
|
||||
const seasons = ['WINTER', 'SPRING', 'SUMMER', 'FALL']
|
||||
const getDate = ({ seasonYear, season }) => +new Date(`${seasonYear}-${seasons.indexOf(season) * 4 || 1}-01`)
|
||||
|
||||
function getMediaDate (media) {
|
||||
if (media.startDate) return +new Date(Object.values(media.startDate).join(' '))
|
||||
return getDate(media)
|
||||
}
|
||||
|
||||
function getCourSequel (media) {
|
||||
const mediaDate = getMediaDate(media)
|
||||
const animeRelations = media.relations.edges.filter(({ node, relationType }) => {
|
||||
if (node.type !== 'ANIME') return false
|
||||
if (node.status !== 'FINISHED') return false
|
||||
if (relationType !== 'SEQUEL') return false
|
||||
if (!['OVA', 'TV'].some(format => node.format === format)) return false // not movies or ona's
|
||||
if (mediaDate > getMediaDate(node)) return false // node needs to be released after media to be a sequel
|
||||
return isTitleSplitCour(node)
|
||||
}).map(({ node }) => node)
|
||||
|
||||
if (!animeRelations.length) return false
|
||||
|
||||
// get closest sequel
|
||||
return animeRelations.reduce((prev, curr) => {
|
||||
return getMediaDate(prev) - mediaDate > getMediaDate(curr) - mediaDate ? curr : prev
|
||||
})
|
||||
}
|
||||
|
||||
function getCourPrequel (media) {
|
||||
const mediaDate = getMediaDate(media)
|
||||
const animeRelations = media.relations.edges.filter(({ node, relationType }) => {
|
||||
if (node.type !== 'ANIME') return false
|
||||
if (node.status !== 'FINISHED') return false
|
||||
if (relationType !== 'PREQUEL') return false
|
||||
if (!['OVA', 'TV'].some(format => node.format === format)) return false
|
||||
if (mediaDate < getMediaDate(node)) return false // node needs to be released before media to be a prequel
|
||||
return true
|
||||
}).map(({ node }) => node)
|
||||
|
||||
if (!animeRelations.length) {
|
||||
console.error('Detected split count but couldn\'t find prequel', media)
|
||||
return false
|
||||
}
|
||||
|
||||
// get closest prequel
|
||||
return animeRelations.reduce((prev, curr) => {
|
||||
return mediaDate - getMediaDate(prev) > mediaDate - getMediaDate(curr) ? curr : prev
|
||||
})
|
||||
}
|
||||
|
||||
function isMovie (media) {
|
||||
if (media.format === 'MOVIE') return true
|
||||
if ([...Object.values(media.title), ...media.synonyms].some(title => title?.toLowerCase().includes('movie'))) return true
|
||||
// if (!getParentForSpecial(media)) return true // TODO: this is good for checking movies, but false positives with normal TV shows
|
||||
return media.duration > 80 && media.episodes === 1
|
||||
}
|
||||
|
||||
function buildQuery (quality) {
|
||||
let query = `&qx=1&q=!("${exclusions.join('"|"')}")`
|
||||
if (quality) {
|
||||
query += ` "${quality}"`
|
||||
} else {
|
||||
query += 'e*|a*|r*|i*|o*' // HACK: tosho NEEDS a search string, so we lazy search a single common vowel
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
async function fetchBatches ({ episodeCount, id, quality, movie = null }) {
|
||||
try {
|
||||
const queryString = buildQuery(quality)
|
||||
const torrents = await fetch(settings.value.toshoURL + 'json?order=size-d&aid=' + id + queryString)
|
||||
|
||||
// safe if AL includes EP 0 or doesn't
|
||||
const batches = (await torrents.json()).filter(entry => entry.num_files >= episodeCount)
|
||||
if (!movie) {
|
||||
for (const batch of batches) {
|
||||
batch.batch = true
|
||||
}
|
||||
}
|
||||
console.log({ batches })
|
||||
return batches
|
||||
} catch (error) {
|
||||
console.log('failed fetching batch', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchSingleEpisode ({ id, quality }) {
|
||||
try {
|
||||
const queryString = buildQuery(quality)
|
||||
const torrents = await fetch(settings.value.toshoURL + 'json?eid=' + id + queryString)
|
||||
|
||||
const episodes = await torrents.json()
|
||||
console.log({ episodes })
|
||||
return episodes
|
||||
} catch (error) {
|
||||
console.log('failed fetching single episode', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
function mapTosho2dDeDupedEntry (entries) {
|
||||
const deduped = {}
|
||||
for (const entry of entries) {
|
||||
if (deduped[entry.info_hash]) {
|
||||
const dupe = deduped[entry.info_hash]
|
||||
dupe.title ??= entry.title || entry.torrent_name
|
||||
dupe.id ||= entry.nyaa_id
|
||||
dupe.seeders ||= entry.seeders >= 30000 ? 0 : entry.seeders
|
||||
dupe.leechers ||= entry.leechers >= 30000 ? 0 : entry.leechers
|
||||
dupe.downloads ||= entry.torrent_downloaded_count
|
||||
dupe.size ||= entry.total_size && fastPrettyBytes(entry.total_size)
|
||||
dupe.verified ||= !!entry.anidb_fid
|
||||
dupe.date ||= entry.timestamp && new Date(entry.timestamp * 1000)
|
||||
} else {
|
||||
deduped[entry.info_hash] = {
|
||||
title: entry.title || entry.torrent_name,
|
||||
link: entry.magnet_uri,
|
||||
id: entry.nyaa_id,
|
||||
seeders: entry.seeders >= 30000 ? 0 : entry.seeders,
|
||||
leechers: entry.leechers >= 30000 ? 0 : entry.leechers,
|
||||
downloads: entry.torrent_downloaded_count,
|
||||
hash: entry.info_hash,
|
||||
size: entry.total_size && fastPrettyBytes(entry.total_size),
|
||||
verified: !!entry.anidb_fid,
|
||||
batch: entry.batch,
|
||||
date: entry.timestamp && new Date(entry.timestamp * 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Object.values(deduped)
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
import { DOMPARSER } from '@/modules/util.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { add } from '@/modules/torrent.js'
|
||||
import { resolveFileMedia, getEpisodeMetadataForMedia } from './anime.js'
|
||||
import { hasNextPage } from '@/modules/sections.js'
|
||||
|
||||
export const exclusions = ['DTS', '[EMBER]']
|
||||
const isDev = location.hostname === 'localhost'
|
||||
|
||||
const video = document.createElement('video')
|
||||
|
||||
if (!isDev && !video.canPlayType('video/mp4; codecs="hev1.1.6.L93.B0"')) {
|
||||
exclusions.push('HEVC', 'x265', 'H.265')
|
||||
}
|
||||
if (!isDev && !video.canPlayType('audio/mp4; codecs="ac-3"')) {
|
||||
exclusions.push('AC3', 'AC-3')
|
||||
}
|
||||
video.remove()
|
||||
|
||||
export function parseRSSNodes (nodes) {
|
||||
return nodes.map(item => {
|
||||
const pubDate = item.querySelector('pubDate')?.textContent
|
||||
|
||||
return {
|
||||
title: item.querySelector('title')?.textContent || '?',
|
||||
link: item.querySelector('enclosure')?.attributes.url.value || item.querySelector('link')?.textContent || '?',
|
||||
seeders: item.querySelector('seeders')?.textContent ?? '?',
|
||||
leechers: item.querySelector('leechers')?.textContent ?? '?',
|
||||
downloads: item.querySelector('downloads')?.textContent ?? '?',
|
||||
size: item.querySelector('size')?.textContent ?? '?',
|
||||
date: pubDate && new Date(pubDate)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const rssmap = {
|
||||
SubsPlease: settings.value.toshoURL + 'rss2?qx=1&q="[SubsPlease] "',
|
||||
'Erai-raws [Multi-Sub]': settings.value.toshoURL + 'rss2?qx=1&q="[Erai-raws] "',
|
||||
'Yameii [Dubbed]': settings.value.toshoURL + 'rss2?qx=1&q="[Yameii] "',
|
||||
'Judas [Small Size]': settings.value.toshoURL + 'rss2?qx=1&q="[Judas] "'
|
||||
}
|
||||
export function getReleasesRSSurl (val) {
|
||||
const rss = rssmap[val] || val
|
||||
return rss && new URL(rssmap[val] ? `${rss}${settings.value.rssQuality ? `"${settings.value.rssQuality}"` : ''}` : rss)
|
||||
}
|
||||
|
||||
export async function getRSSContent (url) {
|
||||
if (!url) return null
|
||||
try {
|
||||
const res = await fetch(url)
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed fetching RSS!\n' + res.statusText)
|
||||
}
|
||||
return DOMPARSER(await res.text(), 'text/xml')
|
||||
} catch (e) {
|
||||
throw new Error('Failed fetching RSS!\n' + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
class RSSMediaManager {
|
||||
constructor () {
|
||||
this.resultMap = {}
|
||||
this.lastResult = null
|
||||
}
|
||||
|
||||
getMediaForRSS (page, perPage, url, ignoreErrors) {
|
||||
const res = this._getMediaForRSS(page, perPage, url)
|
||||
if (!ignoreErrors) {
|
||||
res.catch(e => {
|
||||
toast.error('Search Failed', {
|
||||
description: 'Failed fetching RSS!\n' + e.message
|
||||
})
|
||||
console.error('Failed to fetch rss', e)
|
||||
})
|
||||
}
|
||||
return Array.from({ length: perPage }, (_, i) => ({ type: 'episode', data: this.fromPending(res, i) }))
|
||||
}
|
||||
|
||||
async fromPending (result, i) {
|
||||
const array = await result
|
||||
return array[i]
|
||||
}
|
||||
|
||||
async getContentChanged (page, perPage, url) {
|
||||
const content = await getRSSContent(getReleasesRSSurl(url))
|
||||
|
||||
if (!content) return false
|
||||
|
||||
const pubDate = +(new Date(content.querySelector('pubDate').textContent)) * page * perPage
|
||||
if (this.resultMap[url]?.date === pubDate) return false
|
||||
return { content, pubDate }
|
||||
}
|
||||
|
||||
async _getMediaForRSS (page, perPage, url) {
|
||||
const changed = await this.getContentChanged(page, perPage, url)
|
||||
if (!changed) return this.resultMap[url].result
|
||||
|
||||
const index = (page - 1) * perPage
|
||||
const targetPage = [...changed.content.querySelectorAll('item')].slice(index, index + perPage)
|
||||
const items = parseRSSNodes(targetPage)
|
||||
hasNextPage.value = items.length === perPage
|
||||
const result = items.map(item => this.resolveAnimeFromRSSItem(item))
|
||||
this.resultMap[url] = {
|
||||
date: changed.pubDate,
|
||||
result
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
resolveAnimeFromRSSItem (item) {
|
||||
this.lastResult = this.queueResolve(item)
|
||||
return this.lastResult
|
||||
}
|
||||
|
||||
async queueResolve ({ title, link, date }) {
|
||||
await this.lastResult
|
||||
const res = {
|
||||
...(await resolveFileMedia(title))[0],
|
||||
episodeData: undefined,
|
||||
date: undefined,
|
||||
onclick: undefined
|
||||
}
|
||||
if (res.media?.id) {
|
||||
try {
|
||||
res.episodeData = (await getEpisodeMetadataForMedia(res.media))?.[res.episode]
|
||||
} catch (e) {
|
||||
console.warn('failed fetching episode metadata', e)
|
||||
}
|
||||
}
|
||||
res.date = date
|
||||
res.onclick = () => add(link)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
export const RSSManager = new RSSMediaManager()
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
import { settings } from '@/modules/settings.js'
|
||||
|
||||
export default function (t, { speed = 120, smooth = 10 } = {}) {
|
||||
if (!settings.value.smoothScroll) return
|
||||
let moving = false
|
||||
let pos = 0
|
||||
let scrollTop = 0
|
||||
let lastTime = null
|
||||
t.addEventListener('wheel', e => {
|
||||
e.preventDefault()
|
||||
// is trackpad
|
||||
const spd = (e.deltaY !== (e.deltaY | 0) || e.wheelDelta % 10 !== 0) ? speed / 10 : speed
|
||||
pos = Math.max(0, Math.min(pos - Math.max(-1, Math.min(1, e.deltaY * -1)) * spd, (t.scrollHeight - t.clientHeight) + (smooth * 2)))
|
||||
if (!moving) {
|
||||
lastTime = null
|
||||
update()
|
||||
}
|
||||
}, { capture: true, passive: false })
|
||||
|
||||
function getDeltaTime () {
|
||||
const now = performance.now()
|
||||
if (!lastTime) {
|
||||
lastTime = now
|
||||
return 1
|
||||
}
|
||||
const deltaTime = now - lastTime
|
||||
lastTime = now
|
||||
return deltaTime / 14
|
||||
}
|
||||
|
||||
t.addEventListener('pointerup', () => { pos = scrollTop = t.scrollTop })
|
||||
|
||||
function update () {
|
||||
const delta = pos - scrollTop === smooth * 2 ? 0 : ((pos - scrollTop) / smooth) * getDeltaTime()
|
||||
scrollTop += delta
|
||||
|
||||
t.scrollTo(0, scrollTop < 1.3 ? 0 : scrollTop)
|
||||
moving = Math.abs(delta) > 0.1 && !!requestAnimationFrame(update)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
import { alRequest, currentSeason, currentYear, userLists } from '@/modules/anilist.js'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
import { settings, alToken } from '@/modules/settings.js'
|
||||
import { RSSManager } from '@/modules/rss.js'
|
||||
|
||||
export const hasNextPage = writable(true)
|
||||
|
||||
export default class SectionsManager {
|
||||
constructor (data = []) {
|
||||
this.sections = []
|
||||
for (const section of data) this.add(section)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} data
|
||||
*/
|
||||
add (data) {
|
||||
if (!data) return
|
||||
const { title, variables = {}, type, load = SectionsManager.createFallbackLoad(variables, type), preview = writable() } = data
|
||||
const section = { ...data, load, title, preview, variables }
|
||||
this.sections.push(section)
|
||||
return section
|
||||
}
|
||||
|
||||
static createFallbackLoad (variables, type) {
|
||||
return (page = 1, perPage = 50, search = variables) => {
|
||||
const options = { method: 'Search', page, perPage, ...SectionsManager.sanitiseObject(search) }
|
||||
const res = alRequest(options)
|
||||
return SectionsManager.wrapResponse(res, perPage, type)
|
||||
}
|
||||
}
|
||||
|
||||
static wrapResponse (res, length, type) {
|
||||
res.then(res => {
|
||||
hasNextPage.value = res?.data?.Page.pageInfo.hasNextPage
|
||||
})
|
||||
return Array.from({ length }, (_, i) => ({ type, data: SectionsManager.fromPending(res, i) }))
|
||||
}
|
||||
|
||||
static sanitiseObject (object = {}) {
|
||||
const safe = {}
|
||||
for (const [key, value] of Object.entries(object)) {
|
||||
if (value) safe[key] = value
|
||||
}
|
||||
return safe
|
||||
}
|
||||
|
||||
static async fromPending (arr, i) {
|
||||
const { data } = await arr
|
||||
return data.Page.media[i]
|
||||
}
|
||||
}
|
||||
|
||||
// list of all possible home screen sections
|
||||
export let sections = []
|
||||
|
||||
settings.subscribe(() => {
|
||||
for (const section of sections) clearInterval(section.interval)
|
||||
sections = createSections()
|
||||
})
|
||||
|
||||
function createSections () {
|
||||
return [
|
||||
// RSS feeds
|
||||
...settings.value.rssFeedsNew.map(([title, url]) => {
|
||||
const section = {
|
||||
title,
|
||||
load: (page = 1, perPage = 8) => RSSManager.getMediaForRSS(page, perPage, url),
|
||||
preview: writable(RSSManager.getMediaForRSS(1, 8, url)),
|
||||
variables: { disableSearch: true }
|
||||
}
|
||||
|
||||
// update every 30 seconds
|
||||
section.interval = setInterval(async () => {
|
||||
if (await RSSManager.getContentChanged(1, 8, url)) {
|
||||
section.preview.value = RSSManager.getMediaForRSS(1, 8, url, true)
|
||||
}
|
||||
}, 30000)
|
||||
|
||||
return section
|
||||
}),
|
||||
// user specific sections
|
||||
{
|
||||
title: 'Continue Watching',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const mediaList = res.data.MediaListCollection.lists.reduce((filtered, { status, entries }) => {
|
||||
return (status === 'CURRENT' || status === 'REPEATING') ? filtered.concat(entries) : filtered
|
||||
}, [])
|
||||
const ids = mediaList.filter(({ media }) => {
|
||||
if (media.status === 'FINISHED') return true
|
||||
return media.mediaListEntry?.progress < media.nextAiringEpisode?.episode - 1
|
||||
}).map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Sequels You Missed',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const mediaList = res.data.MediaListCollection.lists.find(({ status }) => status === 'COMPLETED').entries
|
||||
const ids = mediaList.flatMap(({ media }) => {
|
||||
return media.relations.edges.filter(edge => edge.relationType === 'SEQUEL')
|
||||
}).map(({ node }) => node.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables), status: ['FINISHED', 'RELEASING'], onList: false })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Your List',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const ids = res.data.MediaListCollection.lists.find(({ status }) => status === 'PLANNING').entries.map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Completed List',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const ids = res.data.MediaListCollection.lists.find(({ status }) => status === 'COMPLETED').entries.map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Paused List',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const ids = res.data.MediaListCollection.lists.find(({ status }) => status === 'PAUSED').entries.map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Dropped List',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const ids = res.data.MediaListCollection.lists.find(({ status }) => status === 'DROPPED').entries.map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
{
|
||||
title: 'Currently Watching List',
|
||||
load: (page = 1, perPage = 50, variables = {}) => {
|
||||
const res = userLists.value.then(res => {
|
||||
const ids = res.data.MediaListCollection.lists.find(({ status }) => status === 'CURRENT').entries.map(({ media }) => media.id)
|
||||
return alRequest({ method: 'SearchIDS', page, perPage, id: ids, ...SectionsManager.sanitiseObject(variables) })
|
||||
})
|
||||
return SectionsManager.wrapResponse(res, perPage)
|
||||
},
|
||||
hide: !alToken
|
||||
},
|
||||
// common, non-user specific sections
|
||||
{ title: 'Popular This Season', variables: { sort: 'POPULARITY_DESC', season: currentSeason, year: currentYear } },
|
||||
{ title: 'Trending Now', variables: { sort: 'TRENDING_DESC' } },
|
||||
{ title: 'All Time Popular', variables: { sort: 'POPULARITY_DESC' } },
|
||||
{ title: 'Romance', variables: { sort: 'TRENDING_DESC', genre: 'Romance' } },
|
||||
{ title: 'Action', variables: { sort: 'TRENDING_DESC', genre: 'Action' } },
|
||||
{ title: 'Adventure', variables: { sort: 'TRENDING_DESC', genre: 'Adventure' } },
|
||||
{ title: 'Fantasy', variables: { sort: 'TRENDING_DESC', genre: 'Fantasy' } },
|
||||
{ title: 'Comedy', variables: { sort: 'TRENDING_DESC', genre: 'Comedy' } }
|
||||
]
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
import { writable } from 'simple-store-svelte'
|
||||
import { defaults } from './util.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
export let alToken = localStorage.getItem('ALtoken') || null
|
||||
|
||||
let storedSettings = { ...defaults }
|
||||
|
||||
let scopedDefaults = { ...defaults }
|
||||
|
||||
try {
|
||||
storedSettings = JSON.parse(localStorage.getItem('settings')) || { ...defaults }
|
||||
} catch (e) {}
|
||||
try {
|
||||
scopedDefaults = {
|
||||
homeSections: [...(storedSettings.rssFeedsNew || defaults.rssFeedsNew).map(([title]) => title), 'Continue Watching', 'Sequels You Missed', 'Your List', 'Popular This Season', 'Trending Now', 'All Time Popular', 'Romance', 'Action', 'Adventure', 'Fantasy', 'Comedy']
|
||||
}
|
||||
} catch (e) {
|
||||
resetSettings()
|
||||
location.reload()
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import('svelte/store').Writable & { value: any }}
|
||||
*/
|
||||
export const settings = writable({ ...defaults, ...scopedDefaults, ...storedSettings })
|
||||
|
||||
settings.subscribe(value => {
|
||||
localStorage.setItem('settings', JSON.stringify(value))
|
||||
})
|
||||
|
||||
export function resetSettings () {
|
||||
settings.value = { ...defaults, ...scopedDefaults }
|
||||
}
|
||||
|
||||
window.addEventListener('paste', ({ clipboardData }) => {
|
||||
if (clipboardData.items?.[0]) {
|
||||
if (clipboardData.items[0].type === 'text/plain' && clipboardData.items[0].kind === 'string') {
|
||||
clipboardData.items[0].getAsString(text => {
|
||||
let token = text.split('access_token=')?.[1]?.split('&token_type')?.[0]
|
||||
if (token) {
|
||||
if (token.endsWith('/')) token = token.slice(0, -1)
|
||||
handleToken(token)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
IPC.on('altoken', handleToken)
|
||||
function handleToken (data) {
|
||||
localStorage.setItem('ALtoken', data)
|
||||
alToken = data
|
||||
location.reload()
|
||||
}
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
import JASSUB from 'jassub'
|
||||
import { toTS, subRx, videoRx } from './util.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { client } from '@/modules/torrent.js'
|
||||
import clipboard from './clipboard.js'
|
||||
import { SUPPORTS } from '@/modules/support.js'
|
||||
|
||||
const defaultHeader = `[Script Info]
|
||||
Title: English (US)
|
||||
ScriptType: v4.00+
|
||||
WrapStyle: 0
|
||||
PlayResX: 1280
|
||||
PlayResY: 720
|
||||
ScaledBorderAndShadow: yes
|
||||
|
||||
[V4+ Styles]
|
||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||
Style: Default, ${settings.value.font?.name.toLowerCase() || 'Roboto Medium'},52,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2.6,0,2,20,20,46,1
|
||||
[Events]
|
||||
|
||||
`
|
||||
const stylesRx = /^Style:[^,]*/gm
|
||||
export default class Subtitles {
|
||||
constructor (video, files, selected, onHeader) {
|
||||
this.video = video
|
||||
this.selected = selected || null
|
||||
this.files = files || []
|
||||
this.headers = []
|
||||
this.tracks = []
|
||||
this._tracksString = []
|
||||
this._stylesMap = []
|
||||
this.fonts = ['/Roboto.ttf']
|
||||
this.renderer = null
|
||||
this.parsed = false
|
||||
this.stream = null
|
||||
this.parser = null
|
||||
this.current = 0
|
||||
this.onHeader = onHeader
|
||||
this.videoFiles = files.filter(file => videoRx.test(file.name))
|
||||
this.subtitleFiles = []
|
||||
this.timeout = null
|
||||
this.handleFile = ({ detail }) => {
|
||||
if (this.selected) {
|
||||
const uint8 = new Uint8Array(detail.data)
|
||||
this.fonts.push(uint8)
|
||||
this.renderer?.addFont(uint8)
|
||||
}
|
||||
}
|
||||
this.handleSubtitle = ({ detail }) => {
|
||||
const { subtitle, trackNumber } = detail
|
||||
if (this.selected) {
|
||||
const string = JSON.stringify(subtitle)
|
||||
if (this._tracksString[trackNumber] && !this._tracksString[trackNumber].has(string)) {
|
||||
this._tracksString[trackNumber].add(string)
|
||||
const assSub = this.constructSub(subtitle, this.headers[trackNumber].type !== 'ass', this.tracks[trackNumber].length, trackNumber)
|
||||
this.tracks[trackNumber].push(assSub)
|
||||
if (this.current === trackNumber) this.renderer?.createEvent(assSub)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.handleTracks = ({ detail }) => {
|
||||
if (this.selected) {
|
||||
for (const track of detail) {
|
||||
if (!this.tracks[track.number]) {
|
||||
// overwrite webvtt or other header with custom one
|
||||
if (track.type !== 'ass') track.header = defaultHeader
|
||||
this.tracks[track.number] = []
|
||||
this._tracksString[track.number] = new Set()
|
||||
this.headers[track.number] = track
|
||||
this._stylesMap[track.number] = {
|
||||
Default: 0
|
||||
}
|
||||
const styleMatches = track.header.match(stylesRx)
|
||||
for (let i = 0; i < styleMatches.length; ++i) {
|
||||
const style = styleMatches[i].replace('Style:', '').trim()
|
||||
this._stylesMap[track.number][style] = i + 1
|
||||
}
|
||||
|
||||
this.onHeader()
|
||||
}
|
||||
}
|
||||
this.initSubtitleRenderer()
|
||||
const tracks = this.headers?.filter(t => t)
|
||||
if (tracks?.length && settings.value.subtitleLanguage) {
|
||||
if (tracks.length === 1) {
|
||||
this.selectCaptions(tracks[0].number)
|
||||
} else {
|
||||
const wantedTrack = tracks.find(({ language }) => {
|
||||
if (language == null) language = 'eng'
|
||||
return language === settings.value.subtitleLanguage
|
||||
})
|
||||
if (wantedTrack) return this.selectCaptions(wantedTrack.number)
|
||||
|
||||
const englishTrack = tracks.find(({ language }) => language === null || language === 'eng')
|
||||
if (englishTrack) return this.selectCaptions(englishTrack.number)
|
||||
|
||||
this.selectCaptions(tracks[0].number)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.handleClipboardText = ({ detail }) => {
|
||||
for (const { text, type } of detail) {
|
||||
if (text.startsWith('[Script Info]')) this.addSingleSubtitleFile(new File([text], 'Subtitle', { type }))
|
||||
}
|
||||
}
|
||||
this.handleClipboardFiles = ({ detail }) => {
|
||||
for (const file of detail) {
|
||||
if (subRx.test(file.name)) this.addSingleSubtitleFile(file)
|
||||
}
|
||||
}
|
||||
this.handleSubtitleFile = ({ detail }) => {
|
||||
this.addSingleSubtitleFile(new File([detail.data], detail.name))
|
||||
}
|
||||
|
||||
client.on('tracks', this.handleTracks)
|
||||
client.on('subtitle', this.handleSubtitle)
|
||||
client.on('file', this.handleFile)
|
||||
client.on('subtitleFile', this.handleSubtitleFile)
|
||||
clipboard.on('text', this.handleClipboardText)
|
||||
clipboard.on('files', this.handleClipboardFiles)
|
||||
}
|
||||
|
||||
async addSingleSubtitleFile (file) {
|
||||
const index = this.headers.length
|
||||
this.subtitleFiles[index] = file
|
||||
const type = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase()
|
||||
const subname = file.name.slice(0, file.name.lastIndexOf('.'))
|
||||
// sub name could contain video name with or without extension, possibly followed by lang, or not.
|
||||
const name = subname.includes(this.selected.name)
|
||||
? subname.replace(this.selected.name, '')
|
||||
: subname.replace(this.selected.name.slice(0, this.selected.name.lastIndexOf('.')), '')
|
||||
this.headers[index] = {
|
||||
header: defaultHeader,
|
||||
language: name.replace(/[,._-]/g, ' ').trim() || 'Track ' + index,
|
||||
number: index,
|
||||
type
|
||||
}
|
||||
this.onHeader()
|
||||
this.tracks[index] = []
|
||||
const subtitles = Subtitles.convertSubText(await file.text(), type)
|
||||
if (type === 'ass') {
|
||||
this.headers[index].header = subtitles
|
||||
} else {
|
||||
this.headers[index].header += subtitles.join('\n')
|
||||
}
|
||||
if (!this.current) {
|
||||
this.current = 0
|
||||
this.initSubtitleRenderer()
|
||||
this.selectCaptions(this.current)
|
||||
this.onHeader()
|
||||
}
|
||||
}
|
||||
|
||||
initSubtitleRenderer () {
|
||||
if (!this.renderer) {
|
||||
const options = {
|
||||
video: this.video,
|
||||
subContent: defaultHeader,
|
||||
fonts: this.fonts,
|
||||
offscreenRender: SUPPORTS.offscreenRender,
|
||||
libassMemoryLimit: 1024,
|
||||
libassGlyphLimit: 80000,
|
||||
maxRenderHeight: parseInt(settings.value.subtitleRenderHeight) || 0,
|
||||
fallbackFont: settings.value.font?.name || 'roboto medium',
|
||||
availableFonts: {
|
||||
'roboto medium': './Roboto.ttf'
|
||||
},
|
||||
workerUrl: new URL('jassub/dist/jassub-worker.js', import.meta.url).toString(),
|
||||
wasmUrl: new URL('jassub/dist/jassub-worker.wasm', import.meta.url).toString(),
|
||||
legacyWasmUrl: new URL('jassub/dist/jassub-worker.wasm.js', import.meta.url).toString(),
|
||||
modernWasmUrl: new URL('jassub/dist/jassub-worker-modern.wasm', import.meta.url).toString(),
|
||||
useLocalFonts: settings.value.missingFont,
|
||||
dropAllBlur: settings.value.disableSubtitleBlur
|
||||
}
|
||||
if (settings.value.font) {
|
||||
options.availableFonts[settings.value.font.name.toLowerCase()] = new Uint8Array(settings.value.font.data)
|
||||
this.fonts.push(new Uint8Array(settings.value.font.data))
|
||||
}
|
||||
this.renderer = new JASSUB(options)
|
||||
}
|
||||
}
|
||||
|
||||
static convertSubText (text, type) {
|
||||
const srtRx = /(?:\d+\r?\n)?(\S{9,12})\s?-->\s?(\S{9,12})(.*)\r?\n([\s\S]*)$/i
|
||||
const srt = text => {
|
||||
const subtitles = []
|
||||
const replaced = text.replace(/\r/g, '')
|
||||
for (const split of replaced.split(/\r?\n\r?\n/)) {
|
||||
const match = split.match(srtRx)
|
||||
if (match) {
|
||||
// timestamps
|
||||
match[1] = match[1].match(/.*[.,]\d{2}/)[0]
|
||||
match[2] = match[2].match(/.*[.,]\d{2}/)[0]
|
||||
if (match[1].length === 9) {
|
||||
match[1] = '0:' + match[1]
|
||||
} else {
|
||||
if (match[1][0] === '0') {
|
||||
match[1] = match[1].substring(1)
|
||||
}
|
||||
}
|
||||
match[1].replace(',', '.')
|
||||
if (match[2].length === 9) {
|
||||
match[2] = '0:' + match[2]
|
||||
} else {
|
||||
if (match[2][0] === '0') {
|
||||
match[2] = match[2].substring(1)
|
||||
}
|
||||
}
|
||||
match[2].replace(',', '.')
|
||||
// create array of all tags
|
||||
const matches = match[4].match(/<[^>]+>/g)
|
||||
if (matches) {
|
||||
matches.forEach(matched => {
|
||||
if (/<\//.test(matched)) { // check if its a closing tag
|
||||
match[4] = match[4].replace(matched, matched.replace('</', '{\\').replace('>', '0}'))
|
||||
} else {
|
||||
match[4] = match[4].replace(matched, matched.replace('<', '{\\').replace('>', '1}'))
|
||||
}
|
||||
})
|
||||
}
|
||||
subtitles.push('Dialogue: 0,' + match[1].replace(',', '.') + ',' + match[2].replace(',', '.') + ',Default,,0,0,0,,' + match[4].replace(/\r?\n/g, '\\N'))
|
||||
}
|
||||
}
|
||||
return subtitles
|
||||
}
|
||||
const subRx = /[{[](\d+)[}\]][{[](\d+)[}\]](.+)/i
|
||||
const sub = text => {
|
||||
const subtitles = []
|
||||
const replaced = text.replace(/\r/g, '')
|
||||
let frames = 1000 / Number(replaced.match(subRx)[3])
|
||||
if (!frames || isNaN(frames)) frames = 41.708
|
||||
for (const split of replaced.split('\r?\n')) {
|
||||
const match = split.match(subRx)
|
||||
if (match) subtitles.push('Dialogue: 0,' + toTS((match[1] * frames) / 1000, 1) + ',' + toTS((match[2] * frames) / 1000, 1) + ',Default,,0,0,0,,' + match[3].replace('|', '\\N'))
|
||||
}
|
||||
return subtitles
|
||||
}
|
||||
const subtitles = type === 'ass' ? text : []
|
||||
if (type === 'ass') {
|
||||
return subtitles
|
||||
} else if (type === 'srt' || type === 'vtt') {
|
||||
return srt(text)
|
||||
} else if (type === 'sub') {
|
||||
return sub(text)
|
||||
} else {
|
||||
// subbers have a tendency to not set the extensions properly
|
||||
if (srtRx.test(text)) return srt(text)
|
||||
if (subRx.test(text)) return sub(text)
|
||||
}
|
||||
}
|
||||
|
||||
constructSub (subtitle, isNotAss, subtitleIndex, trackNumber) {
|
||||
if (isNotAss === true) { // converts VTT or other to SSA
|
||||
const matches = subtitle.text.match(/<[^>]+>/g) // create array of all tags
|
||||
if (matches) {
|
||||
matches.forEach(match => {
|
||||
if (/<\//.test(match)) { // check if its a closing tag
|
||||
subtitle.text = subtitle.text.replace(match, match.replace('</', '{\\').replace('>', '0}'))
|
||||
} else {
|
||||
subtitle.text = subtitle.text.replace(match, match.replace('<', '{\\').replace('>', '1}'))
|
||||
}
|
||||
})
|
||||
}
|
||||
// replace all html special tags with normal ones
|
||||
subtitle.text = subtitle.text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/ /g, '\\h').replace(/\r?\n/g, '\\N')
|
||||
}
|
||||
return {
|
||||
Start: subtitle.time,
|
||||
Duration: subtitle.duration,
|
||||
Style: this._stylesMap[trackNumber][subtitle.style || 'Default'] || 0,
|
||||
Name: subtitle.name || '',
|
||||
MarginL: Number(subtitle.marginL) || 0,
|
||||
MarginR: Number(subtitle.marginR) || 0,
|
||||
MarginV: Number(subtitle.marginV) || 0,
|
||||
Effect: subtitle.effect || '',
|
||||
Text: subtitle.text || '',
|
||||
ReadOrder: 1,
|
||||
Layer: Number(subtitle.layer) || 0,
|
||||
_index: subtitleIndex
|
||||
}
|
||||
}
|
||||
|
||||
selectCaptions (trackNumber) {
|
||||
if (trackNumber != null) {
|
||||
this.current = Number(trackNumber)
|
||||
this.onHeader()
|
||||
if (this.headers) {
|
||||
this.renderer?.setTrack(this.current !== -1 ? this.headers[this.current].header.slice(0, -1) : defaultHeader)
|
||||
if (this.tracks[this.current]) {
|
||||
if (this.renderer) for (const subtitle of this.tracks[this.current]) this.renderer.createEvent(subtitle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroy () {
|
||||
client.off('tracks', this.handleTracks)
|
||||
client.off('subtitle', this.handleSubtitle)
|
||||
client.off('file', this.handleFile)
|
||||
client.off('files', this.handleClipboardFiles)
|
||||
client.off('text', this.handleClipboardText)
|
||||
client.off('subtitleFile', this.handleSubtitleFile)
|
||||
this.stream?.destroy()
|
||||
this.parser?.destroy()
|
||||
this.renderer?.destroy()
|
||||
this.files = null
|
||||
this.video = null
|
||||
this.selected = null
|
||||
this.tracks = null
|
||||
this.headers = null
|
||||
this.onHeader()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// feature support list, overriden per environment, global
|
||||
|
||||
export const SUPPORTS = {
|
||||
offscreenRender: true,
|
||||
update: true,
|
||||
angle: true,
|
||||
doh: true,
|
||||
dht: true,
|
||||
discord: true,
|
||||
torrentPort: true,
|
||||
torrentPath: true,
|
||||
torrentPersist: true
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import { append, element } from 'svelte/internal'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
|
||||
const style = element('style')
|
||||
style.id = 'customThemes'
|
||||
append(document.head, style)
|
||||
|
||||
export const variables = writable(localStorage.getItem('theme') || '')
|
||||
|
||||
variables.subscribe(value => {
|
||||
localStorage.setItem('theme', value)
|
||||
style.textContent = `:root{${value.replaceAll('}', '')}}`
|
||||
})
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
import { files, media } from '../views/Player/MediaHandler.svelte'
|
||||
import { page } from '@/App.svelte'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import clipboard from './clipboard.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
import 'browser-event-target-emitter'
|
||||
|
||||
const torrentRx = /(^magnet:){1}|(^[A-F\d]{8,40}$){1}|(.*\.torrent$){1}/i
|
||||
|
||||
class TorrentWorker extends EventTarget {
|
||||
constructor () {
|
||||
super()
|
||||
this.ready = new Promise(resolve => {
|
||||
IPC.once('port', () => {
|
||||
this.port = window.port
|
||||
this.port.onmessage(this.handleMessage.bind(this))
|
||||
resolve()
|
||||
})
|
||||
IPC.emit('portRequest')
|
||||
})
|
||||
clipboard.on('text', ({ detail }) => {
|
||||
for (const { text } of detail) {
|
||||
if (torrentRx.exec(text)) {
|
||||
media.set(null)
|
||||
add(text)
|
||||
}
|
||||
}
|
||||
})
|
||||
clipboard.on('files', async ({ detail }) => {
|
||||
for (const file of detail) {
|
||||
if (file.name.endsWith('.torrent')) {
|
||||
media.set(null)
|
||||
add(new Uint8Array(await file.arrayBuffer()))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleMessage ({ data }) {
|
||||
this.emit(data.type, data.data)
|
||||
}
|
||||
|
||||
async send (type, data, transfer) {
|
||||
await this.ready
|
||||
console.info('Torrent: sending message', { type, data })
|
||||
this.port.postMessage({ type, data }, transfer)
|
||||
}
|
||||
}
|
||||
|
||||
export const client = new TorrentWorker()
|
||||
|
||||
client.send('load')
|
||||
|
||||
client.on('files', ({ detail }) => {
|
||||
files.set(detail)
|
||||
})
|
||||
|
||||
client.on('error', ({ detail }) => {
|
||||
console.error(detail)
|
||||
toast.error('Torrent Error', { description: detail.message || detail })
|
||||
})
|
||||
|
||||
client.on('warn', ({ detail }) => {
|
||||
console.error(detail)
|
||||
toast.warning('Torrent Warning', { description: detail.message || detail })
|
||||
})
|
||||
|
||||
export async function add (torrentID, hide) {
|
||||
if (torrentID) {
|
||||
console.info('Torrent: adding torrent', { torrentID })
|
||||
files.set([])
|
||||
if (!hide) page.set('player')
|
||||
client.send('torrent', torrentID)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
export function countdown (s) {
|
||||
const d = Math.floor(s / (3600 * 24))
|
||||
s -= d * 3600 * 24
|
||||
const h = Math.floor(s / 3600)
|
||||
s -= h * 3600
|
||||
const m = Math.floor(s / 60)
|
||||
s -= m * 60
|
||||
const tmp = []
|
||||
if (d) tmp.push(d + 'd')
|
||||
if (d || h) tmp.push(h + 'h')
|
||||
if (d || h || m) tmp.push(m + 'm')
|
||||
return tmp.join(' ')
|
||||
}
|
||||
|
||||
const formatter = new Intl.RelativeTimeFormat('en')
|
||||
const ranges = {
|
||||
years: 3600 * 24 * 365,
|
||||
months: 3600 * 24 * 30,
|
||||
weeks: 3600 * 24 * 7,
|
||||
days: 3600 * 24,
|
||||
hours: 3600,
|
||||
minutes: 60,
|
||||
seconds: 1
|
||||
}
|
||||
|
||||
export function since (date) {
|
||||
const secondsElapsed = (date.getTime() - Date.now()) / 1000
|
||||
for (const key in ranges) {
|
||||
if (ranges[key] < Math.abs(secondsElapsed)) {
|
||||
const delta = secondsElapsed / ranges[key]
|
||||
// @ts-ignore
|
||||
return formatter.format(Math.round(delta), key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const units = [' B', ' kB', ' MB', ' GB', ' TB']
|
||||
export function fastPrettyBytes (num) {
|
||||
if (isNaN(num)) return '0 B'
|
||||
if (num < 1) return num + ' B'
|
||||
const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
|
||||
return Number((num / Math.pow(1000, exponent)).toFixed(2)) + units[exponent]
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {DOMParser['parseFromString']}
|
||||
*/
|
||||
export const DOMPARSER = (typeof DOMParser !== 'undefined') && DOMParser.prototype.parseFromString.bind(new DOMParser())
|
||||
|
||||
export const sleep = t => new Promise(resolve => setTimeout(resolve, t).unref?.())
|
||||
|
||||
export function toTS (sec, full) {
|
||||
if (isNaN(sec) || sec < 0) {
|
||||
switch (full) {
|
||||
case 1:
|
||||
return '0:00:00.00'
|
||||
case 2:
|
||||
return '0:00:00'
|
||||
case 3:
|
||||
return '00:00'
|
||||
default:
|
||||
return '0:00'
|
||||
}
|
||||
}
|
||||
const hours = Math.floor(sec / 3600)
|
||||
/**
|
||||
* @type {any}
|
||||
*/
|
||||
let minutes = Math.floor(sec / 60) - hours * 60
|
||||
/**
|
||||
* @type {any}
|
||||
*/
|
||||
let seconds = full === 1 ? (sec % 60).toFixed(2) : Math.floor(sec % 60)
|
||||
if (minutes < 10 && (hours > 0 || full)) minutes = '0' + minutes
|
||||
if (seconds < 10) seconds = '0' + seconds
|
||||
return (hours > 0 || full === 1 || full === 2) ? hours + ':' + minutes + ':' + seconds : minutes + ':' + seconds
|
||||
}
|
||||
|
||||
export async function PromiseBatch (task, items, batchSize) {
|
||||
let position = 0
|
||||
let results = []
|
||||
while (position < items.length) {
|
||||
const itemsForBatch = items.slice(position, position + batchSize)
|
||||
results = [...results, ...await Promise.all(itemsForBatch.map(item => task(item)))]
|
||||
position += batchSize
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
export function generateRandomHexCode (len) {
|
||||
let hexCode = ''
|
||||
|
||||
while (hexCode.length < len) {
|
||||
hexCode += (Math.round(Math.random() * 15)).toString(16)
|
||||
}
|
||||
|
||||
return hexCode
|
||||
}
|
||||
|
||||
export function throttle (fn, time) {
|
||||
let wait = false
|
||||
return () => {
|
||||
if (!wait) {
|
||||
fn()
|
||||
wait = true
|
||||
setTimeout(() => {
|
||||
fn()
|
||||
wait = false
|
||||
}, time).unref?.()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function debounce (fn, time) {
|
||||
let timeout
|
||||
return (...args) => {
|
||||
const later = () => {
|
||||
timeout = null
|
||||
fn(...args)
|
||||
}
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(later, time)
|
||||
timeout.unref?.()
|
||||
}
|
||||
}
|
||||
|
||||
export function binarySearch (arr, el) {
|
||||
let left = 0
|
||||
let right = arr.length - 1
|
||||
|
||||
while (left <= right) {
|
||||
// Using bitwise or instead of Math.floor as it is slightly faster
|
||||
const mid = ((right + left) / 2) | 0
|
||||
if (arr[mid] === el) {
|
||||
return true
|
||||
} else if (el < arr[mid]) {
|
||||
right = mid - 1
|
||||
} else {
|
||||
left = mid + 1
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
export const defaults = {
|
||||
playerAutoplay: true,
|
||||
playerPause: true,
|
||||
playerAutocomplete: true,
|
||||
rssQuality: '1080',
|
||||
rssFeedsNew: [['New Releases', 'SubsPlease']],
|
||||
rssAutoplay: true,
|
||||
torrentSpeed: 5,
|
||||
torrentPersist: false,
|
||||
torrentDHT: false,
|
||||
torrentPeX: false,
|
||||
torrentPort: 0,
|
||||
dhtPort: 0,
|
||||
missingFont: true,
|
||||
maxConns: 50,
|
||||
subtitleRenderHeight: '0',
|
||||
subtitleLanguage: 'eng',
|
||||
audioLanguage: 'jpn',
|
||||
enableDoH: false,
|
||||
doHURL: 'https://cloudflare-dns.com/dns-query',
|
||||
disableSubtitleBlur: false,
|
||||
toshoURL: decodeURIComponent(atob('aHR0cHM6Ly9mZWVkLmFuaW1ldG9zaG8ub3JnLw==')),
|
||||
showDetailsInRPC: true,
|
||||
smoothScroll: true,
|
||||
cards: 'small',
|
||||
expandingSidebar: true,
|
||||
torrentPath: undefined,
|
||||
font: undefined,
|
||||
angle: 'default'
|
||||
}
|
||||
|
||||
export const subtitleExtensions = ['srt', 'vtt', 'ass', 'ssa', 'sub', 'txt']
|
||||
export const subRx = new RegExp(`.(${subtitleExtensions.join('|')})$`, 'i')
|
||||
|
||||
export const videoExtensions = ['3g2', '3gp', 'asf', 'avi', 'dv', 'flv', 'gxf', 'm2ts', 'm4a', 'm4b', 'm4p', 'm4r', 'm4v', 'mkv', 'mov', 'mp4', 'mpd', 'mpeg', 'mpg', 'mxf', 'nut', 'ogm', 'ogv', 'swf', 'ts', 'vob', 'webm', 'wmv', 'wtv']
|
||||
export const videoRx = new RegExp(`.(${videoExtensions.join('|')})$`, 'i')
|
||||
|
||||
// freetype supported
|
||||
export const fontExtensions = ['ttf', 'ttc', 'woff', 'woff2', 'otf', 'cff', 'otc', 'pfa', 'pfb', 'pcf', 'fnt', 'bdf', 'pfr', 'eot']
|
||||
export const fontRx = new RegExp(`.(${fontExtensions.join('|')})$`, 'i')
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
import WebTorrent from 'webtorrent'
|
||||
import HTTPTracker from 'bittorrent-tracker/lib/client/http-tracker.js'
|
||||
import { hex2bin, arr2hex, text2arr } from 'uint8-util'
|
||||
import Parser from './parser.js'
|
||||
import { defaults, fontRx, subRx, videoRx } from './util.js'
|
||||
import { SUPPORTS } from './support.js'
|
||||
|
||||
const LARGE_FILESIZE = 32_000_000_000
|
||||
|
||||
const announce = [
|
||||
atob('d3NzOi8vdHJhY2tlci5vcGVud2VidG9ycmVudC5jb20='),
|
||||
atob('d3NzOi8vdHJhY2tlci53ZWJ0b3JyZW50LmRldg=='),
|
||||
atob('d3NzOi8vdHJhY2tlci5maWxlcy5mbTo3MDczL2Fubm91bmNl'),
|
||||
atob('d3NzOi8vdHJhY2tlci5idG9ycmVudC54eXov'),
|
||||
atob('dWRwOi8vb3Blbi5zdGVhbHRoLnNpOjgwL2Fubm91bmNl'),
|
||||
atob('aHR0cDovL255YWEudHJhY2tlci53Zjo3Nzc3L2Fubm91bmNl'),
|
||||
atob('dWRwOi8vdHJhY2tlci5vcGVudHJhY2tyLm9yZzoxMzM3L2Fubm91bmNl'),
|
||||
atob('dWRwOi8vZXhvZHVzLmRlc3luYy5jb206Njk2OS9hbm5vdW5jZQ=='),
|
||||
atob('dWRwOi8vdHJhY2tlci5jb3BwZXJzdXJmZXIudGs6Njk2OS9hbm5vdW5jZQ=='),
|
||||
atob('dWRwOi8vOS5yYXJiZy50bzoyNzEwL2Fubm91bmNl'),
|
||||
atob('dWRwOi8vdHJhY2tlci50b3JyZW50LmV1Lm9yZzo0NTEvYW5ub3VuY2U='),
|
||||
atob('aHR0cDovL29wZW4uYWNnbnh0cmFja2VyLmNvbTo4MC9hbm5vdW5jZQ=='),
|
||||
atob('aHR0cDovL2FuaWRleC5tb2U6Njk2OS9hbm5vdW5jZQ=='),
|
||||
atob('aHR0cDovL3RyYWNrZXIuYW5pcmVuYS5jb206ODAvYW5ub3VuY2U=')
|
||||
]
|
||||
|
||||
let storedSettings = {}
|
||||
|
||||
try {
|
||||
storedSettings = JSON.parse(localStorage.getItem('settings')) || {}
|
||||
} catch (error) {}
|
||||
|
||||
export default class TorrentClient extends WebTorrent {
|
||||
static excludedErrorMessages = ['WebSocket', 'User-Initiated Abort, reason=', 'Connection failed.']
|
||||
|
||||
constructor (ipc, storageQuota, serverMode, controller, settingOverrides = {}) {
|
||||
const settings = { ...defaults, ...storedSettings, ...settingOverrides }
|
||||
super({
|
||||
dht: !settings.torrentDHT,
|
||||
maxConns: settings.maxConns,
|
||||
downloadLimit: settings.torrentSpeed * 1048576 || 0,
|
||||
uploadLimit: settings.torrentSpeed * 1572864 || 0, // :trolled:
|
||||
torrentPort: settings.torrentPort || 0,
|
||||
dhtPort: settings.dhtPort || 0
|
||||
})
|
||||
this._ready = new Promise(resolve => {
|
||||
ipc.on('port', ({ ports }) => {
|
||||
this.message = ports[0].postMessage.bind(ports[0])
|
||||
resolve()
|
||||
ports[0].onmessage = ({ data }) => {
|
||||
if (data.type === 'load') this.loadLastTorrent()
|
||||
if (data.type === 'destroy') this.destroy()
|
||||
this.handleMessage({ data })
|
||||
}
|
||||
})
|
||||
ipc.on('destroy', this.destroy.bind(this))
|
||||
})
|
||||
this.settings = settings
|
||||
|
||||
this.serverMode = serverMode
|
||||
this.storageQuota = storageQuota
|
||||
|
||||
this.current = null
|
||||
this.parsed = false
|
||||
|
||||
setInterval(() => {
|
||||
this.dispatch('stats', {
|
||||
numPeers: (this.torrents.length && this.torrents[0].numPeers) || 0,
|
||||
uploadSpeed: (this.torrents.length && this.torrents[0].uploadSpeed) || 0,
|
||||
downloadSpeed: (this.torrents.length && this.torrents[0].downloadSpeed) || 0
|
||||
})
|
||||
}, 200)
|
||||
setInterval(() => {
|
||||
if (this.torrents[0]?.pieces) this.dispatch('progress', this.current?.progress)
|
||||
}, 2000)
|
||||
this.on('torrent', this.handleTorrent.bind(this))
|
||||
|
||||
const createServer = controller => {
|
||||
this.server = this.createServer({ controller }, serverMode)
|
||||
this.server.listen(0, () => {})
|
||||
}
|
||||
|
||||
if (controller) {
|
||||
controller.then(createServer)
|
||||
} else {
|
||||
createServer()
|
||||
}
|
||||
|
||||
this.trackers = {
|
||||
cat: new HTTPTracker({}, atob('aHR0cDovL255YWEudHJhY2tlci53Zjo3Nzc3L2Fubm91bmNl'))
|
||||
}
|
||||
|
||||
this.on('error', this.dispatchError.bind(this))
|
||||
}
|
||||
|
||||
loadLastTorrent () {
|
||||
const torrent = localStorage.getItem('torrent')
|
||||
if (torrent) this.addTorrent(new Uint8Array(JSON.parse(torrent)), JSON.parse(localStorage.getItem('lastFinished')))
|
||||
}
|
||||
|
||||
async handleTorrent (torrent) {
|
||||
const files = torrent.files.map(file => {
|
||||
return {
|
||||
infoHash: torrent.infoHash,
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
size: file.size,
|
||||
path: file.path,
|
||||
url: this.serverMode === 'node' ? 'http://localhost:' + this.server.address().port + file.streamURL : file.streamURL
|
||||
}
|
||||
})
|
||||
if (torrent.length > LARGE_FILESIZE) {
|
||||
for (const file of torrent.files) {
|
||||
file.deselect()
|
||||
}
|
||||
this.dispatch('warn', 'Detected Large Torrent! To Conserve Drive Space Files Will Be Downloaded Selectively Instead Of Downloading The Entire Torrent.')
|
||||
}
|
||||
this.dispatch('files', files)
|
||||
this.dispatch('magnet', { magnet: torrent.magnetURI, hash: torrent.infoHash })
|
||||
localStorage.setItem('torrent', JSON.stringify([...torrent.torrentFile]))
|
||||
|
||||
if (torrent.length > await this.storageQuota(torrent.path)) {
|
||||
this.dispatch('error', 'Torrent Too Big! This Torrent Exceeds The Selected Drive\'s Available Space. Change Download Location In Torrent Settings To A Drive With More Space And Restart The App!')
|
||||
}
|
||||
}
|
||||
|
||||
async findFontFiles (targetFile) {
|
||||
const files = this.torrents[0].files
|
||||
const fontFiles = files.filter(file => fontRx.test(file.name))
|
||||
|
||||
const map = {}
|
||||
|
||||
// deduplicate fonts
|
||||
// some releases have duplicate fonts for diff languages
|
||||
// if they have different chars, we can't find that out anyways
|
||||
// so some chars might fail, on REALLY bad releases
|
||||
for (const file of fontFiles) {
|
||||
map[file.name] = file
|
||||
}
|
||||
|
||||
for (const file of Object.values(map)) {
|
||||
const data = await file.arrayBuffer()
|
||||
if (targetFile !== this.current) return
|
||||
this.dispatch('file', { data: new Uint8Array(data) }, [data])
|
||||
}
|
||||
}
|
||||
|
||||
async findSubtitleFiles (targetFile) {
|
||||
const files = this.torrents[0].files
|
||||
const videoFiles = files.filter(file => videoRx.test(file.name))
|
||||
const videoName = targetFile.name.substring(0, targetFile.name.lastIndexOf('.')) || targetFile.name
|
||||
// array of subtitle files that match video name, or all subtitle files when only 1 vid file
|
||||
const subfiles = files.filter(file => {
|
||||
return subRx.test(file.name) && (videoFiles.length === 1 ? true : file.name.includes(videoName))
|
||||
})
|
||||
for (const file of subfiles) {
|
||||
const data = await file.arrayBuffer()
|
||||
if (targetFile !== this.current) return
|
||||
this.dispatch('subtitleFile', { name: file.name, data: new Uint8Array(data) }, [data])
|
||||
}
|
||||
}
|
||||
|
||||
_scrape ({ id, infoHashes }) {
|
||||
this.trackers.cat._request(this.trackers.cat.scrapeUrl, { info_hash: infoHashes.map(infoHash => hex2bin(infoHash)) }, (err, data) => {
|
||||
if (err) {
|
||||
this.dispatch('error', err)
|
||||
return this.dispatch('scrape', { id, result: [] })
|
||||
}
|
||||
const { files } = data
|
||||
const result = []
|
||||
for (const [key, data] of Object.entries(files || {})) {
|
||||
result.push({ hash: key.length !== 40 ? arr2hex(text2arr(key)) : key, ...data })
|
||||
}
|
||||
this.dispatch('scrape', { id, result })
|
||||
})
|
||||
}
|
||||
|
||||
dispatchError (e) {
|
||||
if (e instanceof ErrorEvent) return this.dispatchError(e.error)
|
||||
if (e instanceof PromiseRejectionEvent) return this.dispatchError(e.reason)
|
||||
for (const exclude of TorrentClient.excludedErrorMessages) {
|
||||
if (e.message?.startsWith(exclude)) return
|
||||
}
|
||||
this.dispatch('error', e)
|
||||
}
|
||||
|
||||
async addTorrent (data, skipVerify = false) {
|
||||
const existing = await this.get(data)
|
||||
if (existing) {
|
||||
if (existing.ready) this.handleTorrent(existing)
|
||||
return
|
||||
}
|
||||
localStorage.setItem('lastFinished', false)
|
||||
if (this.torrents.length) await this.remove(this.torrents[0])
|
||||
const torrent = await this.add(data, {
|
||||
private: this.settings.torrentPeX,
|
||||
path: this.settings.torrentPath,
|
||||
destroyStoreOnDestroy: !this.settings.torrentPersist,
|
||||
skipVerify,
|
||||
announce
|
||||
})
|
||||
|
||||
torrent.once('done', () => {
|
||||
if (SUPPORTS.torrentPersist && this.settings.torrentPath) localStorage.setItem('lastFinished', true)
|
||||
})
|
||||
}
|
||||
|
||||
async handleMessage ({ data }) {
|
||||
switch (data.type) {
|
||||
case 'current': {
|
||||
if (data.data) {
|
||||
const torrent = await this.get(data.data.infoHash)
|
||||
const found = torrent?.files.find(file => file.path === data.data.path)
|
||||
if (!found) return
|
||||
if (this.current) {
|
||||
this.current.removeAllListeners('stream')
|
||||
}
|
||||
this.parser?.destroy()
|
||||
found.select()
|
||||
this.current = found
|
||||
this.parser = new Parser(this, found)
|
||||
this.findSubtitleFiles(found)
|
||||
this.findFontFiles(found)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'scrape': {
|
||||
this._scrape(data.data)
|
||||
break
|
||||
}
|
||||
case 'torrent': {
|
||||
this.addTorrent(data.data)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async dispatch (type, data, transfer) {
|
||||
await this._ready
|
||||
this.message?.({ type, data }, transfer)
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this.parser?.destroy()
|
||||
this.server.close()
|
||||
super.destroy()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"name": "common",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@fontsource-variable/material-symbols-outlined": "latest",
|
||||
"@fontsource-variable/nunito": "latest",
|
||||
"@fontsource/roboto": "latest",
|
||||
"anitomyscript": "github:ThaUnknown/anitomyscript#42290c4b3f256893be08a4e89051f448ff5e9d00",
|
||||
"bottleneck": "^2.19.5",
|
||||
"browser-event-target-emitter": "^1.0.1",
|
||||
"jassub": "latest",
|
||||
"js-levenshtein": "^1.1.6",
|
||||
"p2pt": "github:ThaUnknown/p2pt#modernise",
|
||||
"perfect-seekbar": "^1.1.0",
|
||||
"quartermoon": "^1.2.3",
|
||||
"simple-font-select": "^1.0.1",
|
||||
"simple-store-svelte": "^1.0.1",
|
||||
"svelte": "^4.2.7",
|
||||
"svelte-keybinds": "^1.0.5",
|
||||
"svelte-loader": "^3.1.9",
|
||||
"svelte-miniplayer": "^1.0.5",
|
||||
"svelte-sonner": "^0.3.3",
|
||||
"webpack-merge": "^5.10.0"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
},
|
||||
"checkJs": true,
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"module": "ESNext",
|
||||
"types": ["./types.d.ts"],
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"exclude": ["node_modules/**", "**/node_modules", "dist", "build"]
|
||||
}
|
||||
33
common/types.d.ts
vendored
|
|
@ -1,33 +0,0 @@
|
|||
export {}
|
||||
|
||||
type Track = {
|
||||
selected: boolean
|
||||
enabled: boolean
|
||||
id: string
|
||||
kind: string
|
||||
label: string
|
||||
language: string
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
IPC: any
|
||||
port: MessagePort
|
||||
version: {
|
||||
platform: string
|
||||
arch: string
|
||||
}
|
||||
}
|
||||
interface EventTarget {
|
||||
on: (type: string, callback: (any) => void, options?: boolean | {}) => void
|
||||
once: (type: string, callback: (any) => void, options?: boolean | {}) => void
|
||||
emit: (type: string, data?: any) => void
|
||||
dispatch: (type: string, data?: any) => void
|
||||
removeListener: (type: string, callback: (any) => void) => void
|
||||
off: (type: string, callback: (any) => void) => void
|
||||
}
|
||||
interface HTMLMediaElement {
|
||||
videoTracks: Track[]
|
||||
audioTracks: Track[]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<script context='module'>
|
||||
import SectionsManager from '@/modules/sections.js'
|
||||
import Search, { search } from './Search.svelte'
|
||||
import { alRequest, currentSeason, currentYear } from '@/modules/anilist.js'
|
||||
|
||||
const vars = { format: 'TV', season: currentSeason, year: currentYear }
|
||||
|
||||
async function fetchAllScheduleEntries (_variables) {
|
||||
const variables = { ..._variables }
|
||||
const results = { data: { Page: { media: [], pageInfo: { hasNextPage: false } } } }
|
||||
for (let page = 1, hasNextPage = true; hasNextPage && page < 5; ++page) {
|
||||
const res = await alRequest({ method: 'Search', page, perPage: 50, ...vars, ...SectionsManager.sanitiseObject(variables) })
|
||||
hasNextPage = res.data.Page.pageInfo.hasNextPage
|
||||
results.data.Page.media = results.data.Page.media.concat(res.data.Page.media)
|
||||
}
|
||||
results.data.Page.media.sort((a, b) => a.airingSchedule?.nodes?.[0]?.airingAt - b.airingSchedule?.nodes?.[0]?.airingAt)
|
||||
|
||||
return results
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$search = {
|
||||
...vars,
|
||||
load: (_, __, variables) => SectionsManager.wrapResponse(fetchAllScheduleEntries(variables), 150)
|
||||
}
|
||||
</script>
|
||||
|
||||
<Search />
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<script context='module'>
|
||||
import SectionsManager, { sections } from '@/modules/sections.js'
|
||||
import { alToken, settings } from '@/modules/settings.js'
|
||||
import { alRequest, currentSeason, currentYear, userLists } from '@/modules/anilist.js'
|
||||
|
||||
const bannerData = alRequest({ method: 'Search', sort: 'POPULARITY_DESC', perPage: 1, onList: false, season: currentSeason, year: currentYear })
|
||||
|
||||
const manager = new SectionsManager()
|
||||
|
||||
const mappedSections = {}
|
||||
|
||||
for (const section of sections) {
|
||||
mappedSections[section.title] = section
|
||||
}
|
||||
|
||||
for (const sectionTitle of settings.value.homeSections) manager.add(mappedSections[sectionTitle])
|
||||
|
||||
if (alToken) {
|
||||
const userSections = ['Continue Watching', 'Sequels You Missed', 'Your List', 'Completed List', 'Paused List', 'Dropped List', 'Currently Watching List']
|
||||
|
||||
userLists.subscribe(() => {
|
||||
for (const section of manager.sections) {
|
||||
// remove preview value, to force UI to re-request data, which updates it once in viewport
|
||||
if (userSections.includes(section.title)) section.preview.value = section.load(1, 15)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Section from './Section.svelte'
|
||||
import Banner from '@/components/banner/Banner.svelte'
|
||||
import smoothScroll from '@/modules/scroll.js'
|
||||
</script>
|
||||
|
||||
<div class='h-full w-full overflow-y-scroll root overflow-x-hidden' use:smoothScroll>
|
||||
<Banner data={bannerData} />
|
||||
<div class='d-flex flex-column h-full w-full'>
|
||||
{#each manager.sections as section, i (i)}
|
||||
{#if !section.hide}
|
||||
<Section bind:opts={section} />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<script context='module'>
|
||||
const fakecards = Array.from({ length: 15 }, () => ({ data: new Promise(() => {}) }))
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Card from '@/components/cards/Card.svelte'
|
||||
import ErrorCard from '@/components/cards/ErrorCard.svelte'
|
||||
import { search } from '../Search.svelte'
|
||||
import { page } from '@/App.svelte'
|
||||
import { click } from '@/modules/click.js'
|
||||
|
||||
export let opts
|
||||
|
||||
function deferredLoad (element) {
|
||||
const observer = new IntersectionObserver(([entry]) => {
|
||||
if (entry.isIntersecting) {
|
||||
if (!opts.preview.value) opts.preview.value = opts.load(1, 15)
|
||||
observer.unobserve(element)
|
||||
}
|
||||
}, { threshold: 0 })
|
||||
observer.observe(element)
|
||||
|
||||
return { destroy () { observer.unobserve(element) } }
|
||||
}
|
||||
|
||||
function _click () {
|
||||
$search = {
|
||||
...opts.variables,
|
||||
load: opts.load
|
||||
}
|
||||
$page = 'search'
|
||||
}
|
||||
const preview = opts.preview
|
||||
</script>
|
||||
|
||||
<span class='d-flex px-20 align-items-end pointer text-decoration-none text-muted'
|
||||
use:click={_click}
|
||||
use:deferredLoad>
|
||||
<div class='font-size-24 font-weight-semi-bold'>{opts.title}</div>
|
||||
<div class='pr-10 ml-auto font-size-12'>View More</div>
|
||||
</span>
|
||||
<div class='pb-10 w-full position-relative d-flex flex-row justify-content-start gallery'>
|
||||
{#each $preview || fakecards as card}
|
||||
<Card {card} />
|
||||
{/each}
|
||||
{#if $preview?.length}
|
||||
<ErrorCard promise={$preview[0].data} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.text-muted:hover {
|
||||
color: var(--dm-link-text-color-hover) !important;
|
||||
}
|
||||
.gallery:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
height: 100%;
|
||||
width: 8rem;
|
||||
background: linear-gradient(270deg, #17191cff 0%, #17191c00 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.gallery {
|
||||
overflow-x: clip
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<script>
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
let block = false
|
||||
|
||||
async function testConnection () {
|
||||
try {
|
||||
for (let i = 0; i < 2; ++i) {
|
||||
// fetch twice, sometimes it will go tru once if ISP is shitty
|
||||
await fetch($settings.toshoURL + 'json?show=torrent&id=1')
|
||||
}
|
||||
block = false
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
block = true
|
||||
}
|
||||
}
|
||||
testConnection()
|
||||
</script>
|
||||
|
||||
{#if block}
|
||||
<div class='w-full h-full left-0 z-50 px-10 position-absolute content-wrapper bg-dark d-flex align-items-center justify-content-center flex-column'>
|
||||
<div>
|
||||
<h1 class='font-weight-bold'>Could not connect to Tosho!</h1>
|
||||
<div class='font-size-16'>This happens either because Tosho is down, or because your ISP blocks Tosho, the latter being more likely.</div>
|
||||
<div class='font-size-16'>Most features of Miru will not function correctly without being able to connect to Tosho.</div>
|
||||
<div class='font-size-16'>If you enable a VPN a restart might be required for it to take effect.</div>
|
||||
<!-- eslint-disable-next-line svelte/valid-compile -->
|
||||
<div class='font-size-16'>Visit <a class='text-primary pointer' use:click={() => { IPC.emit('open', 'https://thewiki.moe/tutorials/unblock/') }}>this guide</a> for a tutorial on how to bypass ISP blocks.</div>
|
||||
<div class='d-flex w-full mt-20 pt-20'>
|
||||
<button class='btn ml-auto mr-5' type='button' use:click={() => { block = false }}>I Understand</button>
|
||||
<button class='btn btn-primary mr-5' type='button' use:click={() => { IPC.emit('open', 'https://thewiki.moe/tutorials/unblock/') }}>Open Guide</button>
|
||||
<button class='btn btn-primary' type='button' use:click={testConnection}>Reconnect</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
<script context='module'>
|
||||
import { writable } from 'simple-store-svelte'
|
||||
import { resolveFileMedia } from '@/modules/anime.js'
|
||||
import { videoRx } from '@/modules/util.js'
|
||||
import { tick } from 'svelte'
|
||||
import { state } from '../WatchTogether/WatchTogether.svelte'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
|
||||
const episodeRx = /Episode (\d+) - (.*)/
|
||||
|
||||
export const media = writable(null)
|
||||
|
||||
const nowPlaying = writable({})
|
||||
|
||||
export const files = writable([])
|
||||
|
||||
const processed = writable([])
|
||||
|
||||
const noop = () => {}
|
||||
|
||||
let playFile
|
||||
|
||||
media.subscribe((media) => {
|
||||
handleMedia(media || {})
|
||||
return noop
|
||||
})
|
||||
|
||||
function handleCurrent ({ detail }) {
|
||||
media.set(detail.media)
|
||||
}
|
||||
|
||||
export function findInCurrent (obj) {
|
||||
const oldNowPlaying = nowPlaying.value
|
||||
|
||||
if (oldNowPlaying.media?.id === obj.media.id && oldNowPlaying.episode === obj.episode) return false
|
||||
|
||||
const fileList = files.value
|
||||
|
||||
const targetFile = fileList.find(file => file.media?.media?.id === obj.media.id && file.media?.episode === obj.episode)
|
||||
if (!targetFile) return false
|
||||
if (oldNowPlaying.media?.id !== obj.media.id) {
|
||||
// mediachange, filelist change
|
||||
media.set({ media: obj.media, episode: obj.episode })
|
||||
handleFiles(fileList)
|
||||
} else {
|
||||
playFile(targetFile)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function handleMedia ({ media, episode, parseObject }) {
|
||||
if (media) {
|
||||
const ep = Number(episode || parseObject?.episode_number) || null
|
||||
const streamingEpisode = media?.streamingEpisodes.find(episode => {
|
||||
const match = episodeRx.exec(episode.title)
|
||||
return match && Number(match[1]) === ep
|
||||
})
|
||||
|
||||
const np = {
|
||||
media,
|
||||
title: media?.title.userPreferred || parseObject.anime_title,
|
||||
episode: ep,
|
||||
episodeTitle: streamingEpisode && episodeRx.exec(streamingEpisode.title)[2],
|
||||
thumbnail: streamingEpisode?.thumbnail || media?.coverImage.extraLarge
|
||||
}
|
||||
setDiscordRPC(np)
|
||||
setMediaSession(np)
|
||||
nowPlaying.set(np)
|
||||
}
|
||||
}
|
||||
|
||||
const TYPE_EXCLUSIONS = ['ED', 'ENDING', 'NCED', 'NCOP', 'OP', 'OPENING', 'PREVIEW', 'PV']
|
||||
|
||||
// find best media in batch to play
|
||||
// currently in progress or unwatched
|
||||
// tv, movie, ona, ova
|
||||
function findPreferredPlaybackMedia (videoFiles) {
|
||||
for (const { media } of videoFiles) {
|
||||
if (media.media?.mediaListEntry?.status === 'CURRENT') return { media: media.media, episode: (media.media.mediaListEntry.progress || 0) + 1 }
|
||||
}
|
||||
|
||||
for (const { media } of videoFiles) {
|
||||
if (media.media?.mediaListEntry?.status === 'REPEATING') return { media: media.media, episode: (media.media.mediaListEntry.progress || 0) + 1 }
|
||||
}
|
||||
|
||||
let lowestPlanning
|
||||
for (const { media, episode } of videoFiles) {
|
||||
if (media.media?.mediaListEntry?.status === 'PLANNING' && (!lowestPlanning || episode > lowestPlanning.episode)) lowestPlanning = { media: media.media, episode }
|
||||
}
|
||||
if (lowestPlanning) return lowestPlanning
|
||||
|
||||
// unwatched
|
||||
for (const format of ['TV', 'MOVIE', 'ONA', 'OVA']) {
|
||||
let lowestUnwatched
|
||||
for (const { media, episode } of videoFiles) {
|
||||
if (media.media?.format === format && !media.media.mediaListEntry && (!lowestUnwatched || episode > lowestUnwatched.episode)) lowestUnwatched = { media: media.media, episode }
|
||||
}
|
||||
if (lowestUnwatched) return lowestUnwatched
|
||||
}
|
||||
|
||||
// highest occurence if all else fails - unlikely
|
||||
|
||||
const max = highestOccurence(videoFiles, file => file.media.media?.id).media
|
||||
if (max?.media) {
|
||||
return { media: max.media, episode: (max.media.mediaListEntry?.progress + 1 || 1) }
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFiles (files) {
|
||||
console.info('MediaHandler: got files', files)
|
||||
if (!files?.length) return processed.set(files)
|
||||
let videoFiles = []
|
||||
const otherFiles = []
|
||||
for (const file of files) {
|
||||
if (videoRx.test(file.name)) {
|
||||
videoFiles.push(file)
|
||||
} else {
|
||||
otherFiles.push(file)
|
||||
}
|
||||
}
|
||||
let nowPlaying = media.value
|
||||
|
||||
const resolved = await resolveFileMedia(videoFiles.map(file => file.name))
|
||||
|
||||
videoFiles.map(file => {
|
||||
file.media = resolved.find(({ parseObject }) => file.name.includes(parseObject.file_name))
|
||||
return file
|
||||
})
|
||||
|
||||
videoFiles = videoFiles.filter(file => !TYPE_EXCLUSIONS.includes(file.media.parseObject.anime_type?.toUpperCase()))
|
||||
|
||||
if (nowPlaying?.verified && videoFiles.length === 1) {
|
||||
console.info('Media was verified, skipping verification')
|
||||
videoFiles[0].media.media = nowPlaying.media
|
||||
if (nowPlaying.episode) videoFiles[0].media.episode = nowPlaying.episode
|
||||
}
|
||||
|
||||
console.info('MediaHandler: resolved video files', { videoFiles })
|
||||
|
||||
if (!nowPlaying) {
|
||||
nowPlaying = findPreferredPlaybackMedia(videoFiles)
|
||||
}
|
||||
|
||||
const filtered = nowPlaying?.media && videoFiles.filter(file => file.media?.media?.id && file.media?.media?.id === nowPlaying.media.id)
|
||||
|
||||
console.info('MediaHandler: filtered files based on media', filtered)
|
||||
|
||||
let result
|
||||
if (filtered?.length) {
|
||||
result = filtered
|
||||
} else {
|
||||
const max = highestOccurence(videoFiles, file => file.media.parseObject.anime_title).media.parseObject.anime_title
|
||||
console.info('MediaHandler: filtering based on highest occurence', max)
|
||||
result = videoFiles.filter(file => file.media.parseObject.anime_title === max)
|
||||
}
|
||||
|
||||
result.sort((a, b) => a.media.episode - b.media.episode)
|
||||
result.sort((a, b) => (b.media.parseObject.anime_season ?? 1) - (a.media.parseObject.anime_season ?? 1))
|
||||
|
||||
console.info('MediaHandler: final resolve result', { result })
|
||||
|
||||
processed.set([...result, ...otherFiles])
|
||||
await tick()
|
||||
const file = (nowPlaying?.episode && (result.find(({ media }) => media.episode === nowPlaying.episode) || result.find(({ media }) => media.episode === 1))) || result[0]
|
||||
if (nowPlaying) nowPlaying.episode = file.media.parseObject.episode_number
|
||||
media.set(nowPlaying)
|
||||
playFile(file || 0)
|
||||
}
|
||||
|
||||
// find element with most occurences in array according to map function
|
||||
const highestOccurence = (arr = [], mapfn = a => a) => arr.reduce((acc, el) => {
|
||||
const mapped = mapfn(el)
|
||||
acc.sums[mapped] = (acc.sums[mapped] || 0) + 1
|
||||
acc.max = (acc.max !== undefined ? acc.sums[mapfn(acc.max)] : -1) > acc.sums[mapped] ? acc.max : el
|
||||
return acc
|
||||
}, { sums: {} }).max
|
||||
|
||||
files.subscribe((files = []) => {
|
||||
handleFiles(files)
|
||||
return noop
|
||||
})
|
||||
|
||||
function setMediaSession (nowPlaying) {
|
||||
if (typeof MediaMetadata === 'undefined') return
|
||||
const name = [nowPlaying.title, nowPlaying.episode, nowPlaying.episodeTitle, 'Miru'].filter(i => i).join(' - ')
|
||||
|
||||
const metadata =
|
||||
nowPlaying.thumbnail
|
||||
? new MediaMetadata({
|
||||
title: name,
|
||||
artwork: [
|
||||
{
|
||||
src: nowPlaying.thumbnail,
|
||||
sizes: '256x256',
|
||||
type: 'image/jpg'
|
||||
}
|
||||
]
|
||||
})
|
||||
: new MediaMetadata({ title: name })
|
||||
navigator.mediaSession.metadata = metadata
|
||||
}
|
||||
|
||||
function setDiscordRPC (np = nowPlaying.value) {
|
||||
const w2g = state.value
|
||||
const details = [np.title, np.episodeTitle].filter(i => i).join(' - ') || undefined
|
||||
const activity = {
|
||||
details,
|
||||
state: details && 'Watching Episode ' + ((!np.media?.episodes && np.episode) || ''),
|
||||
timestamps: {
|
||||
start: Date.now()
|
||||
},
|
||||
party: {
|
||||
size: (np.episode && np.media?.episodes && [np.episode, np.media.episodes]) || undefined
|
||||
},
|
||||
assets: {
|
||||
large_text: np.title,
|
||||
large_image: np.thumbnail,
|
||||
small_image: 'logo',
|
||||
small_text: 'https://github.com/ThaUnknown/miru'
|
||||
},
|
||||
instance: true,
|
||||
type: 3
|
||||
}
|
||||
// cannot have buttons and secrets at once
|
||||
if (w2g) {
|
||||
activity.secrets = {
|
||||
join: w2g,
|
||||
match: w2g + 'm'
|
||||
}
|
||||
activity.party.id = w2g + 'p'
|
||||
} else {
|
||||
activity.buttons = [
|
||||
{
|
||||
label: 'Download app',
|
||||
url: 'https://github.com/ThaUnknown/miru/releases/latest'
|
||||
},
|
||||
{
|
||||
label: 'Watch on Miru',
|
||||
url: `miru://anime/${np.media?.id}`
|
||||
}
|
||||
]
|
||||
}
|
||||
IPC.emit('discord', { activity })
|
||||
}
|
||||
state.subscribe(() => {
|
||||
setDiscordRPC()
|
||||
return noop
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Player from './Player.svelte'
|
||||
|
||||
export let miniplayer = false
|
||||
export let page = 'home'
|
||||
</script>
|
||||
|
||||
<Player files={$processed} {miniplayer} media={$nowPlaying} bind:playFile bind:page on:current={handleCurrent} />
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
<script context='module'>
|
||||
import { since } from '@/modules/util.js'
|
||||
import { settings } from '@/modules/settings.js'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { findInCurrent } from './Player/MediaHandler.svelte'
|
||||
import getRSSEntries from '@/modules/providers/tosho.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
|
||||
import { writable } from 'simple-store-svelte'
|
||||
|
||||
const rss = writable({})
|
||||
|
||||
export function playAnime (media, episode = 1, force) {
|
||||
episode = Number(episode)
|
||||
episode = isNaN(episode) ? 1 : episode
|
||||
if (!force && findInCurrent({ media, episode })) return
|
||||
rss.set({ media, episode })
|
||||
}
|
||||
|
||||
const termMapping = {}
|
||||
termMapping['5.1'] = { text: '5.1', color: '#f67255' }
|
||||
termMapping['5.1CH'] = termMapping[5.1]
|
||||
termMapping['TRUEHD5.1'] = { text: 'TrueHD 5.1', color: '#f67255' }
|
||||
termMapping.AAC = { text: 'AAC', color: '#f67255' }
|
||||
termMapping.AACX2 = termMapping.AAC
|
||||
termMapping.AACX3 = termMapping.AAC
|
||||
termMapping.AACX4 = termMapping.AAC
|
||||
termMapping.AC3 = { text: 'AC3', color: '#f67255' }
|
||||
termMapping.EAC3 = { text: 'EAC3', color: '#f67255' }
|
||||
termMapping['E-AC-3'] = termMapping.EAC3
|
||||
termMapping.FLAC = { text: 'FLAC', color: '#f67255' }
|
||||
termMapping.FLACX2 = termMapping.FLAC
|
||||
termMapping.FLACX3 = termMapping.FLAC
|
||||
termMapping.FLACX4 = termMapping.FLAC
|
||||
termMapping.VORBIS = { text: 'Vorbis', color: '#f67255' }
|
||||
termMapping.DUALAUDIO = { text: 'Dual Audio', color: '#f67255' }
|
||||
termMapping['DUAL AUDIO'] = termMapping.DUALAUDIO
|
||||
termMapping['10BIT'] = { text: '10 Bit', color: '#0c8ce9' }
|
||||
termMapping['10BITS'] = termMapping['10BIT']
|
||||
termMapping['10-BIT'] = termMapping['10BIT']
|
||||
termMapping['10-BITS'] = termMapping['10BIT']
|
||||
termMapping.HI10 = termMapping['10BIT']
|
||||
termMapping.HI10P = termMapping['10BIT']
|
||||
termMapping.HI444 = { text: 'HI444', color: '#0c8ce9' }
|
||||
termMapping.HI444P = termMapping.HI444
|
||||
termMapping.HI444PP = termMapping.HI444
|
||||
termMapping.HEVC = { text: 'HEVC', color: '#0c8ce9' }
|
||||
termMapping.H265 = termMapping.HEVC
|
||||
termMapping['H.265'] = termMapping.HEVC
|
||||
termMapping.X265 = termMapping.HEVC
|
||||
termMapping.AV1 = { text: 'AV1', color: '#0c8ce9' }
|
||||
|
||||
function sanitiseTerms ({ video_term: video, audio_term: audio, video_resolution: resolution }) {
|
||||
if (!Array.isArray(video)) video = [video]
|
||||
if (!Array.isArray(audio)) audio = [audio]
|
||||
|
||||
const terms = [...new Set([...video, ...audio].map(term => termMapping[term?.toUpperCase()]).filter(t => t))]
|
||||
if (resolution) terms.unshift({ text: resolution, color: '#c6ec58' })
|
||||
|
||||
return terms
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { add } from '@/modules/torrent.js'
|
||||
import { media } from './Player/MediaHandler.svelte'
|
||||
|
||||
$: loadRss($rss)
|
||||
|
||||
let data = null
|
||||
let filtered = null
|
||||
|
||||
async function loadRss ({ media, episode }) {
|
||||
if (!media) return
|
||||
const promise = getRSSEntries({ media, episode })
|
||||
toast.promise(promise, {
|
||||
loading: `Looking for torrents for ${media.title.userPreferred} Episode ${parseInt(episode)}...`,
|
||||
success: `Found torrents for ${media.title.userPreferred} Episode ${parseInt(episode)}.`,
|
||||
error: err => {
|
||||
console.error(err)
|
||||
return `Couldn't find torrents for ${media.title.userPreferred} Episode ${parseInt(episode)}! Try specifying a torrent manually.\n${err.message}`
|
||||
}
|
||||
|
||||
})
|
||||
const entries = await promise
|
||||
|
||||
entries.sort((a, b) => b.seeders - a.seeders)
|
||||
if ($settings.rssAutoplay) {
|
||||
const best = entries.find(entry => entry.best)
|
||||
if (best?.seeders >= 15) { // only play best if it actually has a lot of seeders, 20 might be too little for those overkill blurays
|
||||
play(best)
|
||||
} else {
|
||||
play(entries[0])
|
||||
}
|
||||
} else {
|
||||
filtered = data = entries
|
||||
}
|
||||
}
|
||||
function close () {
|
||||
data = null
|
||||
}
|
||||
function checkClose ({ keyCode }) {
|
||||
if (keyCode === 27) close()
|
||||
}
|
||||
function play (entry) {
|
||||
$media = $rss
|
||||
$media.verified = entry.verified
|
||||
if (entry.seeders !== '?' && entry.seeders < 15) {
|
||||
toast('Availability Warning', {
|
||||
description: 'This release is poorly seeded and likely will have playback issues such as buffering!'
|
||||
})
|
||||
}
|
||||
add(entry.link)
|
||||
data = null
|
||||
}
|
||||
let modal
|
||||
$: data && modal?.focus()
|
||||
|
||||
function filter ({ target }) {
|
||||
const searchText = target.value
|
||||
|
||||
filtered = data.filter(({ title }) => title.toLowerCase().includes(searchText.toLowerCase()))
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class='modal z-40' class:show={data} id='viewAnime'>
|
||||
{#if data}
|
||||
<div class='modal-dialog' on:pointerup|self={close} on:keydown={checkClose} tabindex='-1' role='button' bind:this={modal}>
|
||||
<div class='modal-content w-auto h-full mx-20 p-0 rounded overflow-x-hidden overflow-y-scroll'>
|
||||
<div class='w-full bg-dark-light d-flex px-15 py-10 position-sticky top-0 z-10'>
|
||||
<div class='material-symbols-outlined text-danger symbol-bold' title='Badges Are a Rough Guess of Information And Might Not Be Representative of Actual Data'>
|
||||
warning
|
||||
</div>
|
||||
<input type='text' class='form-control bg-dark w-300 ml-15' placeholder='Search...' on:input={filter} />
|
||||
<button class='btn btn-square bg-dark rounded-circle ml-auto pointer' type='button' use:click={close}> × </button>
|
||||
</div>
|
||||
<table class='table table-hover font-size-14 position-relative'>
|
||||
<thead>
|
||||
<tr class='border-0'>
|
||||
<td class='py-15 pl-20 pr-0' />
|
||||
<td class='py-15 px-20'>Name</td>
|
||||
<td class='py-15 px-20'>Size</td>
|
||||
<td class='py-15 px-20'>Seed</td>
|
||||
<td class='py-15 px-20'>Leech</td>
|
||||
<td class='py-15 px-20'>Downloads</td>
|
||||
<td class='py-15 px-20'>Released</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class='pointer'>
|
||||
{#each filtered as row}
|
||||
<tr class='border-0' class:text-secondary={row.best} use:click={() => play(row)}>
|
||||
<td class='py-10 pl-20 pr-0'>
|
||||
{#if row.best}
|
||||
<div class='material-symbols-outlined font-size-24 symbol-bold' title='Best Release'>
|
||||
star
|
||||
</div>
|
||||
{:else if row.verified}
|
||||
<div class='text-success material-symbols-outlined font-size-24 symbol-bold' title='Verified'>
|
||||
verified
|
||||
</div>
|
||||
{:else if row.batch}
|
||||
<div class='text-light material-symbols-outlined font-size-24 symbol-bold' title='Batch'>
|
||||
database
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class='py-10 px-20'>{row.title}
|
||||
<div class='d-flex flex-row text-dark font-weight-bold font-size-12'>
|
||||
{#each sanitiseTerms(row.parseObject) as { text, color }}
|
||||
<div style={'background:' + color} class='rounded px-15 mr-10 mt-5'>
|
||||
{text}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</td>
|
||||
<td class='py-10 px-20 text-nowrap'>{row.size}</td>
|
||||
<td class='py-10 px-20'>{row.seeders ?? '?'}</td>
|
||||
<td class='py-10 px-20'>{row.leechers ?? '?'}</td>
|
||||
<td class='py-10 px-20'>{row.downloads ?? '?'}</td>
|
||||
<td class='py-10 px-20 text-nowrap'>{since(row.date)}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.modal-content {
|
||||
margin: 8rem 6rem 0 6rem !important
|
||||
}
|
||||
.symbol-bold {
|
||||
font-variation-settings: 'wght' 500;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
<script context='module'>
|
||||
import { writable } from 'simple-store-svelte'
|
||||
import SectionsManager from '@/modules/sections.js'
|
||||
|
||||
export const search = writable({})
|
||||
|
||||
const items = writable([])
|
||||
export const key = writable({})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Search, { searchCleanup } from '../components/Search.svelte'
|
||||
import Card from '../components/cards/Card.svelte'
|
||||
import { hasNextPage } from '@/modules/sections.js'
|
||||
import smoothScroll from '@/modules/scroll.js'
|
||||
import { debounce } from '@/modules/util.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import ErrorCard from '@/components/cards/ErrorCard.svelte'
|
||||
|
||||
let page = 0
|
||||
items.value = []
|
||||
let container = null
|
||||
|
||||
function loadSearchData () {
|
||||
const load = $search.load || SectionsManager.createFallbackLoad()
|
||||
const nextData = load(++page, undefined, searchCleanup($search))
|
||||
$items = [...$items, ...nextData]
|
||||
return nextData[nextData.length - 1].data
|
||||
}
|
||||
const update = debounce(() => {
|
||||
$key = {}
|
||||
}, 300)
|
||||
|
||||
$: loadTillFull($key)
|
||||
|
||||
let canScroll = true
|
||||
|
||||
async function loadTillFull (_key) {
|
||||
if (!container) return
|
||||
const cachedKey = $key
|
||||
canScroll = false
|
||||
page = 0
|
||||
items.value = []
|
||||
hasNextPage.value = true
|
||||
await loadSearchData()
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
while (hasNextPage.value && container && cachedKey === $key && container.scrollHeight <= container.clientHeight) {
|
||||
canScroll = false
|
||||
await loadSearchData()
|
||||
}
|
||||
canScroll = true
|
||||
}
|
||||
|
||||
async function infiniteScroll () {
|
||||
if (canScroll && $hasNextPage && this.scrollTop + this.clientHeight > this.scrollHeight - 800) {
|
||||
canScroll = false
|
||||
await loadSearchData()
|
||||
canScroll = true
|
||||
}
|
||||
}
|
||||
onDestroy(() => {
|
||||
if ($search.clearNext || $search.disableSearch) $search = {}
|
||||
})
|
||||
onMount(loadTillFull)
|
||||
</script>
|
||||
|
||||
<div class='bg-dark h-full w-full overflow-y-scroll d-flex flex-wrap flex-row root overflow-x-hidden justify-content-center align-content-start' use:smoothScroll bind:this={container} on:scroll={infiniteScroll}>
|
||||
<Search bind:search={$search} on:input={update} />
|
||||
<div class='w-full d-flex flex-wrap flex-row px-50 justify-content-center align-content-start'>
|
||||
{#key $key}
|
||||
{#each $items as card}
|
||||
<Card {card} />
|
||||
{/each}
|
||||
{#if $items?.length}
|
||||
<ErrorCard promise={$items[0].data} />
|
||||
{/if}
|
||||
{/key}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<script context='module'>
|
||||
import { click } from '@/modules/click.js'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { resetSettings } from '@/modules/settings.js'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
import { SUPPORTS } from '@/modules/support.js'
|
||||
|
||||
async function importSettings () {
|
||||
localStorage.setItem('settings', await navigator.clipboard.readText())
|
||||
location.reload()
|
||||
}
|
||||
function exportSettings () {
|
||||
navigator.clipboard.writeText(localStorage.getItem('settings'))
|
||||
toast('Copied to clipboard', {
|
||||
description: 'Copied settings to clipboard',
|
||||
duration: 5000
|
||||
})
|
||||
}
|
||||
function restoreSettigs () {
|
||||
resetSettings()
|
||||
location.reload()
|
||||
}
|
||||
function checkUpdate () {
|
||||
IPC.emit('update')
|
||||
}
|
||||
setInterval(checkUpdate, 1200000)
|
||||
</script>
|
||||
<div class='d-inline-flex flex-column'>
|
||||
<button
|
||||
use:click={importSettings}
|
||||
class='btn btn-primary mx-20 mt-10'
|
||||
type='button'>
|
||||
Import Settings From Clipboard
|
||||
</button>
|
||||
<button
|
||||
use:click={exportSettings}
|
||||
class='btn btn-primary mx-20 mt-10'
|
||||
type='button'>
|
||||
Export Settings To Clipboard
|
||||
</button>
|
||||
{#if SUPPORTS.update}
|
||||
<button
|
||||
use:click={checkUpdate}
|
||||
class='btn btn-primary mx-20 mt-10'
|
||||
type='button'>
|
||||
Check For Updates
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
use:click={restoreSettigs}
|
||||
class='btn btn-danger mx-20 mt-10'
|
||||
type='button'
|
||||
data-toggle='tooltip'
|
||||
data-placement='top'
|
||||
data-title='Restores All Settings Back To Their Recommended Defaults'>
|
||||
Restore Default Settings
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
<script>
|
||||
import { click } from '@/modules/click.js'
|
||||
import { sections } from '@/modules/sections.js'
|
||||
|
||||
const allowedHomeSections = sections.map(({ title }) => title)
|
||||
export let homeSections
|
||||
|
||||
let mouseYCoordinate = null // pointer y coordinate within client
|
||||
let distanceTopGrabbedVsPointer = null
|
||||
|
||||
let draggingItem = null
|
||||
let draggingItemIndex = null
|
||||
|
||||
let hoveredItemIndex = null
|
||||
|
||||
$: {
|
||||
if (draggingItemIndex != null && hoveredItemIndex != null && draggingItemIndex !== hoveredItemIndex) {
|
||||
[homeSections[draggingItemIndex], homeSections[hoveredItemIndex]] = [homeSections[hoveredItemIndex], homeSections[draggingItemIndex]]
|
||||
|
||||
draggingItemIndex = hoveredItemIndex
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if mouseYCoordinate}
|
||||
<div
|
||||
class='input-group mb-10 ghost w-full'
|
||||
style='top: {mouseYCoordinate + distanceTopGrabbedVsPointer}px;'>
|
||||
<div class='input-group-prepend'>
|
||||
<span class='input-group-text d-flex justify-content-center px-5 material-symbols-outlined font-size-20'>swap_vert</span>
|
||||
</div>
|
||||
<select class='form-control' value={draggingItem}>
|
||||
{#each allowedHomeSections as section}
|
||||
<option>{section}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<div class='input-group-append'>
|
||||
<button type='button' class='btn btn-danger input-group-append px-5 material-symbols-outlined font-size-20'>delete</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#each homeSections as item, index}
|
||||
<div
|
||||
class='input-group mb-10'
|
||||
class:tp={draggingItem === item}
|
||||
draggable='true'
|
||||
role='menuitem'
|
||||
tabindex='0'
|
||||
on:dragstart={({ clientY, target }) => {
|
||||
mouseYCoordinate = clientY
|
||||
draggingItem = item
|
||||
draggingItemIndex = index
|
||||
distanceTopGrabbedVsPointer = target.offsetTop - clientY
|
||||
}}
|
||||
on:drag={e => { mouseYCoordinate = e.clientY }}
|
||||
on:dragover={() => { hoveredItemIndex = index }}
|
||||
on:dragend={() => {
|
||||
mouseYCoordinate = null
|
||||
draggingItem = null
|
||||
hoveredItemIndex = null
|
||||
}}>
|
||||
<div class='input-group-prepend grab'>
|
||||
<span class='input-group-text d-flex justify-content-center px-5 material-symbols-outlined font-size-20'>swap_vert</span>
|
||||
</div>
|
||||
<select class='form-control bg-dark w-300 mw-full' bind:value={homeSections[index]}>
|
||||
{#each allowedHomeSections as section}
|
||||
<option>{section}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<div class='input-group-append'>
|
||||
<button type='button' use:click={() => { homeSections.splice(index, 1); homeSections = homeSections }} class='btn btn-danger input-group-append px-5 material-symbols-outlined font-size-20'>delete</button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
<button type='button' use:click={() => { homeSections[homeSections.length] = 'Trending Now' }} class='btn btn-primary'>Add Section</button>
|
||||
|
||||
<style>
|
||||
.ghost {
|
||||
margin-bottom: 10px;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
position: absolute !important;
|
||||
}
|
||||
|
||||
.tp {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.grab{
|
||||
cursor: grab;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
<script>
|
||||
import { variables } from '@/modules/themes.js'
|
||||
import { click } from '@/modules/click.js'
|
||||
import HomeSections from './HomeSectionsSettings.svelte'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
import SettingCard from './SettingCard.svelte'
|
||||
import { SUPPORTS } from '@/modules/support.js'
|
||||
function updateAngle () {
|
||||
IPC.emit('angle', settings.value.angle)
|
||||
}
|
||||
export let settings
|
||||
</script>
|
||||
|
||||
{#if SUPPORTS.discord}
|
||||
<h4 class='mb-10 font-weight-bold'>Rich Pressence Settings</h4>
|
||||
<SettingCard title='Show Details in Discord Rich Presence' description='Shows currently played anime and episode in Discord rich presence.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='rpc-details' bind:checked={settings.showDetailsInRPC} />
|
||||
<label for='rpc-details'>{settings.showDetailsInRPC ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
{/if}
|
||||
|
||||
<h4 class='mb-10 font-weight-bold'>Interface Settings</h4>
|
||||
<SettingCard title='Enable Smooth Scrolling' description='Enables smooth scrolling for vertical containers. Turning this off might remove jitter when scrolling on devices without a GPU.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='smooth-scroll' bind:checked={settings.smoothScroll} />
|
||||
<label for='smooth-scroll'>{settings.smoothScroll ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Enable Sidebar Animation' description='Enables the sidebar expand hover animation.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='disable-sidebar' bind:checked={settings.expandingSidebar} />
|
||||
<label for='disable-sidebar'>{settings.expandingSidebar ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='CSS Variables' description='Used for custom themes. Can change colors, sizes, spacing and more. Best way to discover variables is to use the built-in devtools via Ctrl+Shift+I or F12.'>
|
||||
<textarea class='form-control w-500 mw-full bg-dark' placeholder='--accent-color: #e5204c;' bind:value={$variables} />
|
||||
</SettingCard>
|
||||
|
||||
{#if SUPPORTS.angle}
|
||||
<h4 class='mb-10 font-weight-bold'>Rendering Settings</h4>
|
||||
<SettingCard title='ANGLE Backend' description="What ANGLE backend to use for rendering. DON'T CHANGE WITHOUT REASON! On some Windows machines D3D9 might help with flicker. Changing this setting to something your device doesn't support might prevent Miru from opening which will require a full reinstall. While Vulkan is an available option it might not be fully supported on Linux.">
|
||||
<select class='form-control bg-dark w-300 mw-full' bind:value={settings.angle} on:change={updateAngle}>
|
||||
<option value='default' selected>Default</option>
|
||||
<option value='d3d9'>D3D9</option>
|
||||
<option value='d3d11'>D3D11</option>
|
||||
<option value='warp'>Warp [Software D3D11]</option>
|
||||
<option value='gl'>GL</option>
|
||||
<option value='gles'>GLES</option>
|
||||
<option value='swiftshader'>SwiftShader</option>
|
||||
<option value='vulkan'>Vulkan</option>
|
||||
<option value='metal'>Metal</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
{/if}
|
||||
|
||||
<h4 class='mb-10 font-weight-bold'>Home Screen Settings</h4>
|
||||
<SettingCard title='RSS Feeds' description={'RSS feeds to display on the home screen. This needs to be a CORS enabled URL to a Nyaa or Tosho like RSS feed which cotains either an "infoHash" or "enclosure" tag.\nThis only shows the releases on the home screen, it doesn\'t automatically download the content.\nSince the feeds only provide the name of the file, Miru might not always detect the anime correctly!\nSome presets for popular groups are already provided as an example, custom feeds require the FULL URL.'}>
|
||||
<div>
|
||||
{#each settings.rssFeedsNew as _, i}
|
||||
<div class='input-group mb-10 w-500 mw-full'>
|
||||
<input type='text' class='form-control w-150 mw-full bg-dark flex-reset' placeholder='New Releases' autocomplete='off' bind:value={settings.rssFeedsNew[i][0]} />
|
||||
<input id='rss-feed-{i}' type='text' list='rss-feed-list-{i}' class='w-400 form-control mw-full bg-dark' placeholder={settings.toshoURL + 'rss2?qx=1&q="[SubsPlease] "'} autocomplete='off' bind:value={settings.rssFeedsNew[i][1]} />
|
||||
<datalist id='rss-feed-list-{i}'>
|
||||
<option value='SubsPlease'>{settings.toshoURL + 'rss2?qx=1&q="[SubsPlease] "'}</option>
|
||||
<option value='Erai-raws [Multi-Sub]'>{settings.toshoURL + 'rss2?qx=1&q="[Erai-raws] "'}</option>
|
||||
<option value='Yameii [Dubbed]'>{settings.toshoURL + 'rss2?qx=1&q="[Yameii] "'}</option>
|
||||
<option value='Judas [Small Size]'>{settings.toshoURL + 'rss2?qx=1&q="[Judas] "'}</option>
|
||||
</datalist>
|
||||
<div class='input-group-append'>
|
||||
<button type='button' use:click={() => { settings.rssFeedsNew.splice(i, 1); settings.rssFeedsNew = settings.rssFeedsNew }} class='btn btn-danger input-group-append px-5 material-symbols-outlined font-size-20'>delete</button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
<button type='button' use:click={() => { settings.rssFeedsNew[settings.rssFeedsNew.length] = ['New Releases', null] }} class='btn btn-primary mb-10'>Add Feed</button>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Sections And Order' description="Sections and their order on the home screen, if you want more RSS feeds to show up here, create them first in the RSS feed list. Adding many multiple normal lists doesn't impact performance, but adding a lot of RSS feeds will impact app startup times. Drag/drop these sections to re-order them.">
|
||||
<div class='position-relative'>
|
||||
<HomeSections bind:homeSections={settings.homeSections} />
|
||||
</div>
|
||||
</SettingCard>
|
||||
|
||||
<style>
|
||||
textarea {
|
||||
min-height: 6.6rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
<script>
|
||||
import { toast } from 'svelte-sonner'
|
||||
import FontSelect from 'simple-font-select'
|
||||
import SettingCard from './SettingCard.svelte'
|
||||
export let settings
|
||||
|
||||
async function changeFont ({ detail }) {
|
||||
try {
|
||||
const blob = await detail.blob()
|
||||
const data = await blob.arrayBuffer()
|
||||
settings.font = {
|
||||
name: detail.fullName,
|
||||
value: detail.postscriptName,
|
||||
data: [...new Uint8Array(data)]
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
toast.error('File Error', {
|
||||
description: `${error.message}\n Try using a different font.`,
|
||||
duration: 8000
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if ('queryLocalFonts' in self)}
|
||||
<h4 class='mb-10 font-weight-bold'>Subtitle Settings</h4>
|
||||
<SettingCard title='Default Subtitle Font' description={"What font to use when the current loaded video doesn't provide or specify one.\nThis uses fonts installed on your OS."}>
|
||||
<FontSelect class='form-control bg-dark w-300 mw-full' on:change={changeFont} value={settings.font?.name} />
|
||||
</SettingCard>
|
||||
<SettingCard title='Find Missing Subtitle Fonts' description="Automatically finds and loads fonts that are missing from a video's subtitles.">
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='player-missingFont' bind:checked={settings.missingFont} />
|
||||
<label for='player-missingFont'>{settings.missingFont ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Fast Subtitle Rendering' description='Disables blur when rendering subtitles reducing lag. Will cause text and subtitle edges to appear sharper and in rare cases might break styling. If you want better rendering speeds without sacrificing accuracy lower the render resolution limit.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='player-sub-blur' bind:checked={settings.disableSubtitleBlur} />
|
||||
<label for='player-sub-blur'>{settings.disableSubtitleBlur ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Subtitle Render Resolution Limit' description="Max resolution to render subtitles at. If your resolution is higher than this setting the subtitles will be upscaled lineary. This will GREATLY improve rendering speeds for complex typesetting for slower devices. It's best to lower this on mobile devices which often have high pixel density where their effective resolution might be ~1440p while having small screens and slow processors.">
|
||||
<select class='form-control bg-dark w-300 mw-full' bind:value={settings.subtitleRenderHeight}>
|
||||
<option value='0' selected>None</option>
|
||||
<option value='1440'>1440p</option>
|
||||
<option value='1080'>1080p</option>
|
||||
<option value='720'>720p</option>
|
||||
<option value='480'>480p</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
{/if}
|
||||
|
||||
<h4 class='mb-10 font-weight-bold'>Language Settings</h4>
|
||||
<SettingCard title='Preferred Subtitle Language' description="What subtitle language to automatically select when a video is loaded if it exists. This won't find torrents with this language automatically. If not found defaults to English.">
|
||||
<select class='form-control bg-dark w-300 mw-full' bind:value={settings.subtitleLanguage}>
|
||||
<option value=''>None</option>
|
||||
<option value='eng' selected>English</option>
|
||||
<option value='jpn'>Japanese</option>
|
||||
<option value='chi'>Chinese</option>
|
||||
<option value='por'>Portuguese</option>
|
||||
<option value='spa'>Spanish</option>
|
||||
<option value='ger'>German</option>
|
||||
<option value='pol'>Polish</option>
|
||||
<option value='cze'>Czech</option>
|
||||
<option value='dan'>Danish</option>
|
||||
<option value='gre'>Greek</option>
|
||||
<option value='fin'>Finnish</option>
|
||||
<option value='fre'>French</option>
|
||||
<option value='hun'>Hungarian</option>
|
||||
<option value='ita'>Italian</option>
|
||||
<option value='kor'>Korean</option>
|
||||
<option value='dut'>Dutch</option>
|
||||
<option value='nor'>Norwegian</option>
|
||||
<option value='rum'>Romanian</option>
|
||||
<option value='rus'>Russian</option>
|
||||
<option value='slo'>Slovak</option>
|
||||
<option value='swe'>Swedish</option>
|
||||
<option value='ara'>Arabic</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
<SettingCard title='Preferred Audio Language' description="What audio language to automatically select when a video is loaded if it exists. This won't find torrents with this language automatically. If not found defaults to Japanese.">
|
||||
<select class='form-control bg-dark w-300 mw-full' bind:value={settings.audioLanguage}>
|
||||
<option value='eng'>English</option>
|
||||
<option value='jpn' selected>Japanese</option>
|
||||
<option value='chi'>Chinese</option>
|
||||
<option value='por'>Portuguese</option>
|
||||
<option value='spa'>Spanish</option>
|
||||
<option value='ger'>German</option>
|
||||
<option value='pol'>Polish</option>
|
||||
<option value='cze'>Czech</option>
|
||||
<option value='dan'>Danish</option>
|
||||
<option value='gre'>Greek</option>
|
||||
<option value='fin'>Finnish</option>
|
||||
<option value='fre'>French</option>
|
||||
<option value='hun'>Hungarian</option>
|
||||
<option value='ita'>Italian</option>
|
||||
<option value='kor'>Korean</option>
|
||||
<option value='dut'>Dutch</option>
|
||||
<option value='nor'>Norwegian</option>
|
||||
<option value='rum'>Romanian</option>
|
||||
<option value='rus'>Russian</option>
|
||||
<option value='slo'>Slovak</option>
|
||||
<option value='swe'>Swedish</option>
|
||||
<option value='ara'>Arabic</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
|
||||
<h4 class='mb-10 font-weight-bold'>Playback Settings</h4>
|
||||
<SettingCard title='Autoplay Next Episode' description='Automatically starts playing next episode when a video ends.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='player-autoplay' bind:checked={settings.playerAutoplay} />
|
||||
<label for='player-autoplay'>{settings.playerAutoplay ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Pause On Lost Focus' description='Pauses/Resumes video playback when tabbing in/out of the app.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='player-pause' bind:checked={settings.playerPause} />
|
||||
<label for='player-pause'>{settings.playerPause ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||
<SettingCard title='Auto-Complete Episodes' description='Automatically marks episodes as complete on AniList when you finish watching them. Requires AniList login.'>
|
||||
<div class='custom-switch'>
|
||||
<input type='checkbox' id='player-autocomplete' bind:checked={settings.playerAutocomplete} />
|
||||
<label for='player-autocomplete'>{settings.playerAutocomplete ? 'On' : 'Off'}</label>
|
||||
</div>
|
||||
</SettingCard>
|
||||