Compare commits
783 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a050d220d0 | ||
|
|
5e64d55ac0 | ||
|
|
d32a657d62 | ||
|
|
78e5e298b3 | ||
|
|
44ad0f3a51 | ||
|
|
e783cc64f5 | ||
|
|
c1f10a1c46 | ||
|
|
a0231ed598 | ||
|
|
900ba2f3a2 | ||
|
|
519e224914 | ||
|
|
2e067f98ff | ||
|
|
63ca296037 | ||
|
|
2221053c66 | ||
|
|
5ce6354bd3 | ||
|
|
44ae334492 | ||
|
|
4020de976f | ||
|
|
9929a5f578 | ||
|
|
3dd1e916c1 | ||
|
|
5b810e8cf5 | ||
|
|
a9356fbd4a | ||
|
|
6aad9e6130 | ||
|
|
258b4113db | ||
|
|
66d5b7a6f4 | ||
|
|
4c4df5011e | ||
|
|
2b99b888bc | ||
|
|
618e1f64df | ||
|
|
fca00e7084 | ||
|
|
7d92df6626 | ||
|
|
f00b552305 | ||
|
|
d7b5f5f25b | ||
|
|
a4c3088e02 | ||
|
|
0e44df8cfa | ||
|
|
eddc2214ed | ||
|
|
db3f87d219 | ||
|
|
d962124da2 | ||
|
|
e1c8afd5ba | ||
|
|
01614667a4 | ||
|
|
43bd4ff468 | ||
|
|
d5bdb78de6 | ||
|
|
acd5e547fd | ||
|
|
201eb38a35 | ||
|
|
9b13c2554a | ||
|
|
21918cadd9 | ||
|
|
55191a6e9b | ||
|
|
e93a30d2e1 | ||
|
|
443fce9fd1 | ||
|
|
02f4a730c7 | ||
|
|
f02626a118 | ||
|
|
7632219a83 | ||
|
|
4e563b3c05 | ||
|
|
92a60bd03e | ||
|
|
1238ef62fa | ||
|
|
0a101e3b69 | ||
|
|
ecd2f0e0f2 | ||
|
|
9be3cc1f13 | ||
|
|
c64c503ba9 | ||
|
|
d704b2ecac | ||
|
|
66539aa422 | ||
|
|
f8c20e55a4 | ||
|
|
3b5448a334 | ||
|
|
4b1614e247 | ||
|
|
bb4f843a33 | ||
|
|
9008039a2a | ||
|
|
fb1ee381fe | ||
|
|
8ad0ce8911 | ||
|
|
59c4b6db86 | ||
|
|
f4e15215ec | ||
|
|
b57cc559d9 | ||
|
|
4a1d6047ac | ||
|
|
3d411826f2 | ||
|
|
898c0a2f7c | ||
|
|
2a9bc2278d | ||
|
|
989209758a | ||
|
|
1d4386e9e9 | ||
|
|
d8e45814bb | ||
|
|
ce01f8bce0 | ||
|
|
76384e38c8 | ||
|
|
ac64512ff7 | ||
|
|
7d9261dace | ||
|
|
6187b849a7 | ||
|
|
724d0b2567 | ||
|
|
2d24e2e0eb | ||
|
|
d4d65044b3 | ||
|
|
717f1e7eec | ||
|
|
30b58d213e | ||
|
|
0404b5f1e4 | ||
|
|
f2a946790d | ||
|
|
37ea2260b8 | ||
|
|
938ad5f8b9 | ||
|
|
4e881415d2 | ||
|
|
96af470708 | ||
|
|
3275abafb0 | ||
|
|
2538a41fcb | ||
|
|
d93b76a664 | ||
|
|
ea5703d99d | ||
|
|
22c3c797ff | ||
|
|
0cc0ec6c55 | ||
|
|
d1e5fdc1e0 | ||
|
|
ed9c5a0dc7 | ||
|
|
e1fae2e219 | ||
|
|
e5cf24e1cc | ||
|
|
3d1f970262 | ||
|
|
a002655b3d | ||
|
|
9fe2384b47 | ||
|
|
a6781414a5 | ||
|
|
cbdbac4e01 | ||
|
|
c867e62502 | ||
|
|
341fe5d46e | ||
|
|
e70eefdbbf | ||
|
|
67c2daf4ef | ||
|
|
178cfd4a6b | ||
|
|
6d868e21da | ||
|
|
691a6d0956 | ||
|
|
6eda60d314 | ||
|
|
41b0896c2e | ||
|
|
e8bdeed556 | ||
|
|
c29dd321e3 | ||
|
|
6062534d91 | ||
|
|
d6bb61c428 | ||
|
|
65a56684ec | ||
|
|
e1dfe30661 | ||
|
|
87cb1cc4f7 | ||
|
|
0be75ca38e | ||
|
|
54b2561da1 | ||
|
|
fbba7a30d0 | ||
|
|
42d361b7ad | ||
|
|
6d41e6b962 | ||
|
|
ed32aad64a | ||
|
|
e4896fe935 | ||
|
|
2f81690783 | ||
|
|
dc3ec24cd7 | ||
|
|
797171fc3a | ||
|
|
16e12a8a7b | ||
|
|
0e07124cbc | ||
|
|
5db66e3fcb | ||
|
|
01770d25f8 | ||
|
|
e4366c8dfa | ||
|
|
f19446eda9 | ||
|
|
0d7f1657de | ||
|
|
e905f01305 | ||
|
|
e5e7fa3f8a | ||
|
|
69575622a2 | ||
|
|
ee229e9ed8 | ||
|
|
21a9481459 | ||
|
|
f28732904d | ||
|
|
06828e2cfd | ||
|
|
e89c58e2e9 | ||
|
|
cb1203a2b8 | ||
|
|
be64aba265 | ||
|
|
316281d42b | ||
|
|
91520753b0 | ||
|
|
94bb94e8f4 | ||
|
|
fcf020658a | ||
|
|
4d8cd8a926 | ||
|
|
ec871c1a41 | ||
|
|
acf7fe3117 | ||
|
|
55f99980cc | ||
|
|
7079cc0d20 | ||
|
|
dfb68c512b | ||
|
|
85ff73c055 | ||
|
|
96bb31de5f | ||
|
|
b06f13e32a | ||
|
|
512282c446 | ||
|
|
0986583365 | ||
|
|
7e5c07c6e5 | ||
|
|
99d14139d2 | ||
|
|
b5419ee747 | ||
|
|
22e9f3308b | ||
|
|
d1161207da | ||
|
|
f8aad34bb1 | ||
|
|
8b9686edba | ||
|
|
e0e8a66d48 | ||
|
|
6d029505ed | ||
|
|
e5c7c4b02f | ||
|
|
a17bbc4d15 | ||
|
|
bc5c9df40d | ||
|
|
59c5dfe703 | ||
|
|
953e2e6a73 | ||
|
|
f16b3cb2dd | ||
|
|
b8d5978668 | ||
|
|
6dc2d5092d | ||
|
|
45227c6628 | ||
|
|
76f88ffd66 | ||
|
|
5a6864f26e | ||
|
|
8eca4c8054 | ||
|
|
1a12ce8992 | ||
|
|
db8d6ce4ab | ||
|
|
9874c5f417 | ||
|
|
9f2e4277bb | ||
|
|
2d933416f8 | ||
|
|
6886f3081f | ||
|
|
3edbbda7fa | ||
|
|
7e7160e0bf | ||
|
|
a9f92dc9f3 | ||
|
|
57d6da52bb | ||
|
|
72dc85d90d | ||
|
|
ff5ff54e88 | ||
|
|
6ab0fa3fbd | ||
|
|
4d4c02ebb3 | ||
|
|
a34542171c | ||
|
|
fce6138031 | ||
|
|
38c8197989 | ||
|
|
b7f4578c34 | ||
|
|
e5ea72e334 | ||
|
|
73a0f610c3 | ||
|
|
ee2d884434 | ||
|
|
a9ac568dc0 | ||
|
|
365dac5c2b | ||
|
|
511069b641 | ||
|
|
342d3bbd49 | ||
|
|
28da67c0c5 | ||
|
|
47c9de2e22 | ||
|
|
9e6f8c16a5 | ||
|
|
1f8d3aa7f4 | ||
|
|
209c16eff8 | ||
|
|
49b0135798 | ||
|
|
1d55dad4b1 | ||
|
|
f4e9434294 | ||
|
|
97cf766466 | ||
|
|
debcd3dc0d | ||
|
|
495d7ba9aa | ||
|
|
aac405a99d | ||
|
|
22fed1dfba | ||
|
|
ce79a638f5 | ||
|
|
ae420910e9 | ||
|
|
8068d4e591 | ||
|
|
cd3a7375e6 | ||
|
|
be9f60abf3 | ||
|
|
6431afec31 | ||
|
|
43c744df59 | ||
|
|
116d7b4365 | ||
|
|
a4fd51445d | ||
|
|
66393224ba | ||
|
|
8faceb1376 | ||
|
|
3ce0379c99 | ||
|
|
24a8dfdfdb | ||
|
|
3952044a82 | ||
|
|
a11128ae9f | ||
|
|
ca802a7254 | ||
|
|
ae7d4770fa | ||
|
|
430c00c689 | ||
|
|
302f7018d4 | ||
|
|
804445637d | ||
|
|
e9d1718793 | ||
|
|
d9953ff0ac | ||
|
|
5433bf013d | ||
|
|
244cbb39ca | ||
|
|
a0eac8e0dc | ||
|
|
f8c473d039 | ||
|
|
fc259f5c20 | ||
|
|
a3a6ec4838 | ||
|
|
c32a8c1614 | ||
|
|
50f4e623f7 | ||
|
|
b7de63c5f5 | ||
|
|
4ed41cf06a | ||
|
|
d613ceb3eb | ||
|
|
91ee57997b | ||
|
|
50a7a94dac | ||
|
|
61c5d7e637 | ||
|
|
816ba32bb0 | ||
|
|
3c6937ea94 | ||
|
|
bf897eb02a | ||
|
|
254bb9e0a9 | ||
|
|
2cdd9a7fc0 | ||
|
|
774abcc612 | ||
|
|
bbea1fba25 | ||
|
|
1c68b02343 | ||
|
|
1f2054beb7 | ||
|
|
2385942f7c | ||
|
|
36bef805ea | ||
|
|
ed1f88db9d | ||
|
|
c4390a0bb0 | ||
|
|
301e761897 | ||
|
|
72173298e3 | ||
|
|
c4265edaf4 | ||
|
|
93f9bde307 | ||
|
|
0bf8f978f9 | ||
|
|
a6522bbcf2 | ||
|
|
44aeddcdbd | ||
|
|
c6a630875f | ||
|
|
b18fa8fa76 | ||
|
|
689808a9db | ||
|
|
8bb45d6f43 | ||
|
|
cd1ff1699b | ||
|
|
4ca13ca884 | ||
|
|
b05138630a | ||
|
|
9394ac47f4 | ||
|
|
c43716b0d9 | ||
|
|
e8b54ddc1f | ||
|
|
37d756b1b0 | ||
|
|
e3140aaab8 | ||
|
|
238aa2e509 | ||
|
|
54c6d4fb96 | ||
|
|
969b921fae | ||
|
|
40add5ca44 | ||
|
|
06db4610ca | ||
|
|
e4334f256a | ||
|
|
4286baec0f | ||
|
|
cd1df94235 | ||
|
|
649b73f0e1 | ||
|
|
e967d4b344 | ||
|
|
e5a71b8044 | ||
|
|
9886957034 | ||
|
|
3e7d155002 | ||
|
|
b96add529c | ||
|
|
e91db6aeec | ||
|
|
1b25283284 | ||
|
|
2bc61baac3 | ||
|
|
f862f1a2c4 | ||
|
|
3074169446 | ||
|
|
afee575f10 | ||
|
|
94a53a278c | ||
|
|
4a3ac7176f | ||
|
|
305c5bad68 | ||
|
|
4570da2e26 | ||
|
|
7ec0487e37 | ||
|
|
3aa3dccda7 | ||
|
|
21efa7f639 | ||
|
|
614fd1a85d | ||
|
|
05bd6a5d48 | ||
|
|
208fa85e8f | ||
|
|
2b703cac3a | ||
|
|
ce59872a66 | ||
|
|
c402c416e5 | ||
|
|
466b4314c5 | ||
|
|
40f8aac655 | ||
|
|
2afd1ab938 | ||
|
|
722fcaa2e1 | ||
|
|
5d3830d3de | ||
|
|
da244fe836 | ||
|
|
c00ff163f1 | ||
|
|
6bb18f18fd | ||
|
|
b8ea8f8a97 | ||
|
|
f9c01d03d3 | ||
|
|
f05dcf99ff | ||
|
|
a8edec2184 | ||
|
|
de3db81222 | ||
|
|
e0a49bc71e | ||
|
|
031e65efa7 | ||
|
|
3a1978e2fe | ||
|
|
edffa28d89 | ||
|
|
2c60fadb99 | ||
|
|
adfd9f63fa | ||
|
|
22f3f245b5 | ||
|
|
53e832fbf0 | ||
|
|
884c180e43 | ||
|
|
a1d5c0252d | ||
|
|
94a40f4b79 | ||
|
|
523467f47e | ||
|
|
eea48c257f | ||
|
|
d9e6718217 | ||
|
|
84afda69c0 | ||
|
|
820a1c1604 | ||
|
|
941d79410b | ||
|
|
78d2b8a68b | ||
|
|
0d147c7585 | ||
|
|
2f23d6a67d | ||
|
|
df6c5fee9c | ||
|
|
41f6bc588c | ||
|
|
660eedb917 | ||
|
|
37cc205dfa | ||
|
|
78beaf0b45 | ||
|
|
8c5cb09e70 | ||
|
|
3163e53502 | ||
|
|
1a58cdb08f | ||
|
|
183ebfad96 | ||
|
|
49e7e14422 | ||
|
|
6576099748 | ||
|
|
5d6bc5bc55 | ||
|
|
edf0c62ce3 | ||
|
|
0a9f3efecc | ||
|
|
a7bc98d1e3 | ||
|
|
ac03bc50b7 | ||
|
|
61a8d07912 | ||
|
|
2d744f1080 | ||
|
|
2582fe20db | ||
|
|
6a322ef9d5 | ||
|
|
bbcbd55e5a | ||
|
|
99f6e1b346 | ||
|
|
a7c564ee20 | ||
|
|
bf9b6f634c | ||
|
|
1698c9311b | ||
|
|
6b7c2c6f01 | ||
|
|
54e52758e5 | ||
|
|
4f9a85b3a7 | ||
|
|
7fe63a2cfe | ||
|
|
a7c418ac79 | ||
|
|
3a51ce523c | ||
|
|
ff0f8bd86e | ||
|
|
12d4b1448d | ||
|
|
3e552f19b5 | ||
|
|
13e2ce88d5 | ||
|
|
276814f2d8 | ||
|
|
4263c59117 | ||
|
|
786e1441d7 | ||
|
|
4100673705 | ||
|
|
759d4475fc | ||
|
|
2e986a4bdd | ||
|
|
005afae9aa | ||
|
|
739cdea934 | ||
|
|
894e774523 | ||
|
|
397a3f5d80 | ||
|
|
c30c6a4cfb | ||
|
|
01134c94b8 | ||
|
|
0cd963a9cf | ||
|
|
1db452829d | ||
|
|
9e7d0d7429 | ||
|
|
de891f783f | ||
|
|
dd4922ea77 | ||
|
|
e0ac7022fc | ||
|
|
0809c80965 | ||
|
|
1e5e8ef5fc | ||
|
|
bc44ee346a | ||
|
|
2ed9a55c9b | ||
|
|
88196afc14 | ||
|
|
60605eb347 | ||
|
|
d361621dc3 | ||
|
|
1e99b7ffa2 | ||
|
|
143e02d16c | ||
|
|
92cb18389e | ||
|
|
ce4383505c | ||
|
|
6e0ab7f24d | ||
|
|
64461d649b | ||
|
|
19acd42336 | ||
|
|
5d050348ea | ||
|
|
6d34e8e9bb | ||
|
|
5a80658ec5 | ||
|
|
be3ba2219a | ||
|
|
00026ee452 | ||
|
|
706e381f02 | ||
|
|
d06655316b | ||
|
|
17308694d8 | ||
|
|
ef7dfa7709 | ||
|
|
871ece2514 | ||
|
|
106ea10d93 | ||
|
|
5398b98195 | ||
|
|
4caef40690 | ||
|
|
a7ab6f11fb | ||
|
|
41b1d68de6 | ||
|
|
c322c8818b | ||
|
|
6a2de3a9a7 | ||
|
|
f40c52d317 | ||
|
|
c2774fc562 | ||
|
|
bad7fd1234 | ||
|
|
3bc2227f70 | ||
|
|
8c2c25ad52 | ||
|
|
0dc4511f0f | ||
|
|
3cdf057be5 | ||
|
|
727e11996c | ||
|
|
7259154e0c | ||
|
|
8e5212b37a | ||
|
|
b09b4929ea | ||
|
|
5629bb63c0 | ||
|
|
2c100466c4 | ||
|
|
a963567d95 | ||
|
|
6f9b1586bf | ||
|
|
3076ed37dd | ||
|
|
38fe1c60f6 | ||
|
|
fc551a7acd | ||
|
|
1e974807e5 | ||
|
|
0dc258ebde | ||
|
|
b26e92ecb7 | ||
|
|
6488a62c45 | ||
|
|
cf3825be83 | ||
|
|
a4bb14d1a0 | ||
|
|
a5e431e31c | ||
|
|
4005f2c6de | ||
|
|
b0b9be552b | ||
|
|
acacdc870a | ||
|
|
66a89572ca | ||
|
|
a12c817821 | ||
|
|
d19912ff5b | ||
|
|
111ede487d | ||
|
|
6f7ca3cb5e | ||
|
|
e6b63095ad | ||
|
|
a40e8e3c57 | ||
|
|
0d129be808 | ||
|
|
d70ab1beab | ||
|
|
5666cbd9c0 | ||
|
|
b0d4eb7c3f | ||
|
|
ed5773883b | ||
|
|
fc668cb395 | ||
|
|
d7746c48f2 | ||
|
|
b5cb340a43 | ||
|
|
44089e28f7 | ||
|
|
1c6fb7f1ac | ||
|
|
4198b31cd7 | ||
|
|
638364d3d2 | ||
|
|
e7195e40b0 | ||
|
|
1e084234fd | ||
|
|
833813098d | ||
|
|
df0e27e56a | ||
|
|
5b8fbf8ea6 | ||
|
|
3286d38fc8 | ||
|
|
8838185cbf | ||
|
|
0be5bfd050 | ||
|
|
154b265e1f | ||
|
|
7a9e965cc2 | ||
|
|
e05a770f51 | ||
|
|
fd5e5ff7d4 | ||
|
|
53e73cc42a | ||
|
|
c419eef405 | ||
|
|
0c24ac38be | ||
|
|
67535d8691 | ||
|
|
1205d5d113 | ||
|
|
7be63d8e99 | ||
|
|
695cf18449 | ||
|
|
a117d42f67 | ||
|
|
a98dd3382c | ||
|
|
34e0755b78 | ||
|
|
975f8d81ce | ||
|
|
769b6465d1 | ||
|
|
12d3a781ff | ||
|
|
0bab251f3d | ||
|
|
8eb0d43287 | ||
|
|
44e69429ad | ||
|
|
d787de821a | ||
|
|
7c616718fd | ||
|
|
2edfab25d7 | ||
|
|
584fc6088e | ||
|
|
99254b3315 | ||
|
|
e5f3d86b9f | ||
|
|
0322aeada2 | ||
|
|
6d9ca8a820 | ||
|
|
c57f647ddd | ||
|
|
1f5669532f | ||
|
|
055d6a6790 | ||
|
|
9eb03f2c16 | ||
|
|
f6569f5091 | ||
|
|
cb0a632944 | ||
|
|
576c3cc7d2 | ||
|
|
8490e93b99 | ||
|
|
31d318b7d2 | ||
|
|
cd50872acb | ||
|
|
ff7ff8ee58 | ||
|
|
14d29dc167 | ||
|
|
99aa8579cd | ||
|
|
5df7be8fef | ||
|
|
4fbd56cf08 | ||
|
|
01f9ccdb4d | ||
|
|
c6749105e0 | ||
|
|
7a582a6576 | ||
|
|
dfab4af72c | ||
|
|
a200246843 | ||
|
|
89a6c467d4 | ||
|
|
a4bc108cdc | ||
|
|
d0f5b803fa | ||
|
|
10f1acc0ac | ||
|
|
10da4bc4e6 | ||
|
|
cb6d5865a4 | ||
|
|
fe19187dad | ||
|
|
024e9b247e | ||
|
|
d058940728 | ||
|
|
5ca16e8f1c | ||
|
|
d52ddfed36 | ||
|
|
b1ba8e4d6e | ||
|
|
2e9c5d3bac | ||
|
|
ac79d8482f | ||
|
|
597594b5bc | ||
|
|
7736259f70 | ||
|
|
f3558f4aa7 | ||
|
|
e6fa3dd823 | ||
|
|
c4b1502385 | ||
|
|
ccb75f4166 | ||
|
|
bc3932d008 | ||
|
|
9e29398b11 | ||
|
|
a0646862fc | ||
|
|
2085b0340f | ||
|
|
1550997d55 | ||
|
|
18f6c24809 | ||
|
|
7c387140d4 | ||
|
|
91765df50d | ||
|
|
ac4cd8f5c6 | ||
|
|
27ef9efb38 | ||
|
|
874dd9ff62 | ||
|
|
a3cce7edcd | ||
|
|
1ac98acefd | ||
|
|
9370a9331b | ||
|
|
cfe2522699 | ||
|
|
ee9bd8dd1a | ||
|
|
532ac4f8a7 | ||
|
|
1859fce603 | ||
|
|
452c1da6b8 | ||
|
|
75569abbe2 | ||
|
|
0ce772a6d6 | ||
|
|
92c28368f6 | ||
|
|
216228d9e4 | ||
|
|
c13145971a | ||
|
|
c78e90588a | ||
|
|
8e3b7b0418 | ||
|
|
f3eac47dc7 | ||
|
|
bf7304df3b | ||
|
|
c5ddf1a1c7 | ||
|
|
de951e3ea0 | ||
|
|
44b7e34d7f | ||
|
|
e025496bbc | ||
|
|
db747ea246 | ||
|
|
84c1110f18 | ||
|
|
73253cda17 | ||
|
|
34f6ac59f6 | ||
|
|
da814b0a5a | ||
|
|
99421e7617 | ||
|
|
c30eb02d91 | ||
|
|
59185b6112 | ||
|
|
79c070ec0d | ||
|
|
ce4b1c8014 | ||
|
|
3d3d44440a | ||
|
|
a91f7126e1 | ||
|
|
d9358b6134 | ||
|
|
fd4cdcaba6 | ||
|
|
13fd612b50 | ||
|
|
905872232d | ||
|
|
409fa79f59 | ||
|
|
82304058b2 | ||
|
|
ec457a0e44 | ||
|
|
f176938831 | ||
|
|
33c5a40e9f | ||
|
|
57874362c3 | ||
|
|
c1581f3845 | ||
|
|
72d510a6c1 | ||
|
|
723233be84 | ||
|
|
ad9a0b2f50 | ||
|
|
b881ea1e03 | ||
|
|
e2fb3802d7 | ||
|
|
eb7674cf04 | ||
|
|
3ee169ba14 | ||
|
|
4a903053de | ||
|
|
961ad02e8a | ||
|
|
472a063979 | ||
|
|
4fd61c97df | ||
|
|
5b81c31ba2 | ||
|
|
ef9507a282 | ||
|
|
4efe137e82 | ||
|
|
cea5a282c2 | ||
|
|
2ad69bf1e9 | ||
|
|
397cfaf23a | ||
|
|
8223c073ef | ||
|
|
b564b5d0f6 | ||
|
|
c744f1ff93 | ||
|
|
39656bec03 | ||
|
|
5b1f7db2c5 | ||
|
|
f914026c14 | ||
|
|
156150bd36 | ||
|
|
99b7e83324 | ||
|
|
4222d98e49 | ||
|
|
cd00881afb | ||
|
|
d1cf1e4243 | ||
|
|
cf5227a81f | ||
|
|
2110fbee8d | ||
|
|
680116082b | ||
|
|
94092eb6af | ||
|
|
1286fb165c | ||
|
|
36a22bd5eb | ||
|
|
15fa4b80b2 | ||
|
|
2c5281a41c | ||
|
|
2e433d73db | ||
|
|
1f915c6c5e | ||
|
|
bec69b3abf | ||
|
|
530e82cc6d | ||
|
|
29765230b1 | ||
|
|
29a556c7d1 | ||
|
|
7f3d4ba8aa | ||
|
|
9c714c9c4e | ||
|
|
91ef9955b4 | ||
|
|
97f0f3784d | ||
|
|
42d903ac16 | ||
|
|
b9111348d3 | ||
|
|
69b7fa79de | ||
|
|
4c67233e83 | ||
|
|
c9d14992b9 | ||
|
|
f06411e018 | ||
|
|
73b9c419ff | ||
|
|
e763d98134 | ||
|
|
0533256b87 | ||
|
|
4d0c874a95 | ||
|
|
ae1608e0bb | ||
|
|
88ae7c8994 | ||
|
|
d697ce8c81 | ||
|
|
a684cf1294 | ||
|
|
b9d4028074 | ||
|
|
916cb7e76f | ||
|
|
6dd61af5dd | ||
|
|
5bee7c0791 | ||
|
|
a4a731f04a | ||
|
|
b15d3c5375 | ||
|
|
99ba73f194 | ||
|
|
1456c15f91 | ||
|
|
8a26580453 | ||
|
|
af393ad0ca | ||
|
|
8a46f3a7d2 | ||
|
|
0aff71496c | ||
|
|
f3a5642bcd | ||
|
|
b97e6e0870 | ||
|
|
3e704c3d22 | ||
|
|
ae02fa80ce | ||
|
|
ec5c1038b3 | ||
|
|
e5e6295a83 | ||
|
|
19560fe60f | ||
|
|
1f1b469a4b | ||
|
|
eb095a7497 | ||
|
|
6415b095ab | ||
|
|
d93c959da8 | ||
|
|
09893e1409 | ||
|
|
93ec6384d0 | ||
|
|
a221bf33b2 | ||
|
|
c7ec3d2197 | ||
|
|
18d04099fd | ||
|
|
fec52ee19f | ||
|
|
d87a22da23 | ||
|
|
4bda273947 | ||
|
|
7c8a2e32b4 | ||
|
|
45e8d0c2b6 | ||
|
|
3fe0b93567 | ||
|
|
06147dd5cc | ||
|
|
44dae3832e | ||
|
|
4f06d804e9 | ||
|
|
fb87b201da | ||
|
|
a58090b334 | ||
|
|
0050bfe36f | ||
|
|
d40233cb1e | ||
|
|
3125f8e7d1 | ||
|
|
0646fb77f2 | ||
|
|
c5a3a17a94 | ||
|
|
e4b1880025 | ||
|
|
c0b74c1605 | ||
|
|
96aed66af2 | ||
|
|
65e23a90a1 | ||
|
|
f3405b5724 | ||
|
|
5bef1e5663 | ||
|
|
5120cee05a | ||
|
|
895e593d02 | ||
|
|
32d8070119 | ||
|
|
46273ecbe5 | ||
|
|
4268099a06 | ||
|
|
921db2f6cb | ||
|
|
f640c45464 | ||
|
|
d4dc7a32a4 | ||
|
|
33e5171742 | ||
|
|
ebb4857782 | ||
|
|
c47d253967 | ||
|
|
c58e7d2ccf | ||
|
|
f3cad86f6f | ||
|
|
a23655de42 | ||
|
|
b7b899ea40 | ||
|
|
89029b1bc3 | ||
|
|
9b4212e00c | ||
|
|
6b158e1e23 | ||
|
|
6cae350ef2 | ||
|
|
3b83738208 | ||
|
|
6b894eadf7 | ||
|
|
13128b6a0f | ||
|
|
4b84238fb4 | ||
|
|
7345ecde7b | ||
|
|
8272cf0ade | ||
|
|
cae3d41af0 | ||
|
|
54061018ea | ||
|
|
0281b3c9f9 | ||
|
|
70c8d3f837 | ||
|
|
19dcd072c7 | ||
|
|
4c5474cb0f | ||
|
|
2c5baf6b87 | ||
|
|
508c2fe5b6 | ||
|
|
200bd1be74 | ||
|
|
29617de259 | ||
|
|
96f1a1153b | ||
|
|
c931fd1737 | ||
|
|
8f8e9a538d | ||
|
|
8dbec207cb | ||
|
|
4ca0fff9d9 | ||
|
|
97378addf5 | ||
|
|
1888243853 | ||
|
|
e0e61f7e7d | ||
|
|
d2b7054d80 | ||
|
|
afbd0a3301 | ||
|
|
5a8c10ba82 | ||
|
|
c1b0aaec2d | ||
|
|
3ac0b252ff | ||
|
|
f199c3051b | ||
|
|
aa575ee267 | ||
|
|
20c9120b3f | ||
|
|
8e17cff31c | ||
|
|
69641c0b93 | ||
|
|
0a39d8622c |
30
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Contributing
|
||||
|
||||
## Requiered knowledge
|
||||
|
||||
- JavaScript
|
||||
- html5
|
||||
- NodeJS
|
||||
|
||||
Additional:
|
||||
|
||||
- CSS
|
||||
- [VueJS](https://vuejs.org/)
|
||||
- [ElectronJS](https://electronjs.org/)
|
||||
- [NPMjs](https://www.npmjs.com/)
|
||||
|
||||
A source code editor is also requiered. We recommend [Visual Studio Code](https://code.visualstudio.com/).
|
||||
|
||||
### Installing the components
|
||||
|
||||
1. Install [Git](https://git-scm.com/)
|
||||
2. Install [Node](https://nodejs.org/en/)
|
||||
|
||||
### Cloning the project
|
||||
|
||||
1. Fork the [repository](https://github.com/PreMiD/PreMiD)
|
||||
2. Open a terminal and type `git clone https://github.com/PreMiD/PreMiD`
|
||||
|
||||
### Coding your vision
|
||||
|
||||
Please keep the structure. We don't want to disorganize our project. Chaotic files may not be accepted.
|
||||
BIN
.github/Electron/Chrome_bsp.png
vendored
Normal file
|
After Width: | Height: | Size: 332 KiB |
BIN
.github/Electron/PMD_Banner.png
vendored
Normal file
|
After Width: | Height: | Size: 682 KiB |
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: Timeraa
|
||||
open_collective: premid
|
||||
ko_fi: timeraa
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZU8Q766ACS2WS&lc=US
|
||||
3
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,7 +1,6 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for YT Presence
|
||||
|
||||
about: Suggest an idea for PreMiD
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
|
||||
16
.github/ISSUE_TEMPLATE/service_request.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Service request
|
||||
about: Suggest Rich Presence support for a website
|
||||
---
|
||||
|
||||
**What's the name of the service?**
|
||||
Ex. www.youtube.com | YouTube
|
||||
|
||||
**What should the Presence display?**
|
||||
Informations about the current video
|
||||
|
||||
**Why do you want support for this service?**
|
||||
Tell us why you want to have support for this website. Please don't just tell us "I use it all the time"
|
||||
|
||||
**Are you able to provide an image for the service? (512x512 minimum)**
|
||||
If you can provide the logo pls paste a link in here or the image
|
||||
BIN
.github/Logo.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
.github/Patreon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
1
.github/PayPal.svg
vendored
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
13
.github/SUPPORT.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# How to get support
|
||||
|
||||
## Take a look at the [wiki](https://wiki.premid.app)
|
||||
Our GitHub wiki is full of information around PreMiD.<br>
|
||||
Take a look and feel free to contribute if you want to add something new.
|
||||
|
||||
## [Open a issue](https://github.com/PreMiD/PreMiD/issues/new/choose) on [GitHub](https://github.com/PreMiD/PreMiD)
|
||||
Simply open a issue if you don't feel allright.<br>
|
||||
*Aand there he goes...*
|
||||
|
||||
## Ask a staff member in [#support](https://discord.gg/WvfVZ8T)
|
||||
The team is ready to tell you the secrets of the underworld.<br>
|
||||
Join our [Discord server](https://discord.gg/WvfVZ8T) and find out what we're hiding.
|
||||
BIN
.github/TwitterButton.png
vendored
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
45
.github/deploy.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import * as Client from "ssh2-sftp-client";
|
||||
import * as archiver from "archiver";
|
||||
import { platform, arch } from "os";
|
||||
import { createWriteStream } from "fs";
|
||||
|
||||
let sftp = new Client();
|
||||
|
||||
sftp
|
||||
.connect({
|
||||
host: process.env.SSH_HOST,
|
||||
username: process.env.SSH_USERNAME,
|
||||
password: process.env.SSH_PASSWORD
|
||||
})
|
||||
.then(async () => {
|
||||
console.log("Zipping...");
|
||||
let output = createWriteStream("app.zip"),
|
||||
archive = archiver("zip");
|
||||
|
||||
archive.directory(
|
||||
`../dist/PreMiD-${platform()}-${arch()}`,
|
||||
`PreMiD-${platform()}-${arch()}`
|
||||
);
|
||||
|
||||
output.on("close", function() {
|
||||
console.log("Uploading...");
|
||||
sftp
|
||||
.fastPut(
|
||||
"app.zip",
|
||||
`/home/PreMiD/builds/PreMiD-${platform()}-${arch()}.zip`
|
||||
)
|
||||
.then(() => {
|
||||
console.log("Done!");
|
||||
sftp.end();
|
||||
});
|
||||
});
|
||||
|
||||
archive.on("error", function(err) {
|
||||
sftp.end();
|
||||
throw err;
|
||||
});
|
||||
|
||||
archive.pipe(output);
|
||||
|
||||
archive.finalize();
|
||||
});
|
||||
BIN
.github/example.png
vendored
Normal file
|
After Width: | Height: | Size: 332 KiB |
25
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: DePloY
|
||||
on: push
|
||||
env:
|
||||
NODE_ENV: DePloY
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@master
|
||||
- name: Install Dependencies
|
||||
run: npm i
|
||||
- name: Prepare to package
|
||||
run: npm run init
|
||||
- name: Package
|
||||
run: npm run pkg
|
||||
- name: Upload to server
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSHHOST }}
|
||||
SSH_USERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSH_PASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
run: npm run deploy
|
||||
14
.gitignore
vendored
@@ -1,2 +1,16 @@
|
||||
node_modules
|
||||
out
|
||||
dist
|
||||
tmp
|
||||
|
||||
.vscode
|
||||
.env
|
||||
|
||||
src/package-lock.json
|
||||
src/package.json
|
||||
src/update.ini
|
||||
|
||||
*.exe
|
||||
*.app
|
||||
*.xml.backup
|
||||
*.js
|
||||
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "PMD_Extension"]
|
||||
path = Extension
|
||||
url = https://github.com/Timeraa/PMD_Extension
|
||||
66
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at contact@premid.app or by contacting a staff member on our [Discord server](https://discord.gg/WvfVZ8T). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
@@ -1,56 +0,0 @@
|
||||
function updatePresence(tabId, changeInfo, tab) {
|
||||
if (tab.url) {
|
||||
// Create a URL object from the current tab URL
|
||||
const url = new URL(tab.url);
|
||||
// Parse data
|
||||
if (tab.url.startsWith("https://music.youtube.com/")) {
|
||||
const data = {
|
||||
connected: true,
|
||||
service: "ytm",
|
||||
url: tab.url
|
||||
}
|
||||
} else {
|
||||
const data = {
|
||||
connected: true,
|
||||
service: "NaN"
|
||||
}
|
||||
}
|
||||
|
||||
if (!data) return;
|
||||
|
||||
$.ajax({
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
url: "http://localhost:3000/",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
processData: false,
|
||||
data: JSON.stringify(data),
|
||||
error: function(jqXHR, textStatus, errorThrown) {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
chrome.tabs.onUpdated.addListener(updatePresence);
|
||||
|
||||
function sendAlive() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
url: "http://localhost:3000/",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
processData: false,
|
||||
data: JSON.stringify({
|
||||
connected: true,
|
||||
service: "keepAlive"
|
||||
}),
|
||||
error: function(jqXHR, textStatus, errorThrown) {}
|
||||
})
|
||||
}
|
||||
|
||||
setInterval(sendAlive, 1*1000)
|
||||
@@ -1,56 +0,0 @@
|
||||
//* Start interval
|
||||
window.onload = function() {
|
||||
setInterval(updateData, 1000);
|
||||
};
|
||||
|
||||
//* Create used variables
|
||||
let urlForVideo,
|
||||
songTime,
|
||||
calcDifference = [];
|
||||
|
||||
function updateData() {
|
||||
if (document.location.href.includes("youtube"))
|
||||
urlForVideo = document.location.href;
|
||||
if ($(".ytp-time-current").html() != " ") {
|
||||
const data = {
|
||||
connected: true,
|
||||
service: "yt",
|
||||
url: urlForVideo,
|
||||
currentSongTitle: $(".style-scope.ytd-video-primary-info-renderer")
|
||||
.children()
|
||||
.eq(2)
|
||||
.contents()
|
||||
.first()
|
||||
.html(),
|
||||
currentSongAuthor: $(
|
||||
"#upload-info .style-scope .ytd-video-owner-renderer"
|
||||
)
|
||||
.contents()
|
||||
.first()
|
||||
.html(),
|
||||
currentSongStartTime: getSeconds($(".ytp-time-current").html()),
|
||||
currentSongEndTime: getSeconds($(".ytp-time-duration").html()),
|
||||
currentSongCover: "NAN"
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
url: "http://localhost:3000/",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
processData: false,
|
||||
data: JSON.stringify(data),
|
||||
error: function(jqXHR, textStatus, errorThrown) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getSeconds(string) {
|
||||
const a = string.split(":");
|
||||
|
||||
const seconds = +a[0] * 60 + +a[1];
|
||||
return seconds;
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
//* Start interval
|
||||
window.onload = function() {
|
||||
setInterval(updateData, 1000);
|
||||
};
|
||||
|
||||
//* Create used variables
|
||||
let urlForVideo, songTime, calcDifference;
|
||||
|
||||
function updateData() {
|
||||
if (document.location.href.includes("music.youtube")) urlForVideo = document.location.href;
|
||||
if($(".time-info.style-scope.ytmusic-player-bar").html() != " ") {
|
||||
songTime = $(".time-info.style-scope.ytmusic-player-bar").html();
|
||||
calcDifference = songTime.split(" / ", 2);
|
||||
|
||||
var currentSongAuthors = []
|
||||
|
||||
$(".byline.ytmusic-player-bar").contents().each(function(index, item) {
|
||||
if(item.classList != undefined) {
|
||||
if(item.classList.contains("yt-simple-endpoint") == true) {
|
||||
currentSongAuthors.push(item.innerHTML)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var currentSongAuthorString = ""
|
||||
|
||||
if(currentSongAuthors.length == 0 || currentSongAuthors.length == 1) {
|
||||
currentSongAuthorString = $(".byline.ytmusic-player-bar").contents().first().text()
|
||||
} else {
|
||||
for(var i = 0; i < currentSongAuthors.length; i++) {
|
||||
if(i == currentSongAuthors.length -1) {
|
||||
currentSongAuthorString = currentSongAuthorString + " - " + currentSongAuthors[i]
|
||||
} else {
|
||||
if(i == 0) {
|
||||
currentSongAuthorString = currentSongAuthorString + currentSongAuthors[i]
|
||||
} else {
|
||||
currentSongAuthorString = currentSongAuthorString + ", " + currentSongAuthors[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
connected: true,
|
||||
service: "ytm",
|
||||
url: urlForVideo,
|
||||
currentSongTitle: $(".title.style-scope.ytmusic-player-bar").html(),
|
||||
currentSongAuthor: currentSongAuthorString,
|
||||
currentSongStartTime: getSeconds(calcDifference[0]),
|
||||
currentSongEndTime: getSeconds(calcDifference[1]),
|
||||
currentSongCover: $(".image.style-scope.ytmusic-player-bar").attr("src")
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
url: "http://localhost:3000/",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
processData: false,
|
||||
data: JSON.stringify(data),
|
||||
error: function(jqXHR, textStatus, errorThrown) {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function getSeconds(string) {
|
||||
const a = string.split(":");
|
||||
|
||||
const seconds = +a[0] * 60 + +a[1];
|
||||
return seconds;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 120 KiB |
4
Extension/jquery-3.2.1.min.js
vendored
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "YT Presence",
|
||||
"version": "0.1",
|
||||
"description":
|
||||
"Show your current YouTube Video / Song in your Discord profile.",
|
||||
"manifest_version": 2,
|
||||
"icons": {
|
||||
"2024": "images/icon.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": ["jquery-3.2.1.min.js", "background.js"],
|
||||
"persistent": true
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"2024": "images/icon.png"
|
||||
}
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"js": ["jquery-3.2.1.min.js", "handleYTM.js"],
|
||||
"matches": ["https://music.youtube.com/*"]
|
||||
},
|
||||
{
|
||||
"js": ["jquery-3.2.1.min.js", "handleYT.js"],
|
||||
"matches": ["https://www.youtube.com/*"]
|
||||
}
|
||||
],
|
||||
"permissions": ["http://localhost/*", "tabs"]
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
transition: 0.5s all ease-out;
|
||||
width: 200px;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
button {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#header {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
background-color: #ce1d2a;
|
||||
box-shadow: 0px 0px 8px 2px #cccccc;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
#footer {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
background-color: rgb(230, 230, 230);
|
||||
}
|
||||
|
||||
#footer p {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
text-decoration: none;
|
||||
color: #2196f3;
|
||||
}
|
||||
|
||||
#footer a:hover {
|
||||
text-decoration: underline;
|
||||
color: #1a76c2;
|
||||
}
|
||||
|
||||
#footer #heart {
|
||||
color: #ff0c1e;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#heading {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#heading h1 {
|
||||
margin: 5px;
|
||||
padding: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
#optionsTable {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#optionsTable table {
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
#optionsTable th {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#connectionStatus {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#connectionBar {
|
||||
background-color: rgb(30, 243, 30);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
#connectionBar p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* The switch - the box around the slider */
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
/* Hide default HTML checkbox */
|
||||
|
||||
.switch input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* The slider */
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: 0.25s;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 17px;
|
||||
width: 17px;
|
||||
left: -2.5px;
|
||||
top: -2.5px;
|
||||
background-color: white;
|
||||
-webkit-transition: 0.4s;
|
||||
transition: 0.4s;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
input:disabled + .slider {
|
||||
background-color: rgb(160, 160, 160);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
input:disabled + .slider:before {
|
||||
background-color: lightgray;
|
||||
border: 1px solid rgb(160, 160, 160);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196f3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(20px);
|
||||
-ms-transform: translateX(20px);
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link href="popup.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header">
|
||||
<h1 class="noselect">YT Presence</h1>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="heading">
|
||||
<h1 class="noselect">Options</h1>
|
||||
</div>
|
||||
<div id="optionsTable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="noselect">Enabled</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="togglePresence" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="noselect">YouTube</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="toggleYouTube" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="noselect">YouTube Music</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="toggleYouTubeMusic" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p class="noselect">Made with
|
||||
<span id="heart">♥</span> by
|
||||
<strong>
|
||||
<a target="_blank" title="Click to visit Timeraa's GitHub profile." draggable="false" href="https://github.com/Timeraa/">Timeraa</a>
|
||||
</strong> &
|
||||
<strong>
|
||||
<a target="_blank" title="Click to visit RedstoneDaedalus's GitHub profile." draggable="false" href="https://github.com/RedstoneDaedalus/">RedstoneDaedalus</a>
|
||||
</strong>
|
||||
</p>
|
||||
</div>
|
||||
<div id="connectionStatus">
|
||||
<div id="connectionBar">
|
||||
<p class="noselect">Connected to server.</p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,68 +0,0 @@
|
||||
const togglePresence = $(".togglePresence"),
|
||||
toggleYouTube = $(".toggleYouTube"),
|
||||
toggleYouTubeMusic = document.getElementsByClassName("toggleYouTubeMusic")[0];
|
||||
|
||||
window.onload = function() {
|
||||
togglePresence.on("change", switchPresence);
|
||||
toggleYouTube.on("change", switchYouTube);
|
||||
toggleYouTubeMusic.on("change", switchYouTubeMusic);
|
||||
|
||||
if (localStorage.enabled === "true") togglePresence.checked = true;
|
||||
else {
|
||||
togglePresence.checked = false;
|
||||
toggleYouTube.checked = false;
|
||||
toggleYouTubeMusic.checked = false;
|
||||
toggleYouTube.disabled = true;
|
||||
toggleYouTubeMusic.disabled = true;
|
||||
}
|
||||
|
||||
if (localStorage.youtube === "true") {
|
||||
toggleYouTube.checked = true;
|
||||
toggleYouTube.disabled = false;
|
||||
} else toggleYouTube.checked = false;
|
||||
|
||||
if (localStorage.youTubeMusic === "true") {
|
||||
toggleYouTubeMusic.checked = true;
|
||||
toggleYouTubeMusic.disabled = false;
|
||||
} else toggleYouTubeMusic.checked = false;
|
||||
};
|
||||
|
||||
function switchPresence() {
|
||||
if (localStorage.enabled === "true") {
|
||||
localStorage.enabled = "false";
|
||||
localStorage.youTube = "false";
|
||||
localStorage.youTubeMusic = "false";
|
||||
toggleYouTube.checked = false;
|
||||
toggleYouTube.disabled = true;
|
||||
toggleYouTubeMusic.checked = false;
|
||||
toggleYouTubeMusic.disabled = true;
|
||||
} else {
|
||||
localStorage.enabled = "true";
|
||||
localStorage.youTube = "true";
|
||||
localStorage.youTubeMusic = "true";
|
||||
toggleYouTube.checked = true;
|
||||
toggleYouTube.disabled = false;
|
||||
toggleYouTubeMusic.checked = true;
|
||||
toggleYouTubeMusic.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function switchYouTube() {
|
||||
if (localStorage.youTube === "true") {
|
||||
localStorage.youTube = "false";
|
||||
toggleYouTube.checked = false;
|
||||
} else {
|
||||
localStorage.youTube = "true";
|
||||
toggleYouTube.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function switchYouTubeMusic() {
|
||||
if (localStorage.youTubeMusic === "true") {
|
||||
localStorageyouTubeMusic = "false";
|
||||
toggleYouTubeMusic.checked = false;
|
||||
} else {
|
||||
localStorageyouTubeMusic = "true";
|
||||
toggleYouTubeMusic.checked = true;
|
||||
}
|
||||
}
|
||||
373
LICENSE
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
87
README.md
@@ -1,73 +1,40 @@
|
||||
##  [](https://discord.gg/GzCUcf)
|
||||
<div align="center">
|
||||
|
||||
# <img src="icon.png" width="20" draggable="false"><b> </b>YouTube Presence · Watcha watching there? 👀
|
||||
<img src=".github/Logo.png" width="150px" draggable="false"><br>
|
||||
|
||||
_Show your current YouTube video/song in your Discord profile_
|
||||
# PreMiD
|
||||
|
||||
## Table of contents
|
||||
## Your Rich Presence for web services!
|
||||
|
||||
---
|
||||

|
||||
[](https://www.codacy.com/project/Timeraa/PreMiD/dashboard?utm_source=github.com&utm_medium=referral&utm_content=PreMiD/PreMiD&utm_campaign=Badge_Grade_Dashboard&branchId=10584370)
|
||||
[](https://chrome.google.com/webstore/detail/premid/agjnjboanicjcpenljmaaigopkgdnihi)
|
||||
[](https://twitter.com/PreMiDapp)
|
||||
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [Installing the Extension](#installing-the-extension)
|
||||
- [Installing the Apllication](#installing-the-application)
|
||||
- Mac OS
|
||||
- Windows
|
||||
- FAQ
|
||||
<img src=".github/example.png" draggable="false"><br>
|
||||
|
||||
## Installing the Extension
|
||||
# About
|
||||
|
||||
<details>
|
||||
<summary><b><u>Installing the Chrome extension</u></b> (Click to expand)</summary>
|
||||
<h1>Chrome extension installation</h1>
|
||||
<ul>
|
||||
<li>In <b>Chrome</b> go to <a href="chrome://extensions/">chrome://extensions/</a></li>
|
||||
<li>Turn on <b>Developer mode</b><br>
|
||||
<img src="developerMode.png">
|
||||
</li>
|
||||
<li>Click <b>Load unpacked extension</b><br>
|
||||
<img src="loadUnpackedExtension.png">
|
||||
</li>
|
||||
<li>Load the extracted <b>Extension</b> folder</li>
|
||||
</ul>
|
||||
</details>
|
||||
**PreMiD** is a simple, configurable utility that allows you to show what you're doing on the web in your Discord **now playing status**. It supports many different websites, and will support multiple users watching the same content simultaneously in an upcoming update.
|
||||
|
||||
## Installing the Application
|
||||
# Features
|
||||
|
||||
<details>
|
||||
<summary><b><u>Mac OS</u></b> (Click to expand)</summary>
|
||||
<h1>Mac OS</h1>
|
||||
<ul>
|
||||
<li>Extract downloaded <b>.zip</b> file</li>
|
||||
<li>Drag <b>YT Presence</b> Into your <b>Applications</b> Folder</li>
|
||||
<li>Open your Launchpad</li>
|
||||
<li>Open <b>YT Presence</b></li>
|
||||
</ul>
|
||||
</details>
|
||||
· Displays your current web service in Discord as your status.<br>
|
||||
· Grants full control over Presences.<br>
|
||||
· Supports over 100 web services, still rising!<br>
|
||||
· _Watch parties and more are coming soon!_
|
||||
|
||||
<details>
|
||||
<summary><b><u>Windows</u></b> (Click to expand)</summary>
|
||||
<h1>Windows</h1>
|
||||
<ul>
|
||||
<li>Move downloaded <b>.exe</b> file to a place you decide</li>
|
||||
<li>Launch <b>YT Presence</b></li>
|
||||
</ul>
|
||||
</details>
|
||||
# Installation/Troubleshooting
|
||||
|
||||
## FAQ · Frequently Asked Questions
|
||||
### Installation instructions, Troubleshooting guides etc. can be found in our [**Wiki**](https://wiki.premid.app).
|
||||
|
||||
> ## Why can't i install the extension on the **Chrome Web Store**?<br>
|
||||
# Support us
|
||||
|
||||
- Because i am not willing to pay **5$** for only one project. <br>Change that! **_(DonationButton)_**
|
||||
|
||||
> ## Is this project still up to date?<br>
|
||||
|
||||
- Yes! I use and work on this program and extension almost everyday!<br>There are currently no plans on discontinuing this Project.
|
||||
|
||||
> ## Will this project stay free?<br>
|
||||
|
||||
- Of course! Its open source! But i would highly appreciate a little bit of Money to activate the Google Developer Account so that i can put the Chrome extension on the Chrome Web store. And it would help me to get the money needed for future plans like a **Driver license** 😎
|
||||
|
||||
---
|
||||
|
||||
### Version 0.1 · By Timeraa
|
||||
<div>
|
||||
<a target="_blank" href="https://www.patreon.com/bePatron?u=4610890" data-patreon-widget-type="become-patron-button" title="Support me on Patreon!">
|
||||
<img height="75px" draggable="false" src=".github/Patreon.png">
|
||||
</a>
|
||||
<a target="_blank" href="https://discord.gg/WvfVZ8T" title="Join our Discord!">
|
||||
<img height="75px" draggable="false" src="https://discordapp.com/api/guilds/493130730549805057/widget.png?style=banner2" alt="Join my Discord!">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
BIN
appIcon.icns
BIN
appIcon.ico
|
Before Width: | Height: | Size: 36 KiB |
112
devMode.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import * as ts from "typescript";
|
||||
import chalk from "chalk";
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
import { removeSync, writeFileSync, copySync } from "fs-extra";
|
||||
import { extname } from "path";
|
||||
import * as glob from "fast-glob";
|
||||
|
||||
//* Current child process = null
|
||||
var currChild: ChildProcess = null;
|
||||
|
||||
//* Format Host
|
||||
const formatHost: ts.FormatDiagnosticsHost = {
|
||||
getCanonicalFileName: path => path,
|
||||
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
};
|
||||
|
||||
//* Create ts program
|
||||
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
|
||||
|
||||
//* Create Watch compoile host
|
||||
const host = ts.createWatchCompilerHost(
|
||||
"./tsconfig.json",
|
||||
{},
|
||||
ts.sys,
|
||||
createProgram,
|
||||
null,
|
||||
fileChange
|
||||
);
|
||||
|
||||
if (process.argv.length == 3 && process.argv[2] == "compile")
|
||||
prepareDist().then(() => process.exit());
|
||||
//* Create watch program
|
||||
else ts.createWatchProgram(host);
|
||||
|
||||
async function fileChange(diagnostic: ts.Diagnostic) {
|
||||
//* TS compilation != done
|
||||
if (diagnostic.code !== 6194) {
|
||||
//* If error
|
||||
if ([6031, 6032].includes(diagnostic.code))
|
||||
console.log(
|
||||
chalk.blueBright(ts.formatDiagnostic(diagnostic, formatHost))
|
||||
);
|
||||
else
|
||||
console.log(chalk.redBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
return;
|
||||
} else
|
||||
console.log(chalk.greenBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
|
||||
console.log(currChild && currChild.killed);
|
||||
//* Kill old child if exists && alive
|
||||
if (currChild && !currChild.killed) currChild.kill();
|
||||
|
||||
//* Run devMode script
|
||||
prepareDist();
|
||||
|
||||
//* Clear console
|
||||
console.clear();
|
||||
|
||||
//* Run child
|
||||
currChild = spawn("npm run --silent start", {
|
||||
shell: true,
|
||||
stdio: "inherit"
|
||||
});
|
||||
}
|
||||
|
||||
//* Prepare dist folder
|
||||
async function prepareDist() {
|
||||
//* Select files
|
||||
var dist = await glob("dist/app/**/*", { onlyFiles: true }),
|
||||
src = await glob("src/**/*", { onlyFiles: true });
|
||||
|
||||
//* Filter file differences
|
||||
var nDist = dist.map(f => [f.replace("dist/app/", ""), f]);
|
||||
src = src
|
||||
.map(f => f.replace("src/", "").split(".")[0])
|
||||
.filter(sf => nDist.find(d => d[0].split(".")[0] == sf));
|
||||
|
||||
//* Old files, delete
|
||||
Promise.all(
|
||||
dist
|
||||
.filter(f => !src.includes(f.replace("dist/app/", "").split(".")[0]))
|
||||
.map(f => removeSync(f))
|
||||
);
|
||||
|
||||
//* Copy package.json (minified)
|
||||
var packageJSON = require("./package.json"),
|
||||
srcPackageJSON = packageJSON;
|
||||
|
||||
//* Delete scripts, not needed
|
||||
delete srcPackageJSON.scripts;
|
||||
|
||||
//* only electron as devDependency
|
||||
srcPackageJSON.devDependencies = {
|
||||
electron: packageJSON.devDependencies.electron
|
||||
};
|
||||
|
||||
//* Write file
|
||||
await writeFileSync(
|
||||
"./src/package.json",
|
||||
JSON.stringify(srcPackageJSON, null, 2)
|
||||
);
|
||||
|
||||
//* Copy files from src to dist
|
||||
copySync("src", "dist/app", {
|
||||
filter: function(path) {
|
||||
if (path.includes("node_modules")) return false;
|
||||
return extname(path) !== ".ts";
|
||||
console.log(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -1,15 +0,0 @@
|
||||
// config.forge.js
|
||||
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {
|
||||
appBundleId: "eu.Timeraa.YTPresence",
|
||||
icon: path.resolve(__dirname, 'appIcon.icns')
|
||||
},
|
||||
make_targets: {
|
||||
win32: ["squirrel"], // An array of win32 make targets
|
||||
darwin: ["dmg"], // An array of darwin make targets
|
||||
linux: ["deb", "rpm", "flatpak", "snap"] // An array of linux make targets
|
||||
}
|
||||
}
|
||||
236
installer_assets/PreMiD_x32.xml
Normal file
@@ -0,0 +1,236 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>2.0</version>
|
||||
<installerFilename>${product_fullname}-${product_version}-installer_32bit.${platform_exec_suffix}</installerFilename>
|
||||
<wrapLicenseFileText>0</wrapLicenseFileText>
|
||||
<logoImage>appIcon.png</logoImage>
|
||||
<componentList>
|
||||
<component>
|
||||
<name>default</name>
|
||||
<description>Default Component</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfiles</name>
|
||||
<platforms>all</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>../tmp/update.ini</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux</name>
|
||||
<platforms>linux</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows</name>
|
||||
<platforms>windows</platforms>
|
||||
<distributionFileList>
|
||||
<distributionDirectory allowWildcards="1">
|
||||
<origin>../dist/PreMiD-win32-ia32/*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionFile>
|
||||
<origin>appIcon.ico</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>updater.exe</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfilesosx</name>
|
||||
<platforms>osx</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>updater.app</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../dist/PreMiD-darwin-x64/PreMiD.app</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
</folderList>
|
||||
<startMenuShortcutList>
|
||||
<startMenuShortcut>
|
||||
<comment></comment>
|
||||
<name>${product_fullname}</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMID.exe</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath>${installdir}/</windowsPath>
|
||||
</startMenuShortcut>
|
||||
</startMenuShortcutList>
|
||||
</component>
|
||||
</componentList>
|
||||
<preInstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<program>${windows_folder_local_appdata}\premid\Update.exe</program>
|
||||
<programArguments>--uninstall</programArguments>
|
||||
<onErrorActionList>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
</deleteFile>
|
||||
</onErrorActionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<fileExists>
|
||||
<path>${windows_folder_local_appdata}\premid\PreMiD.exe</path>
|
||||
</fileExists>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</preInstallationActionList>
|
||||
<postInstallationActionList>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>PreMID.exe</program>
|
||||
<programArguments>&</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<show>0</show>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<workingDirectory>${installdir}</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<setInstallerVariableFromRegEx show="0">
|
||||
<name>escaped_installdir</name>
|
||||
<pattern> </pattern>
|
||||
<substitution>\\ </substitution>
|
||||
<text>${installdir}</text>
|
||||
</setInstallerVariableFromRegEx>
|
||||
<runProgram>
|
||||
<program>open</program>
|
||||
<programArguments> ${escaped_installdir}/PreMiD.app</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update</path>
|
||||
</deleteFile>
|
||||
<addDirectoriesToUninstaller>
|
||||
<addContents>1</addContents>
|
||||
<files>${installdir}</files>
|
||||
</addDirectoriesToUninstaller>
|
||||
<deleteFile>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</deleteFile>
|
||||
</postInstallationActionList>
|
||||
<preUninstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update/</path>
|
||||
</deleteFile>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_appdata}/${product_fullname}</path>
|
||||
</deleteFile>
|
||||
</preUninstallationActionList>
|
||||
<defaultInstallationMode>unattended</defaultInstallationMode>
|
||||
<enableRollback>0</enableRollback>
|
||||
<enableTimestamp>1</enableTimestamp>
|
||||
<osxPlatforms>osx-intel osx-x86_64</osxPlatforms>
|
||||
<outputDirectory>../dist/installer</outputDirectory>
|
||||
<productDisplayIcon>${installdir}/appIcon.ico</productDisplayIcon>
|
||||
<saveRelativePaths>1</saveRelativePaths>
|
||||
<unattendedModeUI>minimal</unattendedModeUI>
|
||||
<vendor>Timeraa</vendor>
|
||||
<windowsExecutableIcon>appIcon.ico</windowsExecutableIcon>
|
||||
<parameterList>
|
||||
<directoryParameter>
|
||||
<name>installdir</name>
|
||||
<description>Installer.Parameter.installdir.description</description>
|
||||
<explanation>Installer.Parameter.installdir.explanation</explanation>
|
||||
<value></value>
|
||||
<default>${platform_install_prefix}/${product_shortname}</default>
|
||||
<allowEmptyValue>0</allowEmptyValue>
|
||||
<cliOptionName>prefix</cliOptionName>
|
||||
<mustBeWritable>1</mustBeWritable>
|
||||
<mustExist>0</mustExist>
|
||||
<width>40</width>
|
||||
</directoryParameter>
|
||||
</parameterList>
|
||||
</project>
|
||||
237
installer_assets/PreMiD_x64.xml
Normal file
@@ -0,0 +1,237 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>2.0</version>
|
||||
<installerFilename>${product_fullname}-${product_version}-installer_64bit.${platform_exec_suffix}</installerFilename>
|
||||
<wrapLicenseFileText>0</wrapLicenseFileText>
|
||||
<logoImage>appIcon.png</logoImage>
|
||||
<componentList>
|
||||
<component>
|
||||
<name>default</name>
|
||||
<description>Default Component</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfiles</name>
|
||||
<platforms>all</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>../tmp/update.ini</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux</name>
|
||||
<platforms>linux</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows</name>
|
||||
<platforms>windows</platforms>
|
||||
<distributionFileList>
|
||||
<distributionDirectory allowWildcards="1">
|
||||
<origin>../dist/PreMiD-win32-x64/*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionFile>
|
||||
<origin>appIcon.ico</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>updater.exe</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfilesosx</name>
|
||||
<platforms>osx</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>updater.app</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../dist/PreMiD-darwin-x64/PreMiD.app</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
</folderList>
|
||||
<startMenuShortcutList>
|
||||
<startMenuShortcut>
|
||||
<comment></comment>
|
||||
<name>${product_fullname}</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMID.exe</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath>${installdir}/</windowsPath>
|
||||
</startMenuShortcut>
|
||||
</startMenuShortcutList>
|
||||
</component>
|
||||
</componentList>
|
||||
<preInstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<program>${windows_folder_local_appdata}\premid\Update.exe</program>
|
||||
<programArguments>--uninstall</programArguments>
|
||||
<onErrorActionList>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
</deleteFile>
|
||||
</onErrorActionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<fileExists>
|
||||
<path>${windows_folder_local_appdata}\premid\PreMiD.exe</path>
|
||||
</fileExists>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</preInstallationActionList>
|
||||
<postInstallationActionList>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>PreMID.exe</program>
|
||||
<programArguments>&</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<show>0</show>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<workingDirectory>${installdir}</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<setInstallerVariableFromRegEx show="0">
|
||||
<name>escaped_installdir</name>
|
||||
<pattern> </pattern>
|
||||
<substitution>\\ </substitution>
|
||||
<text>${installdir}</text>
|
||||
</setInstallerVariableFromRegEx>
|
||||
<runProgram>
|
||||
<program>open</program>
|
||||
<programArguments> ${escaped_installdir}/PreMiD.app</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update</path>
|
||||
</deleteFile>
|
||||
<addDirectoriesToUninstaller>
|
||||
<addContents>1</addContents>
|
||||
<files>${installdir}</files>
|
||||
</addDirectoriesToUninstaller>
|
||||
<deleteFile>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</deleteFile>
|
||||
</postInstallationActionList>
|
||||
<preUninstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update/</path>
|
||||
</deleteFile>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_appdata}/${product_fullname}</path>
|
||||
</deleteFile>
|
||||
</preUninstallationActionList>
|
||||
<defaultInstallationMode>unattended</defaultInstallationMode>
|
||||
<enableRollback>0</enableRollback>
|
||||
<enableTimestamp>1</enableTimestamp>
|
||||
<osxPlatforms>osx-intel osx-x86_64</osxPlatforms>
|
||||
<outputDirectory>../dist/installer</outputDirectory>
|
||||
<productDisplayIcon>${installdir}/appIcon.ico</productDisplayIcon>
|
||||
<saveRelativePaths>1</saveRelativePaths>
|
||||
<unattendedModeUI>minimal</unattendedModeUI>
|
||||
<vendor>Timeraa</vendor>
|
||||
<windowsExecutableIcon>appIcon.ico</windowsExecutableIcon>
|
||||
<parameterList>
|
||||
<directoryParameter>
|
||||
<name>installdir</name>
|
||||
<description>Installer.Parameter.installdir.description</description>
|
||||
<explanation>Installer.Parameter.installdir.explanation</explanation>
|
||||
<value></value>
|
||||
<default>${platform_install_prefix}/${product_shortname}</default>
|
||||
<allowEmptyValue>0</allowEmptyValue>
|
||||
<cliOptionName>prefix</cliOptionName>
|
||||
<mustBeWritable>1</mustBeWritable>
|
||||
<mustExist>0</mustExist>
|
||||
<width>40</width>
|
||||
</directoryParameter>
|
||||
</parameterList>
|
||||
</project>
|
||||
|
||||
BIN
installer_assets/appIcon.icns
Normal file
BIN
installer_assets/appIcon.ico
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
installer_assets/appIcon.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
6
installer_assets/update.ini
Normal file
@@ -0,0 +1,6 @@
|
||||
[Update]
|
||||
|
||||
url=https://api.premid.app/app/update/64bit/
|
||||
version_id= ?
|
||||
check_for_updates=1
|
||||
update_download_location=${installer_directory}/update
|
||||
12
installer_assets/updater.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<autoUpdateProject>
|
||||
<fullName>PreMiD</fullName>
|
||||
<shortName>PreMiD</shortName>
|
||||
<vendor>Timeraa</vendor>
|
||||
<version>2.0</version>
|
||||
<singleInstanceCheck>1</singleInstanceCheck>
|
||||
<requestedExecutionLevel>asInvoker</requestedExecutionLevel>
|
||||
<enableSslSupport>1</enableSslSupport>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
<installerFilename>updater.${platform_exec_suffix}</installerFilename>
|
||||
<osxPlatforms>osx-intel osx-x86_64</osxPlatforms>
|
||||
</autoUpdateProject>
|
||||
|
Before Width: | Height: | Size: 16 KiB |
6966
package-lock.json
generated
75
package.json
@@ -1,41 +1,50 @@
|
||||
{
|
||||
"name": "yt-presence",
|
||||
"productName": "YT Presence",
|
||||
"version": "0.0.1",
|
||||
"description": "Show your current YouTube Video / Song in your Discord profile.",
|
||||
"main": "src/index.js",
|
||||
"repository": "Timeraa/YT-Presence",
|
||||
"name": "premid",
|
||||
"productName": "PreMiD",
|
||||
"description": "Discord Rich Presence for websites.",
|
||||
"version": "2.0.4",
|
||||
"repository": "https://github.com/PreMiD/PreMiD",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "echo \"No linting configured\""
|
||||
"init": "tsc && tsc pkg devMode && node devMode.js compile",
|
||||
"start": "electron dist/app/.",
|
||||
"dev": "node devMode.js",
|
||||
"pkg": "rimraf dist && tsc && node devMode compile && cd dist/app/ && npm i --prefer-offline && cd ../../ && node pkg",
|
||||
"deploy": "tsc .github/deploy && cd .github && node deploy.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Timeraa",
|
||||
"license": "MIT",
|
||||
"config": {
|
||||
"forge": "./forge.config.js"
|
||||
"devDependencies": {
|
||||
"@types/archiver": "3.0.0",
|
||||
"@types/auto-launch": "5.0.1",
|
||||
"@types/chalk": "2.2.0",
|
||||
"@types/discord-rpc": "3.0.2",
|
||||
"@types/electron-packager": "14.0.0",
|
||||
"@types/fs-extra": "8.0.0",
|
||||
"@types/ini": "1.3.30",
|
||||
"@types/ora": "3.2.0",
|
||||
"@types/prompts": "2.0.1",
|
||||
"@types/request-promise-native": "1.0.17",
|
||||
"@types/socket.io": "2.1.4",
|
||||
"@types/ssh2-sftp-client": "4.1.0",
|
||||
"archiver": "3.1.1",
|
||||
"chalk": "2.4.2",
|
||||
"electron": "6.0.12",
|
||||
"electron-packager": "14.0.6",
|
||||
"fast-glob": "3.1.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"ini": "1.3.5",
|
||||
"nodemon": "1.19.3",
|
||||
"ora": "4.0.2",
|
||||
"prompts": "2.2.1",
|
||||
"rimraf": "3.0.0",
|
||||
"source-map-support": "0.5.13",
|
||||
"ssh2-sftp-client": "4.2.0",
|
||||
"typescript": "3.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"auto-launch": "^5.0.5",
|
||||
"chalk": "^2.4.1",
|
||||
"discord-rpc": "^3.0.0-beta.12",
|
||||
"electron-config": "^1.0.0",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"express": "^4.16.3",
|
||||
"fs": "0.0.1-security",
|
||||
"html-entities": "^1.2.1",
|
||||
"menubar": "^5.2.3",
|
||||
"request": "^2.87.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^6.0.0-beta.22",
|
||||
"@electron-forge/maker-deb": "^6.0.0-beta.22",
|
||||
"@electron-forge/maker-rpm": "^6.0.0-beta.22",
|
||||
"@electron-forge/maker-squirrel": "^6.0.0-beta.22",
|
||||
"@electron-forge/maker-zip": "^6.0.0-beta.22",
|
||||
"electron": "2.0.4"
|
||||
"auto-launch": "5.0.5",
|
||||
"discord-rpc": "github:discordjs/RPC",
|
||||
"electron-store": "5.0.0",
|
||||
"socket.io": "2.3.0",
|
||||
"sudo-prompt": "9.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
207
pkg.ts
Normal file
@@ -0,0 +1,207 @@
|
||||
import * as electronPackager from "electron-packager";
|
||||
import { platform } from "os";
|
||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { exec } from "child_process";
|
||||
import { removeSync, ensureDirSync } from "fs-extra";
|
||||
import { parse, stringify } from "ini";
|
||||
import * as prompts from "prompts";
|
||||
import * as ora from "ora";
|
||||
|
||||
(async () => {
|
||||
let response = {
|
||||
os: "current",
|
||||
arch: "current",
|
||||
installer: false
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV !== "DePloY")
|
||||
response = await prompts([
|
||||
{
|
||||
type: "select",
|
||||
name: "arch",
|
||||
message: "What architecture?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "arm64",
|
||||
value: "arm64"
|
||||
},
|
||||
{
|
||||
title: "armv7l",
|
||||
value: "armv7l"
|
||||
},
|
||||
{
|
||||
title: "ia32",
|
||||
value: "ia32"
|
||||
},
|
||||
{
|
||||
title: "mips64el",
|
||||
value: "mips64el"
|
||||
},
|
||||
{
|
||||
title: "x64",
|
||||
value: "x64"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
name: "os",
|
||||
message: "What operating system?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "darwin",
|
||||
value: "darwin"
|
||||
},
|
||||
{
|
||||
title: "linux",
|
||||
value: "linux"
|
||||
},
|
||||
{
|
||||
title: "mas",
|
||||
value: "mas"
|
||||
},
|
||||
{
|
||||
title: "win32",
|
||||
value: "win32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "installer",
|
||||
message: "With installer?"
|
||||
}
|
||||
]);
|
||||
|
||||
if (!response.os) return;
|
||||
|
||||
let icon: string;
|
||||
|
||||
if (
|
||||
response.os == "darwin" ||
|
||||
(response.os === "current" && platform() === "darwin")
|
||||
)
|
||||
icon = "./installer_assets/appIcon.icns";
|
||||
if (["ia32", "x64"].includes(response.arch) || platform() === "win32")
|
||||
icon = "./installer_assets/appIcon.ico";
|
||||
|
||||
if (existsSync("./dist/app/update.ini")) removeSync("./dist/app/update.ini");
|
||||
if (existsSync("./dist/app/updater.app"))
|
||||
removeSync("./dist/app/updater.app");
|
||||
if (existsSync("./dist/app/updater.exe"))
|
||||
removeSync("./dist/app/updater.exe");
|
||||
|
||||
let spinner = ora("Packaging app").start(),
|
||||
packagingOptions = {
|
||||
dir: "./dist/app",
|
||||
out: "./dist",
|
||||
darwinDarkModeSupport: true,
|
||||
icon: icon,
|
||||
overwrite: true,
|
||||
quiet: true,
|
||||
appBundleId: "eu.Timeraa.PreMiD",
|
||||
appCategoryType: "Utilities",
|
||||
appCopyright: `Timeraa 2018-${new Date().getFullYear()}`,
|
||||
prune: true,
|
||||
arch: response.arch,
|
||||
platform: response.os
|
||||
};
|
||||
|
||||
if (response.arch === "current") delete packagingOptions.arch;
|
||||
if (response.os === "current") delete packagingOptions.platform;
|
||||
|
||||
// @ts-ignore
|
||||
electronPackager(packagingOptions).then(() => {
|
||||
if (!response.installer) {
|
||||
spinner.text = "Done!";
|
||||
spinner.succeed();
|
||||
return;
|
||||
}
|
||||
|
||||
let versionId = "0" + require("./package.json").version.replace(/[.]/g, ""),
|
||||
updateIni = parse(readFileSync("./installer_assets/update.ini", "utf-8"));
|
||||
|
||||
updateIni.Update.version_id = versionId;
|
||||
|
||||
ensureDirSync("./tmp");
|
||||
writeFileSync("./tmp/update.ini", stringify(updateIni));
|
||||
|
||||
let bitRockBuilder = "",
|
||||
bitRockUpdater = "";
|
||||
|
||||
if (platform() === "win32") {
|
||||
bitRockBuilder = resolve(
|
||||
"C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/bin/builder-cli.exe"
|
||||
);
|
||||
bitRockUpdater = resolve(
|
||||
"C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/autoupdate/bin/customize.exe"
|
||||
);
|
||||
}
|
||||
|
||||
if (platform() === "darwin") {
|
||||
bitRockBuilder = resolve(
|
||||
"/Applications/Installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh"
|
||||
);
|
||||
bitRockUpdater = resolve(
|
||||
"/Applications/Installbuilder/autoupdate/bin/customize.sh"
|
||||
);
|
||||
}
|
||||
|
||||
if (!existsSync(bitRockBuilder) || !existsSync(bitRockUpdater)) {
|
||||
spinner.fail("Bitrock installation not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Building updater";
|
||||
|
||||
let updater = exec(
|
||||
`"${bitRockUpdater}" build installer_assets/updater.xml ${
|
||||
platform() === "win32" ? "windows" : "osx"
|
||||
}`
|
||||
);
|
||||
|
||||
updater.once("exit", (code, signal) => {
|
||||
if (![0, 1].includes(code)) {
|
||||
spinner.fail(`Updater failed with code ${code}: ${signal}`);
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Building installer";
|
||||
let builder = exec(
|
||||
`"${bitRockBuilder}" build installer_assets/PreMiD_x64.xml ${
|
||||
platform() === "win32" ? "windows" : "osx"
|
||||
}`
|
||||
);
|
||||
|
||||
builder.once("exit", code => {
|
||||
removeSync("./tmp");
|
||||
|
||||
if (code !== 0) {
|
||||
spinner.fail(`Error code: ${code}`);
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Done!";
|
||||
spinner.succeed();
|
||||
return;
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
13
renovate.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"automerge": true,
|
||||
"major": {
|
||||
"automerge": false
|
||||
},
|
||||
"packageRules": [{
|
||||
"depTypeList": ["devDependencies"],
|
||||
"automerge": true
|
||||
}]
|
||||
}
|
||||
BIN
src/assets/tray/Icon@2x.png
Normal file
|
After Width: | Height: | Size: 986 B |
BIN
src/assets/tray/Icon@2xTemplate.png
Normal file
|
After Width: | Height: | Size: 986 B |
BIN
src/assets/tray/IconTemplate.png
Normal file
|
After Width: | Height: | Size: 880 B |
BIN
src/assets/tray/icon.png
Normal file
|
After Width: | Height: | Size: 880 B |
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"yt_client_id": "463097721130188830",
|
||||
"ytm_client_id": "463151177836658699",
|
||||
"version": 0.2
|
||||
}
|
||||
76
src/index.js
@@ -1,76 +0,0 @@
|
||||
//* Clear console
|
||||
process.stdout.write("\u001b[2J\u001b[0;0H");
|
||||
|
||||
const { app } = require('electron');
|
||||
|
||||
//* Require config
|
||||
const config = require('./config.json');
|
||||
|
||||
//* Require electron-config
|
||||
var os = require('os')
|
||||
|
||||
let constants = require('./util/constants')
|
||||
|
||||
constants.platform = os.platform
|
||||
|
||||
const Config = require('electron-config');
|
||||
const userSettings = new Config({
|
||||
name: "userSettings"
|
||||
});
|
||||
|
||||
//* Set default value for electon-config userSettings
|
||||
if(userSettings.get('enabled') == undefined) {
|
||||
userSettings.set('enabled', true)
|
||||
userSettings.set('youTube', true)
|
||||
userSettings.set('youTubeMusic', true)
|
||||
}
|
||||
|
||||
|
||||
//* Set dock Badge to Loading...
|
||||
if(constants.platform == "darwin") {
|
||||
app.dock.setBadge("Loading...")
|
||||
}
|
||||
|
||||
//* Require Needed packages
|
||||
const AutoLaunch = require('auto-launch');
|
||||
const chalk = require("chalk")
|
||||
|
||||
let constants = require('./util/constants')
|
||||
|
||||
console.log(constants.consolePrefix + chalk.yellow("Loading..."))
|
||||
|
||||
//* Check for update
|
||||
require('./util/checkForUpdate')
|
||||
|
||||
//* Setup MenuBar
|
||||
require('./menubar/setup')
|
||||
|
||||
//* App ready
|
||||
const appReady = () => {
|
||||
//* Add App to AutoLaunch
|
||||
console.log(constants.consolePrefix + chalk.yellow("Adding App to autostart..."))
|
||||
let autoLaunch = new AutoLaunch({
|
||||
name: 'YT Presence',
|
||||
path: app.getPath('exe'),
|
||||
isHidden: true
|
||||
});
|
||||
|
||||
//* Enable AutoLaunch if disabled
|
||||
autoLaunch.isEnabled().then((isEnabled) => {
|
||||
if (!isEnabled) autoLaunch.enable();
|
||||
console.log(constants.consolePrefix + chalk.green("Added App to autostart."))
|
||||
})
|
||||
//* Catch error
|
||||
.catch(function(err) {
|
||||
console.log(constants.consolePrefix + chalk.red("Error while adding App to autostart."))
|
||||
})
|
||||
|
||||
//* Include PresenceHandler
|
||||
require('./presenceHandler.js')
|
||||
}
|
||||
|
||||
//* Register Handler
|
||||
app.on('ready', appReady);
|
||||
|
||||
//* Prevent default behaviour
|
||||
app.on('window-all-closed', () => {});
|
||||
56
src/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { app, systemPreferences, dialog } from "electron";
|
||||
//* Source .map support if devEnv
|
||||
if (!app.isPackaged) require("source-map-support").install();
|
||||
|
||||
import { init as initSocket, socket } from "./managers/socketManager";
|
||||
import { init as initTray } from "./managers/trayManager";
|
||||
import { update as initAutoLaunch } from "./managers/launchManager";
|
||||
import { platform } from "os";
|
||||
import { checkForUpdate } from "./util/updateChecker";
|
||||
import { info } from "./util/debug";
|
||||
|
||||
//* Define and set it to null
|
||||
//* Set AppUserModelId for task manager etc
|
||||
//* Hide app icon if Mac OS
|
||||
//* Mac OS truted accessability client
|
||||
export let updateCheckerInterval = null;
|
||||
app.setAppUserModelId("Timeraa.PreMiD");
|
||||
if (platform() === "darwin") {
|
||||
app.dock.hide();
|
||||
|
||||
!systemPreferences.isTrustedAccessibilityClient(false)
|
||||
? systemPreferences.isTrustedAccessibilityClient(true)
|
||||
: info("Trusted accessibility client.");
|
||||
}
|
||||
|
||||
//* When app is ready
|
||||
app.whenReady().then(async () => {
|
||||
//* Init auto launch
|
||||
initAutoLaunch();
|
||||
|
||||
//* Check for updates > Update and relaunch
|
||||
//* Init socket
|
||||
//* init application tray icon
|
||||
//* If app is packaged, run an update check every 15 mins
|
||||
await checkForUpdate(true);
|
||||
await initSocket();
|
||||
await initTray();
|
||||
app.isPackaged
|
||||
? (updateCheckerInterval = setInterval(checkForUpdate, 15 * 1000 * 60))
|
||||
: undefined;
|
||||
});
|
||||
|
||||
//* If second instance started, close old one
|
||||
app.on("second-instance", app.quit);
|
||||
|
||||
//* Send errors from app to extension
|
||||
process.on("unhandledRejection", rejection => {
|
||||
console.log(rejection);
|
||||
socket.emit("unhandledRejection", rejection);
|
||||
});
|
||||
|
||||
// TODO Find better way to log
|
||||
process.on("uncaughtException", err => {
|
||||
dialog.showErrorBox(err.name, err.stack);
|
||||
app.exit(0);
|
||||
});
|
||||
4
src/jquery-3.2.1.min.js
vendored
167
src/managers/discordManager.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import * as Discord from "discord-rpc";
|
||||
import { app } from "electron";
|
||||
import { platform } from "os";
|
||||
import { tray } from "./trayManager";
|
||||
import { info } from "../util/debug";
|
||||
import { init as initKeybinds, deinit as deinitKeybinds } from "./inputManager";
|
||||
|
||||
//* Define Presence array
|
||||
let loggedInPresences: Array<Presence> = [];
|
||||
|
||||
/**
|
||||
* Sets the user's activity
|
||||
* @param presence PresenceData to set activity
|
||||
*/
|
||||
export function setActivity(presence: PresenceData) {
|
||||
//* If presence.mediakeys defined & enabled, init
|
||||
//* If platform is darwin (Mac OS) set trayTitle if theres one
|
||||
//* Check if theres an active RPC connection that we can use
|
||||
//* If we have one, use it
|
||||
//* Else create one and use it
|
||||
//* Show debug
|
||||
if (presence.mediaKeys) initKeybinds();
|
||||
else deinitKeybinds();
|
||||
if (platform() === "darwin" && presence.trayTitle)
|
||||
tray.setTitle(presence.trayTitle);
|
||||
let rpc = loggedInPresences.find(p => p.clientId === presence.clientId);
|
||||
if (rpc) rpc.rpc.setActivity(presence.presenceData);
|
||||
else
|
||||
loginPresence(presence.clientId).then(p =>
|
||||
p.rpc.setActivity(presence.presenceData)
|
||||
);
|
||||
info("setActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a user's activity
|
||||
* @param clientId clientId of presence to clear
|
||||
*/
|
||||
export function clearActivity(clientId: string = undefined) {
|
||||
//* Clear keybinds
|
||||
//* Clear tray title
|
||||
//* If clientId set
|
||||
//* Else map through presences and clear them
|
||||
//* Show Debug
|
||||
deinitKeybinds();
|
||||
if (platform() === "darwin") tray.setTitle("");
|
||||
if (clientId) {
|
||||
//* Check if this presence is logged in
|
||||
//* If it is clear its activity
|
||||
//* Return to prevent further actions
|
||||
let pTC = loggedInPresences.find(p => p.clientId === clientId);
|
||||
if (pTC) pTC.rpc.clearActivity();
|
||||
return;
|
||||
}
|
||||
loggedInPresences.map(p => p.rpc.clearActivity());
|
||||
info("clearActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create RPC connection to discord
|
||||
* @param clientId client ID of presence
|
||||
*/
|
||||
function loginPresence(clientId: string) {
|
||||
//* Return promise that will resolve to either Presence or null
|
||||
return new Promise<Presence>((resolve, reject) => {
|
||||
//* Create presence object
|
||||
//* Add presence to object
|
||||
//* Try login with client id
|
||||
//* Once RPC connection is ready
|
||||
//* Destroy all clients when Discord closed (My issue #42)
|
||||
let presence: Presence = {
|
||||
clientId: clientId,
|
||||
rpc: new Discord.Client({ transport: "ipc" }),
|
||||
ready: false
|
||||
};
|
||||
loggedInPresences.push(presence);
|
||||
presence.rpc.login({ clientId: clientId }).catch(() => {
|
||||
//* If couldn't log in remove it from loggedInPresences
|
||||
//* Reject promise
|
||||
loggedInPresences = loggedInPresences.filter(
|
||||
p => p.clientId !== presence.clientId
|
||||
);
|
||||
reject();
|
||||
});
|
||||
presence.rpc.once("ready", () => {
|
||||
//* Update status
|
||||
//* Resolve with presence
|
||||
presence.ready = true;
|
||||
resolve(presence);
|
||||
});
|
||||
// @ts-ignore
|
||||
presence.rpc.once("disconnected", destroy);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys all rpc connections
|
||||
*/
|
||||
export function destroy() {
|
||||
//* Clear tray title
|
||||
//* Map through loggedInPresences and destroy their rpcs
|
||||
//* Set loggedInPresences to new Array
|
||||
//* Return the promise
|
||||
if (platform() === "darwin") tray.setTitle("");
|
||||
let res = Promise.all(
|
||||
loggedInPresences.map((presence: Presence) =>
|
||||
presence.rpc.destroy().catch(() => {})
|
||||
)
|
||||
);
|
||||
loggedInPresences = [];
|
||||
return res;
|
||||
}
|
||||
|
||||
//* if app will quit
|
||||
app.once("will-quit", () => {
|
||||
//* Show debug
|
||||
//* Destroy all connections
|
||||
info("Closing rpc connections");
|
||||
destroy();
|
||||
});
|
||||
|
||||
//TODO Try to move this to a type file
|
||||
interface Presence {
|
||||
/**
|
||||
* Client ID of presence
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Rich Procedual call connection
|
||||
*/
|
||||
rpc: Discord.Client;
|
||||
/**
|
||||
* Connection ready?
|
||||
*/
|
||||
ready: Boolean;
|
||||
}
|
||||
interface PresenceData {
|
||||
/**
|
||||
* Client ID of presence
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Tray title to be shown in Mac OS tray
|
||||
*/
|
||||
trayTitle: string;
|
||||
/**
|
||||
* service name of presence
|
||||
* @deprecated
|
||||
*/
|
||||
service: string;
|
||||
/**
|
||||
* Determines if the service is currently playing something back or not, if false it will automatically hide after 1 minute
|
||||
*/
|
||||
playback: boolean;
|
||||
/**
|
||||
* Discord Presence which gets sent directly to Discord app
|
||||
*/
|
||||
presenceData: Discord.Presence;
|
||||
/**
|
||||
* Determines if the service should be hidden (clearActivity)
|
||||
*/
|
||||
hidden: boolean;
|
||||
/**
|
||||
* Determines if the service is mediaKey able / uses them
|
||||
*/
|
||||
mediaKeys: boolean;
|
||||
}
|
||||
97
src/managers/inputManager.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import { app, globalShortcut } from "electron";
|
||||
import { socket } from "./socketManager";
|
||||
import { info, error, success } from "./../util/debug";
|
||||
|
||||
let playPauseSwitch = null,
|
||||
playPauseTimeout = null;
|
||||
|
||||
/**
|
||||
* Register media keyboard shortcuts
|
||||
*/
|
||||
export function init() {
|
||||
//! Disabled for now
|
||||
return
|
||||
|
||||
//* If registered or not enabled return
|
||||
//* Bind mediaplaypause
|
||||
//* Bind medianexttrack
|
||||
//* Bind mediaprevioustrack
|
||||
//* Debug if bound failed/succeeded
|
||||
if (
|
||||
globalShortcut.isRegistered("mediaplaypause") ||
|
||||
globalShortcut.isRegistered("medianexttrack") ||
|
||||
globalShortcut.isRegistered("mediaprevioustrack")
|
||||
)
|
||||
return;
|
||||
let mpp = globalShortcut.register("mediaplaypause", () => {
|
||||
//* Return if not connected
|
||||
//* if playPause timeout not set set it - 500ms timeout > switch play/pause, nextrack/previoustrack
|
||||
//* Increase switch each press
|
||||
//* Show debug
|
||||
if (!socket.connected) return;
|
||||
if (!playPauseTimeout)
|
||||
playPauseTimeout = setTimeout(handlePlayPause, 500);
|
||||
playPauseSwitch++;
|
||||
info("Media Play/Pause");
|
||||
}),
|
||||
mnt = globalShortcut.register("medianexttrack", () => {
|
||||
//* send keybind to app if connected
|
||||
if (socket.connected)
|
||||
socket.emit("keybinds", {
|
||||
playback: "nextTrack"
|
||||
});
|
||||
info("Media Nextrack");
|
||||
}),
|
||||
mpt = globalShortcut.register("mediaprevioustrack", () => {
|
||||
//* send keybind to app if connected
|
||||
if (socket.connected)
|
||||
socket.emit("keybinds", {
|
||||
playback: "previousTrack"
|
||||
});
|
||||
info("Media Previoustrack");
|
||||
});
|
||||
if (mpp && mnt && mpt) success("Registered keyboard shortcuts.");
|
||||
else error("Registering keyboard shortcuts failed.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Play/Pause media key after 500ms timeout
|
||||
*/
|
||||
function handlePlayPause() {
|
||||
//* Switch case -> emit
|
||||
//* Reset switch let
|
||||
//* Reset timeout let
|
||||
switch (playPauseSwitch) {
|
||||
case 1:
|
||||
socket.emit("keybinds", { playback: "pause" });
|
||||
break;
|
||||
case 2:
|
||||
socket.emit("keybinds", { playback: "nextTrack" });
|
||||
break;
|
||||
case 3:
|
||||
socket.emit("keybinds", { playback: "previousTrack" });
|
||||
break;
|
||||
}
|
||||
playPauseSwitch = null;
|
||||
playPauseTimeout = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister all globalShortcuts set by app
|
||||
*/
|
||||
export function deinit() {
|
||||
//* Return if they aren't bound
|
||||
//* Clear keybinds
|
||||
//* Show debug
|
||||
if (
|
||||
!globalShortcut.isRegistered("mediaplaypause") &&
|
||||
!globalShortcut.isRegistered("medianexttrack") &&
|
||||
!globalShortcut.isRegistered("mediaprevioustrack")
|
||||
)
|
||||
return;
|
||||
globalShortcut.unregisterAll();
|
||||
info("Cleared keybinds");
|
||||
}
|
||||
|
||||
//* If app will quit deinit keybinds
|
||||
app.once("will-quit", deinit);
|
||||
31
src/managers/launchManager.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import AutoLaunch from "auto-launch";
|
||||
import { app } from "electron";
|
||||
import { settings } from "./settingsManager";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
//* Create autoLaunch object
|
||||
let autoLaunch = new AutoLaunch({
|
||||
name: app.getName(),
|
||||
isHidden: true
|
||||
});
|
||||
|
||||
/**
|
||||
* Updates autoLaunch
|
||||
*/
|
||||
export async function update() {
|
||||
//* If app not packaged return
|
||||
//* Either enable/disable autolaunch
|
||||
if (!app.isPackaged) {
|
||||
//* Show debug
|
||||
//* Return
|
||||
info("Skipping autoLaunch.");
|
||||
return;
|
||||
}
|
||||
if (settings.get("autoLaunch", true)) {
|
||||
//* Enable if not enabled
|
||||
if (!(await autoLaunch.isEnabled())) autoLaunch.enable();
|
||||
} else {
|
||||
//* Disable if enabled
|
||||
if (await autoLaunch.isEnabled()) autoLaunch.disable();
|
||||
}
|
||||
}
|
||||
77
src/managers/presenceDevManager.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { readdirSync, readFileSync, unwatchFile, watchFile } from "fs";
|
||||
import { dialog } from "electron";
|
||||
import { socket } from "./socketManager";
|
||||
import { extname } from "path";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
let presenceDevWatchedFiles = [],
|
||||
currWatchPath = "";
|
||||
|
||||
export async function watchDir(path: string) {
|
||||
//* Read dir
|
||||
//* Set currWatchDir
|
||||
//* Set watched files to files
|
||||
//* Add file watcher to each file
|
||||
let files = await readdirSync(path);
|
||||
currWatchPath = path + "/";
|
||||
presenceDevWatchedFiles = files;
|
||||
presenceDevWatchedFiles.map(f => {
|
||||
//* Watch file
|
||||
//* ReadFiles
|
||||
watchFile(currWatchPath + f, { interval: 250 }, async () => {
|
||||
//* Read dir
|
||||
//* ReadFiles
|
||||
files = await readdirSync(path);
|
||||
readFiles(files, path);
|
||||
});
|
||||
});
|
||||
readFiles(files, path);
|
||||
}
|
||||
|
||||
async function readFiles(files, path) {
|
||||
//* Send files to extension
|
||||
socket.emit("localPresence", {
|
||||
files: await Promise.all(
|
||||
files.map(f => {
|
||||
if (extname(f) === ".json")
|
||||
return {
|
||||
file: f,
|
||||
contents: JSON.parse(readFileSync(`${path}/${f}`).toString())
|
||||
};
|
||||
else if (extname(f) === ".js")
|
||||
return {
|
||||
file: f,
|
||||
contents: readFileSync(`${path}/${f}`).toString()
|
||||
};
|
||||
else return;
|
||||
})
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
export async function openFileDialog() {
|
||||
//* Open file dialog
|
||||
//* If user cancels
|
||||
//* Unwatch all still watched files
|
||||
//* Watch directory
|
||||
let filePaths = await dialog.showOpenDialogSync(null, {
|
||||
title: "Select Presence Folder",
|
||||
message:
|
||||
"Please select the folder that contains the presence you want to load.\n(metadata.json, presence.js, iframe.js)",
|
||||
buttonLabel: "Load Presence",
|
||||
properties: ["openDirectory"]
|
||||
});
|
||||
if (typeof filePaths === "undefined") {
|
||||
//* Show debug
|
||||
//* return
|
||||
info("Presence load canceled.");
|
||||
return;
|
||||
}
|
||||
info(`Watching ${filePaths[0]}`);
|
||||
if (presenceDevWatchedFiles.length > 0)
|
||||
await Promise.all(
|
||||
presenceDevWatchedFiles.map(f => unwatchFile(currWatchPath + f))
|
||||
);
|
||||
|
||||
watchDir(filePaths[0]);
|
||||
}
|
||||
58
src/managers/settingsManager.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import ElectronStore from "electron-store";
|
||||
import { tray } from "./trayManager";
|
||||
import { update as updateAutoLaunch } from "./launchManager";
|
||||
import { platform } from "os";
|
||||
import { deinit as deinitInputs } from "./inputManager";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
//* Export and set default settings
|
||||
export let settings = new ElectronStore({
|
||||
defaults: {
|
||||
autoLaunch: true
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Update settings of app
|
||||
* @param extensionSettings Settings from extension
|
||||
*/
|
||||
export function update(extensionSettings: extensionSettings) {
|
||||
console.log(extensionSettings);
|
||||
//* Show debug
|
||||
//* remove title if disabled
|
||||
//* unbind keybinds if disabled
|
||||
//* Update autolaunch if updated
|
||||
//* Save Settings
|
||||
|
||||
info("Updated settings");
|
||||
if (!extensionSettings.titleMenubar && platform() === "darwin")
|
||||
tray.setTitle("");
|
||||
if (!extensionSettings.mediaKeys) deinitInputs();
|
||||
if (settings.get("autoLaunch") != extensionSettings.autoLaunch)
|
||||
updateAutoLaunch();
|
||||
settings.set("autoLaunch", extensionSettings.autoLaunch);
|
||||
}
|
||||
|
||||
//TODO Try to move types into file
|
||||
interface extensionSettings {
|
||||
/**
|
||||
* If extension is enabled
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* Autolaunch enabled
|
||||
*/
|
||||
autoLaunch: boolean;
|
||||
/**
|
||||
* Media keys enabled
|
||||
*/
|
||||
mediaKeys: boolean;
|
||||
/**
|
||||
* title menubar (TrayTitle)
|
||||
*/
|
||||
titleMenubar: boolean;
|
||||
/**
|
||||
* language of extension
|
||||
*/
|
||||
language: string;
|
||||
}
|
||||
80
src/managers/socketManager.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import socketIo from "socket.io";
|
||||
import { createServer, Server } from "http";
|
||||
import { app, dialog } from "electron";
|
||||
import { success, error } from "../util/debug";
|
||||
import { deinit as deinitInputs } from "./inputManager";
|
||||
import { update as updateSettings } from "./settingsManager";
|
||||
import { openFileDialog } from "./presenceDevManager";
|
||||
import { setActivity, clearActivity, destroy } from "./discordManager";
|
||||
|
||||
export let io: socketIo.Server;
|
||||
export let socket: socketIo.Socket;
|
||||
export let server: Server;
|
||||
|
||||
export function init() {
|
||||
return new Promise(resolve => {
|
||||
//* Create server
|
||||
//* create SocketIo server, don't server client
|
||||
//* Try to listen to port 3020
|
||||
//* If that fails/some other error happens run socketError
|
||||
//* If someone connects to socket socketConnection
|
||||
server = createServer();
|
||||
io = socketIo(server, { serveClient: false });
|
||||
server.listen(3020, () => {
|
||||
//* Resolve promise
|
||||
//* Debug info
|
||||
resolve();
|
||||
success("Opened socket");
|
||||
});
|
||||
server.on("error", socketError);
|
||||
io.on("connection", socketConnection);
|
||||
});
|
||||
}
|
||||
|
||||
function socketConnection(cSocket: socketIo.Socket) {
|
||||
//* Show debug
|
||||
//* Set exported socket letiable to current socket
|
||||
//* Handle setActivity event
|
||||
//* Handle clearActivity event
|
||||
//* Handle settingsUpdate
|
||||
//* Handle presenceDev
|
||||
//* Handle version request
|
||||
//* Once socket user disconnects run cleanup
|
||||
success("Socket connection");
|
||||
socket = cSocket;
|
||||
socket.on("setActivity", setActivity);
|
||||
socket.on("clearActivity", clearActivity);
|
||||
socket.on("settingUpdate", updateSettings);
|
||||
socket.on("selectLocalPresence", openFileDialog);
|
||||
socket.on("getVersion", () =>
|
||||
socket.emit("receiveVersion", app.getVersion().replace(/[\D]/g, ""))
|
||||
);
|
||||
socket.once("disconnect", () => {
|
||||
//* Show debug
|
||||
//* Destroy all open RPC connections
|
||||
//* Clear input bindings
|
||||
error("Socket disconnection.");
|
||||
destroy();
|
||||
deinitInputs();
|
||||
});
|
||||
}
|
||||
|
||||
//* Runs on socket errors
|
||||
function socketError(e: any) {
|
||||
//* Show debug
|
||||
//* If port in use
|
||||
error(e.message);
|
||||
if (e.code === "EADDRINUSE") {
|
||||
//* Focus app
|
||||
//* Show error dialog
|
||||
//* Exit app afterwards
|
||||
app.focus();
|
||||
dialog.showErrorBox(
|
||||
"Oh noes! Port error...",
|
||||
`${app.getName()} could not bind to port ${
|
||||
e.port
|
||||
}.\nIs ${app.getName()} running already?`
|
||||
);
|
||||
app.exit(0);
|
||||
}
|
||||
}
|
||||
26
src/managers/trayManager.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Menu, Tray } from "electron";
|
||||
import { join } from "path";
|
||||
|
||||
//* Export tray
|
||||
//* Export trayContextMenu
|
||||
export let tray: Tray;
|
||||
export let trayContextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
role: "quit"
|
||||
}
|
||||
]);
|
||||
|
||||
/**
|
||||
* Create tray
|
||||
*/
|
||||
export function init() {
|
||||
//* Return promise resolves to Tray
|
||||
return new Promise<Tray>(function(resolve) {
|
||||
//* Create Tray
|
||||
//* Set its context menu
|
||||
//* Resolve promise
|
||||
tray = new Tray(join(__dirname, "../assets/tray/IconTemplate.png"));
|
||||
tray.setContextMenu(trayContextMenu);
|
||||
resolve(tray);
|
||||
});
|
||||
}
|
||||
|
Before Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 607 B |
@@ -1,226 +0,0 @@
|
||||
* {
|
||||
font-family: "Open Sans", sans-serif;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
transition: 0.5s all ease-out;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
button {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#header {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
background-color: #ce1d2a;
|
||||
box-shadow: 0px 0px 8px 2px #cccccc;
|
||||
}
|
||||
|
||||
#header img {
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
top: 13px;
|
||||
left: 25px;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
top: 10px;
|
||||
width: 250px;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
#header a {
|
||||
z-index: 1;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
transition: 0.1s all ease-out;
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#header a:hover {
|
||||
transition: 0.1s all ease-out;
|
||||
transform: scale(1.25);
|
||||
}
|
||||
|
||||
#header a:active {
|
||||
transition: 0.1s all ease-out;
|
||||
transform: scale(0.85);
|
||||
}
|
||||
|
||||
#footer {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
background-color: rgb(230, 230, 230);
|
||||
padding-bottom: 5px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
#footer p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
text-decoration: none;
|
||||
color: #2196f3;
|
||||
}
|
||||
|
||||
#footer a:hover {
|
||||
text-decoration: underline;
|
||||
color: #1a76c2;
|
||||
}
|
||||
|
||||
#footer #heart {
|
||||
color: #ff0c1e;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#heading {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#heading h1 {
|
||||
margin: 5px;
|
||||
padding: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
#optionsTable {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#optionsTable table {
|
||||
width: 95%;
|
||||
margin-left: 2.5%;
|
||||
}
|
||||
|
||||
#optionsTable th {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#version {
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
bottom: 0px;
|
||||
line-height: normal;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* The switch - the box around the slider */
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
/* Hide default HTML checkbox */
|
||||
|
||||
.switch input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* The slider */
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: 0.25s;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 17px;
|
||||
width: 17px;
|
||||
left: -2.5px;
|
||||
top: -2.5px;
|
||||
background-color: white;
|
||||
-webkit-transition: 0.4s;
|
||||
transition: 0.4s;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
input:disabled + .slider {
|
||||
background-color: rgb(160, 160, 160);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
input:disabled + .slider:before {
|
||||
background-color: lightgray;
|
||||
border: 1px solid rgb(160, 160, 160);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196f3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(20px);
|
||||
-ms-transform: translateX(20px);
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>YouTube Presence</title>
|
||||
<script>if (typeof module === 'object') { window.module = module; module = undefined; }</script>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt"
|
||||
crossorigin="anonymous">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,800" rel="stylesheet">
|
||||
<link href="popup.css" rel="stylesheet">
|
||||
<script src="../jquery-3.2.1.min.js"></script>
|
||||
<script src="popup.js"></script>
|
||||
|
||||
<script>if (window.module) module = window.module;</script>
|
||||
<script>
|
||||
const { remote, webContents } = require('electron');
|
||||
function quitApp() {
|
||||
remote.app.exit(0);
|
||||
}
|
||||
|
||||
var shell = require('electron').shell;
|
||||
//open links externally by default
|
||||
$(document).on('click', 'a[href^="http"]', function (event) {
|
||||
event.preventDefault();
|
||||
shell.openExternal(this.href);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header">
|
||||
<img src="icon@2x.png">
|
||||
<h1 class="noselect">YT Presence</h1>
|
||||
<a title="Quit" onclick="quitApp()">
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="heading">
|
||||
<h1 class="noselect">Options</h1>
|
||||
</div>
|
||||
<div id="optionsTable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="noselect">Enabled</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="togglePresence" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="noselect">YouTube</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="toggleYouTube" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="noselect">YouTube Music</td>
|
||||
<td class="right">
|
||||
<label class="switch">
|
||||
<input class="toggleYouTubeMusic" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p class="noselect">Made with
|
||||
<span id="heart">♥</span> by
|
||||
<strong>
|
||||
<a target="_blank" title="Click to visit Timeraa's GitHub profile." draggable="false" href="https://github.com/Timeraa/">Timeraa</a>
|
||||
</strong>
|
||||
</p>
|
||||
<p id="version" class="noselect"></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,77 +0,0 @@
|
||||
const config = require('../config.json')
|
||||
const constants = require('../util/constants')
|
||||
const Config = require('electron-config');
|
||||
const userSettings = new Config({
|
||||
name: "userSettings"
|
||||
});
|
||||
|
||||
|
||||
var togglePresence,
|
||||
toggleYouTube,
|
||||
toggleYouTubeMusic;
|
||||
|
||||
$(document).ready(function() {
|
||||
document.getElementById('version').innerHTML = 'V' + config.version
|
||||
togglePresence = $(".togglePresence"),
|
||||
toggleYouTube = $(".toggleYouTube"),
|
||||
toggleYouTubeMusic = $(".toggleYouTubeMusic");
|
||||
|
||||
togglePresence.change(switchPresence);
|
||||
toggleYouTube.change(switchYouTube);
|
||||
toggleYouTubeMusic.change(switchYouTubeMusic);
|
||||
|
||||
if (userSettings.get('enabled') == true) togglePresence.prop("checked", true)
|
||||
else {
|
||||
togglePresence.prop("checked", false)
|
||||
toggleYouTube.prop("checked", false)
|
||||
toggleYouTubeMusic.prop("checked", false)
|
||||
toggleYouTube.attr("disabled", "disabled")
|
||||
toggleYouTubeMusic.attr("disabled", "disabled")
|
||||
}
|
||||
|
||||
if (userSettings.get('youTube') == true) {
|
||||
toggleYouTube.prop("checked", true)
|
||||
toggleYouTube.removeAttr("disabled")
|
||||
} else toggleYouTube.prop("checked", false)
|
||||
|
||||
if (userSettings.get('youTubeMusic') == true) {
|
||||
toggleYouTubeMusic.prop("checked", true)
|
||||
toggleYouTubeMusic.removeAttr("disabled")
|
||||
} else toggleYouTubeMusic.prop("checked", false)
|
||||
})
|
||||
|
||||
function switchPresence() {
|
||||
if (userSettings.get('enabled') == true) {
|
||||
userSettings.set('enabled', false);
|
||||
userSettings.set('youTube', false);
|
||||
userSettings.set('youTubeMusic', false);
|
||||
toggleYouTube.prop("checked", false)
|
||||
toggleYouTube.attr("disabled", "disabled")
|
||||
toggleYouTubeMusic.prop("checked", false)
|
||||
toggleYouTubeMusic.attr("disabled", "disabled")
|
||||
} else {
|
||||
userSettings.set('enabled', true);
|
||||
toggleYouTube.removeAttr("disabled")
|
||||
toggleYouTubeMusic.removeAttr("disabled")
|
||||
}
|
||||
}
|
||||
|
||||
function switchYouTube() {
|
||||
if (userSettings.get('youTube') == true) {
|
||||
userSettings.set('youTube', false)
|
||||
toggleYouTube.prop("checked", false)
|
||||
} else {
|
||||
userSettings.set('youTube', true)
|
||||
toggleYouTube.prop("checked", true)
|
||||
}
|
||||
}
|
||||
|
||||
function switchYouTubeMusic() {
|
||||
if (userSettings.get('youTubeMusic') == true) {
|
||||
userSettings.set('youTubeMusic', false);
|
||||
toggleYouTubeMusic.prop("checked", false)
|
||||
} else {
|
||||
userSettings.set('youTubeMusic', true);
|
||||
toggleYouTubeMusic.prop("checked", true)
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
const path = require('path')
|
||||
var MenuBar = require('menubar')
|
||||
var constants = require("../util/constants")
|
||||
|
||||
//* Create MenuBar
|
||||
constants.menuBar = MenuBar({
|
||||
icon: __dirname + "/icon.png",
|
||||
index: 'file://' + path.join(__dirname + "/popup.html"),
|
||||
preloadWindow: true,
|
||||
enableLargerThanScreen: false,
|
||||
movable: true,
|
||||
resizable: false,
|
||||
height: 225,
|
||||
width: 250,
|
||||
backgroundColor: 'white',
|
||||
})
|
||||
|
||||
//* Show connecting message when ready
|
||||
constants.menuBar.on('ready', function() {
|
||||
constants.menuBar.tray.setTitle("Connecting...")
|
||||
})
|
||||
@@ -1,97 +0,0 @@
|
||||
//* Require needed packages
|
||||
const chalk = require("chalk")
|
||||
const express = require("express")
|
||||
var constants = require('./util/constants.js')
|
||||
let YTM = require('./presences/handleYTM.js');
|
||||
let YT = require('./presences/handleYT.js');
|
||||
|
||||
const Config = require('electron-config');
|
||||
const userSettings = new Config({
|
||||
name: "userSettings"
|
||||
});
|
||||
|
||||
|
||||
//* Create APP
|
||||
const app = express()
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
let data
|
||||
|
||||
var keepAliveSwitch = 0
|
||||
var lastKeepAliveSwitch = 0
|
||||
|
||||
setInterval(keepAliveCheck, 1000)
|
||||
|
||||
function keepAliveCheck() {
|
||||
if(lastKeepAliveSwitch > keepAliveSwitch + 10) {
|
||||
constants.menuBar.tray.setTitle("")
|
||||
constants.ytmrpc.clearActivity()
|
||||
}
|
||||
lastKeepAliveSwitch += 1
|
||||
}
|
||||
|
||||
app.post("/", async (request, response) => {
|
||||
|
||||
constants.lastResponse = new Date().getTime();
|
||||
data = request.body
|
||||
if(data.connected === true) {
|
||||
//* Check if presence is ready
|
||||
if(constants.chromeConnected == false) {
|
||||
constants.chromeConnected = true;
|
||||
constants.menuBar.tray.setTitle("Chrome client connected!")
|
||||
console.log(constants.consolePrefix + chalk.green("Chrome client connected."))
|
||||
setTimeout(function() {
|
||||
if(data.currentSongAuthor == undefined) {
|
||||
constants.menuBar.tray.setTitle("")
|
||||
}
|
||||
constants.introRan = true
|
||||
}, 5*1000)
|
||||
}
|
||||
if(data.service != "keepAlive" && data.service == "ytm") {
|
||||
lastKeepAliveSwitch = 0
|
||||
keepAliveSwitch = 0
|
||||
if(userSettings.get('youTubeMusic') == true) {
|
||||
if(constants.introRan && constants.chromeConnected && constants.presenceReady) {
|
||||
if(serviceType(data.service) == "ytm") YTM.updatePresence(data)
|
||||
}
|
||||
} else {
|
||||
constants.menuBar.tray.setTitle("")
|
||||
constants.ytmrpc.clearActivity()
|
||||
}
|
||||
} else if(data.service != "keepAlive" && data.service == "yt") {
|
||||
lastKeepAliveSwitch = 0
|
||||
keepAliveSwitch = 0
|
||||
if(userSettings.get('youTube') == true) {
|
||||
if(constants.introRan && constants.chromeConnected && constants.presenceReady) {
|
||||
if(serviceType(data.service) == "yt") YT.updatePresence(data)
|
||||
}
|
||||
} else {
|
||||
constants.menuBar.tray.setTitle("")
|
||||
constants.ytrpc.clearActivity()
|
||||
}
|
||||
} else {
|
||||
if(keepAliveSwitch >= 10) {
|
||||
constants.menuBar.tray.setTitle("")
|
||||
constants.ytmrpc.clearActivity()
|
||||
constants.ytmrpc.clearActivity()
|
||||
}
|
||||
keepAliveSwitch += 1
|
||||
}
|
||||
}
|
||||
return response.sendStatus(200);
|
||||
})
|
||||
|
||||
function serviceType(service) {
|
||||
switch(service) {
|
||||
case "ytm":
|
||||
return "ytm"
|
||||
case "yt":
|
||||
return "yt"
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
//* Listen on port 3000
|
||||
app.listen(3000, () => console.log(constants.consolePrefix + chalk.green("Listening on Port 3000")));
|
||||
@@ -1,51 +0,0 @@
|
||||
const constants = require("../util/constants.js");
|
||||
const { yt_client_id } = require("../config.json");
|
||||
const Entities = require("html-entities").AllHtmlEntities;
|
||||
const entities = new Entities();
|
||||
|
||||
let presence,
|
||||
startTime = new Date(),
|
||||
endTime = new Date(),
|
||||
lastTitle,
|
||||
lastStartingTime;
|
||||
|
||||
async function updatePresence(data) {
|
||||
if(lastTitle != data.currentSongTitle) {
|
||||
startTime = new Date()
|
||||
}
|
||||
if(data.url.includes("/watch?v")) {
|
||||
lastTitle = data.currentSongTitle;
|
||||
if (
|
||||
(data.currentSongAuthor && data.currentSongTitle) != undefined &&
|
||||
data.currentSongAuthor != "" &&
|
||||
data.currentSongTitle != ""
|
||||
) {
|
||||
constants.menuBar.tray.setTitle(entities.decode(data.currentSongTitle));
|
||||
constants.ytrpc.setActivity({
|
||||
details: entities.decode(data.currentSongTitle),
|
||||
state: entities.decode(data.currentSongAuthor),
|
||||
smallImageKey: "play",
|
||||
smallImageText: "Playing back.",
|
||||
startTimestamp: startTime,
|
||||
largeImageKey: "yt_lg",
|
||||
instance: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
constants.menuBar.tray.setTitle(entities.decode(data.currentSongTitle));
|
||||
constants.ytrpc.setActivity({
|
||||
details: "Searching",
|
||||
state: "for a video...",
|
||||
largeImageKey: "yt_lg",
|
||||
instance: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
constants.ytrpc.on("ready", () => {
|
||||
constants.presenceReady = true;
|
||||
});
|
||||
|
||||
exports.updatePresence = updatePresence;
|
||||
|
||||
constants.ytrpc.login(yt_client_id).catch(console.error);
|
||||
@@ -1,60 +0,0 @@
|
||||
const constants = require("../util/constants.js");
|
||||
const { ytm_client_id } = require("../config.json");
|
||||
const Entities = require("html-entities").AllHtmlEntities;
|
||||
const entities = new Entities();
|
||||
|
||||
let presence,
|
||||
startTime = new Date(),
|
||||
endTime = new Date(),
|
||||
lastTitle,
|
||||
lastStartingTime;
|
||||
|
||||
async function updatePresence(data) {
|
||||
if (data.currentSongStartTime == lastStartingTime) {
|
||||
if ((data.currentSongAuthor && data.currentSongTitle) != undefined) {
|
||||
constants.menuBar.tray.setTitle("");
|
||||
constants.ytmrpc.setActivity({
|
||||
details: entities.decode(data.currentSongTitle),
|
||||
state: entities.decode(data.currentSongAuthor),
|
||||
smallImageKey: "pause",
|
||||
smallImageText: "Playback paused.",
|
||||
largeImageKey: "ytm_lg",
|
||||
instance: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
startTime = new Date();
|
||||
endTime =
|
||||
Math.floor(startTime / 1000) -
|
||||
data.currentSongStartTime +
|
||||
data.currentSongEndTime;
|
||||
lastTitle = data.currentSongTitle;
|
||||
lastStartingTime = data.currentSongStartTime;
|
||||
|
||||
if (
|
||||
(data.currentSongAuthor && data.currentSongTitle) != undefined &&
|
||||
data.currentSongAuthor != "" &&
|
||||
data.currentSongTitle != ""
|
||||
) {
|
||||
constants.menuBar.tray.setTitle(entities.decode(data.currentSongTitle));
|
||||
constants.ytmrpc.setActivity({
|
||||
details: entities.decode(data.currentSongTitle),
|
||||
state: entities.decode(data.currentSongAuthor),
|
||||
smallImageKey: "play",
|
||||
smallImageText: "Playing back.",
|
||||
largeImageKey: "ytm_lg",
|
||||
startTimestamp: startTime,
|
||||
endTimestamp: endTime,
|
||||
instance: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants.ytmrpc.on("ready", () => {
|
||||
constants.presenceReady = true;
|
||||
});
|
||||
|
||||
exports.updatePresence = updatePresence;
|
||||
|
||||
constants.ytmrpc.login(ytm_client_id).catch(console.error);
|
||||
@@ -1,35 +0,0 @@
|
||||
const { Notification } = require('electron');
|
||||
|
||||
const request = require("request")
|
||||
const chalk = require("chalk")
|
||||
let constants = require('./constants')
|
||||
let config = require('../config')
|
||||
|
||||
//* Check for update
|
||||
console.log(constants.consolePrefix + chalk.cyan("Checking for update..."))
|
||||
request({
|
||||
url: "https://api.github.com/repos/Timeraa/YT-Presence/releases/latest",
|
||||
json: true,
|
||||
headers: {'user-agent': 'node.js'}
|
||||
}, function (error, response, body) {
|
||||
//* Remove v from version
|
||||
var gitVersion = body.tag_name.replace('v', '')
|
||||
//* Compare version
|
||||
if(gitVersion > config.version) {
|
||||
constants.newVersion = gitVersion
|
||||
|
||||
console.log(constants.consolePrefix + chalk.cyan("New version avaiable: ") + chalk.red(`V${config.version}`) + chalk.blue(' > ') + chalk.yellow(`V${gitVersion}`))
|
||||
|
||||
const newVersionNotification = new Notification({
|
||||
title: 'Updater | YT Presence',
|
||||
body: `New version avaiable! (V${gitVersion})\nClick here to download the newest version.`
|
||||
})
|
||||
|
||||
newVersionNotification.show()
|
||||
newVersionNotification.on('click', () => {
|
||||
require("electron").shell.openExternal("https://github.com/Timeraa/YT-Presence/releases/latest")
|
||||
})
|
||||
} else {
|
||||
console.log(constants.consolePrefix + chalk.cyan("Up to date! ") + chalk.yellow(`V${config.version}`))
|
||||
}
|
||||
})
|
||||
@@ -1,41 +0,0 @@
|
||||
const chalk = require("chalk")
|
||||
const DiscordRPC = require("discord-rpc")
|
||||
|
||||
let app,
|
||||
consolePrefix,
|
||||
win,
|
||||
menuBar,
|
||||
menuBarMenu,
|
||||
chromeConnected,
|
||||
presenceReady,
|
||||
presence,
|
||||
setup,
|
||||
newVersion,
|
||||
introRan,
|
||||
lastResponse,
|
||||
ytmrpc,
|
||||
ytrpc,
|
||||
platform;
|
||||
|
||||
module.exports = {
|
||||
app: "",
|
||||
consolePrefix: chalk.bold(chalk.bgHex('#db0918')(chalk.hex('#000000')(" Y") + chalk.hex('#ffffff')("T "))) + chalk.cyan(" Presence") + chalk.hex('#ffffff')(": "),
|
||||
win: "",
|
||||
menuBar: "",
|
||||
menuBarMenu: "",
|
||||
chromeConnected: false,
|
||||
presenceReady: false,
|
||||
setup: false,
|
||||
presence: {
|
||||
details: "Waiting for music",
|
||||
state: "to start playing...",
|
||||
largeImageKey: "ytm_lg",
|
||||
instance: true
|
||||
},
|
||||
newVersion: false,
|
||||
introRan: false,
|
||||
lastResponse: false,
|
||||
ytmrpc: new DiscordRPC.Client({ transport: "ipc" }),
|
||||
ytrpc: new DiscordRPC.Client({ transport: "ipc" }),
|
||||
platform: ""
|
||||
};
|
||||
32
src/util/debug.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { app } from "electron";
|
||||
if (!app.isPackaged) var chalk = require("chalk");
|
||||
|
||||
/**
|
||||
* Show info message in console
|
||||
* */
|
||||
export function info(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgBlue(chalk.white(" INFO "))} ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show success message in console
|
||||
* */
|
||||
export function success(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgGreen(" SUCCESS ")} ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show error message in console
|
||||
* */
|
||||
export function error(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgRed(" ERROR ")} ${message}`);
|
||||
}
|
||||
100
src/util/updateChecker.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import { spawn } from "child_process";
|
||||
import { resolve } from "path";
|
||||
import { error, info } from "./debug";
|
||||
import { trayContextMenu } from "../managers/trayManager";
|
||||
import { MenuItem, app, dialog } from "electron";
|
||||
import { tray } from "../managers/trayManager";
|
||||
import { platform } from "os";
|
||||
import { updateCheckerInterval } from "../index";
|
||||
import { existsSync } from "fs";
|
||||
import sudoPrompt from "sudo-prompt";
|
||||
|
||||
let updaterPath: string;
|
||||
|
||||
export async function checkForUpdate(autoUpdate = false) {
|
||||
if (!app.isPackaged) {
|
||||
info("Skipping UpdateChecker");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (platform()) {
|
||||
case "darwin":
|
||||
updaterPath = resolve(
|
||||
`${app.getAppPath()}../../../../../updater.app/Contents/MacOS/installbuilder.sh`
|
||||
);
|
||||
break;
|
||||
case "win32":
|
||||
updaterPath = resolve(`${app.getAppPath()}../../../updater.exe`);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!existsSync(updaterPath)) {
|
||||
error("Updater not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
let child = spawn(updaterPath, ["--mode", "unattended"]);
|
||||
|
||||
child.on("error", err => {
|
||||
// @ts-ignore
|
||||
if (err.code === "ENOENT") {
|
||||
error("Updater file not found. Skipping updater functions.");
|
||||
clearInterval(updateCheckerInterval);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
child.on("exit", code => {
|
||||
//* If no update or error return
|
||||
if (code === 1) {
|
||||
info("Up to date!");
|
||||
return;
|
||||
}
|
||||
if (code === 2) {
|
||||
error("Error while checking for updates");
|
||||
return;
|
||||
}
|
||||
|
||||
//* If autoUpdate == true
|
||||
if (autoUpdate) {
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (trayContextMenu.items.length < 3) {
|
||||
trayContextMenu.insert(
|
||||
0,
|
||||
new MenuItem({
|
||||
label: "Update available!",
|
||||
click() {
|
||||
update();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
trayContextMenu.insert(
|
||||
1,
|
||||
new MenuItem({
|
||||
type: "separator"
|
||||
})
|
||||
);
|
||||
tray.setContextMenu(trayContextMenu);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function update() {
|
||||
sudoPrompt.exec(
|
||||
`\"${updaterPath}\" --mode unattended --unattendedmodebehavior download`,
|
||||
{
|
||||
name: app.getName()
|
||||
},
|
||||
(error: Error) => {
|
||||
dialog.showMessageBox({ message: error.message });
|
||||
if (error) {
|
||||
checkForUpdate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
18
tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"outDir": "dist/app",
|
||||
"removeComments": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"devMode.ts",
|
||||
"pkg.ts",
|
||||
"installer_assets/builder.ts",
|
||||
".github/deploy.ts"
|
||||
]
|
||||
}
|
||||