forked from mystiq/hydrogen-web
Compare commits
3653 commits
bwindels/o
...
master
Author | SHA1 | Date | |
---|---|---|---|
f9aa7b52f8 | |||
2e54866353 | |||
ce075eb32b | |||
02a50a19cb | |||
a33d9981bd | |||
8335a50308 | |||
ee9e73d8c7 | |||
63f77feb7b | |||
04de39596f | |||
25b634bb78 | |||
96c9ea8de7 | |||
d80e970117 | |||
6db5f34ac2 | |||
df0000783d | |||
|
c898bcb46a | ||
|
97391663d3 | ||
|
7d3f22c106 | ||
|
832597447a | ||
|
236a4ab49b | ||
|
ba8cdea6b4 | ||
|
ef9f90bc36 | ||
|
67e94bd642 | ||
|
f7839135a4 | ||
|
4571ecd851 | ||
|
5091090795 | ||
|
db2b4e693c | ||
|
eee8412621 | ||
|
5e83eca3b9 | ||
|
041e628520 | ||
|
4838e19c92 | ||
|
cb0ac846c7 | ||
|
b40ce6137e | ||
|
fdefea5b88 | ||
|
39817dc36b | ||
|
708637e390 | ||
|
b6f795505d | ||
|
10522cacef | ||
|
02116103a1 | ||
|
06da5a8ae4 | ||
|
02bc7d1d7e | ||
|
09bc77073b | ||
|
4a2e14925a | ||
|
224ab2672a | ||
|
170460f5a9 | ||
|
2a5e0302dc | ||
|
f512bfcfc1 | ||
|
5b5c852401 | ||
|
58a2d1f34c | ||
|
d937b9b14b | ||
|
d3e93196e3 | ||
|
62b3a67e33 | ||
|
319ec37864 | ||
|
f5dacb4e42 | ||
|
302131c447 | ||
|
fb79326747 | ||
|
3c64f7d49b | ||
|
a82df95b82 | ||
|
cadca70946 | ||
|
8b91d8fac8 | ||
|
a5b9cb6b95 | ||
|
aeed978789 | ||
|
7b7b19476c | ||
|
ad0bd82bda | ||
|
d7657dcc4d | ||
|
176caf340f | ||
|
a40bb59dc0 | ||
|
ab64ce02b2 | ||
|
2d3b6fe973 | ||
|
550b9db4dc | ||
|
0df66b5aea | ||
|
f18520a2fe | ||
|
50b6ee91d7 | ||
|
9b0ab0c8f1 | ||
|
402cf17d22 | ||
|
bfaba63f47 | ||
|
544afef902 | ||
|
dd878bb8d6 | ||
|
dea3852425 | ||
|
4c17612b05 | ||
|
f9f49b7640 | ||
|
0718f1e77e | ||
|
09fd1a5113 | ||
|
832b840a15 | ||
|
adfecf0778 | ||
|
5fa6793958 | ||
|
1e5179f835 | ||
|
bc385e2cdc | ||
|
0bf021ea87 | ||
|
fdd60a7516 | ||
|
63bdbee39c | ||
|
8a976861fb | ||
|
a23df8a545 | ||
|
17f42f523a | ||
|
f6011f3f34 | ||
|
86c0e9e669 | ||
|
f337940202 | ||
|
b7fd22c7f9 | ||
|
66a59e6f4d | ||
|
e345d0b33e | ||
|
be8962cec2 | ||
|
8b39346409 | ||
|
fb58d9c9ef | ||
|
22831e710c | ||
|
faa8cae532 | ||
|
8d766ac504 | ||
|
c8a8eb10b5 | ||
|
d79e5f7806 | ||
|
7feaa479c0 | ||
|
1456e308a8 | ||
|
313e65e00c | ||
|
612b878793 | ||
|
8aa96e8031 | ||
|
7ac2c7c7fa | ||
|
de02456641 | ||
|
994667205f | ||
|
ecb3a66dfc | ||
|
e1ee258630 | ||
|
83b5d3b68e | ||
|
7a1591e0ce | ||
|
07db5450b7 | ||
|
081de5afa8 | ||
|
dece42dce3 | ||
|
b29287c47e | ||
|
9bdf9c500b | ||
|
9e2d355573 | ||
|
ce5db47708 | ||
|
da0a918c18 | ||
|
043cc9f12c | ||
|
80fb953688 | ||
|
f15e23762a | ||
|
f440457875 | ||
|
a8cab98666 | ||
|
ac7be0c7a1 | ||
|
d731eab51c | ||
|
f7b302d34f | ||
|
5ba74b1d75 | ||
|
c5f4a75d4b | ||
|
2f3db89e0a | ||
|
1ef382f3a9 | ||
|
161e29b36e | ||
|
2947f9f6ff | ||
|
c873804543 | ||
|
43e8cc9e52 | ||
|
bf87ed7eae | ||
|
8c02541b69 | ||
|
599e519f22 | ||
|
d5e24bf6e8 | ||
|
bb5711db7e | ||
|
88808b0b06 | ||
|
c9bca52e82 | ||
|
6718198d9c | ||
|
7b9e681d55 | ||
|
8291aea2f7 | ||
|
f073f40e31 | ||
|
963324c767 | ||
|
eac75644e7 | ||
|
0bdbb96036 | ||
|
d292e1f5ad | ||
|
cd9e00b847 | ||
|
3941b7e3f0 | ||
|
efd9f70e92 | ||
|
204948db64 | ||
|
a85d2c96d6 | ||
|
28b686dae7 | ||
|
dd82469ab4 | ||
|
3bf6a46a39 | ||
|
e42e76a21c | ||
|
8ec0bd7295 | ||
|
ff2129f36a | ||
|
1aa2ff5c10 | ||
|
34ce8a8e3c | ||
|
652e2c6d3b | ||
|
c0445f2182 | ||
|
b76fd1d792 | ||
|
751dfa66a8 | ||
|
a3c6d744f5 | ||
|
b9f316e7c3 | ||
|
d448ee1722 | ||
|
da87470996 | ||
|
b319c0acb0 | ||
|
e90e573bf9 | ||
|
a68f0bba39 | ||
|
ca94c65dac | ||
|
fba3275f5b | ||
|
fc93acfd8d | ||
|
d398e490eb | ||
|
0ab611b013 | ||
|
bb923b8eb9 | ||
|
73cd96fe3a | ||
|
4929839fe9 | ||
|
c59f65e43b | ||
|
fd3a0f0126 | ||
|
ccfd63dfeb | ||
|
5b54280ac2 | ||
|
bd5bf7d456 | ||
|
ad8ad22cc1 | ||
|
3369bda2f0 | ||
|
7430aa7aab | ||
|
3bc453d5ca | ||
|
84bac0afe9 | ||
|
9cb7d89097 | ||
|
d688fa4737 | ||
|
0dfd24af22 | ||
|
34eac94da3 | ||
|
fbdd512e06 | ||
|
5eec724712 | ||
|
93165cb947 | ||
|
e3372f0f2b | ||
|
5a3cf03f0b | ||
|
c050ade03c | ||
|
cc29dc045d | ||
|
09b2437e72 | ||
|
cfd347335b | ||
|
d322f380ad | ||
|
f658dc2e4b | ||
|
7a3eabf39c | ||
|
48da6c782c | ||
|
b00bbc7daf | ||
|
9fbe8a4e32 | ||
|
623939c671 | ||
|
fccc41f4b9 | ||
|
3b66ed8c17 | ||
|
8fe8981ffa | ||
|
375d8b066c | ||
|
69ada73dd4 | ||
|
2129a97588 | ||
|
4caabae895 | ||
|
d0375141f8 | ||
|
a644621889 | ||
|
4ed7e01dfd | ||
|
e643ffb334 | ||
|
d00ea39dc4 | ||
|
69d8e6031e | ||
|
abee9baf60 | ||
|
d4aaa8117b | ||
|
be66969c9a | ||
|
7bce0d848f | ||
|
53a8915ffc | ||
|
b5fd3656a7 | ||
|
acffd15002 | ||
|
989ecd785a | ||
|
9a5a002293 | ||
|
2cfd08e500 | ||
|
2b4a7f05a6 | ||
|
d31f127982 | ||
|
d08cfe3a29 | ||
|
51a837d459 | ||
|
2f0f7143b5 | ||
|
0dac00f327 | ||
|
a639fc5467 | ||
|
258a604cc6 | ||
|
a2cbac9e0c | ||
|
71c3fb39a2 | ||
|
43244fa026 | ||
|
9e88bc3098 | ||
|
b74f4b612b | ||
|
8de91291dd | ||
|
dc2d1ce700 | ||
|
12a8e94243 | ||
|
9e79b632a8 | ||
|
efb1a67470 | ||
|
e3235ea3eb | ||
|
46d2792dac | ||
|
8ad0b8a726 | ||
|
e8e4c33bae | ||
|
cb03e97e78 | ||
|
f6cec938a7 | ||
|
bbec2effe5 | ||
|
d4084da299 | ||
|
1f00c8f635 | ||
|
0b98473e85 | ||
|
3afbe1148e | ||
|
809c522571 | ||
|
4474458f4b | ||
|
9d8a578dce | ||
|
38c3774869 | ||
|
8b2299852e | ||
|
c62c8da10b | ||
|
bc51644868 | ||
|
3d3d590334 | ||
|
11d7535c23 | ||
|
a49d7eae5d | ||
|
1b2a6b5d0e | ||
|
ba647d012d | ||
|
fc873757d8 | ||
|
ec1cc89cf9 | ||
|
a336623f3a | ||
|
9300347e9b | ||
|
f49d580d49 | ||
|
263948faa3 | ||
|
52f0690c70 | ||
|
7a24059337 | ||
|
4fd1918202 | ||
|
4ae3a5bf7a | ||
|
5be00f051f | ||
|
e7f4ce6175 | ||
|
09bc0f1b60 | ||
|
76d04ee277 | ||
|
f28dfc6964 | ||
|
c14e4f3eed | ||
|
5d42f372f6 | ||
|
4c3e0a6ff0 | ||
|
d9bfca10e1 | ||
|
bf2fb52691 | ||
|
646cbe0fff | ||
|
92e8fc8ad3 | ||
|
92c79c853d | ||
|
55229252d7 | ||
|
3efc426fed | ||
|
04d5b9bfda | ||
|
66f6c4aba1 | ||
|
ed8c98558d | ||
|
514d5c0a50 | ||
|
13428bd03c | ||
|
1555b0f4bc | ||
|
0e46aed0df | ||
|
7b0591be46 | ||
|
f21e103270 | ||
|
7a197c0a1a | ||
|
8a5f1ed9cd | ||
|
36ddd61318 | ||
|
03ab1ee2c7 | ||
|
a550788788 | ||
|
683ffa9ed3 | ||
|
7952a34d64 | ||
|
7426d17e33 | ||
|
660a08db3e | ||
|
1b22a48b54 | ||
|
b725269c7a | ||
|
639358b146 | ||
|
34e8b60917 | ||
|
9ba1534390 | ||
|
4ddfd3b508 | ||
|
e63440527a | ||
|
0984aeb570 | ||
|
654e83a5f9 | ||
|
b306344739 | ||
|
4231037345 | ||
|
d5bc9f5d7d | ||
|
6fde6bbf6b | ||
|
cc88245933 | ||
|
174adc0755 | ||
|
c26dc04b52 | ||
|
2761789f45 | ||
|
213f87378b | ||
|
855298bdaf | ||
|
e8a4ab5ecc | ||
|
5204fe5c99 | ||
|
c39f0d2efb | ||
|
bb3368959f | ||
|
af9cbd727f | ||
|
12a70469eb | ||
|
c611d3f85c | ||
|
ecb83bb277 | ||
|
daae7442bb | ||
|
cc2c74fdff | ||
|
541cd96eeb | ||
|
f16a2e5d22 | ||
|
b7675f46c4 | ||
|
a06474d7ac | ||
|
e903d3a6a4 | ||
|
3888291758 | ||
|
6beff7e552 | ||
|
139a87de99 | ||
|
e54482e4c0 | ||
|
75098b4712 | ||
|
d053d4388f | ||
|
23b621492f | ||
|
83664a1b13 | ||
|
c07a42292c | ||
|
049a477008 | ||
|
fa34315210 | ||
|
bec8cea583 | ||
|
3536d12680 | ||
|
ab893f63b5 | ||
|
6c57c96cb9 | ||
|
6ba5fbeebb | ||
|
d8da128780 | ||
|
7a33c2e00d | ||
|
5a94a2feba | ||
|
c6691cf1cb | ||
|
826835e518 | ||
|
b6e55ef59c | ||
|
4f23944581 | ||
|
1cdc76f5a4 | ||
|
468b7e1595 | ||
|
ce289baba6 | ||
|
f1e07b6842 | ||
|
e9cee2e6a4 | ||
|
5f8a171c2c | ||
|
6cd3c8ee2b | ||
|
2cfcd4653f | ||
|
f56dc582a5 | ||
|
f61bf6090e | ||
|
12d6447b06 | ||
|
480c5c1584 | ||
|
2d6cbcfce0 | ||
|
78f352b839 | ||
|
cbdd7548da | ||
|
3b74e2ea7e | ||
|
3f4dddc004 | ||
|
5170329c79 | ||
|
2d8a3d9f9b | ||
|
83dffef47d | ||
|
23aac5cb45 | ||
|
f7bfab6e08 | ||
|
5e7432b5de | ||
|
2de0450e97 | ||
|
f26b51e5da | ||
|
bf74c3c67b | ||
|
3d304be211 | ||
|
698d47e221 | ||
|
3e2a2b7942 | ||
|
061dc5f824 | ||
|
366e75b242 | ||
|
b76fb70579 | ||
|
aacd0e6dfb | ||
|
bf0cdcd3f1 | ||
|
825c9847fe | ||
|
14523ecc5d | ||
|
efef7147af | ||
|
39bc827aaf | ||
|
bb9954a36c | ||
|
0b241db058 | ||
|
743bd0db1c | ||
|
25a8521efc | ||
|
36782fb4fe | ||
|
6456d4ef76 | ||
|
49535807bf | ||
|
0a95eb0940 | ||
|
ff98ef4465 | ||
|
a6b6fef6d2 | ||
|
c9bc080aef | ||
|
4cbd149c25 | ||
|
cf780ce259 | ||
|
d21d10e4f2 | ||
|
1fea14dd10 | ||
|
1f0cb542c8 | ||
|
57f50cc416 | ||
|
cda96a35ee | ||
|
e977a6829b | ||
|
ac4bb8ca15 | ||
|
a913671f0c | ||
|
5445db2a42 | ||
|
220f35ae03 | ||
|
6aa79cf6e2 | ||
|
88482292e1 | ||
|
9755062563 | ||
|
0a225292f0 | ||
|
1b18b1f815 | ||
|
c0fb8a2c77 | ||
|
f2b4f2e069 | ||
|
7046fcc7c7 | ||
|
8c6400ab2c | ||
|
5d5eb93baa | ||
|
4ded893880 | ||
|
bfd73ae52a | ||
|
6d724e27e7 | ||
|
2dd655cd9a | ||
|
9a96112146 | ||
|
545ff2ec32 | ||
|
5e702171ce | ||
|
cd4fce0c6f | ||
|
1a50effd86 | ||
|
b7a47ae901 | ||
|
0a186dd11b | ||
|
f07a3ea5b5 | ||
|
2d4ec5380e | ||
|
6b4bb762aa | ||
|
97ade0659c | ||
|
b59d6970fc | ||
|
cbff912476 | ||
|
3ae2b4dab4 | ||
|
f897e5132c | ||
|
e0bc9b31a9 | ||
|
f75ee86c0e | ||
|
7f9af5b5fa | ||
|
b0f082e81f | ||
|
d5b5e10230 | ||
|
86c45b5b99 | ||
|
32eb95734a | ||
|
1f6efb4db3 | ||
|
48d0242c80 | ||
|
2401b7f453 | ||
|
dd06d78a72 | ||
|
95d17303c3 | ||
|
d247bc4e28 | ||
|
454345c9b2 | ||
|
76789eacf1 | ||
|
859449ed60 | ||
|
918a3e42b1 | ||
|
4350d2f264 | ||
|
2015fa2d7a | ||
|
e8bd1f3390 | ||
|
66304ed7e0 | ||
|
72785e7c3e | ||
|
59ca8e6309 | ||
|
5d4323cd1d | ||
|
19a6d669a9 | ||
|
bca1648df6 | ||
|
4020ade70c | ||
|
2c068cc3ce | ||
|
6f4a7e074a | ||
|
9f77df0bff | ||
|
ff10297bf8 | ||
|
f732164b5f | ||
|
5210123977 | ||
|
1663782954 | ||
|
63c1f2a7a3 | ||
|
96fa83b508 | ||
|
79f363fb9d | ||
|
ca211f929b | ||
|
6150e91c3f | ||
|
762925d4a5 | ||
|
21080d2110 | ||
|
6d7c983e8e | ||
|
a83850ebf3 | ||
|
41f6b6ab6b | ||
|
a5d46bb40c | ||
|
f170ef0206 | ||
|
e07abfa02a | ||
|
b6f5e68e9e | ||
|
92084e8005 | ||
|
8b8233ff00 | ||
|
60d60e9572 | ||
|
61ce2f9e3d | ||
|
2f4c639cef | ||
|
c09964dc30 | ||
|
2e1283d199 | ||
|
62ce111938 | ||
|
770f7aea00 | ||
|
b6d9993ed0 | ||
|
643ab1a5f3 | ||
|
42141c7063 | ||
|
1087d62705 | ||
|
ee8e45926f | ||
|
4c50dbf7ec | ||
|
4a4856a29e | ||
|
0023ab34ba | ||
|
8fb2b2755a | ||
|
cd007b40e1 | ||
|
17acda7741 | ||
|
7055f02f16 | ||
|
0935f2d23a | ||
|
b993331e06 | ||
|
8adc5a9fae | ||
|
3f9f0e98c7 | ||
|
82299e5aea | ||
|
3330530f68 | ||
|
620409b3f0 | ||
|
78e0bb1ff0 | ||
|
347edb5988 | ||
|
0ff1a01b42 | ||
|
91fd0e433a | ||
|
cdd6112971 | ||
|
ac48a5a4df | ||
|
49f6a2c2eb | ||
|
2821f4d396 | ||
|
2472f11ec0 | ||
|
7f1fed6f8c | ||
|
d971fd1a47 | ||
|
498a43327f | ||
|
d9acc83182 | ||
|
60f5da60bb | ||
|
e3e90ed167 | ||
|
eb5ca200f2 | ||
|
61b264be3b | ||
|
37cec04e9c | ||
|
7a9298328f | ||
|
a76bcd1739 | ||
|
60bc4450f3 | ||
|
ed151c8567 | ||
|
c40801efd9 | ||
|
a4fd1615dd | ||
|
74c640f937 | ||
|
7aeda70ff6 | ||
|
c6dde63abd | ||
|
dea1e7eaf3 | ||
|
7179758c50 | ||
|
1a159f9e9a | ||
|
1795f58ba5 | ||
|
4d82dd22b6 | ||
|
460780d602 | ||
|
dfed04166e | ||
|
75e2618f70 | ||
|
9685ef4dd3 | ||
|
750f3cd8ff | ||
|
34ec0e2c82 | ||
|
ea8f3e5a6a | ||
|
a184ad528f | ||
|
57b1542688 | ||
|
175f869c83 | ||
|
a442b4b009 | ||
|
d65b25f084 | ||
|
2765f48a64 | ||
|
d2008a336b | ||
|
ff46d382ac | ||
|
3adb2c3254 | ||
|
8526461d3c | ||
|
15eecbb463 | ||
|
30c8ea29b2 | ||
|
b0d790543a | ||
|
2c1b29e637 | ||
|
75bbde598d | ||
|
955a6bd6f9 | ||
|
147810864f | ||
|
4c0167ed74 | ||
|
024a6c06aa | ||
|
b5536830d0 | ||
|
20493f9e87 | ||
|
e8c20c28b2 | ||
|
f12841b2d3 | ||
|
d6d1af13d0 | ||
|
bbb1683dbf | ||
|
fed42f13ad | ||
|
5f6308e7c4 | ||
|
74f7879cb6 | ||
|
5c085efc10 | ||
|
a1e14c4eec | ||
|
4b1be30dc0 | ||
|
8523f6feaf | ||
|
83d2b58bad | ||
|
afe8e17a6f | ||
|
743f2270e5 | ||
|
5325b0b466 | ||
|
d7b024eac1 | ||
|
45c8e3a793 | ||
|
e04463c143 | ||
|
26fa2a5d60 | ||
|
e1fbd1242e | ||
|
b868734378 | ||
|
0bb3cfcfad | ||
|
3ff39a9549 | ||
|
94709fd316 | ||
|
4a0db9f984 | ||
|
28931f4103 | ||
|
f7f32ac806 | ||
|
a163cee18d | ||
|
0828ac12b1 | ||
|
b59f916824 | ||
|
2ac63e78ca | ||
|
028b96e4c5 | ||
|
22d5505a2b | ||
|
e66549a067 | ||
|
e8c480426a | ||
|
891375a885 | ||
|
32af7e6f09 | ||
|
0b04612d6c | ||
|
3d8b9cce41 | ||
|
bc09ede09f | ||
|
b6e1d4a7d5 | ||
|
89a97537b0 | ||
|
8a3c0afba6 | ||
|
0ad0ecfcc2 | ||
|
c4894f2c24 | ||
|
e64f4ad7b2 | ||
|
2aad5546bf | ||
|
7bacbec5e9 | ||
|
e13040a49e | ||
|
30cb9f6d15 | ||
|
a351a185a0 | ||
|
fe0add01ee | ||
|
a249a1b2b5 | ||
|
6798a5e429 | ||
|
3a67da8830 | ||
|
1d4b079d0c | ||
|
49ade61ef6 | ||
|
b482d478b4 | ||
|
ac7108b882 | ||
|
7bb7189c6a | ||
|
6eba60bd75 | ||
|
5de1fc1453 | ||
|
2f3865d8cc | ||
|
2d4c106542 | ||
|
a91ba4370d | ||
|
550a560f40 | ||
|
5f11790f6b | ||
|
e8dbbd876c | ||
|
755f934eb2 | ||
|
5e93e048ab | ||
|
bb6a885116 | ||
|
420c12f202 | ||
|
792d5c62c5 | ||
|
fa2e2bc8f3 | ||
|
170d7a5e55 | ||
|
8ab8726b8f | ||
|
18e2fc1089 | ||
|
a59b67ec45 | ||
|
d76a059525 | ||
|
d28ab919bb | ||
|
eb146830ba | ||
|
618d02d838 | ||
|
348de312f9 | ||
|
65dcf8bc36 | ||
|
2e3616e05d | ||
|
00c5e747d2 | ||
|
b29ecd339d | ||
|
c6820eccab | ||
|
247d13f97a | ||
|
f4fa013ebc | ||
|
f4bb420f35 | ||
|
02f06724d0 | ||
|
fd4eb6b50d | ||
|
997666164c | ||
|
9c599d53aa | ||
|
62acd458c6 | ||
|
17275a5390 | ||
|
830786b2fd | ||
|
06a1421e97 | ||
|
6541aacf98 | ||
|
dacaa86386 | ||
|
a757fb3696 | ||
|
7eb0d347f5 | ||
|
ae5cc17290 | ||
|
d9e6164a5c | ||
|
a97d235cf5 | ||
|
c9b5ce6508 | ||
|
e0df003aba | ||
|
c340746a87 | ||
|
eabd303c8e | ||
|
bd2c70b923 | ||
|
504f420293 | ||
|
eb134a6c47 | ||
|
7d3e3b992b | ||
|
c47bdd5715 | ||
|
b692b3ec4f | ||
|
ebc7f1ecd7 | ||
|
b30db544a3 | ||
|
a499689bd8 | ||
|
c81dde53e7 | ||
|
dd2b41ff95 | ||
|
48e72f9b69 | ||
|
6f1484005b | ||
|
0b4954a9ca | ||
|
bf08c0d850 | ||
|
e80acd4d57 | ||
|
60ed276b8a | ||
|
554aa45d48 | ||
|
524090e27d | ||
|
a791641b34 | ||
|
85155a43bb | ||
|
cfb94206f9 | ||
|
86caa5f9b1 | ||
|
933a1b4636 | ||
|
ffece4f357 | ||
|
8f4e3c62ce | ||
|
290aaad63a | ||
|
a3e294bb60 | ||
|
5d87d8bde3 | ||
|
993a86ddb2 | ||
|
a4d924acd1 | ||
|
30438846e9 | ||
|
e6fee75952 | ||
|
acc9167991 | ||
|
b0e8506cb5 | ||
|
f379bf2341 | ||
|
454d2d3666 | ||
|
57bf730241 | ||
|
4bc421527f | ||
|
05d23cc745 | ||
|
4c5b884af7 | ||
|
c6c1d3b3d8 | ||
|
164d72830f | ||
|
c10435e242 | ||
|
2dc9b63051 | ||
|
d673c8714e | ||
|
412db33c36 | ||
|
000c8b27c3 | ||
|
46c61953f6 | ||
|
a8a8355ea4 | ||
|
3d00881508 | ||
|
7197e5427f | ||
|
3243ce2a90 | ||
|
65929194b0 | ||
|
184a16a194 | ||
|
8201a85c47 | ||
|
2321228981 | ||
|
5f99c2360c | ||
|
ad335d5088 | ||
|
1ea4a347e2 | ||
|
b578f4ac84 | ||
|
052ff02571 | ||
|
3c59004e72 | ||
|
17ebc8a066 | ||
|
9220b6675b | ||
|
18a76025c7 | ||
|
dac2d5e685 | ||
|
0af9f10166 | ||
|
d18f4d341c | ||
|
b5a1c419ca | ||
|
1f9be978b7 | ||
|
41fffdf155 | ||
|
51215fda16 | ||
|
d639e169ec | ||
|
e1b9b1161d | ||
|
846e637716 | ||
|
58dd25b58d | ||
|
a77b9d9027 | ||
|
ef5a377bc6 | ||
|
951af49e04 | ||
|
455b747a1c | ||
|
28a534ee49 | ||
|
f9f7f6cc6f | ||
|
7f91653208 | ||
|
086e0c0320 | ||
|
273c44424f | ||
|
b134fa7409 | ||
|
fee6447e22 | ||
|
e99cd41ed0 | ||
|
af5a008d0f | ||
|
27a9f5dd02 | ||
|
cfefe6962a | ||
|
88f9ad09a2 | ||
|
0ae3c60d6d | ||
|
c34d574385 | ||
|
2a124d4195 | ||
|
e352867f5a | ||
|
f645065db7 | ||
|
d69059de68 | ||
|
0c3f16e5f6 | ||
|
cba044eff1 | ||
|
dee22f7120 | ||
|
46b69b3873 | ||
|
687aa5a7e3 | ||
|
4df3654166 | ||
|
4d63b41127 | ||
|
1b9f970d7f | ||
|
7f1b3e25e8 | ||
|
f01d5d95d9 | ||
|
89d6968139 | ||
|
2773642406 | ||
|
13cba84445 | ||
|
bb45d0eae9 | ||
|
df22db256b | ||
|
e0dc853d74 | ||
|
91912bdb8d | ||
|
54004eef4d | ||
|
aa3bb9c6ef | ||
|
73c5562fd3 | ||
|
4a12acf157 | ||
|
67da746b48 | ||
|
545aae31d9 | ||
|
3aa29cfc65 | ||
|
99f4eb6843 | ||
|
61f4d0719f | ||
|
d6233e7c77 | ||
|
540aa6c546 | ||
|
31573b3599 | ||
|
e88ee31991 | ||
|
f6cf3b378b | ||
|
35a13842af | ||
|
65f957f023 | ||
|
4fb0a84d0a | ||
|
30b8e5b5ea | ||
|
8cd430ac07 | ||
|
75012eda9c | ||
|
e9a49fdf74 | ||
|
315acf2fbc | ||
|
310790c84e | ||
|
277638b107 | ||
|
b238357c53 | ||
|
4fa32bac2f | ||
|
58f2192a7e | ||
|
3c28ee1adf | ||
|
2c4610c132 | ||
|
239d16747d | ||
|
764541d3ca | ||
|
ca1831fef6 | ||
|
1ed8d48ced | ||
|
48e6bba100 | ||
|
8c1596d869 | ||
|
93eca757d3 | ||
|
3f60ef8da7 | ||
|
5d15fce343 | ||
|
f526098293 | ||
|
d7290bf750 | ||
|
2f4c0623d0 | ||
|
ed88184757 | ||
|
d0f7570f5e | ||
|
a5eb386f48 | ||
|
b76f97be93 | ||
|
acafae7d3a | ||
|
a59bf7c002 | ||
|
5c1813888c | ||
|
73733ce145 | ||
|
bf6dfcfcad | ||
|
f605608098 | ||
|
31a8227e53 | ||
|
62dcb61536 | ||
|
fda211e7b3 | ||
|
63b6564f70 | ||
|
93bbeee400 | ||
|
66fa8d84a7 | ||
|
091b55a265 | ||
|
ec8f6e8e0a | ||
|
7ad73bb453 | ||
|
3fecce6fe6 | ||
|
9d161a0bcf | ||
|
8cc04e4c25 | ||
|
0a09a50ab9 | ||
|
c6484f1eac | ||
|
68214156d9 | ||
|
314843f5f2 | ||
|
cfbb6d4250 | ||
|
7adce08eee | ||
|
f76217dcce | ||
|
a2ab36480f | ||
|
90c9018aa4 | ||
|
595deb3a3d | ||
|
78f97c6532 | ||
|
9f1764c325 | ||
|
4418700589 | ||
|
d2c7eec8e0 | ||
|
41cf6460d0 | ||
|
8ec75ce4bb | ||
|
a060d54468 | ||
|
3fe824dbd1 | ||
|
7ef79c92f5 | ||
|
2d5bb82077 | ||
|
6f8001bd82 | ||
|
640a3fb9fa | ||
|
05d2defa2d | ||
|
c3bef6d4d2 | ||
|
d1818d2a57 | ||
|
f5fadf700e | ||
|
d924dbb723 | ||
|
544dca3b18 | ||
|
39f68e8c2f | ||
|
5c0bbdd4c8 | ||
|
51b7b21082 | ||
|
0da94e51e0 | ||
|
4a6293dcdc | ||
|
287212956b | ||
|
7a91dd9595 | ||
|
4a81e06e96 | ||
|
ea89c272b9 | ||
|
c690de9f7b | ||
|
7cc3d4b91a | ||
|
053dcf39a5 | ||
|
d191b327c6 | ||
|
06864a65b7 | ||
|
764e38f8c9 | ||
|
696980aca4 | ||
|
0c42f53a2f | ||
|
e901142661 | ||
|
2265d198a6 | ||
|
b753507b8d | ||
|
196e3726cb | ||
|
c9d11d6f19 | ||
|
aabfbf507e | ||
|
205de7e5c5 | ||
|
908f9a7ce3 | ||
|
203a5fd88c | ||
|
13e77636a9 | ||
|
6247ced7b7 | ||
|
ba27d20b24 | ||
|
9238961992 | ||
|
fe26f48c47 | ||
|
b5fe65d0cc | ||
|
24afe1e496 | ||
|
5f389e654a | ||
|
c31215bc2a | ||
|
c3ff571af7 | ||
|
441fa13bfd | ||
|
3bee4b4585 | ||
|
b48280905e | ||
|
163dae647b | ||
|
c921091957 | ||
|
6add3f1da3 | ||
|
ceb0b5793b | ||
|
14b854ad4f | ||
|
df6000c706 | ||
|
c11f0774eb | ||
|
f2b822e5d2 | ||
|
2d2005934a | ||
|
363cd5b046 | ||
|
8922d2aaf2 | ||
|
10368500f2 | ||
|
5ef7ab32df | ||
|
dacdc1aec6 | ||
|
589a002d67 | ||
|
21a41e192b | ||
|
5ea29297cc | ||
|
c5c08ea34b | ||
|
8d315f2741 | ||
|
cd0d9dcbba | ||
|
ba84387722 | ||
|
0ec86b6dc1 | ||
|
5c5193ef48 | ||
|
d9ff4a8484 | ||
|
dea7e7b4f5 | ||
|
62827b92b7 | ||
|
9a82f88e1f | ||
|
23e0d3f2ff | ||
|
a4fac68393 | ||
|
f934262e35 | ||
|
14dffa4ad4 | ||
|
8e4da396ea | ||
|
c344032c0a | ||
|
180681b602 | ||
|
fb8149b6cf | ||
|
4c2c99fc07 | ||
|
c8b0354d07 | ||
|
c87628b614 | ||
|
5bd28da4f3 | ||
|
0e2a22f509 | ||
|
91e69a2bd0 | ||
|
155cd4c9bd | ||
|
734ecccb9c | ||
|
9a3f74c6fb | ||
|
e2abc312d3 | ||
|
d6378133d8 | ||
|
49a56efa82 | ||
|
640cd88b6e | ||
|
66b4f9bfe5 | ||
|
0541cf8f2b | ||
|
bf93bd79c9 | ||
|
f89b937ee7 | ||
|
82de3c9867 | ||
|
b328c54da8 | ||
|
e9cea73357 | ||
|
3fbf65355d | ||
|
b5438f2ba8 | ||
|
4f43398db0 | ||
|
05121e32b1 | ||
|
a8870f2d24 | ||
|
238b9aafb1 | ||
|
2e6b909173 | ||
|
4bdcafad4b | ||
|
69e67ad5ac | ||
|
2dd050bd90 | ||
|
9b315d1564 | ||
|
57d24dcf90 | ||
|
8387215efd | ||
|
885abc59be | ||
|
7403cbc389 | ||
|
145b40f28d | ||
|
cf54b78af7 | ||
|
0aae31a450 | ||
|
f120ce50e6 | ||
|
90e3fde35d | ||
|
ff53c2757d | ||
|
e1a823400a | ||
|
3a24019d96 | ||
|
9688a561b3 | ||
|
2a3b13ecce | ||
|
9bffd31ee3 | ||
|
6dcebde69d | ||
|
e06a0e9e5a | ||
|
7362e38413 | ||
|
d2c09933c7 | ||
|
b2efcb9515 | ||
|
814c0bed2e | ||
|
e45f66a199 | ||
|
dd4704b818 | ||
|
9b8ab9fd8d | ||
|
f9f59fec39 | ||
|
d91aaabeb3 | ||
|
9042520916 | ||
|
d3ab961364 | ||
|
0c46460861 | ||
|
9f82e7f7fc | ||
|
ef3456199c | ||
|
928a5c27f3 | ||
|
bc86bf2d00 | ||
|
fceca845a9 | ||
|
09338d8aa8 | ||
|
a504e74f54 | ||
|
f83a0cec4e | ||
|
69e34d03bd | ||
|
261b17d36c | ||
|
3fd2d39898 | ||
|
bb9362ee8b | ||
|
1a618dd106 | ||
|
7fda78ff2f | ||
|
70c1e4e3ed | ||
|
b469d03677 | ||
|
de24034b22 | ||
|
75bf410320 | ||
|
7e1818b285 | ||
|
73ca2dfb77 | ||
|
dce0ee5ace | ||
|
85385a0aa7 | ||
|
08314bd4b5 | ||
|
8c3ae57497 | ||
|
de8995fa7e | ||
|
581ef47c78 | ||
|
fc3eb7f57f | ||
|
49443d4f6e | ||
|
2e57e99e34 | ||
|
ef712b16f5 | ||
|
19827a0b5b | ||
|
66fbc37ec4 | ||
|
6699b71bd5 | ||
|
fe77b71c97 | ||
|
be5deea1d3 | ||
|
3322827979 | ||
|
7f115b3e4b | ||
|
a134e48ebb | ||
|
104590e34d | ||
|
d981a85239 | ||
|
bc8b3d71d5 | ||
|
2802164bb4 | ||
|
876fcf532f | ||
|
92bf28e104 | ||
|
ae7d4d07df | ||
|
229c584138 | ||
|
bb18af414b | ||
|
3d9fbb685a | ||
|
346e95c33c | ||
|
a31860dc5f | ||
|
c54ca168ed | ||
|
a1367f8e72 | ||
|
64037cb32a | ||
|
e4c443c73a | ||
|
91f2a96403 | ||
|
93abbe83e8 | ||
|
f444160c6a | ||
|
e4be1702c4 | ||
|
7b38df45da | ||
|
e34a92e2ec | ||
|
35fb84c275 | ||
|
9557178ffb | ||
|
4be2f12a14 | ||
|
c64a9c1e23 | ||
|
7897ea88cd | ||
|
c22718811f | ||
|
3aa3b7e160 | ||
|
cf9f43ab9e | ||
|
4a64d0ee17 | ||
|
d625d57aa4 | ||
|
bbeb909bdc | ||
|
33ac34b04e | ||
|
5d54285640 | ||
|
aee135a6cd | ||
|
da715c70b0 | ||
|
e10b494f0c | ||
|
3ae52ea1ca | ||
|
1165683f69 | ||
|
83ff2dd810 | ||
|
587dd3848e | ||
|
a02b6b68d3 | ||
|
168312627d | ||
|
61402e798e | ||
|
1a28b4f887 | ||
|
d4e923f9de | ||
|
c0f7f0a8f1 | ||
|
f1a6a4924e | ||
|
ec71e30ecb | ||
|
f23227fc8b | ||
|
5a747cd829 | ||
|
6980921dab | ||
|
8fcfd713e0 | ||
|
ea2842f37f | ||
|
64a9892ee2 | ||
|
048547828d | ||
|
a14a8c3a07 | ||
|
08ef84d112 | ||
|
5a0c06473c | ||
|
1beb153f21 | ||
|
0c424cb77f | ||
|
ebd1caf6d1 | ||
|
0e18247184 | ||
|
a945edfe07 | ||
|
6c2aa1bf61 | ||
|
afecac3e3c | ||
|
8a169d5ddc | ||
|
ea0adb4407 | ||
|
88ec1b575d | ||
|
1549d8add0 | ||
|
c8eb7ea7ac | ||
|
a3460d8c2a | ||
|
4ce7634201 | ||
|
ef53a12f7a | ||
|
7d12c2ba54 | ||
|
7270918b65 | ||
|
dd74ed1957 | ||
|
7772643b0d | ||
|
0a433b90e3 | ||
|
efccc1e19e | ||
|
692ae25e76 | ||
|
b5e9eb26ba | ||
|
4030a4918d | ||
|
41a10d9697 | ||
|
fde0163b97 | ||
|
42e5fb33ba | ||
|
526a818269 | ||
|
afc538e875 | ||
|
74fb15e426 | ||
|
46dd78162f | ||
|
276d8d4a42 | ||
|
b1d20178f8 | ||
|
5f362cbdbd | ||
|
695996d6e2 | ||
|
1b13f32d94 | ||
|
3ee7e73ff0 | ||
|
90d7b73dd4 | ||
|
f93bdd962a | ||
|
1942c31eff | ||
|
d01271fb15 | ||
|
07a1130db3 | ||
|
835da58b53 | ||
|
9c8f96e233 | ||
|
b0ab8cd77f | ||
|
8fce29caf7 | ||
|
14eaa57434 | ||
|
58105824d9 | ||
|
4704a70cb7 | ||
|
34a8463bf9 | ||
|
e339e730f4 | ||
|
286747c23c | ||
|
3ee1607298 | ||
|
4161d31642 | ||
|
4c1d7a8f2d | ||
|
2da450d69d | ||
|
fe69f84c85 | ||
|
ba5f2032ba | ||
|
7097ba07d1 | ||
|
30a384fe1e | ||
|
520e0f1b89 | ||
|
a7d059b3ed | ||
|
bba44abf52 | ||
|
39d0708cca | ||
|
2d8b719ab0 | ||
|
5efa27c2a3 | ||
|
67e8fc0c43 | ||
|
8e42e3f21f | ||
|
29a8260514 | ||
|
8c7a765e11 | ||
|
f3d0f88f95 | ||
|
2ddd2d16ed | ||
|
9fed2ca41b | ||
|
eb7c5c4437 | ||
|
09851600f7 | ||
|
425a3c85a9 | ||
|
0f7a78ee25 | ||
|
7148f6fd41 | ||
|
e83781b26a | ||
|
cd7dccd804 | ||
|
7a68c971aa | ||
|
cfa7708b57 | ||
|
c47f872f6f | ||
|
ef2aad8956 | ||
|
ab126729e0 | ||
|
e3c85c585e | ||
|
0b4eca4724 | ||
|
142d3ef543 | ||
|
ceb52eedaf | ||
|
772f7a2757 | ||
|
db792ab5a9 | ||
|
97ec680af2 | ||
|
ba4d5453a2 | ||
|
36a982f7e2 | ||
|
2a5d30d749 | ||
|
122528f9a9 | ||
|
55401a746c | ||
|
8cbc81b8bb | ||
|
da7f66a531 | ||
|
7893a121c0 | ||
|
4c5d028509 | ||
|
eef116e26b | ||
|
8fba3f4ca9 | ||
|
839d3fb689 | ||
|
377cc4ca1f | ||
|
030c46264b | ||
|
dad37dece3 | ||
|
57e2c4ea45 | ||
|
c1a8ffd814 | ||
|
b95c918dc6 | ||
|
e9586711e0 | ||
|
ffef4936f9 | ||
|
fcde507183 | ||
|
3b72157e64 | ||
|
7dce579ac3 | ||
|
16918ddb7d | ||
|
b65782e13c | ||
|
eb60f6717a | ||
|
923a1a2057 | ||
|
216afd45cc | ||
|
3fe1c0cdc3 | ||
|
afadd25885 | ||
|
e2b20f466d | ||
|
01712c3f23 | ||
|
b6fda8865f | ||
|
db3e8a9c6b | ||
|
d1491cc203 | ||
|
d31371b486 | ||
|
2afcddbf49 | ||
|
25fb645c4b | ||
|
5c689ac5b1 | ||
|
e1c8088de2 | ||
|
d40037ef49 | ||
|
faa0246e28 | ||
|
0749073120 | ||
|
2dccd36a6d | ||
|
23494ab630 | ||
|
2f15c9a4a7 | ||
|
c3203fdacd | ||
|
222c616148 | ||
|
44e7e25cab | ||
|
fc1b9abe66 | ||
|
365c8d0953 | ||
|
8ffd98162c | ||
|
c671596c6f | ||
|
b22437840d | ||
|
4c5fe824c2 | ||
|
1fee773313 | ||
|
6be952491a | ||
|
781147bf0e | ||
|
a4cd40c2f8 | ||
|
96a2dd7c72 | ||
|
f6b7dcbad7 | ||
|
b011c3df03 | ||
|
014acbfaf5 | ||
|
ee9c9b33ca | ||
|
b2d8f5f023 | ||
|
790b9cbc13 | ||
|
bffe34fe0a | ||
|
a8022077f6 | ||
|
80a98f04c7 | ||
|
8a36eb4532 | ||
|
abef4f0f79 | ||
|
05fe68823a | ||
|
567cdd5510 | ||
|
6d9d8797fe | ||
|
44a26fd340 | ||
|
3b3751c827 | ||
|
6273d723f1 | ||
|
6863fef7e5 | ||
|
3a6e74ae1c | ||
|
16bec0a656 | ||
|
c3dfdde626 | ||
|
544019f67d | ||
|
bef12c7a8f | ||
|
3ef37c15c7 | ||
|
68a6113c26 | ||
|
cbccca20d0 | ||
|
e3378d5636 | ||
|
c89e414bb5 | ||
|
718b410253 | ||
|
faf4ea6434 | ||
|
abb802b881 | ||
|
d9ecf38e42 | ||
|
7ef19e0ead | ||
|
c621ccf679 | ||
|
0f0719eaa2 | ||
|
5b889f0b32 | ||
|
82a0c1024c | ||
|
af85fe3892 | ||
|
f998041748 | ||
|
2b884e73db | ||
|
e3c5def536 | ||
|
fae4493abc | ||
|
67dd929951 | ||
|
805c2657f2 | ||
|
ab2f15b5a2 | ||
|
3c2604b384 | ||
|
12b5bd3a4f | ||
|
74e8bc3bda | ||
|
6bbce06d93 | ||
|
22361bdf42 | ||
|
076f450ec7 | ||
|
6d8ec69a4d | ||
|
b7e3a54e15 | ||
|
2943cb525f | ||
|
1278288a42 | ||
|
66a93ee108 | ||
|
ac23119838 | ||
|
b55930f084 | ||
|
d6e243321b | ||
|
2ddb3fbf72 | ||
|
45dc2162dc | ||
|
77d10c93d6 | ||
|
66a77519d7 | ||
|
3bafc89855 | ||
|
4fa285e85a | ||
|
041cedbc58 | ||
|
cbf82fcd29 | ||
|
5dc0c8c0b3 | ||
|
c83f78044e | ||
|
d7407ecf66 | ||
|
82aac93f36 | ||
|
c92d6ecbb6 | ||
|
a20fe2b5a6 | ||
|
3d2c74a760 | ||
|
7b2e452cd5 | ||
|
1363af24a7 | ||
|
84187ce109 | ||
|
0466b49520 | ||
|
3b131f2db6 | ||
|
588da9b719 | ||
|
ddca467e30 | ||
|
8466a910da | ||
|
0e6c59983f | ||
|
e6de873b6e | ||
|
b148f3ca9e | ||
|
348a9c83f5 | ||
|
6517704850 | ||
|
cc58d27122 | ||
|
39d5073f49 | ||
|
191cb78d8f | ||
|
fbfda03138 | ||
|
23da4ae2dd | ||
|
675ee59e50 | ||
|
193a0e1a4f | ||
|
c1d20cb9f9 | ||
|
d2eeaab5f5 | ||
|
aac0e74b9d | ||
|
f89d169ef3 | ||
|
de22a0790f | ||
|
1c06e36c1c | ||
|
3de3481765 | ||
|
6b50a63e95 | ||
|
393e2f809e | ||
|
a0f443ccc3 | ||
|
155207ed95 | ||
|
255e479d47 | ||
|
e42739ec81 | ||
|
8911588de9 | ||
|
3fba2c6513 | ||
|
89add8b684 | ||
|
31a70e1b8e | ||
|
dcb08f5266 | ||
|
d10d27c1d6 | ||
|
4cebe26186 | ||
|
f8f4bb4eac | ||
|
42f1603d81 | ||
|
6ea835c2d1 | ||
|
ae68264db4 | ||
|
ccda93cc82 | ||
|
3556878a1e | ||
|
17f24942da | ||
|
c80dfb10a2 | ||
|
99164eb0d8 | ||
|
bf53449f66 | ||
|
e53f3d23d5 | ||
|
64ba656043 | ||
|
414280ada9 | ||
|
3952c3b969 | ||
|
ab6ce62551 | ||
|
a7360f409e | ||
|
319027e2e3 | ||
|
d73dea797a | ||
|
e0b9a3fa50 | ||
|
a1c66738db | ||
|
3a064d6796 | ||
|
2ef7251079 | ||
|
77bd0d3f3c | ||
|
004aa5d3dc | ||
|
1b87eaf21e | ||
|
cd071e47e0 | ||
|
9a96a5b7bb | ||
|
e31d3abc97 | ||
|
ec2f1b9833 | ||
|
edc3a1d33c | ||
|
9036b21b5c | ||
|
0846fcc05d | ||
|
f55f450850 | ||
|
cc0b938a6d | ||
|
7c44fb8cd4 | ||
|
6982f55cd7 | ||
|
e2d7954846 | ||
|
71bd797dd4 | ||
|
a7b6fe4b22 | ||
|
b75e2fe0ce | ||
|
0d798178b0 | ||
|
c6ed0abfd7 | ||
|
e6f7f213ec | ||
|
45917eae1d | ||
|
4b7cb6da9e | ||
|
dd71fdbe08 | ||
|
6c12f0f66f | ||
|
0848306cb0 | ||
|
498c00fe3c | ||
|
ac5a4c2bc6 | ||
|
b58e10521f | ||
|
1963635dd7 | ||
|
a19d93dbef | ||
|
704d7b32da | ||
|
6cded5319a | ||
|
12add19c31 | ||
|
0d486a14f6 | ||
|
2d2521cd9a | ||
|
92dcc6c980 | ||
|
b8548afb71 | ||
|
07c6bf7055 | ||
|
a020febf8d | ||
|
a3a743881d | ||
|
50c8b995c3 | ||
|
0d6881ad22 | ||
|
9f6c48cf0c | ||
|
6d84cc0a81 | ||
|
820b048272 | ||
|
08fe430c4b | ||
|
4759b44233 | ||
|
53a0d29244 | ||
|
f5467a653c | ||
|
ad45016b87 | ||
|
533b0f40d3 | ||
|
aeedb948cc | ||
|
82c35355b6 | ||
|
7d27b46873 | ||
|
bcfca9ad9a | ||
|
cce7606960 | ||
|
5cf8c3c7d2 | ||
|
41089e2806 | ||
|
c4477a81ea | ||
|
f02d52ce4c | ||
|
bae8dc7dd7 | ||
|
ccc5aac025 | ||
|
356af3ae7c | ||
|
e978202f36 | ||
|
9a9b206bf5 | ||
|
a62627f6db | ||
|
381a12db20 | ||
|
898d32c6da | ||
|
6ec2712eec | ||
|
c9f79343ef | ||
|
b1994918fe | ||
|
a6bcfac597 | ||
|
b71a26b04a | ||
|
81ec8dca8c | ||
|
d9ddeaf107 | ||
|
00aa40ea7b | ||
|
ea4d833a43 | ||
|
040efa970c | ||
|
68fb093c9e | ||
|
060f4aa297 | ||
|
65f69a121b | ||
|
69672dd99c | ||
|
cce8207870 | ||
|
bbd174cd67 | ||
|
2396a84c99 | ||
|
e4101ece65 | ||
|
1df12b8c89 | ||
|
2c415e37e7 | ||
|
04edff29cf | ||
|
d2b604e1dd | ||
|
df273c5e2c | ||
|
b2b5690739 | ||
|
f8117b6f98 | ||
|
41e568f783 | ||
|
31577cd496 | ||
|
247d6a2148 | ||
|
b3df37b0bc | ||
|
713f675f3a | ||
|
71694787cd | ||
|
feb0cf7e39 | ||
|
906e5886e1 | ||
|
ecccadb77e | ||
|
8858cffc55 | ||
|
02b8b37b4c | ||
|
5c40b75eab | ||
|
9411e6f065 | ||
|
98cc1e2715 | ||
|
fe4bb5db40 | ||
|
d1242c4b67 | ||
|
d0f122a2be | ||
|
98678b991b | ||
|
ab67ac00b1 | ||
|
e89f60bac0 | ||
|
7578bfa3d9 | ||
|
f4b4638ea8 | ||
|
b3cd2a0e03 | ||
|
c78a83d398 | ||
|
44ea65dd3e | ||
|
ad4ec5f04c | ||
|
632d29795a | ||
|
df74d0c814 | ||
|
c6b020a9e7 | ||
|
9592d286c2 | ||
|
5953cdf0cc | ||
|
35f8c40a0c | ||
|
ae5a4f0051 | ||
|
886a60c12a | ||
|
7cb686ce8e | ||
|
85c8415acd | ||
|
ed082c9869 | ||
|
36da02c14e | ||
|
360b4db17a | ||
|
ad28f1f9a3 | ||
|
cd98cac4e4 | ||
|
5d8e66a3f3 | ||
|
4f4bc8f805 | ||
|
a54413625e | ||
|
f841efeef4 | ||
|
a0d66a71f7 | ||
|
6c3a64f020 | ||
|
27db00ab98 | ||
|
6cec583661 | ||
|
795a57dde1 | ||
|
5b9fd5de94 | ||
|
78fb8fdadf | ||
|
2262e6be30 | ||
|
de3807f690 | ||
|
4eabb7c074 | ||
|
7f8089eaff | ||
|
f34ee53a12 | ||
|
bef02d238f | ||
|
f5943ced97 | ||
|
1fcc147da7 | ||
|
056c7d40eb | ||
|
16d3ed579b | ||
|
ce20d40ff7 | ||
|
eb3f5f1ec2 | ||
|
3e5cc07440 | ||
|
284ec8a74f | ||
|
0a13c12b1f | ||
|
cd900ab842 | ||
|
995ed23b3e | ||
|
3d66d71c97 | ||
|
f466266a5f | ||
|
3ded5b20d3 | ||
|
8d414970c6 | ||
|
a8f89c16bd | ||
|
7fb5412176 | ||
|
0d6ae19d99 | ||
|
a437332482 | ||
|
0ca46bf2ac | ||
|
ddb6753f8d | ||
|
6a6762f036 | ||
|
8e6bd6a7a1 | ||
|
fa555bedf0 | ||
|
0c05e97465 | ||
|
9252f3bede | ||
|
5db9d1493a | ||
|
04e39ef9e2 | ||
|
34b173a057 | ||
|
eae820f91b | ||
|
5f3c9cda97 | ||
|
100aee9dcc | ||
|
914abda7c9 | ||
|
3cd0d1f423 | ||
|
8d44df83c4 | ||
|
b46ae152d6 | ||
|
fad6d63c14 | ||
|
742ab28099 | ||
|
77f75fd968 | ||
|
8c966627bc | ||
|
33d94b9497 | ||
|
5d4454734a | ||
|
af70269169 | ||
|
4c4687a05f | ||
|
a61f052fe8 | ||
|
826de7e9cb | ||
|
b081aa171c | ||
|
904a2cbe74 | ||
|
a95704528f | ||
|
b7d232d56d | ||
|
d0c1ddb51b | ||
|
6d6821319e | ||
|
1707df71df | ||
|
25d0cbe9a2 | ||
|
cb9606a87b | ||
|
e105bc4237 | ||
|
3d4f69d048 | ||
|
b4a3bd1822 | ||
|
54ac5a96ca | ||
|
3d6a990c58 | ||
|
7946a3e4d7 | ||
|
65bd892d8f | ||
|
d31e442c16 | ||
|
d1412e1f42 | ||
|
160ae0b767 | ||
|
59605a2a57 | ||
|
c0d3c950b0 | ||
|
3dbffdb417 | ||
|
e0d53e57ba | ||
|
e944dc5cac | ||
|
c7b47bb8d6 | ||
|
3a5b7c1d0e | ||
|
b4c3a2ea43 | ||
|
9760a4540e | ||
|
993bc36096 | ||
|
d1301fa642 | ||
|
8eab9ab28b | ||
|
577c3168e6 | ||
|
3b693c5b02 | ||
|
ef4db4abab | ||
|
c9319c7c38 | ||
|
fc169af10f | ||
|
b0db7e0344 | ||
|
e80667c935 | ||
|
69478b81b2 | ||
|
ecfdc314d5 | ||
|
c9fbafb909 | ||
|
84fd286140 | ||
|
e610087a79 | ||
|
a2ff02e6c0 | ||
|
69953e5277 | ||
|
e3b1d034f0 | ||
|
7de704ef86 | ||
|
7c56ac7746 | ||
|
38a38e8287 | ||
|
e284224cc8 | ||
|
144e391c82 | ||
|
be4ad66b12 | ||
|
04806a1425 | ||
|
0b8acb51a4 | ||
|
50b7a8a3fd | ||
|
d47e126370 | ||
|
0e6139d5e3 | ||
|
94ba93acb5 | ||
|
0630452571 | ||
|
94ff76711c | ||
|
a5985cba2a | ||
|
82067ca6f5 | ||
|
55da58893b | ||
|
a2677a6400 | ||
|
355468b637 | ||
|
ff8417dfe2 | ||
|
784b06d500 | ||
|
0e7a9e224c | ||
|
5ca732341a | ||
|
c650b35831 | ||
|
9482998b15 | ||
|
2468bc3e9f | ||
|
dadeb7f3e5 | ||
|
bdc860eb79 | ||
|
19bababa68 | ||
|
704a8d99c7 | ||
|
80ea48e8a1 | ||
|
5ab405fc30 | ||
|
3af2ae3bdd | ||
|
ed278e3e5a | ||
|
2d842c7174 | ||
|
daf7af17b1 | ||
|
068fba3616 | ||
|
738603e890 | ||
|
17f1d6b16a | ||
|
a56496ce2b | ||
|
c99c5e62ba | ||
|
073743927d | ||
|
10a6aca477 | ||
|
13cb8979ac | ||
|
83f4095d88 | ||
|
d2c94b0d3e | ||
|
db3fd3d1ae | ||
|
7b9ec5516a | ||
|
c4e7dc3b5a | ||
|
4b72b64a2e | ||
|
f8b0ef052f | ||
|
98f8f04c74 | ||
|
474a4bb19a | ||
|
683d2c21eb | ||
|
3fa955e594 | ||
|
66f28b90fc | ||
|
daeeaa2869 | ||
|
e424293293 | ||
|
6c6c4c7dfd | ||
|
93720f6025 | ||
|
b8f0361157 | ||
|
cabffd5e3f | ||
|
c82af5a0a3 | ||
|
ce5fdd465c | ||
|
0af27fc8dd | ||
|
2c953e361d | ||
|
2103adfc03 | ||
|
4b87887a4f | ||
|
75d71717d8 | ||
|
b2613740b8 | ||
|
bed0185186 | ||
|
74f5e30487 | ||
|
987a83b4cf | ||
|
3efadcb72c | ||
|
e2d2291d8d | ||
|
19664e54be | ||
|
18e1c305f5 | ||
|
f3946fcdf3 | ||
|
9651817c5b | ||
|
730a6b2d0a | ||
|
46b7d9a373 | ||
|
72fb7f679b | ||
|
acfe3f30db | ||
|
a53e29767f | ||
|
20765d9688 | ||
|
e0fcec9102 | ||
|
eb06629385 | ||
|
4b5f5ddffa | ||
|
e1481f2947 | ||
|
e2cdadc714 | ||
|
8fa6f4f9fd | ||
|
02e422f3ac | ||
|
2ceaebbd1f | ||
|
7e177f6953 | ||
|
db66570d7a | ||
|
c4e8ed8851 | ||
|
28ee87cd2f | ||
|
aa9839ee40 | ||
|
cd9fe360a4 | ||
|
5579c018d1 | ||
|
8ec8de67b8 | ||
|
5d764a9f0e | ||
|
e8dff6d16b | ||
|
b6d0d54241 | ||
|
522f8d085a | ||
|
ebd177263a | ||
|
ce273d8761 | ||
|
b8e32a03f8 | ||
|
1e05d41294 | ||
|
dbb9e5363c | ||
|
d9d76839c5 | ||
|
f239199b1b | ||
|
e68df1b324 | ||
|
2c8e259339 | ||
|
c3177b06bf | ||
|
9f0c3b9cea | ||
|
38bdeae4d4 | ||
|
d2f32ca3a5 | ||
|
86242daf3b | ||
|
3c5b186e31 | ||
|
b8c8325292 | ||
|
31c6aa647b | ||
|
f6b2d2cca8 | ||
|
177dfd339a | ||
|
973b33c032 | ||
|
053c94b60e | ||
|
f8dae8e20c | ||
|
a8fcf63cf9 | ||
|
065b1789be | ||
|
bf1f288a92 | ||
|
4c1aeb342a | ||
|
8dc80e68a7 | ||
|
ac044cb5c2 | ||
|
1207203b00 | ||
|
5a0bc55e54 | ||
|
2a92363317 | ||
|
3feaf38252 | ||
|
5426908444 | ||
|
5675895301 | ||
|
1ce111c317 | ||
|
b97b9da14a | ||
|
7d9ccb9a3a | ||
|
be57352f71 | ||
|
1a062f69fd | ||
|
d85cf982cc | ||
|
187cf5cd28 | ||
|
2cae7c41d3 | ||
|
4ddc7c0683 | ||
|
40128c7ff6 | ||
|
b75760c437 | ||
|
1862e31396 | ||
|
7e8d76a95e | ||
|
bc8e6237d6 | ||
|
3ff55204f3 | ||
|
dbd205701c | ||
|
86ddfc1e9e | ||
|
974d9bf199 | ||
|
21b067eaff | ||
|
434882069e | ||
|
73884cff0d | ||
|
49be4e64ca | ||
|
fea4143af9 | ||
|
d3ea26a38a | ||
|
862e8569a9 | ||
|
a16c3aacab | ||
|
28a0a0830f | ||
|
0ff0850979 | ||
|
d056a9f961 | ||
|
16887c3c33 | ||
|
448bf3cb3f | ||
|
4784bcc590 | ||
|
65b1a1958a | ||
|
7dacbdb700 | ||
|
7530b28130 | ||
|
ef17808fbd | ||
|
f9b1068bae | ||
|
fe6551ff3c | ||
|
c9224c13a7 | ||
|
c2b9c3f726 | ||
|
7ef7c419e3 | ||
|
acdba8fc02 | ||
|
e4bb20575b | ||
|
fdd4caa0b7 | ||
|
7e481080b5 | ||
|
a9731f5a1d | ||
|
b4a0c31e1c | ||
|
508214a46b | ||
|
b5f16468ce | ||
|
06961ff693 | ||
|
960e3ec469 | ||
|
2375bf061c | ||
|
fa985f8f16 | ||
|
611c6e9717 | ||
|
790724bc2d | ||
|
0dc5041f47 | ||
|
1a0e305212 | ||
|
f0b6384ad7 | ||
|
8956f6ecf4 | ||
|
c9a4c393ed | ||
|
e363d32921 | ||
|
bb68b4d367 | ||
|
a9308f69b8 | ||
|
89d9cd3782 | ||
|
6cfb4cfbe0 | ||
|
9bd7d1397c | ||
|
d4ed146cd7 | ||
|
99a630fb84 | ||
|
d5f7280249 | ||
|
9a7cb2fd31 | ||
|
28248722a3 | ||
|
e2ad589aa3 | ||
|
fb54ab68a3 | ||
|
699e704a49 | ||
|
3d911f2a22 | ||
|
753bb8392b | ||
|
305fab467e | ||
|
0db6870edb | ||
|
c0d39a5983 | ||
|
73ca5d21ff | ||
|
242a9c209b | ||
|
34f1ecc0dc | ||
|
281dc8bdb4 | ||
|
711732200e | ||
|
b0c5b2f2ce | ||
|
650389538d | ||
|
83f7391af3 | ||
|
1dcfdfc1d8 | ||
|
013f187dc2 | ||
|
66f686210f | ||
|
94ae5faa3c | ||
|
7adb0e5ddc | ||
|
3aeb0c4d98 | ||
|
d33d55376a | ||
|
f486bc0e04 | ||
|
46215b3c51 | ||
|
800b4785d1 | ||
|
fdcafaf6d3 | ||
|
05f05bb577 | ||
|
13932bb480 | ||
|
934e7e6f71 | ||
|
c9e937c41c | ||
|
ad453555b9 | ||
|
44b25e4157 | ||
|
b036e48b66 | ||
|
c062584578 | ||
|
f2e5e34a7f | ||
|
9044f4eebe | ||
|
bc69e1cdae | ||
|
0c0633fdd4 | ||
|
fb29913ef0 | ||
|
c835dc324e | ||
|
3e4314e7f3 | ||
|
c620e9c930 | ||
|
da48ddec83 | ||
|
7cfdd4f663 | ||
|
031ce42831 | ||
|
9e1f57a2b1 | ||
|
1e2945ca54 | ||
|
996d0cfea8 | ||
|
900ebfe289 | ||
|
da7dff18c6 | ||
|
cdf85edad9 | ||
|
eacc033929 | ||
|
2197d68279 | ||
|
9aedc1d526 | ||
|
629d58b041 | ||
|
2ce6cea4ff | ||
|
b5b19abb24 | ||
|
fe3bdda05a | ||
|
1f82aef4ad | ||
|
47c1737371 | ||
|
2159b67ba4 | ||
|
f012c64fc5 | ||
|
1a721fe7e8 | ||
|
7c9755d1a6 | ||
|
86bb56ab6f | ||
|
436e87578e | ||
|
ec4a783759 | ||
|
66d5f4d1a3 | ||
|
9fdfebf00d | ||
|
f366479c16 | ||
|
0bd1d2b291 | ||
|
829830c0fa | ||
|
0e0976c7f5 | ||
|
611524cdda | ||
|
ec8b6f9dd2 | ||
|
c410aed672 | ||
|
4946683b23 | ||
|
694b627309 | ||
|
1f67aa34d3 | ||
|
da733f9f8a | ||
|
0ac3d3727b | ||
|
9a3d7e416a | ||
|
4bac98d39a | ||
|
c4c0e0206f | ||
|
fe18b61688 | ||
|
5c0c59044f | ||
|
60793798c7 | ||
|
960f2c283e | ||
|
e406aa6e45 | ||
|
5873ab63ba | ||
|
5a54be2e2e | ||
|
be46d870aa | ||
|
c7e12c98b5 | ||
|
b126ba1370 | ||
|
f98a8847e3 | ||
|
21f47f21aa | ||
|
8e55967db3 | ||
|
72f79e8bef | ||
|
8ee9cb10c2 | ||
|
fe4f6d2308 | ||
|
c073d4c0d0 | ||
|
2502c4024a | ||
|
8e39aed4b6 | ||
|
14c00f50fc | ||
|
22fab3761a | ||
|
8a976ef24b | ||
|
d1f465e6cc | ||
|
c539c38699 | ||
|
f506cf615b | ||
|
ea0851eb94 | ||
|
d3a8e95962 | ||
|
5338457ea0 | ||
|
85924aba92 | ||
|
4cb9adc9ea | ||
|
9a00143623 | ||
|
96e2bb0b1a | ||
|
f05574f579 | ||
|
452eee6767 | ||
|
ee072343f5 | ||
|
0b9f4a5e1d | ||
|
1d5b16395f | ||
|
35f6043d06 | ||
|
db515d48c1 | ||
|
53fc6a7af9 | ||
|
11d411c9a9 | ||
|
89e256e563 | ||
|
ea06d4f88e | ||
|
da1e981948 | ||
|
ad6122a5b6 | ||
|
41806b5e82 | ||
|
ab0a48ab31 | ||
|
3bb82e55bf | ||
|
e935423814 | ||
|
bcfd1bd135 | ||
|
d64d07aee5 | ||
|
3fb89a81bc | ||
|
7139711314 | ||
|
86c1550850 | ||
|
3d4ba20150 | ||
|
ef40027502 | ||
|
bcb46fc54a | ||
|
b8542c6754 | ||
|
dea0cad252 | ||
|
404129f60e | ||
|
f41c835e91 | ||
|
0819dcb29e | ||
|
b62473ae79 | ||
|
4fcaac3865 | ||
|
11eb9c7783 | ||
|
2e8c4563aa | ||
|
a1e3ff3ed8 | ||
|
a9ff6ab026 | ||
|
3e23392a0e | ||
|
cb5e598e95 | ||
|
f7a6fbd901 | ||
|
ddb7a16fb8 | ||
|
7e72d57be7 | ||
|
abd2c19bf2 | ||
|
a765d7fc7d | ||
|
f3c7ab337d | ||
|
46a6cf6adf | ||
|
1418645e15 | ||
|
dfe7385611 | ||
|
8b01ca502e | ||
|
7500bbeaad | ||
|
b74e4452dd | ||
|
7e6e4ecfab | ||
|
69237fce85 | ||
|
c619eba8cf | ||
|
d69b78469c | ||
|
f6f29adacc | ||
|
c13daedcb0 | ||
|
7177fc1a03 | ||
|
fb3c090de2 | ||
|
ba7e86ac8d | ||
|
025ab16668 | ||
|
038b101ed7 | ||
|
78d7d556e4 | ||
|
763e1cd5de | ||
|
0c05ff459c | ||
|
5e39eb8f6c | ||
|
4b92903ddd | ||
|
4022c6121b | ||
|
012ef2b215 | ||
|
1e9cdbafd4 | ||
|
fd17ffecfb | ||
|
c261b9fb23 | ||
|
9304ca330e | ||
|
abd62373e5 | ||
|
1435c2c9a2 | ||
|
695bdec9fe | ||
|
b3dabc2054 | ||
|
d38c52d311 | ||
|
c582b723bd | ||
|
1a14719483 | ||
|
92e82a76c7 | ||
|
e02163b0ff | ||
|
eca5308742 | ||
|
41d82c4cdd | ||
|
e08aa7df88 | ||
|
49df21e465 | ||
|
1da35be148 | ||
|
e56b15237e | ||
|
f515407491 | ||
|
cfa686867c | ||
|
6ba2deffef | ||
|
005580f385 | ||
|
8f44cc21db | ||
|
824e66a62f | ||
|
94f6c99ea6 | ||
|
db202b23ae | ||
|
cc506756a1 | ||
|
4ee15005f5 | ||
|
fd12baae3b | ||
|
ad868818c7 | ||
|
191613adbe | ||
|
b8c01272f4 | ||
|
93e77a3fcd | ||
|
03a913629f | ||
|
71d0124146 | ||
|
f7d6569154 | ||
|
b40f946b85 | ||
|
ee1f1500e9 | ||
|
9ed6cd57f3 | ||
|
168b1d6247 | ||
|
b469c4299f | ||
|
bcaf84e545 | ||
|
d0f70cbdf9 | ||
|
dec0683145 | ||
|
b42f7e1a36 | ||
|
8b6ff533e8 | ||
|
6527a0c677 | ||
|
97854423c4 | ||
|
5f1346568d | ||
|
ce647e78ce | ||
|
80fff87950 | ||
|
09aba78803 | ||
|
dbaef5117a | ||
|
eee1be1ceb | ||
|
bb6417dab9 | ||
|
5984e8dd6d | ||
|
787308375c | ||
|
575f3fa966 | ||
|
299294daff | ||
|
3fa0f234bb | ||
|
20ae21ead5 | ||
|
366d3761b8 | ||
|
b148368d5b | ||
|
7557e2f437 | ||
|
668c0aff36 | ||
|
38b465cb9d | ||
|
c46c330efb | ||
|
061f44f475 | ||
|
a4a7c23148 | ||
|
eb35f46214 | ||
|
a273b25bac | ||
|
e2fd90bdc2 | ||
|
197c247044 | ||
|
52957beb82 | ||
|
3c7ccc90b2 | ||
|
c585d76ce5 | ||
|
1a5a64864a | ||
|
e125599a47 | ||
|
48588687a5 | ||
|
a1d24894eb | ||
|
442d4cce03 | ||
|
18562d30d8 | ||
|
4d19f8d21d | ||
|
8991632105 | ||
|
b153613200 | ||
|
616d701ebb | ||
|
0e750db9ae | ||
|
d1345d0f83 | ||
|
81f06f565e | ||
|
12305be06a | ||
|
1fc1d2c79b | ||
|
11fba12083 | ||
|
0703cf8915 | ||
|
5bea8130f2 | ||
|
9f99cf4b1e | ||
|
8092713faa | ||
|
f000e98619 | ||
|
64f1abdfed | ||
|
4312610e7d | ||
|
70d64f38eb | ||
|
cad884aa41 | ||
|
a77ef02677 | ||
|
cbee498d41 | ||
|
bf84b59e39 | ||
|
099f99a96b | ||
|
fd54539e1c | ||
|
150f58a6b3 | ||
|
ce5409dc26 | ||
|
9099a76f45 | ||
|
bbcf0d2572 | ||
|
94635a18e0 | ||
|
4f10174e48 | ||
|
3b629622d9 | ||
|
e5c1094153 | ||
|
e161f61319 | ||
|
5e4db2f5dc | ||
|
1772fc04f9 | ||
|
4f05d9a5b7 | ||
|
97e484b8e6 | ||
|
e50b503897 | ||
|
88a1e34987 | ||
|
7b811aa927 | ||
|
e10b455b27 | ||
|
75ee509361 | ||
|
6bdbbee83e | ||
|
81a721f880 | ||
|
1d9709d4e3 | ||
|
757e08c62c | ||
|
cb051ad161 | ||
|
e2443a8b09 | ||
|
b2f2d51594 | ||
|
0c5d118bfd | ||
|
dd9a19b7f0 | ||
|
4005d70bb9 | ||
|
fa67c5e248 | ||
|
95512b5144 | ||
|
6086d157e2 | ||
|
2c0176f3f2 | ||
|
f3f1436bb0 | ||
|
f917730a21 | ||
|
efd37d811f | ||
|
008f3601ca | ||
|
332fbdda84 | ||
|
7fbcf89539 | ||
|
eb870cfc23 | ||
|
fcc2afba08 | ||
|
04065847dc | ||
|
c6f3b1fbbe | ||
|
4700009c68 | ||
|
4c962943b2 | ||
|
0d63ce9a3a | ||
|
5b74038912 | ||
|
b2448e1207 | ||
|
37e052c061 | ||
|
a4bcb21a85 | ||
|
7f922afe79 | ||
|
04933acbfb | ||
|
a3587a80c6 | ||
|
986f04aac0 | ||
|
9074caf443 | ||
|
65bd74442f | ||
|
98ef6f4321 | ||
|
a3271fb916 | ||
|
8d254c91e3 | ||
|
3273682155 | ||
|
d3d65d89ba | ||
|
f1fe17fe65 | ||
|
040c744b6a | ||
|
00dbd3db06 | ||
|
1e96b58f85 | ||
|
426d0779ee | ||
|
02d79b52a4 | ||
|
2dcec6343d | ||
|
d782c9e0bb | ||
|
eab6ca3baf | ||
|
9ac415fa4f | ||
|
b5480b018b | ||
|
4edc58ebcf | ||
|
ecd5505af9 | ||
|
37367cde65 | ||
|
20a250dfc0 | ||
|
c65e26ec4c | ||
|
91f083a245 | ||
|
b0535b5d7d | ||
|
c96abc8892 | ||
|
f42553f8cb | ||
|
ee29d7f799 | ||
|
653fcbbb1f | ||
|
0a4f8aff79 | ||
|
a23e2c361a | ||
|
d502a7f911 | ||
|
aece82dff6 | ||
|
6f1b77b6fa | ||
|
0ea2843454 | ||
|
191eb09a76 | ||
|
0d11f85ab3 | ||
|
9a605cc6c6 | ||
|
c3333f5fe8 | ||
|
ddaa9b46c0 | ||
|
7e38c3ea88 | ||
|
98d8d44695 | ||
|
439910f6ca | ||
|
96959a3c4c | ||
|
e39572b98b | ||
|
986271d02a | ||
|
c7fd0fac07 | ||
|
c7ba472042 | ||
|
9e9099f5d0 | ||
|
4d79279f42 | ||
|
e4a1c99615 | ||
|
670d9a5e66 | ||
|
0685fa2622 | ||
|
206d18f498 | ||
|
2ebadb36c3 | ||
|
c3848ff56b | ||
|
280de98858 | ||
|
3e47877645 | ||
|
47e74bd598 | ||
|
33655ee37e | ||
|
65eb1f7b7d | ||
|
7691b28503 | ||
|
bb6905bdcd | ||
|
23321b4c76 | ||
|
919542f8fc | ||
|
b7402ce43c | ||
|
8bf160dfc0 | ||
|
2878208e94 | ||
|
4ef5afc011 | ||
|
dde26da5a6 | ||
|
ff370d03db | ||
|
05cc1f6757 | ||
|
d91282a767 | ||
|
3e2b7ba5fa | ||
|
1385a22e60 | ||
|
cc444fa207 | ||
|
eab3c2d6dd | ||
|
8d4d9c6e8d | ||
|
2eb2e4e9b3 | ||
|
bb8acbefa3 | ||
|
20abb01ee8 | ||
|
b722691e85 | ||
|
2152d5e833 | ||
|
b94ab42c90 | ||
|
b05345ee27 | ||
|
a78e9af8fc | ||
|
41fb30c68b | ||
|
36a35d92f0 | ||
|
46bfab3eb7 | ||
|
934839574e | ||
|
09cfd2a10a | ||
|
ecde6ed919 | ||
|
eec7ceb765 | ||
|
a39d26a3e0 | ||
|
41b4c31a7f | ||
|
b83613924c | ||
|
711b5be07f | ||
|
5562e7cd74 | ||
|
fef0832074 | ||
|
d965d57be7 | ||
|
0c4c018ceb | ||
|
d2f5b412ac | ||
|
365bd5cad0 | ||
|
84ecaa2ee1 | ||
|
4a8a6168cd | ||
|
d8acf63e1d | ||
|
563847bba9 | ||
|
88a45470ba | ||
|
09bf0f3b4e | ||
|
1bb61d02de | ||
|
31075d601f | ||
|
2194c1b8bd | ||
|
928d3b5eda | ||
|
d5e8481e22 | ||
|
d9de28b2e7 | ||
|
aa2e1aad19 | ||
|
cef94fea45 | ||
|
bf951bd322 | ||
|
c3754fdbd4 | ||
|
87ebdbb0b4 | ||
|
8369dcef5f | ||
|
ffb6cb372a | ||
|
cf6e14ed8b | ||
|
6a5679a338 | ||
|
edbac25613 | ||
|
8dfed73524 | ||
|
7a96f84cab | ||
|
15f6ab8b7e | ||
|
addddf1f26 | ||
|
13a4a0169c | ||
|
25ce06c9d5 | ||
|
dc2e21495b | ||
|
8196a02f9d | ||
|
00231443d3 | ||
|
2bd7c23076 | ||
|
d68d14358f | ||
|
492a8fe359 | ||
|
5d35caf85f | ||
|
606d40c9d4 | ||
|
23459aad52 | ||
|
128f9812a6 | ||
|
245b5458d0 | ||
|
f8f1d49c56 | ||
|
57288f75b0 | ||
|
d4373eb309 | ||
|
d66cdc97cd | ||
|
5f5f83912d | ||
|
2e34668b91 | ||
|
762ed96a3b | ||
|
447b98ce6c | ||
|
0596ca06b1 | ||
|
63b371b6ef | ||
|
fa37e8fedb | ||
|
ab6b87987b | ||
|
849a02cec2 | ||
|
6a5d856093 | ||
|
5b0675b711 | ||
|
95a680eb83 | ||
|
57d9916746 | ||
|
7f41993648 | ||
|
b3749f2d92 | ||
|
5afcfc3e9b | ||
|
43c082475b | ||
|
2b0fa22c8a | ||
|
63e948fc80 | ||
|
100e056d55 | ||
|
f82e873da8 | ||
|
fc898f8c7e | ||
|
ba11cdd83f | ||
|
3f99b7247c | ||
|
bbf9832d6a | ||
|
13ac41b264 | ||
|
2da7ef4280 | ||
|
5e9ce365bf | ||
|
c6e2607f1f | ||
|
a8e43d4850 | ||
|
a93b1af047 | ||
|
afc3db2f33 | ||
|
2b5dcff836 | ||
|
56495c9d13 | ||
|
15048bd9c3 | ||
|
da02b5fe2d | ||
|
ca4d09e923 | ||
|
a5d5c55835 | ||
|
ce7147e463 | ||
|
cb622be653 | ||
|
af45810582 | ||
|
b55efb7f11 | ||
|
c934049523 | ||
|
bc09ed8bf6 | ||
|
54478e6940 | ||
|
11b30e7eda | ||
|
e08f8630df | ||
|
9de506d2a7 | ||
|
c3fb35848b | ||
|
619cf9bcbb | ||
|
f271517446 | ||
|
8a8c5569dc | ||
|
9721432a8c | ||
|
4ce66fc8a1 | ||
|
618a32e6c0 | ||
|
df9e886f32 | ||
|
b655c34bbb | ||
|
780ad44032 | ||
|
94b0bc82ef | ||
|
814e92ad92 | ||
|
39bed4b0fc | ||
|
9b923d337d | ||
|
edaac9f436 | ||
|
b31dc38af1 | ||
|
ab841a84a3 | ||
|
3e42231e7a | ||
|
e6c0df5ab2 | ||
|
3649bf1f04 | ||
|
7ea38a3f4c | ||
|
ce2acfc659 | ||
|
145d7f6f47 | ||
|
9df18b839e | ||
|
fa7e24fed7 | ||
|
1f17edc248 | ||
|
eb8fdf5c27 | ||
|
870cf62ab6 | ||
|
df8686099f | ||
|
7488e0398c | ||
|
c3ef801566 | ||
|
d567664d8b | ||
|
2c7ea44afd | ||
|
dd880529ac | ||
|
1bec1033d1 | ||
|
63620ce59a | ||
|
4c5be997fe | ||
|
754e7e7bb2 | ||
|
f92b1df4fc | ||
|
54798d3079 | ||
|
32e47bc660 | ||
|
3724fc6765 | ||
|
2cf100efaa | ||
|
c04a8140a3 | ||
|
03be63572d | ||
|
3acb3bb48c | ||
|
9679058081 | ||
|
72f58b6001 | ||
|
1d63799c9b | ||
|
11d551f8a3 | ||
|
d671bcec31 | ||
|
a4d3b5f013 | ||
|
c62eff71a9 | ||
|
8ff1f91d2c | ||
|
c3b5c8750e | ||
|
1c8fb0a7b5 | ||
|
645470cd03 | ||
|
ce976226f9 | ||
|
67714040e7 | ||
|
fa64fcce2d | ||
|
054c51b82f | ||
|
01b8b397b6 | ||
|
4f1149c1a7 | ||
|
1ef6a91cf1 | ||
|
f5f25c3019 | ||
|
c153f4a3e2 | ||
|
41f77f33af | ||
|
62bb891e79 | ||
|
59a74dbd9f | ||
|
78946a953a | ||
|
0e270f4cb9 | ||
|
56699baaf1 | ||
|
86d60496c0 | ||
|
402a5e5d54 | ||
|
93c08c16c1 | ||
|
2ccd0c8def | ||
|
10ac1dc29c | ||
|
b30b62416c | ||
|
5d139dff43 | ||
|
e233caf7ac | ||
|
2d2ec25f86 | ||
|
f331d84292 | ||
|
851e8d34a4 | ||
|
00bcdbab37 | ||
|
d7e8529a6e | ||
|
bb74656348 | ||
|
2e657fbbbd | ||
|
55b7c55efe | ||
|
afd33f4b77 | ||
|
9d898bdf47 | ||
|
b521797f4d | ||
|
ef15968a3d | ||
|
c6d7cef491 | ||
|
31740f4ec6 | ||
|
6f0362802a | ||
|
027f6020e7 | ||
|
e20810b0cb | ||
|
ca84f485ab | ||
|
7be9f93909 | ||
|
1738a0ea3c | ||
|
03208b88d5 | ||
|
a0e3848cf6 | ||
|
8b8214cd1b | ||
|
965700272b | ||
|
dbe76e973e | ||
|
82a1b37363 | ||
|
e3c1644d09 | ||
|
9ea0138ffd | ||
|
be7934057e | ||
|
51d13fd8d2 | ||
|
6bb9140720 | ||
|
00d4dc9518 | ||
|
24731687dc | ||
|
e775ed12b4 | ||
|
2087059c0b | ||
|
3830a95af2 | ||
|
86f4b6186a | ||
|
e4a143659c | ||
|
051771397c | ||
|
3beaf88a8b | ||
|
070bc96186 | ||
|
577883a1d4 | ||
|
03b971d898 | ||
|
99d5467ad1 | ||
|
79d97737bc | ||
|
17be7c4f4d | ||
|
fc3b391aa9 | ||
|
55f2d79d07 | ||
|
787d438a74 | ||
|
dca649dfd4 | ||
|
06a6cae4af | ||
|
bbeb0a5764 | ||
|
2f883d049c | ||
|
9ca0d93a01 | ||
|
32fd1eb318 | ||
|
3c46a07a1e | ||
|
1216378783 | ||
|
06868abdb2 | ||
|
a8d4ee0dd6 | ||
|
6c58c61da9 | ||
|
6bb8e2fa43 | ||
|
1b83ae7d8a | ||
|
243d105aad | ||
|
3143f2a791 | ||
|
36f54420cf | ||
|
030b6837ef | ||
|
7e450071b1 | ||
|
8c2ae863fd | ||
|
f16c08f13e | ||
|
a12f10dc3c | ||
|
00d8f81bdd | ||
|
15080edfa7 | ||
|
45837f7377 | ||
|
7defd4a02b | ||
|
08ba4577f6 | ||
|
9546b13821 | ||
|
07535eedca | ||
|
1258aaee7c | ||
|
f6957278c3 | ||
|
644698aed7 | ||
|
89461bf69a | ||
|
12da71f731 | ||
|
bcfc4d1fd7 | ||
|
184480ad36 | ||
|
d4d7adc7fc | ||
|
c2716a061b | ||
|
2cfe7034e8 | ||
|
b13bfee3d8 | ||
|
85385295a6 | ||
|
517a7516b7 | ||
|
57725e745e | ||
|
9e78f8382a | ||
|
a28b2b74d2 | ||
|
08bafad206 | ||
|
d804a93df3 | ||
|
4525daee83 | ||
|
64cca3b874 | ||
|
61c96acc7a | ||
|
dd046d8287 | ||
|
10053efc0c | ||
|
1a473f7f4a | ||
|
408fc29314 | ||
|
62231b7833 | ||
|
57b6c45e34 | ||
|
1104317a76 | ||
|
31a9da09b2 | ||
|
5e9f728346 | ||
|
452a0e7bda | ||
|
9312f71764 | ||
|
0298f31ec7 | ||
|
ad3b7f7f00 | ||
|
e1d4c75d18 | ||
|
b35b6ec496 | ||
|
bfaeffcb51 | ||
|
3bc21c75d8 | ||
|
04a1d89907 | ||
|
870ed3f211 | ||
|
aea59f8974 | ||
|
25e0211ca1 | ||
|
fe9f0f7692 | ||
|
b23ec5ef70 | ||
|
e850874019 | ||
|
15dfb6c202 | ||
|
ef6f10c5a2 | ||
|
1c5b953026 | ||
|
025320b83e | ||
|
396ec4dfd9 | ||
|
c47b27428b | ||
|
f4f153ac4b | ||
|
a9838fed06 | ||
|
fbe255f837 | ||
|
441bb4d5d7 | ||
|
34cca2ba0f | ||
|
1f36122283 | ||
|
799ea50c68 | ||
|
32d9f6e830 | ||
|
a95df54978 | ||
|
15fba7a07d | ||
|
781235cb07 | ||
|
f902f255a4 | ||
|
b6573258fb | ||
|
87defbfb51 | ||
|
fd454f1e20 | ||
|
86e8b27cb3 | ||
|
aaf4e79a73 | ||
|
9b9e6fceda | ||
|
bb6664a9a8 | ||
|
ab8111f847 | ||
|
55b576a299 | ||
|
bd748549f7 | ||
|
47b2eb0bdb | ||
|
f2d7f5e4da | ||
|
827075bc37 | ||
|
847738a76c | ||
|
b9f145caa4 | ||
|
b77d0f75ce | ||
|
d289a44624 | ||
|
2e9ddf9c2c | ||
|
ec0de15da6 | ||
|
ff4abbc5ba | ||
|
4e3127c4cf | ||
|
20f4474eb6 | ||
|
35992ac2fc | ||
|
b4ad6142f4 | ||
|
ac312cbdc7 | ||
|
76933e51aa | ||
|
1cf49688d6 | ||
|
16df40331b | ||
|
bfb7f58a3d | ||
|
f596b34cac | ||
|
1d3a2aca0e | ||
|
0dc796b863 | ||
|
9961d3e4fc | ||
|
7e2870acef | ||
|
0cc95f5083 | ||
|
16f275ca34 | ||
|
a91a584201 | ||
|
9c19fa5c63 | ||
|
ad5d7fc9f0 | ||
|
a5e6294593 | ||
|
465e0c191f | ||
|
5ce138539b | ||
|
bb1c64e1ac | ||
|
ee98eaa640 | ||
|
5876e5200b | ||
|
4560e0e491 | ||
|
09ac503e22 | ||
|
d1dc4c9e9c | ||
|
a072426e07 | ||
|
de125441d1 | ||
|
39c772300a | ||
|
81a35639ba | ||
|
7c4a6fbe4b | ||
|
03d92b687e | ||
|
76e65c0bfd | ||
|
7ecb4f9678 | ||
|
33f1ba686c | ||
|
766ce4e217 | ||
|
c85b2ca3c9 | ||
|
357ce21678 | ||
|
16fda4dde0 | ||
|
050d603812 | ||
|
3cf86999a6 | ||
|
d414fb6b94 | ||
|
ba38ce7976 | ||
|
b852feeb9c | ||
|
4b19e3c498 | ||
|
4d0ad04f7b | ||
|
606e30fed2 | ||
|
c604c31032 | ||
|
c36e812360 | ||
|
2b1f4866a9 | ||
|
2341748023 | ||
|
fe6f0c9b48 | ||
|
e17fb24bd8 | ||
|
13f20cdd26 | ||
|
6802f0720e | ||
|
dce13f67dd | ||
|
bdc8451c4a | ||
|
9e697c6cbe | ||
|
f976eeaf13 | ||
|
d8d97c40f7 | ||
|
aee904fd8c | ||
|
863f659774 | ||
|
521894f401 | ||
|
813be758d7 | ||
|
f67ccc18f4 | ||
|
6f37c232f7 | ||
|
f5db6babf2 | ||
|
d94aeff98c | ||
|
ced98d02d5 | ||
|
141cf95eac | ||
|
ca9663d2f5 | ||
|
cd93077731 | ||
|
97030f7ef3 | ||
|
1ac36cbd23 | ||
|
1505f2d101 | ||
|
334e7c0893 | ||
|
10e9e7388f | ||
|
c06659c0be | ||
|
010b782a96 | ||
|
110f0821f0 | ||
|
3f36ea04f4 | ||
|
5a54eda512 | ||
|
8894329fa3 | ||
|
3767060632 | ||
|
6bdf7f1ee9 | ||
|
37bb078547 | ||
|
c74a829ae4 | ||
|
14ed5fd1e8 | ||
|
f4bb95f459 | ||
|
2a0045bed7 | ||
|
cd615265f8 | ||
|
c06b9cd886 | ||
|
2cba223995 | ||
|
07fc49e371 | ||
|
fb6f31d958 | ||
|
b3680af342 | ||
|
889ca05506 | ||
|
e54a707684 | ||
|
f98369c4d6 | ||
|
a70a38f481 | ||
|
bc763e2a19 | ||
|
165532be30 | ||
|
0b3f2a7fa0 | ||
|
f91abe4301 | ||
|
2de61c5928 | ||
|
73c433ec3d | ||
|
c9642cc98c | ||
|
178790d816 | ||
|
a8ca82ca4d | ||
|
76fdbbb2fe | ||
|
d5b12fa7f9 | ||
|
f92f3b2c21 | ||
|
3313d0623a | ||
|
dbddba3691 | ||
|
bddf6ba6ae | ||
|
725098f262 | ||
|
8fcf7f8c7f | ||
|
7b9904e423 | ||
|
630e61a674 | ||
|
f764323c80 | ||
|
d4fc08c06b | ||
|
1b0f175b02 | ||
|
2fb255d2ec | ||
|
13bf4aadc6 | ||
|
5db3b28e3a | ||
|
95b1804a8d | ||
|
65953f5b18 | ||
|
f496aff478 | ||
|
3d1ddccbd8 | ||
|
c2df9df6d4 | ||
|
5a4afc8f4b | ||
|
f691c0c0ef | ||
|
ffdec16076 | ||
|
eba537a01f | ||
|
017d3818eb | ||
|
5d71b655ad | ||
|
eba4d8a28b | ||
|
25cf72a9b6 | ||
|
ab732bcfbe | ||
|
1348611f9f | ||
|
5d55f6d78c | ||
|
d88720a18f | ||
|
2b24de838a | ||
|
325d237302 | ||
|
8684d6b5e5 | ||
|
fcc06b2754 | ||
|
744ac6b885 | ||
|
7ba979eee6 | ||
|
f2dc7728a5 | ||
|
96f060c0a9 | ||
|
86dfbbb0c9 | ||
|
a9027e1fee | ||
|
4b62e0a2ce | ||
|
d7b3d50a13 | ||
|
bc2e7a7366 | ||
|
ebca3935c5 | ||
|
8100c70e88 | ||
|
e79e4b525d | ||
|
f82f03c1ec | ||
|
9506bf1b81 | ||
|
a672b0c78a | ||
|
e8c8455f43 | ||
|
948249bb3d | ||
|
c8265b2358 | ||
|
9bc1d38d73 | ||
|
35e6dffd0b | ||
|
c6ff56a942 | ||
|
ee6f3e5457 | ||
|
b955cac7ce | ||
|
299fcfd4d1 | ||
|
b4f4594ead | ||
|
0bd0f788e3 | ||
|
351af76da6 | ||
|
8cd6a7988a | ||
|
0b211e8e1c | ||
|
f9979b1a77 | ||
|
2d4003379e | ||
|
2a106c5053 | ||
|
30b056af1c | ||
|
30525cf391 | ||
|
3678045e8d | ||
|
a3987a655e | ||
|
ed7d12b90f | ||
|
0052a11a1e | ||
|
0c0a4011f7 | ||
|
cd4175c559 | ||
|
bf9b69ba2a | ||
|
8791c0bf9c | ||
|
cfb521ef10 | ||
|
b37a586094 | ||
|
f4a7782298 | ||
|
e97ed9ae45 | ||
|
49fc971d67 | ||
|
f98f690b49 | ||
|
4e0bd16a4e | ||
|
f0c0c3e084 | ||
|
7af22da587 | ||
|
c1c8f11bf7 | ||
|
5682e715e6 | ||
|
d08c41c13a | ||
|
e820f0e7b9 | ||
|
db8de005a7 | ||
|
1800d5cffb | ||
|
e603e4b455 | ||
|
6ad778d27b | ||
|
4b075e582e | ||
|
571bedd76d | ||
|
ea66b75b86 | ||
|
932d26ed8c | ||
|
e0d14207ac | ||
|
771719857d | ||
|
4445b1ee01 | ||
|
aa23672694 | ||
|
423a0664cd | ||
|
f8264f1726 | ||
|
f5bba54fd4 | ||
|
b012b1dc99 | ||
|
961d0cb224 | ||
|
ae5f1050ac | ||
|
6771303086 | ||
|
404dbcd065 | ||
|
e7598b9c76 | ||
|
30481a5a9e | ||
|
f3c49e51f2 | ||
|
43547e0901 | ||
|
7f1cdf6841 | ||
|
3671574547 | ||
|
3bfe52b1dc | ||
|
9702c4fd64 | ||
|
8d7cb2a39a | ||
|
e85844f482 | ||
|
56db210763 | ||
|
e29bc6710a | ||
|
c6db23bcfb | ||
|
3fa2d22015 | ||
|
e191880379 | ||
|
265a9bd993 | ||
|
10003e7d3a | ||
|
8d080163b3 | ||
|
061e7abd50 | ||
|
8a39c16a38 | ||
|
a536ea7742 | ||
|
a33200d926 | ||
|
fb446167f6 | ||
|
37151dc06b | ||
|
5c02735ff7 | ||
|
8208464653 | ||
|
e1821b1753 | ||
|
6f6346d5c3 | ||
|
e1eb313ffa | ||
|
c18a7175b7 | ||
|
0eb2b4fe6b | ||
|
42654dbd4f | ||
|
62863c5eaf | ||
|
856001160b | ||
|
5b14d14286 | ||
|
636208a321 | ||
|
b43754da6a | ||
|
6921e9cd21 | ||
|
1e209b8613 | ||
|
5d8d139f44 | ||
|
afc7902324 | ||
|
139ffc9548 | ||
|
b63ad629a7 | ||
|
48c361531d | ||
|
376e59820c | ||
|
1093895133 | ||
|
29df61eb8a | ||
|
87296f434a | ||
|
41ecf1db8e | ||
|
ee8886f7c2 | ||
|
23b8ba7e54 | ||
|
a372836a64 | ||
|
86011b42e3 | ||
|
113b47540a | ||
|
851c469727 | ||
|
ba4fa1ee3e | ||
|
61adca3b10 | ||
|
0cbf6008a2 | ||
|
7b7907add0 | ||
|
dd38fc13d7 | ||
|
57bb75e864 | ||
|
ef1e867dee | ||
|
67ddcaa468 | ||
|
c6c96a611a | ||
|
a8df30016b | ||
|
17451b7bd6 | ||
|
ed1b37d251 | ||
|
b2621b3001 | ||
|
0a4d72b011 | ||
|
94cc8b99b0 | ||
|
f0d9d13f4e | ||
|
3a8badb3e7 | ||
|
364295c7a9 | ||
|
417e920ea0 | ||
|
068d25266c | ||
|
b5eb0e752b | ||
|
5652b78c50 | ||
|
204cc25304 | ||
|
656637e5e2 | ||
|
f4a3b64da0 | ||
|
08622699f6 | ||
|
c5c0a181ff | ||
|
ad0c813833 | ||
|
f2f9162b85 | ||
|
cfc17ad176 | ||
|
bd85dc2393 | ||
|
cd68bb7b3f | ||
|
8539b0c893 | ||
|
dea11845f5 | ||
|
499efb5ce0 | ||
|
e590b573fb | ||
|
9f9de0988e | ||
|
7524a912c3 | ||
|
f321968ac3 | ||
|
e14929bd4f | ||
|
cc916b80de | ||
|
d201d2c9de | ||
|
e9ce87ed9b | ||
|
69feb40075 | ||
|
560918e373 | ||
|
19df43ca3c | ||
|
be1650defc | ||
|
17c2fad4b4 | ||
|
6b527cef65 | ||
|
7e05e4e109 | ||
|
c179bc0aac | ||
|
d39c3812b2 | ||
|
5bec4d5a72 | ||
|
630ac40f05 | ||
|
0ccf735148 | ||
|
b28eefb2db | ||
|
c3637def2e | ||
|
2dd8803efc | ||
|
338f628627 | ||
|
90cfcad5f1 | ||
|
59928432df | ||
|
1f91fa9a94 | ||
|
e629a93edd | ||
|
ee4a382578 | ||
|
5d67db0c5e | ||
|
7dc3707871 | ||
|
48569c28bc | ||
|
4defbe1322 | ||
|
78805f0a65 | ||
|
510d5ab2cd | ||
|
704708bd6c | ||
|
07f8500d29 | ||
|
1183305d71 | ||
|
42780df94f | ||
|
a53c25d2ae | ||
|
e6c108c6e0 | ||
|
f65db338cf | ||
|
89139bba30 | ||
|
c0a03858eb | ||
|
bbab1e9ecc | ||
|
2bb7b3b598 | ||
|
0763410aa1 | ||
|
4c2abcf9c7 | ||
|
91bd5f638c | ||
|
b81ff4b734 | ||
|
105df9d64a | ||
|
e515548037 | ||
|
89599e9f87 | ||
|
e49639fda2 | ||
|
b6938dffdb | ||
|
ac1bbb3937 | ||
|
922770e22d | ||
|
644dcc9b77 | ||
|
430da8766f | ||
|
1e19c491b9 | ||
|
977b9c282d | ||
|
ff6ae86af6 | ||
|
311b239ea1 | ||
|
a9a27133b9 | ||
|
1c4818cf1d | ||
|
669865f8db | ||
|
908a119dc9 | ||
|
2f0f168c6e | ||
|
4cf66b8e61 | ||
|
b7aca076ba | ||
|
7bf02f42b7 | ||
|
83d54351b1 | ||
|
45dd539179 | ||
|
3eec897630 | ||
|
9ab81eea02 | ||
|
764cddcdec | ||
|
f7a07a9e79 | ||
|
628a3b65c6 | ||
|
8b8d06cf3e | ||
|
18407e17a8 | ||
|
59a92bdf97 | ||
|
0581066350 | ||
|
a23075a326 | ||
|
fba5877b3b | ||
|
f6dbb23f79 | ||
|
47147f2d46 | ||
|
6f94ca1a4a | ||
|
a930dec8db | ||
|
fd81111bfb | ||
|
91f7970d66 | ||
|
ca7c07a23c | ||
|
d1a95c664d | ||
|
671e23a123 | ||
|
6bd777e7be | ||
|
83cbe78cd6 | ||
|
1dd46b875b | ||
|
41738ad660 | ||
|
8b82c991e7 | ||
|
41fb3e742e | ||
|
0292725076 | ||
|
262cc8936e | ||
|
96e46d154c | ||
|
791b3ae04f | ||
|
d2a4242e5b | ||
|
14b3c4b701 | ||
|
9bb521986b | ||
|
6fd10b63e5 | ||
|
1ad8af34d1 | ||
|
67c3fb1910 | ||
|
6bd5692517 | ||
|
f23312b0d3 | ||
|
8b16d8bc99 | ||
|
d477be2b41 | ||
|
6384702863 | ||
|
8db7499f5a | ||
|
fd9eccec4d | ||
|
af4f3f902f | ||
|
48cd4ac95d | ||
|
91f15074be | ||
|
366f3c0bba | ||
|
e9324ad678 | ||
|
e2dd9b9f77 | ||
|
65d02072c8 | ||
|
7088b2cdc8 | ||
|
0c70a67ebb | ||
|
c289bcd097 | ||
|
32b7b1f064 | ||
|
2890a6aff7 | ||
|
9f2c7c1e32 | ||
|
c278b0f4a3 | ||
|
2cfffa015d | ||
|
a37d8c0223 | ||
|
82a9fafe8c | ||
|
d88c3f6dea | ||
|
c65e8bea11 | ||
|
d14f485292 | ||
|
98323a7099 | ||
|
2ad34c2dd2 | ||
|
f5480b7708 | ||
|
ba323c65d6 | ||
|
6fa9471292 | ||
|
2d8000d11d | ||
|
a3ca0feda9 | ||
|
21a7ec0dff | ||
|
373a42c7a8 | ||
|
4477073d6d | ||
|
fd950feb94 | ||
|
de143fdafc | ||
|
aa62a5905d | ||
|
a16b0674ad | ||
|
a4f610ad3f | ||
|
1c978f060e | ||
|
a812d07d53 | ||
|
e4fa4ded6c | ||
|
769feac73c | ||
|
fd498b3d24 | ||
|
89c66699d7 | ||
|
f13f1cd593 | ||
|
5f6ad91ff2 | ||
|
bd5771e449 | ||
|
6572377832 | ||
|
9cfb3c8e95 | ||
|
44a2febce9 | ||
|
c6ff4c2517 | ||
|
d0d1f68a9c | ||
|
5d12aef6db | ||
|
85ba1676e5 | ||
|
9708e394a0 | ||
|
e0c8be3a9a | ||
|
c696a75f88 | ||
|
16542284f3 | ||
|
b8370d53b6 | ||
|
134f018849 | ||
|
9f453c0984 | ||
|
b27f6a067f | ||
|
e112e9c2d2 | ||
|
3ab70861cc | ||
|
dc05a163df | ||
|
0003ddebb5 | ||
|
103dc53841 | ||
|
9131cf00a3 | ||
|
8642981fb8 | ||
|
72fdce4a86 | ||
|
8803b84e2b | ||
|
a3ec01385b | ||
|
f1b557f995 | ||
|
fd28b39e23 | ||
|
7e9e937742 | ||
|
fbbdaf7dfa | ||
|
57da68fb1e | ||
|
4d08e415bd | ||
|
8507a3eb16 | ||
|
5aa2c7dc5c | ||
|
5a31bc5f2b | ||
|
708893022a | ||
|
a21765757d | ||
|
581dc95c53 | ||
|
c847cfb200 | ||
|
597a57eae3 | ||
|
c9147e6b9a | ||
|
137264edcb | ||
|
7d81306a49 | ||
|
0691f34650 | ||
|
3008367307 | ||
|
68a0dd30ca | ||
|
fe6e4464fd | ||
|
d7ccdd3304 | ||
|
9afcb154cb | ||
|
6d13709fcc | ||
|
862a0ba56b | ||
|
d1e78a735a | ||
|
0405af0116 | ||
|
b69464b87d | ||
|
d55f38a9e9 | ||
|
97c3a4b8f3 | ||
|
e7ff6decbf | ||
|
c9efee77f2 | ||
|
77dca5dd55 | ||
|
932542bea0 | ||
|
fcc4c21ad2 | ||
|
ade01f6cf7 | ||
|
2ebce8eb7b | ||
|
a61d7fc68a | ||
|
a3aa25449b | ||
|
ee1e62207c | ||
|
3ed5ea8b0b | ||
|
2e3bd75fbf | ||
|
c285e66b1c | ||
|
98be9a8f4d | ||
|
1a518cdd28 | ||
|
22a88d06b4 | ||
|
03351d2e1f | ||
|
46fd769dda | ||
|
06e4dea590 | ||
|
2e0d1363c7 | ||
|
a6224135e3 | ||
|
4fd71279cf | ||
|
cbd48aa528 | ||
|
215a5de289 | ||
|
6a468a0883 | ||
|
3a6268f0c1 | ||
|
8125173420 | ||
|
f214c53fa9 | ||
|
62c8d6574c | ||
|
df8eed14aa | ||
|
df72e829bf | ||
|
08645c8bc0 | ||
|
747bc71a0e | ||
|
e574b392e1 | ||
|
f1aef6c034 | ||
|
1c20556c8d | ||
|
7459985e00 | ||
|
545a2e481a | ||
|
13f1620d88 | ||
|
a7a922680d | ||
|
2b93d50396 | ||
|
f7520bbfc0 | ||
|
14da892ea0 | ||
|
4dd303e558 | ||
|
1e1b254678 | ||
|
601bdbb25d | ||
|
446d30469b | ||
|
98d7ffe87c | ||
|
16e0f515dc | ||
|
6f09bd97b6 | ||
|
6f82d81f39 | ||
|
8f89c7b363 | ||
|
d3b7d176b8 | ||
|
1fe3f646dc | ||
|
d8f8342a10 | ||
|
1e599be142 | ||
|
6bf8e976cb | ||
|
f07b4a6554 | ||
|
ade4ba750f | ||
|
cdcdc07c06 | ||
|
8357260133 | ||
|
fb273782bf | ||
|
3e34ccb7e1 | ||
|
db102e63d2 | ||
|
7aca9e291e | ||
|
90910dae15 | ||
|
4828e141c9 | ||
|
efe6956a79 | ||
|
974f77a71d | ||
|
41d624a1ae | ||
|
753bee2509 | ||
|
90435a8fb7 | ||
|
e599d8b6fa | ||
|
74e6d018f4 | ||
|
0ca926d427 | ||
|
743cdd0bea | ||
|
c125335ef0 | ||
|
5a30855227 | ||
|
0d622164df | ||
|
fc61729cb3 | ||
|
101c7015f2 | ||
|
788bce7904 | ||
|
ddf7d01760 | ||
|
3aa1992a3f | ||
|
2fa39c51f2 | ||
|
a94b099819 | ||
|
3354d601d1 | ||
|
6b15e7e3ba | ||
|
0f71564d65 | ||
|
e290822a32 | ||
|
eaaf18fb82 | ||
|
8923758478 | ||
|
5fcf8022a1 | ||
|
3d8dfc9635 | ||
|
398a5aa4e3 | ||
|
7c2fc516bb | ||
|
19e774ce01 | ||
|
4f46854362 | ||
|
d96f8adcc7 | ||
|
a9cab44314 | ||
|
cf99f55f3d | ||
|
d504d62108 | ||
|
fd1df595c8 | ||
|
dc80276e99 | ||
|
8122d76e73 | ||
|
d3b8d7818f | ||
|
b00db1af3e | ||
|
07701117cd | ||
|
6ad7be8726 | ||
|
de83d7740b | ||
|
fa8bec0b56 | ||
|
b29b776e9f | ||
|
789a41c671 | ||
|
692fa808e4 | ||
|
7e477b3c8d | ||
|
5fe479e8a9 | ||
|
3d327b0875 | ||
|
2b2392f375 | ||
|
2333a959a2 | ||
|
e6ed518aef | ||
|
ab354e9f38 | ||
|
afbfb0c82c | ||
|
081820d8fb | ||
|
a14795e3f8 | ||
|
d1d675ed7a | ||
|
7f3e0f237b | ||
|
1780f334ea | ||
|
d9c8a6339e | ||
|
7b13e45e19 | ||
|
a360d0a2b9 | ||
|
379d65edf1 | ||
|
77a58041eb | ||
|
c8dd7b42e7 | ||
|
db5c98a706 | ||
|
4e8e9eae26 | ||
|
14d2dcbc60 | ||
|
b2d6b7014b | ||
|
6c2c29a7da | ||
|
16b3b7e282 | ||
|
83ac3eccc5 | ||
|
56e51fc2aa | ||
|
927e8134d3 | ||
|
33627edcb3 | ||
|
35e85c55e0 | ||
|
7b86b483ed | ||
|
3ab68ef438 | ||
|
1289f065d6 | ||
|
0f8f558889 | ||
|
d48bbd122a | ||
|
35b83b7976 | ||
|
4ae622bdd3 | ||
|
41c1c9a6c3 | ||
|
c9bb18b87e | ||
|
696e7856f8 | ||
|
da9798979c | ||
|
24690f8035 | ||
|
0d54f88670 | ||
|
00bd4364f0 | ||
|
087aff4ef4 | ||
|
4fe971775c | ||
|
547241f577 | ||
|
ca0f8fd142 | ||
|
5c2425796c | ||
|
cb0ef1a1ae | ||
|
0db3842fcc | ||
|
30ffe72a7c | ||
|
35832e387a | ||
|
93e301e4fa | ||
|
4783e03871 | ||
|
868b1a1045 | ||
|
59802d1812 | ||
|
2cbe349a4d | ||
|
cdd1efe477 | ||
|
5c299c1db9 | ||
|
47a43869e6 | ||
|
c4cfb6f6d1 | ||
|
fd4b3d238f | ||
|
c2eebb9af2 | ||
|
e80f37603b | ||
|
26112fe3de | ||
|
1a331a22ec | ||
|
76028578a7 | ||
|
423a463cd6 | ||
|
dafa995429 | ||
|
b79b41adcd | ||
|
c80c369c42 | ||
|
bd959bc147 | ||
|
ddda03d82c | ||
|
61b5369f2f | ||
|
f6d9ffa7bb | ||
|
46b24c3f24 | ||
|
537972b97b | ||
|
de14d6b54b | ||
|
152a83f75f | ||
|
99ff387dec | ||
|
b9d2da736a | ||
|
1ff6d36ec3 | ||
|
7955462dda | ||
|
dc1357bb31 | ||
|
614ec08238 | ||
|
9cc7833d7a | ||
|
5a1d255d2a | ||
|
01ff806b86 | ||
|
404de53c75 | ||
|
b373a177ec | ||
|
221b94adbf | ||
|
5ab947e7de | ||
|
514095da7a | ||
|
b8dcb249ff | ||
|
ef428809b5 | ||
|
2b3d671ad0 | ||
|
75345a016b | ||
|
1de645a990 | ||
|
e878b5786e | ||
|
0bacde7f13 | ||
|
a7db44eabf | ||
|
b1cb797919 | ||
|
e70f0d3e89 | ||
|
0d6fe32f30 | ||
|
ddbe3305c8 | ||
|
2fe6f4b769 | ||
|
cac3daca72 | ||
|
c8125595a7 | ||
|
c532cb5aea | ||
|
e3fdd3a4fd | ||
|
9a3734e5ba | ||
|
7def542e21 | ||
|
84425fad5c | ||
|
2cf21573b8 | ||
|
943467cf67 | ||
|
5ae1be9a9c | ||
|
c8e4dbc1b3 | ||
|
b2e6310775 | ||
|
a04a6a83be | ||
|
08967755c3 | ||
|
8f5d678698 | ||
|
c8fd9d423d | ||
|
6a8c0b52e0 | ||
|
8dc2816d6e | ||
|
23ec98fb2f | ||
|
5bba5778c4 | ||
|
50fb99c6ed | ||
|
e93b091566 | ||
|
dff8ddb532 | ||
|
38a30bcc49 | ||
|
441bfa4890 | ||
|
4a19c8d575 | ||
|
07b6458f19 | ||
|
5ad600cd56 | ||
|
07eee8fac1 | ||
|
a6bf549d7e | ||
|
912b332c87 | ||
|
bebdaad7d4 | ||
|
c1df371a14 | ||
|
7e1531634e | ||
|
9a4d47820d | ||
|
cb7da2ba4a | ||
|
b08b7e521a | ||
|
f402e8c6c4 | ||
|
300529b7c5 | ||
|
1117c77d05 | ||
|
d5a6a4d350 | ||
|
3c7125bb88 | ||
|
93a7f9959e | ||
|
ddb14f48bf | ||
|
7d271bb35e | ||
|
060fb7af00 | ||
|
d5a52c32d6 | ||
|
37690cffe3 | ||
|
482b5f4d22 | ||
|
43d430fc98 | ||
|
f993048a2b | ||
|
e5b1cbbcd3 | ||
|
7627a2bda2 | ||
|
163ca12854 | ||
|
919357b474 | ||
|
c529df179b | ||
|
c1ecaffbae | ||
|
07fcf7e75b | ||
|
4d23529b68 | ||
|
b1f9cfd972 | ||
|
ee4c132fb4 | ||
|
c68bafde54 | ||
|
76381fbca1 | ||
|
d759e1429f | ||
|
c6cb345e16 | ||
|
3440823981 | ||
|
47dbc87e95 | ||
|
bb58fa9b6c | ||
|
18cc34c082 | ||
|
dd30f51ffe | ||
|
9cf24d910a | ||
|
6d003f9565 | ||
|
e3581c8260 | ||
|
8366b44d8c | ||
|
98a6d82820 | ||
|
706ec97296 | ||
|
9498524369 | ||
|
64290d5ae6 | ||
|
becdf656a4 | ||
|
624d341bc6 | ||
|
255559460e | ||
|
27a8ef4604 | ||
|
e175e9ac8b | ||
|
134b04c782 | ||
|
bcca23bac9 | ||
|
7f0d36cf79 | ||
|
a7ceabad37 | ||
|
86df4993e1 | ||
|
46abafdccc | ||
|
b03cbc3ae9 | ||
|
ae2f9c6332 | ||
|
4a0173e90f | ||
|
82cff84f92 | ||
|
4d616ce281 | ||
|
ece4840653 | ||
|
eb4237f6f4 | ||
|
17f84ab314 | ||
|
086bdafe9a | ||
|
7cad3b2bdb | ||
|
64f657e5a2 | ||
|
6e77ebb160 | ||
|
d53b5eefb3 | ||
|
9d41e122a0 | ||
|
a8392dc684 | ||
|
241176d6fb | ||
|
fe8c63b5f2 | ||
|
137f55b44d | ||
|
150f06b9bf | ||
|
85b451ffa1 | ||
|
5660e0f4f0 | ||
|
0a00d4c865 | ||
|
d7c25e3106 | ||
|
6cd227b82d | ||
|
0a83bf1176 | ||
|
3359d49161 | ||
|
f84f06758c | ||
|
e6a46874c4 | ||
|
c9ee5a5db2 | ||
|
015c6b1c70 | ||
|
4dfbd3f3cd | ||
|
a86b25736c | ||
|
c7370d7b01 | ||
|
2c6a3a7ce7 | ||
|
79ac939c8f | ||
|
8cf29e344b | ||
|
1d33ab20a5 | ||
|
4d604f7357 | ||
|
3704de1a26 | ||
|
da780d0aa2 | ||
|
3aead4eae2 | ||
|
ed913ca24b | ||
|
6c46cc98de | ||
|
2de406afa0 | ||
|
cb32f4201e | ||
|
9fd39ab57f | ||
|
36b56132b0 | ||
|
6375574a56 | ||
|
f58a3ee975 | ||
|
7d6fcfafa8 | ||
|
5b45c00322 | ||
|
ceac6008bc | ||
|
fe5b732c97 | ||
|
494c5cbcf0 | ||
|
06ccd74680 | ||
|
1b8e481559 | ||
|
915925d6ee | ||
|
a205ae8841 | ||
|
5752cca69c | ||
|
9d622434fb | ||
|
3cebd17cbe | ||
|
c9d8d40242 | ||
|
33aa475e18 | ||
|
caaab41e87 | ||
|
7f97c540fb | ||
|
092547bfc8 | ||
|
17fc249fa8 | ||
|
3941af93d2 | ||
|
f2fedae6aa | ||
|
fff8308259 | ||
|
1a105d391b | ||
|
b7401a148c | ||
|
8204e942d9 | ||
|
c44ab3e55e | ||
|
7c4c266fe0 | ||
|
45c62eb0e5 | ||
|
7412b3aae8 | ||
|
4ec0e67384 | ||
|
abfde76e24 | ||
|
00eade1c16 | ||
|
27ff6fc6b1 | ||
|
ab01c903a6 | ||
|
77a21c08eb | ||
|
aac67ff890 | ||
|
729e669ec8 | ||
|
f798a8bca4 | ||
|
ff09f82f81 | ||
|
0c6b6b18f1 | ||
|
192b790981 | ||
|
b4e6be638a | ||
|
b1a5362463 | ||
|
b63aaa6dcb | ||
|
23a0484ff0 | ||
|
885983c2f7 | ||
|
8b0892974d | ||
|
2f2a2ee73f | ||
|
ca6401ac46 | ||
|
12262f2824 | ||
|
75bff228ec | ||
|
a11b612640 | ||
|
b2e6e8687e | ||
|
9ea961ae53 | ||
|
c91290fac2 | ||
|
9212a1313e | ||
|
49f330279b | ||
|
f3f07a0672 | ||
|
bce46daa9c | ||
|
3325f12092 | ||
|
504371eaf3 | ||
|
8555fd5f18 | ||
|
aa5d55bbf2 | ||
|
8c4d68def9 | ||
|
a2f8731a23 | ||
|
9fad5b3b29 | ||
|
0c3ea90ab4 | ||
|
fb69688d47 | ||
|
5b04587722 | ||
|
4875095ea3 | ||
|
2855166239 | ||
|
4bc56cb41a | ||
|
47a238f498 | ||
|
f3d3e3c014 | ||
|
e763771cc2 | ||
|
96119b4e58 | ||
|
ab1fe711ad | ||
|
b00865510f | ||
|
9f6822f362 | ||
|
bba53b3477 | ||
|
0dece5b04f | ||
|
2c186554a1 | ||
|
843e3e6b1c | ||
|
0e3084cce3 | ||
|
95c6fd5a5b | ||
|
df25382616 | ||
|
b8ce97e739 |
607 changed files with 49798 additions and 13786 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
target
|
13
.eslintrc.js
13
.eslintrc.js
|
@ -9,6 +9,17 @@ module.exports = {
|
|||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "off"
|
||||
"no-console": "off",
|
||||
"no-empty": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-unused-vars": "warn"
|
||||
},
|
||||
"globals": {
|
||||
"DEFINE_VERSION": "readonly",
|
||||
"DEFINE_GLOBAL_HASH": "readonly",
|
||||
// only available in sw.js
|
||||
"DEFINE_UNHASHED_PRECACHED_ASSETS": "readonly",
|
||||
"DEFINE_HASHED_PRECACHED_ASSETS": "readonly",
|
||||
"DEFINE_HASHED_CACHED_ON_REQUEST_ASSETS": "readonly"
|
||||
}
|
||||
};
|
||||
|
|
47
.github/workflows/codechecks.js.yml
vendored
Normal file
47
.github/workflows/codechecks.js.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
# yarn cache setup from https://www.karltarvas.com/2020/12/09/github-actions-cache-yarn-install.html
|
||||
|
||||
name: Code checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v2
|
||||
- name: Install tools
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn
|
||||
- name: Get Yarn cache directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Use Yarn cache
|
||||
uses: actions/cache@v2
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
||||
- name: Install dependencies
|
||||
run: yarn install --prefer-offline --frozen-lockfile
|
||||
- name: Unit tests
|
||||
run: yarn test
|
||||
- name: Lint
|
||||
run: yarn run lint-ci
|
||||
- name: Typescript
|
||||
run: yarn run tsc
|
44
.github/workflows/docker-publish.yml
vendored
Normal file
44
.github/workflows/docker-publish.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
name: Container Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
tags: [ 'v*' ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,8 +1,13 @@
|
|||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
.DS_Store
|
||||
node_modules
|
||||
fetchlogs
|
||||
sessionexports
|
||||
bundle.js
|
||||
target
|
||||
lib
|
||||
*.tar.gz
|
||||
.eslintcache
|
||||
.tmp
|
||||
tmp/
|
||||
|
|
61
.gitlab-ci.yml
Normal file
61
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,61 @@
|
|||
image: docker.io/alpine
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
.yarn-template:
|
||||
image: docker.io/node
|
||||
before_script:
|
||||
- yarn install
|
||||
cache:
|
||||
paths:
|
||||
- node_modules
|
||||
test:
|
||||
extends: .yarn-template
|
||||
stage: test
|
||||
script:
|
||||
- yarn test
|
||||
|
||||
build:
|
||||
extends: .yarn-template
|
||||
stage: build
|
||||
script:
|
||||
- yarn build
|
||||
artifacts:
|
||||
paths:
|
||||
- target
|
||||
|
||||
.docker-template:
|
||||
image: docker.io/docker
|
||||
stage: build
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
|
||||
docker-release:
|
||||
extends: .docker-template
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
|
||||
script:
|
||||
- docker build --pull -t "${CI_REGISTRY_IMAGE}:latest" -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" .
|
||||
- docker push "${CI_REGISTRY_IMAGE}:latest"
|
||||
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
|
||||
|
||||
docker-tags:
|
||||
extends: .docker-template
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^v\d+\.\d+\.\d+$/'
|
||||
script:
|
||||
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" .
|
||||
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
|
||||
|
||||
docker-branches:
|
||||
extends: .docker-template
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
script:
|
||||
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}" .
|
||||
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}"
|
||||
|
25
.ts-eslintrc.js
Normal file
25
.ts-eslintrc.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
extends: [
|
||||
// "plugin:@typescript-eslint/recommended",
|
||||
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
rules: {
|
||||
"@typescript-eslint/no-floating-promises": 2,
|
||||
"@typescript-eslint/no-misused-promises": 2,
|
||||
"semi": ["error", "always"]
|
||||
}
|
||||
};
|
18
.woodpecker.yml
Normal file
18
.woodpecker.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
pipeline:
|
||||
buildfrontend:
|
||||
image: node:16
|
||||
commands:
|
||||
- yarn install --prefer-offline --frozen-lockfile
|
||||
- yarn test
|
||||
- yarn run lint-ci
|
||||
- yarn run tsc
|
||||
- yarn build
|
||||
|
||||
deploy:
|
||||
image: python
|
||||
when:
|
||||
event: push
|
||||
branch: master
|
||||
commands:
|
||||
- make ci-deploy
|
||||
secrets: [ GITEA_WRITE_DEPLOY_KEY, LIBREPAGES_DEPLOY_SECRET ]
|
150
CONTRIBUTING.md
Normal file
150
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,150 @@
|
|||
Contributing code to hydrogen-web
|
||||
==================================
|
||||
|
||||
Everyone is welcome to contribute code to hydrogen-web, provided that they are
|
||||
willing to license their contributions under the same license as the project
|
||||
itself. We follow a simple 'inbound=outbound' model for contributions: the act
|
||||
of submitting an 'inbound' contribution means that the contributor agrees to
|
||||
license the code under the same terms as the project's overall 'outbound'
|
||||
license - in this case, Apache Software License v2 (see
|
||||
[LICENSE](LICENSE)).
|
||||
|
||||
How to contribute
|
||||
-----------------
|
||||
|
||||
The preferred and easiest way to contribute changes to the project is to fork
|
||||
it on github, and then create a pull request to ask us to pull your changes
|
||||
into our repo (https://help.github.com/articles/using-pull-requests/)
|
||||
|
||||
We use GitHub's pull request workflow to review the contribution, and either
|
||||
ask you to make any refinements needed or merge it and make them ourselves.
|
||||
|
||||
Things that should go into your PR description:
|
||||
* References to any bugs fixed by the change (in GitHub's `Fixes` notation)
|
||||
* Describe the why and what is changing in the PR description so it's easy for
|
||||
onlookers and reviewers to onboard and context switch.
|
||||
* If your PR makes visual changes, include both **before** and **after** screenshots
|
||||
to easily compare and discuss what's changing.
|
||||
* Include a step-by-step testing strategy so that a reviewer can check out the
|
||||
code locally and easily get to the point of testing your change.
|
||||
* Add comments to the diff for the reviewer that might help them to understand
|
||||
why the change is necessary or how they might better understand and review it.
|
||||
|
||||
We use continuous integration, and all pull requests get automatically tested:
|
||||
if your change breaks the build, then the PR will show that there are failed
|
||||
checks, so please check back after a few minutes.
|
||||
|
||||
Tests
|
||||
-----
|
||||
If your PR is a feature then we require that the PR also includes tests.
|
||||
These need to test that your feature works as expected and ideally test edge cases too.
|
||||
|
||||
Tests are written as unit tests by exporting a `tests` function from the file to be tested.
|
||||
The function returns an object where the key is the test label, and the value is a
|
||||
function that accepts an [assert](https://nodejs.org/api/assert.html) object, and return a Promise or nothing.
|
||||
|
||||
Note that there is currently a limitation that files that are not indirectly included from `src/platform/web/main.js` won't be found by the runner.
|
||||
|
||||
You can run the tests by running `yarn test`.
|
||||
This uses the [impunity](https://github.com/bwindels/impunity) runner.
|
||||
|
||||
We don't require tests for bug fixes.
|
||||
|
||||
In the future we may formalise this more.
|
||||
|
||||
Code style
|
||||
----------
|
||||
The js-sdk aims to target TypeScript/ES6. All new files should be written in
|
||||
TypeScript and existing files should use ES6 principles where possible.
|
||||
|
||||
Please disable any automatic formatting tools you may have active.
|
||||
If present, you'll be asked to undo any unrelated whitespace changes during code review.
|
||||
|
||||
Members should not be exported as a default export in general.
|
||||
In general, avoid using `export default`.
|
||||
|
||||
The remaining code-style for hydrogen is [in the process of being documented](codestyle.md), but
|
||||
contributors are encouraged to read the
|
||||
[code style document for matrix-react-sdk](https://github.com/matrix-org/matrix-react-sdk/blob/master/code_style.md)
|
||||
and follow the principles set out there.
|
||||
|
||||
Please ensure your changes match the cosmetic style of the existing project,
|
||||
and ***never*** mix cosmetic and functional changes in the same commit, as it
|
||||
makes it horribly hard to review otherwise.
|
||||
|
||||
Attribution
|
||||
-----------
|
||||
If you change or create a file, feel free to add yourself to the copyright holders
|
||||
in the license header of that file.
|
||||
|
||||
Sign off
|
||||
--------
|
||||
In order to have a concrete record that your contribution is intentional
|
||||
and you agree to license it under the same terms as the project's license, we've
|
||||
adopted the same lightweight approach that the Linux Kernel
|
||||
(https://www.kernel.org/doc/Documentation/SubmittingPatches), Docker
|
||||
(https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other
|
||||
projects use: the DCO (Developer Certificate of Origin:
|
||||
http://developercertificate.org/). This is a simple declaration that you wrote
|
||||
the contribution or otherwise have the right to contribute it to Matrix:
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
If you agree to this for your contribution, then all that's needed is to
|
||||
include the line in your commit or pull request comment:
|
||||
|
||||
```
|
||||
Signed-off-by: Your Name <your@email.example.org>
|
||||
```
|
||||
|
||||
We accept contributions under a legally identifiable name, such as your name on
|
||||
government documentation or common-law names (names claimed by legitimate usage
|
||||
or repute). Unfortunately, we cannot accept anonymous contributions at this
|
||||
time.
|
||||
|
||||
Git allows you to add this signoff automatically when using the `-s` flag to
|
||||
`git commit`, which uses the name and email set in your `user.name` and
|
||||
`user.email` git configs.
|
||||
|
||||
If you forgot to sign off your commits before making your pull request and are
|
||||
on Git 2.17+ you can mass signoff using rebase:
|
||||
|
||||
```
|
||||
git rebase --signoff origin/develop
|
||||
```
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM docker.io/node:alpine as builder
|
||||
RUN apk add --no-cache git python3 build-base
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN yarn install \
|
||||
&& yarn build
|
||||
|
||||
FROM docker.io/nginx:alpine
|
||||
COPY --from=builder /app/target /usr/share/nginx/html
|
7
Dockerfile-dev
Normal file
7
Dockerfile-dev
Normal file
|
@ -0,0 +1,7 @@
|
|||
FROM docker.io/node:alpine
|
||||
RUN apk add --no-cache git python3 build-base
|
||||
COPY . /code
|
||||
WORKDIR /code
|
||||
RUN yarn install
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["yarn", "start"]
|
14
Makefile
Normal file
14
Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
ci-deploy: ## Deploy from CI/CD. Only call from within CI
|
||||
@if [ "${CI}" != "woodpecker" ]; \
|
||||
then echo "Only call from within CI. Will re-write your local Git configuration. To override, set export CI=woodpecker"; \
|
||||
exit 1; \
|
||||
fi
|
||||
git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL}"
|
||||
git config --global user.name "${CI_COMMIT_AUTHOR}"
|
||||
./scripts/ci.sh --commit-files librepages target "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>"
|
||||
./scripts/ci.sh --init "$$GITEA_WRITE_DEPLOY_KEY"
|
||||
./scripts/ci.sh --deploy ${LIBREPAGES_DEPLOY_SECRET} librepages
|
||||
./scripts/ci.sh --clean
|
||||
|
||||
help: ## Prints help for targets with comments
|
||||
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
41
README.md
41
README.md
|
@ -1,6 +1,8 @@
|
|||
[![status-badge](https://ci.batsense.net/api/badges/mystiq/hydrogen-web/status.svg)](https://ci.batsense.net/mystiq/hydrogen-web)
|
||||
|
||||
# Hydrogen
|
||||
|
||||
A minimal [Matrix](https://matrix.org/) chat client, focused on performance, offline functionality, and broad browser support. This is work in progress and not yet ready for primetime. We're currently not accepting any externally reported issues (features, bug reports, ...) at this time.
|
||||
A minimal [Matrix](https://matrix.org/) chat client, focused on performance, offline functionality, and broad browser support. This is work in progress and not yet ready for primetime. Bug reports are welcome, but please don't file any feature requests or other missing things to be on par with Element Web.
|
||||
|
||||
## Goals
|
||||
|
||||
|
@ -10,16 +12,35 @@ Hydrogen's goals are:
|
|||
- It is a standalone webapp, but can also be easily embedded into an existing website/webapp to add chat capabilities.
|
||||
- Loading (unused) parts of the application after initial page load should be supported
|
||||
|
||||
## Status
|
||||
For embedded usage, see the [SDK instructions](doc/SDK.md).
|
||||
|
||||
Hydrogen can currently log you in, or pick an existing session, sync already joined rooms, fill gaps in the timeline, and send text messages. Everything is stored locally.
|
||||
|
||||
## Why
|
||||
|
||||
For every interaction or network response (syncing, filling a gap), Hydrogen starts a transaction in indexedb, and only commits it once everything went well. This helps to keep your storage always in a consistent state. As little data is kept in memory as well, and while scrolling in the above GIF, everything is loaded straight from the storage.
|
||||
|
||||
If you find this interesting, feel free to reach me at `@bwindels:matrix.org`.
|
||||
If you find this interesting, come and discuss on [`#hydrogen:matrix.org`](https://matrix.to/#/#hydrogen:matrix.org).
|
||||
|
||||
# How to use
|
||||
|
||||
Try it locally by running `npm install dev` (only the first time) and `npm start` in the terminal, and point your browser to `http://localhost:3000`.
|
||||
Hydrogen is deployed to [hydrogen.element.io](https://hydrogen.element.io). You can also deploy Hydrogen on your own web server:
|
||||
|
||||
1. Download the [latest release package](https://github.com/vector-im/hydrogen-web/releases).
|
||||
1. Extract the package to the public directory of your web server.
|
||||
1. If this is your first deploy:
|
||||
1. copy `config.sample.json` to `config.json` and if needed, make any modifications (unless you've set up your own [sygnal](https://github.com/matrix-org/sygnal) instance, you don't need to change anything in the `push` section).
|
||||
1. Disable caching entirely on the server for:
|
||||
- `index.html`
|
||||
- `sw.js`
|
||||
- `config.json`
|
||||
- All theme manifests referenced in the `themeManifests` of `config.json`, these files are typically called `theme-{name}.json`.
|
||||
|
||||
These resources will still be cached client-side by the service worker. Because of this; you'll still need to refresh the app twice before config.json changes are applied.
|
||||
|
||||
## Set up a dev environment
|
||||
|
||||
You can run Hydrogen locally by the following commands in the terminal:
|
||||
|
||||
- `yarn install` (only the first time)
|
||||
- `yarn start` in the terminal
|
||||
|
||||
Now point your browser to `http://localhost:3000`. If you prefer, you can also [use docker](doc/docker.md).
|
||||
|
||||
# FAQ
|
||||
|
||||
Some frequently asked questions are answered [here](doc/FAQ.md).
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
- methods that return a promise should always use async/await
|
||||
otherwise synchronous errors can get swallowed
|
||||
you can return a promise without awaiting it though.
|
||||
- only named exports, no default exports
|
||||
otherwise it becomes hard to remember what was a default/named export
|
||||
- should we return promises from storage mutation calls? probably not, as we don't await them anywhere. only read calls should return promises?
|
||||
- we don't anymore
|
||||
- don't use these features, as they are not widely enough supported.
|
||||
- [lookbehind in regular expressions](https://caniuse.com/js-regexp-lookbehind)
|
||||
|
|
35
doc/FAQ.md
Normal file
35
doc/FAQ.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# FAQ
|
||||
|
||||
## What browsers are supported?
|
||||
|
||||
Internet Explorer 11, Chrome [1], Firefox [1] (not in a private window), Edge [1], Safari [1] and any mobile versions of these. It will probably also work on any derivatives of these.
|
||||
|
||||
1: Because of https://github.com/vector-im/hydrogen-web/issues/230, only [more recent versions](https://caniuse.com/mdn-javascript_operators_optional_chaining) are supported.
|
||||
|
||||
TorBrowser ships a crippled IndexedDB implementation and will not work. At some point we should support a memory store as a fallback, but that will still give a sub-par experience with end-to-end encryption.
|
||||
|
||||
It used work in pre-webkit Edge, to have it work on Windows Phone, but that support has probably bit-rotted as it isn't tested anymore.
|
||||
|
||||
## Is there a way to run the app as a desktop app?
|
||||
|
||||
You can install Hydrogen as a PWA using Chrome/Chromium on any platform or Edge on Windows. Gnome Web/Ephiphany also allows to "Install site as web application". There is no Electron build of Hydrogen, and there will likely be none in the near future, as Electron complicates the release process considerably. Once Hydrogen is more mature and feature complete, we might reconsider and use [Tauri](https://tauri.studio) if there are compelling use cases not possible with PWAs. For now though, we want to keep development and releasing fast and nimble ;)
|
||||
|
||||
## Is feature X supported?
|
||||
|
||||
If you can't find an easy way to locate the feature you are looking for, then the anwser is usually "no, not yet" :) But here are some things people have asked about in the past:
|
||||
|
||||
### How does newline work? Shift+Enter has no effect.
|
||||
|
||||
That's not yet a feature, as hydrogen just uses a single line text box for message input for now.
|
||||
|
||||
## How can I verify my session from Element?
|
||||
|
||||
You can only verify by comparing keys manually currently. In Element, go to your own profile in the right panel, click on the Hydrogen device and select Manually Verify by Text. The session key displayed should be the same as in the Hydrogen settings. You can't yet mark your Element session as trusted from Hydrogen.
|
||||
|
||||
## I want to host my own Hydrogen, how do I do that?
|
||||
|
||||
Published builds can be found at https://github.com/vector-im/hydrogen-web/releases. For building your own, you need to checkout the version you want to build, or master if you want to run bleeding edge, and run `yarn install` and then `yarn build` in a console (and install nodejs >= 15 and yarn if you haven't yet). Now you should find all the files needed to host Hydrogen in the `target/` folder, just copy them all over to your server. As always, don't host your client on the same [origin](https://web.dev/same-origin-policy/#what's-considered-same-origin) as your homeserver.
|
||||
|
||||
## I want to embed Hydrogen in my website, how should I do that?
|
||||
|
||||
Hydrogen aims to be usable as an SDK, and while it is still early days, you can find some documentation how to do that in [SDK.md](SDK.md).
|
11
doc/IMPORT-ISSUES.md
Normal file
11
doc/IMPORT-ISSUES.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
## How to import common-js dependency using ES6 syntax
|
||||
---
|
||||
Until [#6632](https://github.com/vitejs/vite/issues/6632) is fixed, such imports should be done as follows:
|
||||
|
||||
```ts
|
||||
import * as pkg from "off-color";
|
||||
// @ts-ignore
|
||||
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||
```
|
||||
|
||||
This way build, dev server and unit tests should all work.
|
75
doc/INDEXEDDB.md
Normal file
75
doc/INDEXEDDB.md
Normal file
|
@ -0,0 +1,75 @@
|
|||
## Promises, async/await and indexedDB
|
||||
|
||||
Doesn't indexedDB close your transaction if you don't queue more requests from an idb event handler?
|
||||
So wouldn't that mean that you can't use promises and async/await when using idb?
|
||||
|
||||
It used to be like this, and for IE11 on Win7 (not on Windows 10 strangely enough), it still is like this.
|
||||
Here we manually flush the promise queue synchronously at the end of an idb event handler.
|
||||
|
||||
In modern browsers, indexedDB transactions should only be closed after flushing the microtask queue of the event loop,
|
||||
which is where promises run.
|
||||
|
||||
Keep in mind that indexedDB events, just like any other DOM event, are fired as macro tasks.
|
||||
Promises queue micro tasks, of which the queue is drained before proceeding to the next macro task.
|
||||
This also means that if a transaction is completed, you will only receive the event once you are ready to process the next macro tasks.
|
||||
That doesn't prevent any placed request from throwing TransactionInactiveError though.
|
||||
|
||||
## TransactionInactiveError in Safari
|
||||
|
||||
Safari doesn't fully follow the rules above, in that if you open a transaction,
|
||||
you need to "use" (not sure if this means getting a store or actually placing a request) it straight away,
|
||||
without waiting for any *micro*tasks. See comments about Safari at https://github.com/dfahlander/Dexie.js/issues/317#issue-178349994.
|
||||
|
||||
Another failure mode perceived in Hydrogen on Safari is that when the (readonly) prepareTxn in sync wasn't awaited to be completed before opening and using the syncTxn.
|
||||
I haven't found any documentation online about this at all. Awaiting prepareTxn.complete() fixed the issue below. It's strange though the put does not fail.
|
||||
|
||||
## Diagnose of problem
|
||||
|
||||
What is happening below is:
|
||||
- in the sync loop:
|
||||
- we first open a readonly txn on inboundGroupSessions, which we don't use in the example below
|
||||
- we then open a readwrite txn on session, ... (does not overlap with first txn)
|
||||
- first the first incremental sync on a room (!YxKeAxtNcDZDrGgaMF:matrix.org) it seems to work well
|
||||
- on a second incremental sync for that same room, the first get throws TransactionInactiveError for some reason.
|
||||
- the put in the second incremental sync somehow did not throw.
|
||||
|
||||
So it looks like safari doesn't like (some) transactions still being active while a second one is being openened, even with non-overlapping stores.
|
||||
For now I haven't awaited every read txn in the app, as this was the only place it fails, but if this pops up again in safari, we might have to do that.
|
||||
|
||||
Keep in mind that the `txn ... inactive` logs are only logged when the "complete" or "abort" events are processed,
|
||||
which happens in a macro task, as opposed to all of our promises, which run in a micro task.
|
||||
So the transaction is likely to have closed before it appears in the logs.
|
||||
|
||||
```
|
||||
[Log] txn 4504181722375185 active on inboundGroupSessions
|
||||
[Log] txn 861052256474256 active on session, roomSummary, roomState, roomMembers, timelineEvents, timelineFragments, pendingEvents, userIdentities, groupSessionDecryptions, deviceIdentities, outboundGroupSessions, operations, accountData
|
||||
[Info] hydrogen_session_5286139994689036.session.put({"key":"sync","value":{"token":"s1572540047_757284957_7660701_602588550_435736037_1567300_101589125_347651623_132704","filterId":"2"}})
|
||||
[Info] hydrogen_session_5286139994689036.userIdentities.get("@bwindels:matrix.org")
|
||||
[Log] txn 4504181722375185 inactive
|
||||
[Log] * applying sync response to room !YxKeAxtNcDZDrGgaMF:matrix.org ...
|
||||
[Info] hydrogen_session_5286139994689036.roomMembers.put({"roomId":"!YxKeAxtNcDZDrGgaMF:matrix.org","userId":"@bwindels:matrix.org","membership":"join","avatarUrl":"mxc://matrix.org/aerWVfICBMcyFcEyREcivLuI","displayName":"Bruno","key":"!YxKeAxtNcDZDrGgaMF:matrix.org|@bwindels:matrix.org"})
|
||||
[Info] hydrogen_session_5286139994689036.roomMembers.get("!YxKeAxtNcDZDrGgaMF:matrix.org|@bwindels:matrix.org")
|
||||
[Info] hydrogen_session_5286139994689036.timelineEvents.add({"fragmentId":0,"eventIndex":2147483658,"roomId":"!YxKeAxtNcDZDrGgaMF:matrix.org","event":{"content":{"body":"haha","msgtype":"m.text"},"origin_server_ts":1601457573756,"sender":"@bwindels:matrix.org","type":"m.room.message","unsigned":{"age":8360},"event_id":"$eD9z73-lCpXBVby5_fKqzRZzMVHiPzKbE_RSZzqRKx0"},"displayName":"Bruno","avatarUrl":"mxc://matrix.org/aerWVfICBMcyFcEyREcivLuI","key":"!YxKeAxtNcDZDrGgaMF:matrix.org|00000000|8000000a","eventIdKey":"!YxKeAxtNcDZDrGgaMF:matrix.org|$eD9z73-lCpXBVby5_fKqzRZzMVHiPzKbE_RSZzqRKx0"})
|
||||
[Info] hydrogen_session_5286139994689036.roomSummary.put({"roomId":"!YxKeAxtNcDZDrGgaMF:matrix.org","name":"!!!test8!!!!!!","lastMessageBody":"haha","lastMessageTimestamp":1601457573756,"isUnread":true,"encryption":null,"lastDecryptedEventKey":null,"isDirectMessage":false,"membership":"join","inviteCount":0,"joinCount":2,"heroes":null,"hasFetchedMembers":false,"isTrackingMembers":false,"avatarUrl":null,"notificationCount":5,"highlightCount":0,"tags":{"m.lowpriority":{}}})
|
||||
[Log] txn 861052256474256 inactive
|
||||
[Info] syncTxn committed!!
|
||||
|
||||
... two more unrelated sync responses ...
|
||||
|
||||
[Log] starting sync request with since s1572540191_757284957_7660742_602588567_435736063_1567300_101589126_347651632_132704 ...
|
||||
[Log] txn 8104296957004707 active on inboundGroupSessions
|
||||
[Log] txn 2233038992157489 active on session, roomSummary, roomState, roomMembers, timelineEvents, timelineFragments, pendingEvents, userIdentities, groupSessionDecryptions, deviceIdentities, outboundGroupSessions, operations, accountData
|
||||
[Info] hydrogen_session_5286139994689036.session.put({"key":"sync","value":{"token":"s1572540223_757284957_7660782_602588579_435736078_1567300_101589130_347651633_132704","filterId":"2"}})
|
||||
[Log] * applying sync response to room !YxKeAxtNcDZDrGgaMF:matrix.org ...
|
||||
[Info] hydrogen_session_5286139994689036.roomMembers.get("!YxKeAxtNcDZDrGgaMF:matrix.org|@bwindels:matrix.org")
|
||||
[Warning] stopping sync because of error
|
||||
[Error] StorageError: get("!YxKeAxtNcDZDrGgaMF:matrix.org|@bwindels:matrix.org") failed on txn with stores accountData, deviceIdentities, groupSessionDecryptions, operations, outboundGroupSessions, pendingEvents, roomMembers, roomState, roomSummary, session, timelineEvents, timelineFragments, userIdentities on hydrogen_session_5286139994689036.roomMembers: (name: TransactionInactiveError) (code: 0) Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
|
||||
(anonymous function)
|
||||
asyncFunctionResume
|
||||
(anonymous function)
|
||||
promiseReactionJobWithoutPromise
|
||||
promiseReactionJob
|
||||
[Log] newStatus – "SyncError"
|
||||
[Log] txn 8104296957004707 inactive
|
||||
[Log] txn 2233038992157489 inactive
|
||||
```
|
116
doc/SDK.md
Normal file
116
doc/SDK.md
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Hydrogen View SDK
|
||||
|
||||
|
||||
The Hydrogen view SDK allows developers to integrate parts of the Hydrogen application into the UI of their own application. Hydrogen is written with the MVVM pattern, so to construct a view, you'd first construct a view model, which you then pass into the view. For most view models, you will first need a running client.
|
||||
|
||||
## Example
|
||||
|
||||
The Hydrogen SDK requires some assets to be shipped along with your app for things like downloading attachments, and end-to-end encryption. A convenient way to make this happen is provided by the SDK (importing `hydrogen-view-sdk/paths/vite`) but depends on your build system. Currently, only [vite](https://vitejs.dev/) is supported, so that's what we'll be using in the example below.
|
||||
|
||||
You can create a vite project using the following commands:
|
||||
|
||||
```sh
|
||||
# you can pick "vanilla-ts" here for project type if you're not using react or vue
|
||||
yarn create vite
|
||||
cd <your-project-name>
|
||||
yarn
|
||||
yarn add hydrogen-view-sdk
|
||||
```
|
||||
|
||||
You should see a `index.html` in the project root directory, containing an element with `id="app"`. Add the attribute `class="hydrogen"` to this element, as the CSS we'll include from the SDK assumes for now that the app is rendered in an element with this classname.
|
||||
|
||||
If you go into the `src` directory, you should see a `main.ts` file. If you put this code in there, you should see a basic timeline after login and initial sync have finished (might take a while before you see anything on the screen actually).
|
||||
|
||||
You'll need to provide the username and password of a user that is already in the [#element-dev:matrix.org](https://matrix.to/#/#element-dev:matrix.org) room (or change the room id).
|
||||
|
||||
```ts
|
||||
import {
|
||||
Platform,
|
||||
Client,
|
||||
LoadStatus,
|
||||
createNavigation,
|
||||
createRouter,
|
||||
RoomViewModel,
|
||||
TimelineView,
|
||||
viewClassForTile
|
||||
} from "hydrogen-view-sdk";
|
||||
import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url';
|
||||
import workerPath from 'hydrogen-view-sdk/main.js?url';
|
||||
import olmWasmPath from '@matrix-org/olm/olm.wasm?url';
|
||||
import olmJsPath from '@matrix-org/olm/olm.js?url';
|
||||
import olmLegacyJsPath from '@matrix-org/olm/olm_legacy.js?url';
|
||||
const assetPaths = {
|
||||
downloadSandbox: downloadSandboxPath,
|
||||
worker: workerPath,
|
||||
olm: {
|
||||
wasm: olmWasmPath,
|
||||
legacyBundle: olmLegacyJsPath,
|
||||
wasmBundle: olmJsPath
|
||||
}
|
||||
};
|
||||
import "hydrogen-view-sdk/assets/theme-element-light.css";
|
||||
// OR import "hydrogen-view-sdk/assets/theme-element-dark.css";
|
||||
|
||||
async function main() {
|
||||
const app = document.querySelector<HTMLDivElement>('#app')!
|
||||
const config = {};
|
||||
const platform = new Platform({container: app, assetPaths, config, options: { development: import.meta.env.DEV }});
|
||||
const navigation = createNavigation();
|
||||
platform.setNavigation(navigation);
|
||||
const urlRouter = createRouter({
|
||||
navigation: navigation,
|
||||
history: platform.history
|
||||
});
|
||||
urlRouter.attach();
|
||||
const client = new Client(platform);
|
||||
|
||||
const loginOptions = await client.queryLogin("matrix.org").result;
|
||||
client.startWithLogin(loginOptions.password("username", "password"));
|
||||
|
||||
await client.loadStatus.waitFor((status: string) => {
|
||||
return status === LoadStatus.Ready ||
|
||||
status === LoadStatus.Error ||
|
||||
status === LoadStatus.LoginFailed;
|
||||
}).promise;
|
||||
|
||||
if (client.loginFailure) {
|
||||
alert("login failed: " + client.loginFailure);
|
||||
} else if (client.loadError) {
|
||||
alert("load failed: " + client.loadError.message);
|
||||
} else {
|
||||
const {session} = client;
|
||||
// looks for room corresponding to #element-dev:matrix.org, assuming it is already joined
|
||||
const room = session.rooms.get("!bEWtlqtDwCLFIAKAcv:matrix.org");
|
||||
const vm = new RoomViewModel({
|
||||
room,
|
||||
ownUserId: session.userId,
|
||||
platform,
|
||||
urlCreator: urlRouter,
|
||||
navigation,
|
||||
});
|
||||
await vm.load();
|
||||
const view = new TimelineView(vm.timelineViewModel, viewClassForTile);
|
||||
app.appendChild(view.mount());
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
## Typescript support
|
||||
|
||||
Typescript support is not yet available while we're converting the Hydrogen codebase to Typescript.
|
||||
In your `src` directory, you'll need to add a `.d.ts` (can be called anything, e.g. `deps.d.ts`)
|
||||
containing this snippet to make Typescript not complain that `hydrogen-view-sdk` doesn't have types:
|
||||
|
||||
```ts
|
||||
declare module "hydrogen-view-sdk";
|
||||
```
|
||||
|
||||
## API Stability
|
||||
|
||||
This library follows semantic versioning; there is no API stability promised as long as the major version is still 0. Once 1.0.0 is released, breaking changes will be released with a change in major versioning.
|
||||
|
||||
## Third-party licenses
|
||||
|
||||
This package bundles the bs58 package ([license](https://github.com/cryptocoinjs/bs58/blob/master/LICENSE)), and the Inter font ([license](https://github.com/rsms/inter/blob/master/LICENSE.txt)).
|
22
doc/SKINNING.md
Normal file
22
doc/SKINNING.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Replacing javascript files
|
||||
|
||||
Any source file can be replaced at build time by mapping the path in a JSON file passed in to the build command, e.g. `yarn build --override-imports customizations.json`. The file should be written like so:
|
||||
|
||||
```json
|
||||
{
|
||||
"src/platform/web/ui/session/room/timeline/TextMessageView.js": "src/platform/web/ui/session/room/timeline/MyTextMessageView.js"
|
||||
}
|
||||
```
|
||||
The paths are relative to the location of the mapping file, but the mapping file should be in a parent directory of the files you want to replace.
|
||||
|
||||
You should see a "replacing x with y" line (twice actually, for the normal and legacy build).
|
||||
|
||||
# Injecting CSS
|
||||
|
||||
You can override the location of the main css file with the `--override-css <file>` option to the build script. The default is `src/platform/web/ui/css/main.css`, which you probably want to import from your custom css file like so:
|
||||
|
||||
```css
|
||||
@import url('src/platform/web/ui/css/main.css');
|
||||
|
||||
/* additions */
|
||||
```
|
204
doc/THEMING.md
Normal file
204
doc/THEMING.md
Normal file
|
@ -0,0 +1,204 @@
|
|||
# Theming Documentation
|
||||
## Basic Architecture
|
||||
A **theme collection** in Hydrogen is represented by a `manifest.json` file and a `theme.css` file.
|
||||
The manifest specifies variants (eg: dark,light ...) each of which is a **theme** and maps to a single css file in the build output.
|
||||
|
||||
Each such theme is produced by changing the values of variables in the base `theme.css` file with those specified in the variant section of the manifest:
|
||||
|
||||
![](images/theming-architecture.png)
|
||||
|
||||
More in depth explanations can be found in later sections.
|
||||
|
||||
## Structure of `manifest.json`
|
||||
[See theme.ts](../src/platform/types/theme.ts)
|
||||
|
||||
## Variables
|
||||
CSS variables specific to a particular variant are specified in the `variants` section of the manifest:
|
||||
```json=
|
||||
"variants": {
|
||||
"light": {
|
||||
...
|
||||
"variables": {
|
||||
"background-color-primary": "#fff",
|
||||
"text-color": "#2E2F32",
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
...
|
||||
"variables": {
|
||||
"background-color-primary": "#21262b",
|
||||
"text-color": "#fff",
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These variables will appear in the css file (theme.css):
|
||||
```css=
|
||||
body {
|
||||
background-color: var(--background-color-primary);
|
||||
color: var(--text-color);
|
||||
}
|
||||
```
|
||||
|
||||
During the build process, this would result in the creation of two css files (one for each variant) where the variables are substitued with the corresponding values specified in the manifest:
|
||||
|
||||
*element-light.css*:
|
||||
```css=
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #2E2F32;
|
||||
}
|
||||
```
|
||||
|
||||
*element-dark.css*:
|
||||
```css=
|
||||
body {
|
||||
background-color: #21262b;
|
||||
color: #fff;
|
||||
}
|
||||
```
|
||||
|
||||
## Derived Variables
|
||||
In addition to simple substitution of variables in the stylesheet, it is also possible to instruct the build system to first produce a new value from the base variable value before the substitution.
|
||||
|
||||
Such derived variables have the form `base_css_variable--operation-arg` and can be read as:
|
||||
apply `operation` to `base_css_variable` with argument `arg`.
|
||||
|
||||
Continuing with the previous example, it possible to specify:
|
||||
```css=
|
||||
.left-panel {
|
||||
/* background color should be 20% more darker
|
||||
than background-color-primary */
|
||||
background-color: var(--background-color-primary--darker-20);
|
||||
}
|
||||
```
|
||||
|
||||
Currently supported operations are:
|
||||
|
||||
| Operation | Argument | Operates On |
|
||||
| -------- | -------- | -------- |
|
||||
| darker | percentage | color |
|
||||
| lighter | percentage | color |
|
||||
|
||||
## Aliases
|
||||
It is possible give aliases to variables in the `theme.css` file:
|
||||
```css=
|
||||
:root {
|
||||
font-size: 10px;
|
||||
/* Theme aliases */
|
||||
--icon-color: var(--background-color-secondary--darker-40);
|
||||
}
|
||||
```
|
||||
It is possible to further derive from these aliased variables:
|
||||
```css=
|
||||
div {
|
||||
background: var(--icon-color--darker-20);
|
||||
--my-alias: var(--icon-color--darker-20);
|
||||
/* Derive from aliased variable */
|
||||
color: var(--my-alias--lighter-15);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Colorizing svgs
|
||||
Along with a change in color-scheme, it may be necessary to change the colors in the svg icons and images.
|
||||
This can be done by supplying the preferred colors with query parameters:
|
||||
`my-awesome-logo.svg?primary=base-variable-1&secondary=base-variable-2`
|
||||
|
||||
This instructs the build system to colorize the svg with the given primary and secondary colors.
|
||||
`base-variable-1` and `base-variable-2` are the css-variables specified in the `variables` section of the manifest.
|
||||
|
||||
For colorizing svgs, the source svg must use `#ff00ff` as the primary color and `#00ffff` as the secondary color:
|
||||
|
||||
|
||||
|
||||
| ![](images/svg-icon-example.png) | ![](images/coloring-process.png) |
|
||||
| :--: |:--: |
|
||||
| **original source image** | **transformation process** |
|
||||
|
||||
## Creating your own theme variant in Hydrogen
|
||||
If you're looking to change the color-scheme of the existing Element theme, you only need to add your own variant to the existing `manifest.json`.
|
||||
|
||||
The steps are fairly simple:
|
||||
1. Copy over an existing variant to the variants section of the manifest.
|
||||
2. Change `dark`, `default` and `name` fields.
|
||||
3. Give new values to each variable in the `variables` section.
|
||||
4. Build hydrogen.
|
||||
|
||||
## Creating your own theme collection in Hydrogen
|
||||
If a theme variant does not solve your needs, you can create a new theme collection with a different base `theme.css` file.
|
||||
1. Create a directory for your new theme-collection under `src/platform/web/ui/css/themes/`.
|
||||
2. Create `manifest.json` and `theme.css` files within the newly created directory.
|
||||
3. Populate `manifest.json` with the base css variables you wish to use.
|
||||
4. Write styles in your `theme.css` file using the base variables, derived variables and colorized svg icons.
|
||||
5. Tell the build system where to find this theme-collection by providing the location of this directory to the `themeBuilder` plugin in `vite.config.js`:
|
||||
```json=
|
||||
...
|
||||
themeBuilder({
|
||||
themeConfig: {
|
||||
themes: {
|
||||
element: "./src/platform/web/ui/css/themes/element",
|
||||
awesome: "path/to/theme-directory"
|
||||
},
|
||||
default: "element",
|
||||
},
|
||||
compiledVariables,
|
||||
}),
|
||||
...
|
||||
```
|
||||
6. Build Hydrogen.
|
||||
|
||||
## Changing the default theme
|
||||
To change the default theme used in Hydrogen, modify the `defaultTheme` field in `config.json` file (which can be found in the build output):
|
||||
```json=
|
||||
"defaultTheme": {
|
||||
"light": theme-id,
|
||||
"dark": theme-id
|
||||
}
|
||||
```
|
||||
|
||||
Here *theme-id* is of the form `theme-variant` where `theme` is the key used when specifying the manifest location of the theme collection in `vite.config.js` and `variant` is the key used in variants section of the manifest.
|
||||
|
||||
Some examples of theme-ids are `element-dark` and `element-light`.
|
||||
|
||||
To find the theme-id of some theme, you can look at the built-asset section of the manifest in the build output.
|
||||
|
||||
This default theme will render as "Default" option in the theme-chooser dropdown. If the device preference is for dark theme, the dark default is selected and vice versa.
|
||||
|
||||
**You'll need to reload twice so that Hydrogen picks up the config changes!**
|
||||
|
||||
# Derived Theme(Collection)
|
||||
This allows users to theme Hydrogen without the need for rebuilding. Derived theme collections can be thought of as extensions (derivations) of some existing build time theme.
|
||||
|
||||
## Creating a derived theme:
|
||||
Here's how you create a new derived theme:
|
||||
1. You create a new theme manifest file (eg: theme-awesome.json) and mention which build time theme you're basing your new theme on using the `extends` field. The base css file of the mentioned theme is used for your new theme.
|
||||
2. You configure the theme manifest as usual by populating the `variants` field with your desired colors.
|
||||
3. You add your new theme manifest to the list of themes in `config.json`.
|
||||
|
||||
Refresh Hydrogen twice (once to refresh cache, and once to load) and the new theme should show up in the theme chooser.
|
||||
|
||||
## How does it work?
|
||||
|
||||
For every theme collection in hydrogen, the build process emits a runtime css file which like the built theme css file contains variables in the css code. But unlike the theme css file, the runtime css file lacks the definition for these variables:
|
||||
|
||||
CSS for the built theme:
|
||||
```css
|
||||
:root {
|
||||
--background-color-primary: #f2f20f;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color-primary);
|
||||
}
|
||||
```
|
||||
and the corresponding runtime theme:
|
||||
```css
|
||||
/* Notice the lack of definiton for --background-color-primary here! */
|
||||
body {
|
||||
background-color: var(--background-color-primary);
|
||||
}
|
||||
```
|
||||
|
||||
When hydrogen loads a derived theme, it takes the runtime css file of the extended theme and dynamically adds the variable definition based on the values specified in the manifest. Icons are also colored dynamically and injected as variables using Data URIs.
|
38
doc/TS-MIGRATION.md
Normal file
38
doc/TS-MIGRATION.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Typescript style guide
|
||||
|
||||
## Use `type` rather than `interface` for named parameters and POJO return values.
|
||||
|
||||
`type` and `interface` can be used somewhat interchangeably, but let's use `type` to describe data and `interface` to describe (polymorphic) behaviour.
|
||||
|
||||
Good examples of data are option objects to have named parameters, and POJO (plain old javascript objects) without any methods, just fields.
|
||||
|
||||
Also see [this playground](https://www.typescriptlang.org/play?#code/C4TwDgpgBACghgJwgO2AeTMAlge2QZygF4oBvAKCiqmTgFsIAuKfYBLZAcwG5LqATCABs4IAPzNkAVzoAjCAl4BfcuVCQoAYQAWWIfwzY8hEvCSpDuAlABkZPlQDGOITgTNW7LstWOR+QjMUYHtqKGcCNilHYDcAChxMK3xmIIsk4wBKewcoFRVyPzgArV19KAgAD2AUfkDEYNDqCM9o2IQEjIJmHT0DLvxsijCw-ClIDsSjAkzeEebjEIYAuE5oEgADABJSKeSAOloGJSgsQh29433nVwQlDbnqfKA)
|
||||
|
||||
## Use `type foo = { [key: string]: any }` for types that you intend to fill in later.
|
||||
|
||||
For instance, if you have a method such as:
|
||||
```js
|
||||
function load(options) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
and you intend to type options at some later point, do:
|
||||
```ts
|
||||
type Options = { [key: string]: any}
|
||||
```
|
||||
This makes it much easier to add the necessary type information at a later time.
|
||||
|
||||
## Use `object` or `Record<string, any>` to describe a type that accepts any javascript object.
|
||||
|
||||
Sometimes a function or method may genuinely need to accept any object; eg:
|
||||
```js
|
||||
function encodeBody(body) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
In this scenario:
|
||||
- Use `object` if you know that you will not access any property
|
||||
- Use `Record<string, any>` if you need to access some property
|
||||
|
||||
Both usages prevent the type from accepting primitives (eg: string, boolean...).
|
||||
If using `Record`, ensure that you have guards to check that the properties really do exist.
|
3
doc/UI/index.md
Normal file
3
doc/UI/index.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Index for UI code
|
||||
|
||||
1. [Rendering DOM elements](./render-dom-elements.md)
|
47
doc/UI/render-dom-elements.md
Normal file
47
doc/UI/render-dom-elements.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
tldr; Use `tag` from `ui/general/html.js` to quickly create DOM elements.
|
||||
|
||||
## Syntax
|
||||
---
|
||||
The general syntax is as follows:
|
||||
```js
|
||||
tag.tag_name({attribute1: value, attribute2: value, ...}, [child_elements]);
|
||||
```
|
||||
**tag_name** can be any one of the following:
|
||||
```
|
||||
br, a, ol, ul, li, div, h1, h2, h3, h4, h5, h6,
|
||||
p, strong, em, span, img, section, main, article, aside,
|
||||
pre, button, time, input, textarea, label, form, progress, output, video
|
||||
```
|
||||
|
||||
<br />
|
||||
|
||||
eg:
|
||||
Here is an example HTML segment followed with the code to create it in Hydrogen.
|
||||
```html
|
||||
<section class="main-section">
|
||||
<h1>Demo</h1>
|
||||
<button class="btn_cool">Click me</button>
|
||||
</section>
|
||||
```
|
||||
```js
|
||||
tag.section({className: "main-section"},[
|
||||
tag.h1("Demo"),
|
||||
tag.button({className:"btn_cool"}, "Click me")
|
||||
]);
|
||||
```
|
||||
<br />
|
||||
|
||||
**Note:** In views based on `TemplateView`, you will see `t` used instead of `tag`.
|
||||
`t` is is `TemplateBuilder` object passed to the render function in `TemplateView`.
|
||||
Although syntactically similar, they are not functionally equivalent.
|
||||
Primarily `t` **supports** bindings and event handlers while `tag` **does not**.
|
||||
|
||||
```js
|
||||
// The onClick here wont work!!
|
||||
tag.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
|
||||
render(t, vm){
|
||||
// The onClick works here.
|
||||
t.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
}
|
||||
```
|
206
doc/UI/ui.md
Normal file
206
doc/UI/ui.md
Normal file
|
@ -0,0 +1,206 @@
|
|||
## IView components
|
||||
|
||||
The [interface](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/ui/general/types.ts) adopted by view components is agnostic of how they are rendered to the DOM. This has several benefits:
|
||||
- it allows Hydrogen to not ship a [heavy view framework](https://bundlephobia.com/package/react-dom@18.2.0) that may or may not be used by its SDK users, and also keep bundle size of the app down.
|
||||
- Given the interface is quite simple, is should be easy to integrate this interface into the render lifecycle of other frameworks.
|
||||
- The main implementations used in Hydrogen are [`ListView`](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/ui/general/ListView.ts) (rendering [`ObservableList`](https://github.com/vector-im/hydrogen-web/blob/master/src/observable/list/BaseObservableList.ts)s) and [`TemplateView`](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/ui/general/TemplateView.ts) (templating and one-way databinding), each only a few 100 lines of code and tailored towards their specific use-case. They work straight with the DOM API and have no other dependencies.
|
||||
- a common inteface allows us to mix and match between these different implementations (and gradually shift if need be in the future) with the code.
|
||||
|
||||
## Templates
|
||||
|
||||
### Template language
|
||||
|
||||
Templates use a mini-DSL language in pure javascript to express declarative templates. This is basically a very thin wrapper around `document.createElement`, `document.createTextNode`, `node.setAttribute` and `node.appendChild` to quickly create DOM trees. The general syntax is as follows:
|
||||
```js
|
||||
t.tag_name({attribute1: value, attribute2: value, ...}, [child_elements]);
|
||||
t.tag_name(child_element);
|
||||
t.tag_name([child_elements]);
|
||||
```
|
||||
**tag_name** can be [most HTML or SVG tags](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/ui/general/html.ts#L102-L110).
|
||||
|
||||
eg:
|
||||
Here is an example HTML segment followed with the code to create it in Hydrogen.
|
||||
```html
|
||||
<section class="main-section">
|
||||
<h1>Demo</h1>
|
||||
<button class="btn_cool">Click me</button>
|
||||
</section>
|
||||
```
|
||||
```js
|
||||
t.section({className: "main-section"},[
|
||||
t.h1("Demo"),
|
||||
t.button({className:"btn_cool"}, "Click me")
|
||||
]);
|
||||
```
|
||||
|
||||
All these functions return DOM element nodes, e.g. the result of `document.createElement`.
|
||||
|
||||
### TemplateView
|
||||
|
||||
`TemplateView` builds on top of templating by adopting the IView component model and adding event handling attributes, sub views and one-way databinding.
|
||||
In views based on `TemplateView`, you will see a render method with a `t` argument.
|
||||
`t` is `TemplateBuilder` object passed to the render function in `TemplateView`. It also takes a data object to render and bind to, often called `vm`, short for view model from the MVVM pattern Hydrogen uses.
|
||||
|
||||
You either subclass `TemplateView` and override the `render` method:
|
||||
```js
|
||||
class MyView extends TemplateView {
|
||||
render(t, vm) {
|
||||
return t.div(...);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or you pass a render function to `InlineTemplateView`:
|
||||
```js
|
||||
new InlineTemplateView(vm, (t, vm) => {
|
||||
return t.div(...);
|
||||
});
|
||||
```
|
||||
|
||||
**Note:** the render function is only called once to build the initial DOM tree and setup bindings, etc ... Any subsequent updates to the DOM of a component happens through bindings.
|
||||
|
||||
#### Event handlers
|
||||
|
||||
Any attribute starting with `on` and having a function as a value will be attached as an event listener on the given node. The event handler will be removed during unmounting.
|
||||
|
||||
```js
|
||||
t.button({onClick: evt => {
|
||||
vm.doSomething(evt.target.value);
|
||||
}}, "Click me");
|
||||
```
|
||||
|
||||
#### Subviews
|
||||
|
||||
`t.view(instance)` will mount the sub view (can be any IView) and return its root node so it can be attached in the DOM tree.
|
||||
All subviews will be unmounted when the parent view gets unmounted.
|
||||
|
||||
```js
|
||||
t.div({className: "Container"}, t.view(new ChildView(vm.childViewModel)));
|
||||
```
|
||||
|
||||
#### One-way data-binding
|
||||
|
||||
A binding couples a part of the DOM to a value on the view model. The view model emits an update when any of its properties change, to which the view can subscribe. When an update is received by the view, it will reevaluate all the bindings, and update the DOM accordingly.
|
||||
|
||||
A binding can appear in many places where a static value can usually be used in the template tree.
|
||||
To create a binding, you pass a function that maps the view value to a static value.
|
||||
|
||||
##### Text binding
|
||||
|
||||
```js
|
||||
t.p(["I've got ", vm => vm.counter, " beans"])
|
||||
```
|
||||
|
||||
##### Attribute binding
|
||||
|
||||
```js
|
||||
t.button({disabled: vm => vm.isBusy}, "Submit");
|
||||
```
|
||||
|
||||
##### Class-name binding
|
||||
```js
|
||||
t.div({className: {
|
||||
button: true,
|
||||
active: vm => vm.isActive
|
||||
}})
|
||||
```
|
||||
##### Subview binding
|
||||
|
||||
So far, all the bindings can only change node values within our tree, but don't change the structure of the DOM. A sub view binding allows you to conditionally add a subview based on the result of a binding function.
|
||||
|
||||
All sub view bindings return a DOM (element or comment) node and can be directly added to the DOM tree by including them in your template.
|
||||
|
||||
###### map
|
||||
|
||||
`t.mapView` allows you to choose a view based on the result of the binding function:
|
||||
|
||||
```js
|
||||
t.mapView(vm => vm.count, count => {
|
||||
return count > 5 ? new LargeView(count) : new SmallView(count);
|
||||
});
|
||||
```
|
||||
|
||||
Every time the first or binding function returns a different value, the second function is run to create a new view to replace the previous view.
|
||||
|
||||
You can also return `null` or `undefined` from the second function to indicate a view should not be rendered. In this case a comment node will be used as a placeholder.
|
||||
|
||||
There is also a `t.map` which will create a new template view (with the same value) and you directly provide a render function for it:
|
||||
|
||||
```js
|
||||
t.map(vm => vm.shape, (shape, t, vm) => {
|
||||
switch (shape) {
|
||||
case "rect": return t.rect();
|
||||
case "circle": return t.circle();
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
###### if
|
||||
|
||||
`t.ifView` will render the subview if the binding returns a truthy value:
|
||||
|
||||
```js
|
||||
t.ifView(vm => vm.isActive, vm => new View(vm.someValue));
|
||||
```
|
||||
|
||||
You equally have `t.if`, which creates a `TemplateView` and passes you the `TemplateBuilder`:
|
||||
|
||||
```js
|
||||
t.if(vm => vm.isActive, (t, vm) => t.div("active!"));
|
||||
```
|
||||
|
||||
##### Side-effects
|
||||
|
||||
Sometimes you want to imperatively modify your DOM tree based on the value of a binding.
|
||||
`mapSideEffect` makes this easy to do:
|
||||
|
||||
```js
|
||||
let node = t.div();
|
||||
t.mapSideEffect(vm => vm.color, (color, oldColor) => node.style.background = color);
|
||||
return node;
|
||||
```
|
||||
|
||||
**Note:** you shouldn't add any bindings, subviews or event handlers from the side-effect callback,
|
||||
the safest is to not use the `t` argument at all.
|
||||
If you do, they will be added every time the callback is run and only cleaned up when the view is unmounted.
|
||||
|
||||
#### `tag` vs `t`
|
||||
|
||||
If you don't need a view component with data-binding, sub views and event handler attributes, the template language also is available in `ui/general/html.js` without any of these bells and whistles, exported as `tag`. As opposed to static templates with `tag`, you always use
|
||||
`TemplateView` as an instance of a class, as there is some extra state to keep track (bindings, event handlers and subviews).
|
||||
|
||||
Although syntactically similar, `TemplateBuilder` and `tag` are not functionally equivalent.
|
||||
Primarily `t` **supports** bindings and event handlers while `tag` **does not**. This is because to remove event listeners, we need to keep track of them, and thus we need to keep this state somewhere which
|
||||
we can't do with a simple function call but we can insite the TemplateView class.
|
||||
|
||||
```js
|
||||
// The onClick here wont work!!
|
||||
tag.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
|
||||
class MyView extends TemplateView {
|
||||
render(t, vm){
|
||||
// The onClick works here.
|
||||
t.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ListView
|
||||
|
||||
A view component that renders and updates a list of sub views for every item in a `ObservableList`.
|
||||
|
||||
```js
|
||||
const list = new ListView({
|
||||
list: someObservableList
|
||||
}, listValue => return new ChildView(listValue))
|
||||
```
|
||||
|
||||
As items are added, removed, moved (change position) and updated, the DOM will be kept in sync.
|
||||
|
||||
There is also a `LazyListView` that only renders items in and around the current viewport, with the restriction that all items in the list must be rendered with the same height.
|
||||
|
||||
### Sub view updates
|
||||
|
||||
Unless the `parentProvidesUpdates` option in the constructor is set to `false`, the ListView will call the `update` method on the child `IView` component when it receives an update event for one of the items in the `ObservableList`.
|
||||
|
||||
This way, not every sub view has to have an individual listener on it's view model (a value from the observable list), and all updates go from the observable list to the list view, who then notifies the correct sub view.
|
58
doc/docker.md
Normal file
58
doc/docker.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
## Warning
|
||||
|
||||
Usage of docker is a third-party contribution and not actively tested, used or supported by the main developer(s).
|
||||
|
||||
Having said that, you can also use Docker to create a local dev environment or a production deployment.
|
||||
|
||||
## Dev environment
|
||||
|
||||
In this repository, create a Docker image:
|
||||
|
||||
```
|
||||
docker build -t hydrogen-dev -f Dockerfile-dev .
|
||||
```
|
||||
|
||||
Then start up a container from that image:
|
||||
|
||||
```
|
||||
docker run \
|
||||
--name hydrogen-dev \
|
||||
--publish 3000:3000 \
|
||||
--volume "$PWD":/code \
|
||||
--interactive \
|
||||
--tty \
|
||||
--rm \
|
||||
hydrogen-dev
|
||||
```
|
||||
|
||||
Then point your browser to `http://localhost:3000`. You can see the server logs in the terminal where you started the container.
|
||||
|
||||
To stop the container, simply hit `ctrl+c`.
|
||||
|
||||
## Production deployment
|
||||
|
||||
### Build or pull image
|
||||
|
||||
In this repository, create a Docker image:
|
||||
|
||||
```
|
||||
docker build -t hydrogen .
|
||||
```
|
||||
|
||||
Or, pull the docker image from GitLab:
|
||||
|
||||
```
|
||||
docker pull registry.gitlab.com/jcgruenhage/hydrogen-web
|
||||
docker tag registry.gitlab.com/jcgruenhage/hydrogen-web hydrogen
|
||||
```
|
||||
|
||||
### Start container image
|
||||
|
||||
Then, start up a container from that image:
|
||||
|
||||
```
|
||||
docker run \
|
||||
--name hydrogen \
|
||||
--publish 80:80 \
|
||||
hydrogen
|
||||
```
|
BIN
doc/images/coloring-process.png
Normal file
BIN
doc/images/coloring-process.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
BIN
doc/images/svg-icon-example.png
Normal file
BIN
doc/images/svg-icon-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
doc/images/theming-architecture.png
Normal file
BIN
doc/images/theming-architecture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -5,3 +5,8 @@ we should automatically fill gaps (capped at a certain (large) amount of events,
|
|||
during these fills (once supported), we should calculate push actions and trigger notifications, as we would otherwise have received this through sync.
|
||||
|
||||
we could also trigger notifications when just backfilling on initial sync up to a certain amount of time in the past?
|
||||
|
||||
|
||||
we also need to backfill if we didn't receive any m.room.message in a limited sync for an encrypted room, as it's possible the room summary hasn't seen the last message in the room and is now out of date. this is also true for a non-encrypted room actually, although wrt to the above, here notifications would work well though.
|
||||
|
||||
a room should request backfills in needsAfterSyncCompleted and do them in afterSyncCompleted.
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
- verify signature on key
|
||||
- ??? what about inbound/outbound sessions? do they require multiple OlmSession objects?
|
||||
- doesn't look like it, more like a way to start the session but once started (type=1), they are equivalent?
|
||||
- for outbound, see file:///home/bwindels/Downloads/matrix-docs/End-to-End%20Encryption%20implementation%20guide%20%7C%20Matrix.org.html#starting-an-olm-session
|
||||
- for inbound, see: file:///home/bwindels/Downloads/matrix-docs/End-to-End%20Encryption%20implementation%20guide%20|%20Matrix.org.html#handling-an-mroomencrypted-event
|
||||
- for outbound, see https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide#starting-an-olm-session
|
||||
- for inbound, see: https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide#handling-an-mroomencrypted-event
|
||||
- so in this case, it would the session would be created as an outbound session.
|
||||
- store pickled, index by curve25519 identity key?
|
||||
- get from storage if exists and unpickle
|
||||
|
@ -68,10 +68,10 @@
|
|||
- mark them as published in account
|
||||
- update picked session in storage
|
||||
- implement encrypting olm messages
|
||||
- roughly file:///home/bwindels/Downloads/matrix-docs/End-to-End%20Encryption%20implementation%20guide%20|%20Matrix.org.html#encrypting-an-event-with-olm
|
||||
- roughly https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide#encrypting-an-event-with-olm
|
||||
- packaging as m.room.encrypted event
|
||||
- implement decrypting olm messages
|
||||
- roughly file:///home/bwindels/Downloads/matrix-docs/End-to-End%20Encryption%20implementation%20guide%20|%20Matrix.org.html#handling-an-mroomencrypted-event
|
||||
- roughly https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide#handling-an-mroomencrypted-event
|
||||
- decrypt with libolm
|
||||
- verify signature
|
||||
- check message index, etc to detect replay attacks
|
||||
|
|
25
doc/impl-thoughts/PENDING_REPLIES.md
Normal file
25
doc/impl-thoughts/PENDING_REPLIES.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Replying to pending messages
|
||||
The matrix spec requires clients capable of rich replies (that would be us once replies work) to include fallback (textual in `body` and structured in `formatted_body`) that can be rendered
|
||||
by clients that do not natively support rich replies (that would be us at the time of writing). The schema for the fallback is as follows:
|
||||
|
||||
```
|
||||
<mx-reply>
|
||||
<blockquote>
|
||||
<a href="https://matrix.to/#/!somewhere:example.org/$event:example.org">In reply to</a>
|
||||
<a href="https://matrix.to/#/@alice:example.org">@alice:example.org</a>
|
||||
<br />
|
||||
<!-- This is where the related event's HTML would be. -->
|
||||
</blockquote>
|
||||
</mx-reply>
|
||||
```
|
||||
|
||||
There's a single complication here for pending events: we have `$event:example.org` in the schema (the `In reply to` link), and it must
|
||||
be present _within the content_, inside `formatted_body`. The issue is that, if we are queuing a reply to a pending event,
|
||||
we don't know its remote ID. All we know is its transaction ID on our end. If we were to use that while formatting the message,
|
||||
we'd be sending messages that contain our internal transaction IDs instead of proper matrix event identifiers.
|
||||
|
||||
To solve this, we'd need `SendQueue`, whenever it receives a remote echo, to update pending events that are replies with their
|
||||
`relatedEventId`. This already happens, and the `event_id` field in `m.relates_to` is updated. But we'd need to extend this
|
||||
to adjust the messages' `formatted_body` with the resolved remote ID, too.
|
||||
|
||||
How do we safely do this, without accidentally substituting event IDs into places in the body where they were not intended?
|
22
doc/impl-thoughts/PUSH.md
Normal file
22
doc/impl-thoughts/PUSH.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Push Notifications
|
||||
- we setup the app on the sygnal server, with an app_id (io.element.hydrogen.web), generating a key pair
|
||||
- we create a web push subscription, passing the server pub key, and get `endpoint`, `p256dh` and `auth` back. We put `webpush_endpoint` and `auth` in the push data, and use `p256dh` as the push key?
|
||||
- we call `POST /_matrix/client/r0/pushers/set` on the homeserver with the sygnal instance url. We pass the web push subscription as pusher data.
|
||||
- the homeserver wants to send out a notification, calling sygnal on `POST /_matrix/push/v1/notify` with for each device the pusher data.
|
||||
- we encrypt and send with the data in the data for each device in the notification
|
||||
- this wakes up the service worker
|
||||
- now we need to find which local session id this notification is for
|
||||
|
||||
## Testing/development
|
||||
|
||||
- set up local synapse
|
||||
- set up local sygnal
|
||||
- write pushkin
|
||||
- configure "hydrogen" app in sygnal config with a webpush pushkin
|
||||
- start writing service worker code in hydrogen (we'll need to enable it for local dev)
|
||||
- try to get a notification through
|
||||
|
||||
## Questions
|
||||
|
||||
- do we use the `event_id_only` format?
|
||||
- for e2ee rooms, are we fine with just showing "Bob sent you a message (in room if not DM)", or do we want to sync and show the actual message? perhaps former can be MVP.
|
5
doc/impl-thoughts/READ-RECEIPTS.md
Normal file
5
doc/impl-thoughts/READ-RECEIPTS.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Read receipts
|
||||
|
||||
## UI
|
||||
|
||||
For the expanding avatars, trimmed at 5 or so, we could use css grid and switch from the right most cell to a cell that covers the whole width when clicking.
|
|
@ -1,7 +1,22 @@
|
|||
Relations and redactions
|
||||
|
||||
events that refer to another event will need support in the SyncWriter, Timeline and SendQueue I think.
|
||||
SyncWriter will need to resolve the related remote id to a [fragmentId, eventIndex] and persist that on the event that relates to some other. Same for SendQueue? If unknown remote id, not much to do. However, once the remote id comes in, how do we handle it correctly? We might need a index on m.relates_to/event_id?
|
||||
SyncWriter will need to resolve the related remote id to a [fragmentId, eventIndex] and persist that on the event that relates to some other. Same for SendQueue? If unknown remote id, not much to do. However, once the remote id comes in, how do we handle it correctly? We might need a index on m.relates_to/event_id? I'd rather avoid that if possible, as that becomes useless once we have the target event of the relationship (we store the relations on the target event (see "One fetch" below) and have the target event id on the relation so can go both ways). I'm not sure this index will be completely useless actually. For edits, we'll want to be able to list all edits. For reactions, we'll want to fetch the authors and timestamps. For replies, we want to render the origin event and not use the fallback text? It is true though that only a minority of the events will have a related_to event id, so I wonder if it is faster to put it in a different store? Perhaps a prototype can clarify ...
|
||||
|
||||
`event_relations` store could be this:
|
||||
|
||||
{
|
||||
sourceEventId:
|
||||
targetEventId:
|
||||
rel_type:
|
||||
roomId:
|
||||
}
|
||||
|
||||
`{"key": "!bEWtlqtDwCLFIAKAcv:matrix.org|$apmyieZOI5vm4DzjEFzjbRiZW9oeQQR21adM6A6eRwM|m.annotation|m.reaction|$jSisozR3is5XUuDZXD5cyaVMOQ5_BtFS3jKfcP89MOM"}`
|
||||
|
||||
or actually stored like `roomId|targetEventId|rel_type|sourceEventId`. How can we get the last edit? They are sorted by origin_server_ts IIRC? Should this be part of the key? Solved: we store the event id of a replacement on the target event
|
||||
|
||||
We should look into what part of the relationships will be present on the event once it is received from the server (e.g. m.replace might be evident, but not all the reaction events?). If not, we could add a object store with missing relation targets.
|
||||
|
||||
The timeline can take incoming events from both the SendQueue and SyncWriter, and see if their related to fragmentId/eventIndex is in view, and then update it?
|
||||
|
||||
|
@ -13,10 +28,242 @@ Also, related ids should be processed recursively. If event 3 is a redaction of
|
|||
|
||||
As a UI for reactions, we could show (👍 14 + 1) where the + 1 is our own local echo (perhaps style it pulsating and/or in grey?). Clicking it again would just show 14 and when the remote echo comes in it would turn into 15.
|
||||
|
||||
|
||||
## One fetch for timeline reading
|
||||
|
||||
wrt to how to store relations in indexeddb, we could store all local ids of related events (per type?) on the related-to event, so we can fetch them in one query for *all* events that have related events that were fetched in a range, without needing another index that would slow down writes. So that would only add 1 query which we only need to do when there are relations in the TimelineReader. what do we do though if we receive the relating event before the related-to event? An index would fix this mostly ... or we need a temp store where we store unresolved relations...
|
||||
|
||||
Replies should definitely use this relation mechanism, so we can easily show the most up to date version of the replied-to event.
|
||||
|
||||
Redactions can de done separately
|
||||
|
||||
For replies (or references in general?), we do need to load the referred-to event in a second read. For reactions and edits, they will already be stored on the target event.
|
||||
|
||||
|
||||
## Example events from the wild
|
||||
|
||||
### Reaction
|
||||
|
||||
```json
|
||||
{
|
||||
"content": {
|
||||
"m.relates_to": {
|
||||
"event_id": "$apmyieZOI5vm4DzjEFzjbRiZW9oeQQR21adM6A6eRwM",
|
||||
"key": "👍️",
|
||||
"rel_type": "m.annotation"
|
||||
}
|
||||
},
|
||||
"origin_server_ts": 1621284357314,
|
||||
"sender": "@charly:matrix.org",
|
||||
"type": "m.reaction",
|
||||
"unsigned": {
|
||||
"age": 64140856
|
||||
},
|
||||
"event_id": "$jSisozR3is5XUuDZXD5cyaVMOQ5_BtFS3jKfcP89MOM",
|
||||
"room_id": "!bEWtlqtDwCLFIAKAcv:matrix.org"
|
||||
}
|
||||
```
|
||||
|
||||
### Edit
|
||||
|
||||
```json
|
||||
{
|
||||
"content": {
|
||||
"body": " * ...",
|
||||
"m.new_content": {
|
||||
"body": "...",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"m.relates_to": {
|
||||
"event_id": "$OXL0yk18y-VG3DuTybVh9j9cvdjjnnzWbBKY-QPXJ-0",
|
||||
"rel_type": "m.replace"
|
||||
},
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"origin_server_ts": 1621264902371,
|
||||
"room_id": "!bEWtlqtDwCLFIAKAcv:matrix.org",
|
||||
"sender": "@alice:matrix.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 83636544
|
||||
},
|
||||
"event_id": "$Z7sFSKWtLTFoMMabkPFe0PSKWpkakjWUkYQeBU8IHVc",
|
||||
"user_id": "@alice:matrix.org",
|
||||
"age": 83636544
|
||||
}
|
||||
```
|
||||
|
||||
### Reply
|
||||
```json
|
||||
{
|
||||
"content": {
|
||||
"body": "...",
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": "...",
|
||||
"m.relates_to": {
|
||||
"m.in_reply_to": {
|
||||
"event_id": "$rGD9iQ93UmopkkagJ0tW_FHATa8IrvABg9cM_tNUvu4"
|
||||
}
|
||||
},
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"origin_server_ts": 1621242338597,
|
||||
"room_id": "!bEWtlqtDwCLFIAKAcv:matrix.org",
|
||||
"sender": "@bob:matrix.org",
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 106408661,
|
||||
"m.relations": {
|
||||
"m.annotation": {
|
||||
"chunk": [
|
||||
{
|
||||
"type": "m.reaction",
|
||||
"key": "👍️",
|
||||
"count": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"event_id": "$yS_n5n3cIO2aTtek0_2ZSlv-7g4YYR2zKrk2mFCW_q4",
|
||||
"user_id": "@bob:matrix.org",
|
||||
"age": 106408661
|
||||
}
|
||||
```
|
||||
|
||||
### Remaining spec issues
|
||||
|
||||
- m.in_reply_to vs rel_type
|
||||
- reactions in unsigned can't be deduplicated
|
||||
- how to sort edits? for now we went with origin_server_ts
|
||||
- do we say anything about events of a different type replacing an event?
|
||||
- do we specify that replies should be to the original event, not the edit?
|
||||
|
||||
## What to store denormalized on the event itself?
|
||||
|
||||
```json
|
||||
{
|
||||
"reactions": {
|
||||
"👍": {"count": 3, "me": true, "firstTimestamp": 2323989},
|
||||
"👋": {"count": 1, "me": false, "firstTimestamp": 2323989}
|
||||
},
|
||||
"replacingEvent": {
|
||||
"event_id": "$abc",
|
||||
"origin_server_ts": ?,
|
||||
"content": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
we only need the m.new_content and event id of the replacing event, even timestamp we can load the event for on hover?
|
||||
|
||||
|
||||
store the replacing event along the original event because we need to keep the original event along somewhere, but for displaying purposes, we'd use the content of the replacingEvent. Should we just store the content of the replacing event? Or even just the `m.new_content`? Could make sense, but perhaps also store the new timestamp along. How about whem somebody than the sender edits?
|
||||
|
||||
# Aggregation
|
||||
|
||||
what do we do with the aggregated timestamps? do we store them? if so, where?
|
||||
|
||||
when we hover reactions, we want to show the authors, rather than the timestamp, so we'll need to call /relations for that anyway. so no need to store the timestamp?
|
||||
|
||||
`/relations` is in fact a bit the server-side version of our `event_relations` store
|
||||
|
||||
## Dealing with gappy syncs
|
||||
|
||||
Doesn't look like synapse currently tells us which target events have outdates relations after a gappy sync. MSC 2675 proposes `stale_events`, but inspecting network traffic, that doesn't seem to be implemented right now.
|
||||
|
||||
So, if we locally would need to determine if relations are outdated, we could look if any of the fragments between an event and the last synced event have pagination tokens. Although we have no way to clear this "flag" if we were to fetch the relations after this.
|
||||
|
||||
As an initial cut it is probably fine if reactions and edits are outdated unless you scroll up all the way to an event (and hence back-fill), as this is what we'll always do (apart from permalinks).
|
||||
|
||||
### Permalinks
|
||||
|
||||
So once we do support permalinks, how do we solve this? Element solves this by not storing `/context` and the `/messages` requests around, hence it is always fresh.
|
||||
|
||||
We could store the live fragment id in events when we refresh their `/relations`, and if it is not the current live fragment id, you're outdated.
|
||||
|
||||
To accurately display anything not in the live fragment, we either need to:
|
||||
- backfill until there are no more gaps between the event fragment and the live fragment.
|
||||
- -- there is no way to know how many events this would load.
|
||||
- ++ that we know which gaps we've already filled
|
||||
- ++ we need to do this for e2ee rooms anyway
|
||||
- ++ we need to implement this anyway for non-gappy sync
|
||||
- ++ we can only do this as an initial cut, especially as we don't support permalinks yet
|
||||
- Refetch the `/context` and `/messages` for what is on the screen and reconcile.
|
||||
- ++ we know how much we'll fetch
|
||||
- -- we need to fetch everything again if we have one small gap
|
||||
- we store the current live fragment when doing this, so can know:
|
||||
- if we need to refetch / if there is a gap
|
||||
- how many gaps we need to fill
|
||||
- could we fall back to this strategy if the first one takes too long/many events?
|
||||
- we could pick a heuristic to pick either strategy (like time between syncs or try for x events and if the gap is not closed, give up)?
|
||||
- Refetch /aggregations for every event
|
||||
- ++ we don't get the events (we dont need? edits?)
|
||||
- --- need to do it for every event
|
||||
- use `stale_events` if we actually implement it one day
|
||||
- this can work well with the first strategy, we'd store a "relationsStale" flag on the event, and refetch /relations immediately or if scrolled into view.
|
||||
|
||||
# API
|
||||
|
||||
## Reactions
|
||||
|
||||
```js
|
||||
const reaction = eventEntry.react("👍");
|
||||
room.sendEvent("m.reaction", reaction);
|
||||
```
|
||||
|
||||
```js
|
||||
// this is an ObservableMap mapping the key to the count (or rather SortedArray?)
|
||||
// probably fine to just use a SortedArray to sorts by count, then key
|
||||
// actually, maybe better to do ObservableMap and store first timestamp so we can support https://github.com/vector-im/element-web/issues/9698 outside of SDK.
|
||||
const reactions = eventEntry.reactions.sortValues((r1, r2) => r1.count - r2.count);
|
||||
new ListView({list: reactions}, reaction => new ReactionView(reaction, room));
|
||||
// reaction has:
|
||||
reaction.key
|
||||
reaction.hasMyReaction // how do we get this from the bundled events?
|
||||
reaction.count
|
||||
reaction.firstTimestamp
|
||||
room.sendEvent("m.reaction", reaction.react());
|
||||
// this won't work as we don't have the event id:
|
||||
// room.sendRedaction(reaction.redact());
|
||||
```
|
||||
|
||||
## Edits
|
||||
|
||||
```js
|
||||
const replacement = eventEntry.replace({});
|
||||
room.sendEvent(eventEntry.eventType, replacement);
|
||||
```
|
||||
|
||||
## Replies
|
||||
|
||||
```js
|
||||
const reply = eventEntry.reply({});
|
||||
room.sendEvent("m.room.message", reply);
|
||||
```
|
||||
|
||||
## Redactions
|
||||
|
||||
```js
|
||||
const redaction = eventEntry.redact();
|
||||
room.sendRedaction(redaction);
|
||||
```
|
||||
|
||||
All off these reaction and edit entries should probably not be live, and at some point in the future if we need them to be live for some use case, we can add an additional api to make them live with an explicit release mechanism?
|
||||
```js
|
||||
|
||||
// there is no api to get the reactions by sender though, so perhaps we need to load them all and then find our own?
|
||||
const reactions = await eventEntry.getReactionEntries("👍");
|
||||
const reaction = reactions.find(r => r.sender = ownUserId);
|
||||
room.sendRedaction(reaction.redact());
|
||||
```
|
||||
|
||||
```js
|
||||
const edits = await eventEntry.getEdits();
|
||||
room.sendRedaction(edits[1].redact());
|
||||
```
|
||||
|
||||
```js
|
||||
const lastEdit = await eventEntry.getLastEdit();
|
||||
room.sendRedaction(lastEdit.redact());
|
||||
```
|
||||
|
||||
|
|
17
doc/impl-thoughts/REPLIES.md
Normal file
17
doc/impl-thoughts/REPLIES.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
If we were to render replies in a smart way (instead of relying on the fallback), we would
|
||||
need to manually find entries that are pointed to be `in_reply_to`. Consulting the timeline
|
||||
code, it seems appropriate to add a `_replyingTo` field to a `BaseEventEntry` (much like we
|
||||
have `_pendingAnnotations` and `pendingRedactions`). We can then:
|
||||
* use `TilesCollection`'s `_findTileIdx` to find the tile of the message being replied to,
|
||||
and put a reference to its tile into the new tile being created (?).
|
||||
* It doesn't seem appropriate to add an additional argument to TileCreator, but we may
|
||||
want to re-use tiles instead of creating duplicate ones. Otherwise, of course, `tileCreator`
|
||||
can create more than one tile from an entry's `_replyingTo` field.
|
||||
* Resolve `_replyingTo` much like we resolve `redactingEntry` in timeline: search by `relatedTxnId`
|
||||
and `relatedEventId` if our entry is a reply (we can add an `isReply` flag there).
|
||||
* This works fine for local entries, which are loaded via an `AsyncMappedList`, but what
|
||||
about remote entries? They are not loaded asynchronously, and the fact that they are
|
||||
not a derived collection is used throughout `Timeline`.
|
||||
* Entries that don't have replies that are loadeded (but that are replies) probably need
|
||||
to be tracked somehow?
|
||||
* Then, on timeline add, check new IDs and update corresponding entries
|
109
doc/impl-thoughts/SDK.md
Normal file
109
doc/impl-thoughts/SDK.md
Normal file
|
@ -0,0 +1,109 @@
|
|||
SDK:
|
||||
|
||||
- we need to compile src/lib.ts to javascript, with a d.ts file generated as well. We need to compile to javascript once for cjs and once of es modules. The package.json looks like this:
|
||||
|
||||
```
|
||||
"main": "./dist/index.cjs",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
```
|
||||
|
||||
we don't need to bundle for the sdk case! we might need to do some transpilation to just plain ES6 (e.g. don't assume ?. and ??) we could use a browserslist query for this e.g. `node 14`. esbuild seems to support this as well, tldraw uses esbuild for their build.
|
||||
|
||||
one advantage of not bundling the files for the sdk is that you can still use import overrides in the consuming project build settings. is that an idiomatic way of doing things though?
|
||||
|
||||
|
||||
|
||||
|
||||
this way we will support typescript, non-esm javascript and esm javascript using libhydrogen as an SDK
|
||||
|
||||
got this from https://medium.com/dazn-tech/publishing-npm-packages-as-native-es-modules-41ffbc0a9dea
|
||||
|
||||
how about the assets?
|
||||
|
||||
we also need to build the app
|
||||
|
||||
we need to be able to version libhydrogen independently from hydrogen the app? as any api breaking changes will need a major version increase. we probably want to end up with a monorepo where the app uses the sdk as well and we just use the local code with yarn link?
|
||||
|
||||
## Assets
|
||||
|
||||
we want to provide scss/sass files, but also css that can be included
|
||||
https://github.com/webpack/webpack/issues/7353 seems to imply that we just need to include the assets in the published files and from there on it is the consumer of libhydrogen's problem.
|
||||
|
||||
|
||||
how does all of this tie in with vite?
|
||||
|
||||
|
||||
we want to have hydrogenapp be a consumer of libhydrogen, potentially as two packages in a monorepo ... but we want the SDK to expose views and stylesheets... without having an index.html (which would be in hydrogenapp). this seems a bit odd...?
|
||||
|
||||
what would be in hydrogenapp actually? just an index.html file?
|
||||
|
||||
I'm not sure it makes sense to have them be 2 different packages in a monorepo, they should really be two artifacts from the same directory.
|
||||
|
||||
the stylesheets included in libhydrogen are from the same main.css file as is used in the app
|
||||
|
||||
https://www.freecodecamp.org/news/build-a-css-library-with-vitejs/
|
||||
|
||||
basically, we import the sass file from src/lib.ts so it is included in the assets there too, and we also create a plugin that emits a file for every sass file as suggested in the link above?
|
||||
|
||||
we probably want two different build commands for the app and the sdk though, we could have a parent vite config that both build configs extend from?
|
||||
|
||||
|
||||
### Dependency assets
|
||||
our dependencies should not be bundled for the SDK case. So if we import aesjs, it would be up to the build system of the consuming project to make that import work.
|
||||
|
||||
the paths.ts thingy ... we want to make it easy for people to setup the assets for our dependencies (olm), some assets are also part of the sdk itself. it might make sense to make all of the assets there part of the sdk (e.g. bundle olm.wasm and friends?) although shipping crypto, etc ...
|
||||
|
||||
perhaps we should have an include file per build system that treats own assets and dep assets the same by including the package name as wel for our own deps:
|
||||
```js
|
||||
import _downloadSandboxPath from "@matrix-org/hydrogen-sdk/download-sandbox.html?url";
|
||||
import _serviceWorkerPath from "@matrix-org/hydrogen-sdk/sw.js?url"; // not yet sure this is the way to do it
|
||||
import olmWasmPath from "@matrix-org/olm/olm.wasm?url";
|
||||
import olmJsPath from "@matrix-org/olm/olm.js?url";
|
||||
import olmLegacyJsPath from "@matrix-org/olm/olm_legacy.js?url";
|
||||
|
||||
export const olmPaths = {
|
||||
wasm: olmWasmPath,
|
||||
legacyBundle: olmLegacyJsPath,
|
||||
wasmBundle: olmJsPath,
|
||||
};
|
||||
|
||||
export const downloadSandboxPath = _downloadSandboxPath;
|
||||
```
|
||||
|
||||
we could put this file per build system, as ESM, in dist as well so you can include it to get the paths
|
||||
|
||||
|
||||
## Tooling
|
||||
|
||||
- `vite` a more high-level build tool that takes your index.html and turns it into optimized assets that you can host for production, as well as a very fast dev server. is used to have good default settings for our tools, typescript support, and also deals with asset compiling. good dev server. Would be nice to have the same tool for dev and prod. vite has good support for using `import` for anything that is not javascript, where we had an issue with `snowpack` (to get the prod path of an asset).
|
||||
- `rollup`: inlines
|
||||
- `lerna` is used to handle multi-package monorepos
|
||||
- `esbuild`: a js/ts build tool that we could use for building the lower level sdk where no other assets are involved, `vite` uses it for fast dev builds (`rollup` for prod). For now we won't extract a lower level sdk though.
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
- finish vite app build (without IE11 for now?)
|
||||
- create vite config to build src/lib.ts in cjs and esm, inheriting from a common base config with the app config
|
||||
- this will create a dist folder with
|
||||
- the whole source tree in es and cjs format
|
||||
- an es file to import get the asset paths as they are expected by Platform, per build system
|
||||
- assets from hydrogen itself:
|
||||
- css files and any resource used therein
|
||||
- download-sandbox.html
|
||||
- a type declaration file (index.d.ts)
|
||||
|
||||
## Questions
|
||||
- can rollup not bundle the source tree and leave modules intact?
|
||||
- if we can use a function that creates a chunk per file to pass to manualChunks and disable chunk hashing we can probably do this. See https://rollupjs.org/guide/en/#outputmanualchunks
|
||||
|
||||
looks like we should be able to disable chunk name hashing with chunkFileNames https://rollupjs.org/guide/en/#outputoptions-object
|
||||
|
||||
|
||||
we should test this with a vite test config
|
||||
|
||||
we also need to compile down to ES6, both for the app and for the sdk
|
54
doc/impl-thoughts/SSO.md
Normal file
54
doc/impl-thoughts/SSO.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
Pseudo code of how SSO should work:
|
||||
|
||||
```js
|
||||
// 1. Starting SSO
|
||||
const loginOptions = await sessionContainer.queryLogin("matrix.org");
|
||||
// every login option (the return type of loginOptions.password and loginOptions.sso.createLogin)
|
||||
// that can be passed in to startWithLogin will implement a common LoginMethod interface that has:
|
||||
// - a `homeserver` property (so the hsApi can be created for it before passing it into `login`)
|
||||
// - a method `async login(hsApi, deviceName)` that returns loginData (device_id, user_id, access_token)
|
||||
|
||||
// loginOptions goes to the LoginViewModel
|
||||
|
||||
// if password login, mapped to PasswordLoginViewModel
|
||||
if (loginOptions.password) {
|
||||
sessionContainer.startWithLogin(loginOptions.password(username, password));
|
||||
}
|
||||
|
||||
// if sso login, mapped to SSOLoginViewModel
|
||||
if (loginOptions.sso) {
|
||||
const {sso} = loginOptions;
|
||||
// params contains everything needed to create a callback url:
|
||||
// the homeserver, and optionally the provider
|
||||
let provider = null;
|
||||
if (sso.providers) {
|
||||
// show button for each provider
|
||||
// pick the first one as an example
|
||||
provider = providers[0];
|
||||
}
|
||||
// when sso button is clicked:
|
||||
// store the homeserver for when we get redirected back after the sso flow
|
||||
platform.settingsStorage.setString("sso_homeserver", loginOptions.homeserver);
|
||||
// create the redirect url
|
||||
const callbackUrl = urlCreator.createSSOCallbackURL(); // will just return the document url without any fragment
|
||||
const redirectUrl = sso.createRedirectUrl(callbackUrl, provider);
|
||||
// and open it
|
||||
platform.openURL(redirectUrl);
|
||||
}
|
||||
|
||||
// 2. URLRouter, History & parseUrlPath will need to also take the query params into account, so hydrogen.element.io/?loginToken=abc can be converted into a navigation path of [{type: "sso", value: "abc"}]
|
||||
|
||||
// 3. when "sso" is on the navigation path, a CompleteSSOLoginView is shown.
|
||||
// It will use the same SessionLoadView(Model) as for password login once login is called.
|
||||
//
|
||||
// Also see RootViewModel._applyNavigation.
|
||||
//
|
||||
// Its view model will do something like:
|
||||
|
||||
// need to retrieve ssoHomeserver url in localStorage
|
||||
const ssoHomeserver = platform.settingsStorage.getString("sso_homeserver");
|
||||
// need to retrieve loginToken from query parameters
|
||||
const loginToken = "..."; // passed in to view model constructor
|
||||
const loginOptions = await sessionContainer.queryLogin(ssoHomeserver);
|
||||
sessionContainer.startWithLogin(loginOptions.sso.createLogin(loginToken));
|
||||
```
|
116
doc/invites.md
116
doc/invites.md
|
@ -3,4 +3,118 @@
|
|||
- invite_state doesn't update over /sync
|
||||
- can we reuse room summary? need to clear when joining
|
||||
- rely on filter operator to split membership=join from membership=invite?
|
||||
-
|
||||
|
||||
- invite_state comes once, and then not again
|
||||
- only state (no heroes for example, but we do get the members)
|
||||
- wants:
|
||||
- different class to represent invited room, with accept or reject method?
|
||||
- make it somewhat easy to render just joined rooms (rely on filter and still put them all in the same observable map)
|
||||
- make the transition from invite to joined smooth
|
||||
- reuse room summary logic?
|
||||
|
||||
InvitedRoom
|
||||
isDM
|
||||
isEncrypted
|
||||
name
|
||||
|
||||
timestamp
|
||||
accept()
|
||||
reject()
|
||||
JoiningRoom
|
||||
to store intent of room you joined through directory, invite, or just /join roomid
|
||||
also joining is retried when coming back online
|
||||
|
||||
forget()
|
||||
Room
|
||||
|
||||
so, also taking into account that other types of room we might not want to expose through session.rooms will have invites,
|
||||
perhaps it is best to expose invites through a different observable collection. You can always join/concat them to show in
|
||||
the same list.
|
||||
|
||||
How do we handle a smooth UI transition when accepting an invite though?
|
||||
For looking at the room itself:
|
||||
- we would attach to the Invite event emitter, and we can have a property "joined" that we would update. Then you know you can go look for the room (or even allow to access the room through a property?)
|
||||
- so this way the view model can know when to switch and signal the view
|
||||
For the room list:
|
||||
- the new Room will be added at exactly the same moment the Invite is removed,
|
||||
so it should already be fairly smooth whether they are rendered in the same list or not.
|
||||
|
||||
How will we locate the Invite/Room during sync when we go from invite => join?
|
||||
- have both adhere to sync target api (e.g. prepareSync, ...) and look in invite map
|
||||
if room id is not found in room map in session.getroom.
|
||||
- how do we remove the invite when join?
|
||||
- we ca
|
||||
Where to store?
|
||||
- room summaries?
|
||||
- do we have an interest in keeping the raw events?
|
||||
- room versions will add another layer of indirection to the room summaries (or will it? once you've upgraded the room, we don't care too much anymore about the details of the old room? hmmm, we do care about whether it is encrypted or not... we need everything to be able to show the timeline in any case)
|
||||
|
||||
|
||||
Invite => accept() => Room (ends up in session.rooms)
|
||||
(.type) => Space (ends up in session.spaces)
|
||||
Invite:
|
||||
- isEncrypted
|
||||
- isDM
|
||||
- type
|
||||
- id
|
||||
- name
|
||||
- avatarUrl
|
||||
- timestamp
|
||||
- joinRule (to say wheter you cannot join this room again if you reject)
|
||||
|
||||
|
||||
|
||||
new "memberships":
|
||||
joining (when we want to join/are joining but haven't received remote echo yet)
|
||||
leaving (needed?)
|
||||
|
||||
maybe it's slightly overkill to persist the intent of joining or leaving a room,
|
||||
but I do want a way to local echo joining a room,
|
||||
so that it immediately appears in the room list when clicking join in the room directory / from a url ... how would we sort these rooms though? we can always add another collection, but I'm not sure invites should be treated the same, they can already local echo on the invite object itself.
|
||||
|
||||
|
||||
since invites don't update, we could, in sync when processing a new join just set a flag on the roomsyncstate if a room is newly created and in writeSync/afterSync check if there is a `session.invites.get(id)` and call `writeSync/afterSync` on it as well. We need to handle leave => invite as well. So don't check for invites only if it is a new room, but also if membership is leave
|
||||
|
||||
transitions are:
|
||||
invite => join
|
||||
invite => leave
|
||||
invite => ban
|
||||
join => left
|
||||
join => ban
|
||||
leave => invite
|
||||
leave => join
|
||||
leave => ban
|
||||
ban => leave
|
||||
none => invite
|
||||
none => join
|
||||
none => ban
|
||||
|
||||
kick should keep the room & timeline visible (even in room list, until you archive?)
|
||||
leave should close the room. So explicit archive() step on room ?
|
||||
|
||||
Room => leave() => ArchivedRoom (just a Room loaded from archived_room_summaries) => .forget()
|
||||
=> .forget()
|
||||
|
||||
Room receives leave membership
|
||||
- if sender === state_key, we left, and we archive the room (remove it from the room list, but keep it in storage)
|
||||
- if sender !== state_key, we got kicked, and we write the membership but don't archive so it stays in the room list until you call archive/forget on the room
|
||||
when calling room.leave(), do you have to call archive() or forget() after as well? or rather param of leave and stored intent? sounds like non-atomical operation to me ...
|
||||
we should be able to archive or forget before leave remote echo arrives
|
||||
|
||||
if two stores, this could mean we could have both an invite and a room with kicked state for a given room id?
|
||||
|
||||
we should avoid key collisions between `session.invites` and `session.rooms` (also `session.archivedRooms` once supported?) in any case,
|
||||
because if we join them to display in one list, things get complicated.
|
||||
|
||||
avoiding key collisions can happen both with 1 or multiple stores for different room states and is just a matter
|
||||
of carefully removing one state representation before adding another one.
|
||||
so a kicked or left room would disappear from session.rooms when an invite is synced?
|
||||
this would prevent you from seeing the old timeline for example, and if you reject, the old state would come back?
|
||||
|
||||
|
||||
# Decisions
|
||||
- we expose session.invites separate from session.rooms because they are of a different type.
|
||||
This way, you only have methods on the object that make sense (accept on Room does not make sense, like Invite.openTimeline doesn't make sense)
|
||||
- we store invites (and likely also archived rooms) in a different store, so that we don't have to clear/add properties where they both differ when transitioning. Also, this gives us the possibility to show the timeline on a room that you have previously joined, as the room summary and invite can exist at the same time. (need to resolve key collision question though for this)
|
||||
- we want to keep kicked rooms in the room list until explicitly archived
|
||||
- room id collisions between invites and rooms, can we implement a strategy to prefer invites in the join operator?
|
||||
|
|
BIN
icon.png
BIN
icon.png
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
37
index.html
37
index.html
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<meta name="application-name" content="Hydrogen Chat"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="Hydrogen Chat">
|
||||
<meta name="description" content="A matrix chat application">
|
||||
<link rel="stylesheet" type="text/css" href="src/ui/web/css/main.css">
|
||||
<link rel="stylesheet" type="text/css" href="src/ui/web/css/themes/element/theme.css" title="Element Theme">
|
||||
<link rel="alternate stylesheet" type="text/css" href="src/ui/web/css/themes/bubbles/theme.css" title="Bubbles Theme">
|
||||
</head>
|
||||
<body class="hydrogen">
|
||||
<script id="version" type="disabled">
|
||||
window.HYDROGEN_VERSION = "%%VERSION%%";
|
||||
</script>
|
||||
<script id="main" type="module">
|
||||
import {main} from "./src/main.js";
|
||||
main(document.body, {
|
||||
worker: "src/worker.js",
|
||||
olm: {
|
||||
wasm: "lib/olm/olm.wasm",
|
||||
legacyBundle: "lib/olm/olm_legacy.js",
|
||||
wasmBundle: "lib/olm/olm.js",
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script id="service-worker" type="disabled">
|
||||
if('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('sw.js')
|
||||
.then(function() { console.log("Service Worker registered"); });
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
2313
package-lock.json
generated
2313
package-lock.json
generated
File diff suppressed because it is too large
Load diff
63
package.json
63
package.json
|
@ -1,16 +1,24 @@
|
|||
{
|
||||
"name": "hydrogen-web",
|
||||
"version": "0.0.34",
|
||||
"version": "0.3.1",
|
||||
"description": "A javascript matrix client prototype, trying to minize RAM usage by offloading as much as possible to IndexedDB",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"doc": "doc"
|
||||
},
|
||||
"enginesStrict": {
|
||||
"node": ">=15"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node_modules/.bin/impunity --entry-point src/main.js --force-esm-dirs lib/ src/",
|
||||
"start": "node scripts/serve-local.js",
|
||||
"build": "node --experimental-modules scripts/build.mjs",
|
||||
"postinstall": "node ./scripts/post-install.mjs"
|
||||
"lint": "eslint --cache src/",
|
||||
"lint-ts": "eslint src/ -c .ts-eslintrc.js --ext .ts",
|
||||
"lint-ci": "eslint src/",
|
||||
"test": "impunity --entry-point src/platform/web/main.js src/platform/web/Platform.js --force-esm-dirs lib/ src/ --root-dir src/",
|
||||
"test:postcss": "impunity --entry-point scripts/postcss/tests/css-compile-variables.test.js scripts/postcss/tests/css-url-to-variables.test.js",
|
||||
"test:sdk": "yarn build:sdk && cd ./scripts/sdk/test/ && yarn --no-lockfile && node test-sdk-in-esm-vite-build-env.js && node test-sdk-in-commonjs-env.js",
|
||||
"start": "vite --port 3000",
|
||||
"build": "vite build && ./scripts/cleanup.sh",
|
||||
"build:sdk": "./scripts/sdk/build.sh",
|
||||
"watch:sdk": "./scripts/sdk/build.sh && yarn run vite build -c vite.sdk-lib-config.js --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -23,31 +31,36 @@
|
|||
},
|
||||
"homepage": "https://github.com/vector-im/hydrogen-web/#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.1",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@rollup/plugin-babel": "^5.1.0",
|
||||
"@rollup/plugin-commonjs": "^15.0.0",
|
||||
"@rollup/plugin-multi-entry": "^4.0.0",
|
||||
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"commander": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"acorn": "^8.6.0",
|
||||
"acorn-walk": "^8.2.0",
|
||||
"aes-js": "^3.1.2",
|
||||
"bs58": "^4.0.1",
|
||||
"core-js": "^3.6.5",
|
||||
"finalhandler": "^1.1.1",
|
||||
"impunity": "^1.0.0",
|
||||
"es6-promise": "https://github.com/bwindels/es6-promise.git#bwindels/expose-flush",
|
||||
"escodegen": "^2.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"fake-indexeddb": "^3.1.2",
|
||||
"impunity": "^1.0.9",
|
||||
"mdn-polyfills": "^5.20.0",
|
||||
"postcss": "^7.0.32",
|
||||
"postcss-css-variables": "^0.17.0",
|
||||
"postcss-flexbugs-fixes": "^4.2.1",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-url": "^8.0.0",
|
||||
"merge-options": "^3.0.4",
|
||||
"node-html-parser": "^4.0.0",
|
||||
"postcss-css-variables": "^0.18.0",
|
||||
"postcss-flexbugs-fixes": "^5.0.2",
|
||||
"postcss-value-parser": "^4.2.0",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"rollup": "^2.26.4",
|
||||
"rollup-plugin-cleanup": "^3.1.1",
|
||||
"serve-static": "^1.13.2",
|
||||
"svgo": "^2.8.0",
|
||||
"text-encoding": "^0.7.0",
|
||||
"typescript": "^4.7.0",
|
||||
"vite": "^2.9.8",
|
||||
"xxhashjs": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
||||
"another-json": "^0.2.0",
|
||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz"
|
||||
"base64-arraybuffer": "^0.2.0",
|
||||
"dompurify": "^2.3.0",
|
||||
"off-color": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
165
prototypes/derive-key-ie11.html
Normal file
165
prototypes/derive-key-ie11.html
Normal file
|
@ -0,0 +1,165 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://unpkg.com/text-encoding@0.6.4/lib/encoding-indexes.js"></script>
|
||||
<script src="https://unpkg.com/text-encoding@0.6.4/lib/encoding.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>
|
||||
<script src="deps/jsSHA/dist/sha512.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.rawgit.com/ricmoo/aes-js/e27b99df/index.js"></script>
|
||||
<script type="text/javascript" src="derive-keys-bundle.js"></script>
|
||||
<script type="text/javascript">
|
||||
if (!Math.imul) Math.imul = function(a, b) {
|
||||
var aHi = (a >>> 16) & 0xffff;
|
||||
var aLo = a & 0xffff;
|
||||
var bHi = (b >>> 16) & 0xffff;
|
||||
var bLo = b & 0xffff;
|
||||
// the shift by 0 fixes the sign on the high part
|
||||
// the final |0 converts the unsigned value into a signed value
|
||||
return ((aLo * bLo) + (((aHi * bLo + aLo * bHi) << 16) >>> 0) | 0);
|
||||
};
|
||||
|
||||
if (!Math.clz32) Math.clz32 = (function(log, LN2){
|
||||
return function(x) {
|
||||
// Let n be ToUint32(x).
|
||||
// Let p be the number of leading zero bits in
|
||||
// the 32-bit binary representation of n.
|
||||
// Return p.
|
||||
var asUint = x >>> 0;
|
||||
if (asUint === 0) {
|
||||
return 32;
|
||||
}
|
||||
return 31 - (log(asUint) / LN2 | 0) |0; // the "| 0" acts like math.floor
|
||||
};
|
||||
})(Math.log, Math.LN2);
|
||||
</script>
|
||||
<script type="text/javascript" src="../lib/olm/olm_legacy.js"></script>
|
||||
<script type="text/javascript">
|
||||
// sample data from account with recovery key
|
||||
const ssssKeyAccountData = {
|
||||
"type": "m.secret_storage.key.le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d",
|
||||
"content": {
|
||||
"algorithm": "m.secret_storage.v1.aes-hmac-sha2",
|
||||
"iv": "YPhwwArIUTwasbROMFd1PQ==",
|
||||
"mac": "khWXeBzKtZi8SX6I7m/9yPoLB1yv1u9l+NNi6WF4+ek="
|
||||
}
|
||||
};
|
||||
const megolmBackupKeyAccountData = {
|
||||
"type": "m.megolm_backup.v1",
|
||||
"content": {
|
||||
"encrypted": {
|
||||
"le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d": {
|
||||
"iv": "PiqYdySj9s4RsaLc1oDF1w==",
|
||||
"ciphertext": "62fjUs1xkF3BvqVEvAEoDH9jcYiotkcJHG/VNtzSrPBlrmOYQyPA93L2rKo=",
|
||||
"mac": "vtq+kEg5XaRdw08aPiQi7+w9qUiDCQKo/jKNTvrN4ho="
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const backupInfo = {
|
||||
"algorithm": "m.megolm_backup.v1.curve25519-aes-sha2",
|
||||
"auth_data": {
|
||||
"public_key": "tY/jSdfy2q1pS8Ux+LP8xr/RMn9NDElwofH+E5sFG38",
|
||||
"signatures": {
|
||||
"@bruno-test4s2:matrix.org": {
|
||||
"ed25519:KTLGZUJCYZ": "YPuzpLo4OZL5+HQTkbDnUKpIuCmL50Q7RnMs9cRfKqyS+CMPm0RBU1ttPO6XOZ+TjZ4VThXU50LUkmpJiKM+Aw",
|
||||
"ed25519:l17fdsfeS7qUKIYzgx3LxIcHnjPM00+Ge5dTk7Msy04": "epDo+d9foXXcnXChZaEOCKNYzofOMBXQF3FCMDJ52hxvxh9K1w+2zOOAwWEKOts88gubgIsdRQedkuhuIm2LCg"
|
||||
}
|
||||
}
|
||||
},
|
||||
"count": 1,
|
||||
"etag": "1",
|
||||
"version": "1"
|
||||
};
|
||||
|
||||
const sessionResponse = {
|
||||
"first_message_index": 0,
|
||||
"forwarded_count": 0,
|
||||
"is_verified": true,
|
||||
"session_data": {
|
||||
"ciphertext": "+a8OCF0v5U5GYTNAMwgNEqSItxy4hea073zlWCp+ocr4mUQDuUZyOo+DGHDPPvSOnhJA2waSV05wna/Jmig7NAzuJJy8eEd0dHmGiA16eUMFiUz0HYFseDXs0dDGF38shz1C6CXYRjTOS3S7JWLVzeeYy632BMGvGjWMvAuOpm4NgV9fLB5J6nYVb/wvU3Mf8mw/eT5k8AUJA/CAD6zM7T9skEJhuFoi5kdPfBoozUbScA5xcPVmE6aY08zZ6QpiZ7lsyWoIRDbRxaBxL82T2CnpcngE/SAHF+eJ9ZWK3txolYLT/KAfKlAVLV7yWXkYL7oxrW8DI/5ZQFXUqzqqqfAB7Qz2AIvCdUVqhDGwuDr5noCMlKYEwyYR0VC2i4ZyXdtLdOjKBS2eTqDcwdv2gcaOnbJJcIEuGMKVg89/rKqpWncY/+NOBTQhuts05+Wi+9wU+OlGlNFvhkOgp1BaP0Q7T4pkxgj4OSbf3t1UfthltJSX8TS9ZGd3DVDI8swQuMBvF9H+7kAeO2IWTMSe57MYvlk0aw/gPFdI06lcOvH2nAr9C2HNsuYhyO4XGZOAg8HHzkjLlzNU+zJk1MfRIXRoVgbIh1hApcK9HhyTBzg",
|
||||
"ephemeral": "z0JE6swJZbrmRYOWGvEI6zhIzoJ57lhzp1uujVS2jUs",
|
||||
"mac": "+AAASqA+4U8"
|
||||
}
|
||||
};
|
||||
const keyId = "le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d";
|
||||
// sample data with account with recovery passphrase
|
||||
// const ssssKeyAccountData =
|
||||
// {
|
||||
// "type": "m.secret_storage.key.HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM",
|
||||
// "content": {
|
||||
// "algorithm": "m.secret_storage.v1.aes-hmac-sha2",
|
||||
// "passphrase": {
|
||||
// "algorithm": "m.pbkdf2",
|
||||
// "iterations": 500000,
|
||||
// "salt": "tfY5mgvQBr3Gd5Dy1IBiKf7fLquL4Y9O"
|
||||
// },
|
||||
// "iv": "xitm4hxsqagkbyEmXj0tUw==",
|
||||
// "mac": "nagOYz7FKrdlFEKM9ij78th0O2p7YVGgl+p0LHr4EBE="
|
||||
// }
|
||||
// };
|
||||
|
||||
// const megolmBackupKeyAccountData = {
|
||||
// "type": "m.megolm_backup.v1",
|
||||
// "content": {
|
||||
// "encrypted": {
|
||||
// "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM": {
|
||||
// "iv": "HpzOY5DxYFJCxw5Vi6BBOQ==",
|
||||
// "ciphertext": "u1TJjaaGKVDGExg9hu2fIUZ0gjToMcMReyhn4nsXgnhm7Dvz6E/4p+nSF3w=",
|
||||
// "mac": "08ckDbQK9wB2jiE4n4sfp2sw83q/0C2/gEz2LuHMEPg="
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// const backupInfo = {
|
||||
// "algorithm": "m.megolm_backup.v1.curve25519-aes-sha2",
|
||||
// "auth_data": {
|
||||
// "public_key": "Vw2cwhbxFg/GQ2rr4VRIQ+Oh74lP7IxY6oN4R9q992k",
|
||||
// "signatures": {
|
||||
// "@bruno-test4s:matrix.org": {
|
||||
// "ed25519:XAIKJXBCNZ": "AFBp1T2x8hyPSi2hCHg6IzNy67RxULj3/7LYZgVT3Ruz49v5h1+jAScTxZj5jrItxo2LCzSORH+yABHjPIqOBQ",
|
||||
// "ed25519:lukepZkTmPcJS6wCl12B0tIURIO8YbMd5QJLf8UOugI": "a1ZJa+1+p9Gm5Po1B619ZDy4xidHmLt82vXVPH7vWTjny1r3JI2iM4fB2qh8vEiASNlFyVrFx//gQrz9Y1IJBA"
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// "count": 1,
|
||||
// "etag": "1",
|
||||
// "version": "1"
|
||||
// };
|
||||
// const sessionResponse = {
|
||||
// "first_message_index": 0,
|
||||
// "forwarded_count": 0,
|
||||
// "is_verified": true,
|
||||
// "session_data": {
|
||||
// "ciphertext": "1NoC8/GZWeGjneuoFDcqpbMYOJ8bjDFiw2O4/YOKC59x9RqSejLyM8qLL5FzlV+uW7anPVED8t9m+p2t1kKa15LxlcdzXjLPCv1QGYlhotbUhN8eRUobQuLqsD5Dl/QqNxv+Xl65tEaQhUeF30NmSesw6GHvP93vB3mTN8Yz9QyaQtvgoI/Q6c4d+yGmFVE2dlhXdOs7Hrylrg8UyM1QI+qpNJ3L9ETcqiXCG/FJIdM87LmNnHPX65TWK5xsu1JKWCI2BY1KFVDyxm40FyHHypUPYoT9RqPnygHtYoTiZzyaVxqUu2vg08Bv0t1VH2SNDGs5aZYQN5S1JNAHrXE+cWSg0rfVb160Z4FJC/89wO8fw/uXqJehqMVuC9BSU/zsKcZ797U92qDnIb6QQuMYKRgh9JrEugqJN9ocL7F8W9fW2oFfUYRyvOZRSf387hGrapEGBKx7Owb7UoXvWyb4C5hc5SFNvej+yg98+Fi4hzlGH26DqzJdLcxU5P/MWfZc222QqPFuFspe6f0Ts5jnJhjCQhXWoM4G6mtvGbOm2ESSJULj8U4JSDz8GsxrmojR/pBpywBvuy/mx//htnacnTRqYJz+PZVtV63rfaZlEtU",
|
||||
// "ephemeral": "wXBeLoazggBmFS0eiVY9H/qq5o1yt2/NIKWcq384EHc",
|
||||
// "mac": "w3IfO5vL9Bc"
|
||||
// }
|
||||
// };
|
||||
//const keyId = "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM";
|
||||
const cryptoDriver = new bundle.CryptoDriver((window.crypto || window.msCrypto).subtle);
|
||||
window.Olm.init().then(function() {
|
||||
bundle.deserializeSSSSKey("EsUH dBfj L7XF Kdej TNmK 2CdP R7NQ KnQH zA1o 8kDg piuJ QEZh", ssssKeyAccountData).then(function(ssssKey) {
|
||||
//bundle.deriveSSSSKey(cryptoDriver, prompt("passphrase"), ssssKeyAccountData).then(function(ssssKey) {
|
||||
// const ssssKey = new Uint8Array(32);
|
||||
// const bytes = [123, 47, 138, 15, 190, 69, 224, 204, 88, 246, 203, 65, 243, 234, 91, 17, 250, 107, 104, 51, 211, 252, 81, 67, 80, 191, 105, 208, 127, 87, 107, 231];
|
||||
// for (var i = bytes.length - 1; i >= 0; i--) {
|
||||
// ssssKey[i] = bytes[i];
|
||||
// }
|
||||
console.log("ssssKey", ssssKey);
|
||||
bundle.decryptSecret(cryptoDriver, keyId, ssssKey, megolmBackupKeyAccountData).then(function(backupKeyBase64) {
|
||||
console.log("backupKeyBase64", backupKeyBase64);
|
||||
bundle.decryptSession(backupKeyBase64, backupInfo, sessionResponse).then(function(session) {
|
||||
console.log("session", session);
|
||||
alert(session.session_key);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
458
prototypes/derive-keys.js
vendored
Normal file
458
prototypes/derive-keys.js
vendored
Normal file
|
@ -0,0 +1,458 @@
|
|||
import {base58} from "../src/utils/base-encoding.js";
|
||||
|
||||
function subtleCryptoResult(promiseOrOp, method) {
|
||||
if (promiseOrOp instanceof Promise) {
|
||||
return promiseOrOp;
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
promiseOrOp.oncomplete = e => resolve(e.target.result);
|
||||
promiseOrOp.onerror = e => reject(new Error("Crypto error on " + method));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CryptoHMACDriver {
|
||||
constructor(subtleCrypto) {
|
||||
this._subtleCrypto = subtleCrypto;
|
||||
}
|
||||
/**
|
||||
* [hmac description]
|
||||
* @param {BufferSource} key
|
||||
* @param {BufferSource} mac
|
||||
* @param {BufferSource} data
|
||||
* @param {HashName} hash
|
||||
* @return {boolean}
|
||||
*/
|
||||
async verify(key, mac, data, hash) {
|
||||
const opts = {
|
||||
name: 'HMAC',
|
||||
hash: {name: hashName(hash)},
|
||||
};
|
||||
const hmacKey = await subtleCryptoResult(this._subtleCrypto.importKey(
|
||||
'raw',
|
||||
key,
|
||||
opts,
|
||||
false,
|
||||
['verify'],
|
||||
), "importKey");
|
||||
const isVerified = await subtleCryptoResult(this._subtleCrypto.verify(
|
||||
opts,
|
||||
hmacKey,
|
||||
mac,
|
||||
data,
|
||||
), "verify");
|
||||
return isVerified;
|
||||
}
|
||||
|
||||
async compute(key, data, hash) {
|
||||
const opts = {
|
||||
name: 'HMAC',
|
||||
hash: {name: hashName(hash)},
|
||||
};
|
||||
const hmacKey = await subtleCryptoResult(this._subtleCrypto.importKey(
|
||||
'raw',
|
||||
key,
|
||||
opts,
|
||||
false,
|
||||
['sign'],
|
||||
), "importKey");
|
||||
const buffer = await subtleCryptoResult(this._subtleCrypto.sign(
|
||||
opts,
|
||||
hmacKey,
|
||||
data,
|
||||
), "sign");
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
const nwbo = (num, len) => {
|
||||
const arr = new Uint8Array(len);
|
||||
for(let i=0; i<len; i++) arr[i] = 0xFF && (num >> ((len - i - 1)*8));
|
||||
return arr;
|
||||
};
|
||||
|
||||
class CryptoLegacyHMACDriver {
|
||||
constructor(hmacDriver) {
|
||||
this._hmacDriver = hmacDriver;
|
||||
}
|
||||
|
||||
async verify(key, mac, data, hash) {
|
||||
if (hash === "SHA-512") {
|
||||
throw new Error("SHA-512 HMAC verification is not implemented yet");
|
||||
} else {
|
||||
return this._hmacDriver.verify(key, mac, data, hash)
|
||||
}
|
||||
}
|
||||
|
||||
async compute(key, data, hash) {
|
||||
if (hash === "SHA-256") {
|
||||
return await this._hmacDriver.compute(key, data, hash);
|
||||
} else {
|
||||
const shaObj = new window.jsSHA(hash, "UINT8ARRAY", {
|
||||
"hmacKey": {
|
||||
"value": key,
|
||||
"format": "UINT8ARRAY"
|
||||
}
|
||||
});
|
||||
shaObj.update(data);
|
||||
return shaObj.getHash("UINT8ARRAY");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CryptoLegacyDeriveDriver {
|
||||
constructor(cryptoDriver) {
|
||||
this._cryptoDriver = cryptoDriver;
|
||||
}
|
||||
|
||||
// adapted from https://github.com/junkurihara/jscu/blob/develop/packages/js-crypto-pbkdf/src/pbkdf.ts#L21
|
||||
// could also consider https://github.com/brix/crypto-js/blob/develop/src/pbkdf2.js although not async
|
||||
async pbkdf2(password, iterations, salt, hash, length) {
|
||||
const dkLen = length / 8;
|
||||
if (iterations <= 0) {
|
||||
throw new Error('InvalidIterationCount');
|
||||
}
|
||||
if (dkLen <= 0) {
|
||||
throw new Error('InvalidDerivedKeyLength');
|
||||
}
|
||||
const hLen = this._cryptoDriver.digestSize(hash);
|
||||
if(dkLen > (Math.pow(2, 32) - 1) * hLen) throw new Error('DerivedKeyTooLong');
|
||||
|
||||
const l = Math.ceil(dkLen/hLen);
|
||||
const r = dkLen - (l-1)*hLen;
|
||||
|
||||
const funcF = async (i) => {
|
||||
const seed = new Uint8Array(salt.length + 4);
|
||||
seed.set(salt);
|
||||
seed.set(nwbo(i+1, 4), salt.length);
|
||||
let u = await this._cryptoDriver.hmac.compute(password, seed, hash);
|
||||
let outputF = new Uint8Array(u);
|
||||
for(let j = 1; j < iterations; j++){
|
||||
if ((j % 1000) === 0) {
|
||||
console.log(j, j/iterations);
|
||||
}
|
||||
u = await this._cryptoDriver.hmac.compute(password, u, hash);
|
||||
outputF = u.map( (elem, idx) => elem ^ outputF[idx]);
|
||||
}
|
||||
return {index: i, value: outputF};
|
||||
};
|
||||
|
||||
const Tis = [];
|
||||
const DK = new Uint8Array(dkLen);
|
||||
for(let i = 0; i < l; i++) {
|
||||
Tis.push(funcF(i));
|
||||
}
|
||||
const TisResolved = await Promise.all(Tis);
|
||||
TisResolved.forEach(elem => {
|
||||
if (elem.index !== l - 1) {
|
||||
DK.set(elem.value, elem.index*hLen);
|
||||
}
|
||||
else {
|
||||
DK.set(elem.value.slice(0, r), elem.index*hLen);
|
||||
}
|
||||
});
|
||||
|
||||
return DK;
|
||||
}
|
||||
|
||||
// based on https://github.com/junkurihara/jscu/blob/develop/packages/js-crypto-hkdf/src/hkdf.ts
|
||||
async hkdf(key, salt, info, hash, length) {
|
||||
length = length / 8;
|
||||
const len = this._cryptoDriver.digestSize(hash);
|
||||
|
||||
// RFC5869 Step 1 (Extract)
|
||||
const prk = await this._cryptoDriver.hmac.compute(salt, key, hash);
|
||||
|
||||
// RFC5869 Step 2 (Expand)
|
||||
let t = new Uint8Array([]);
|
||||
const okm = new Uint8Array(Math.ceil(length / len) * len);
|
||||
for(let i = 0; i < Math.ceil(length / len); i++){
|
||||
const concat = new Uint8Array(t.length + info.length + 1);
|
||||
concat.set(t);
|
||||
concat.set(info, t.length);
|
||||
concat.set(new Uint8Array([i+1]), t.length + info.length);
|
||||
t = await this._cryptoDriver.hmac.compute(prk, concat, hash);
|
||||
okm.set(t, len * i);
|
||||
}
|
||||
return okm.slice(0, length);
|
||||
}
|
||||
}
|
||||
|
||||
class CryptoDeriveDriver {
|
||||
constructor(subtleCrypto) {
|
||||
this._subtleCrypto = subtleCrypto;
|
||||
}
|
||||
/**
|
||||
* [pbkdf2 description]
|
||||
* @param {BufferSource} password
|
||||
* @param {Number} iterations
|
||||
* @param {BufferSource} salt
|
||||
* @param {HashName} hash
|
||||
* @param {Number} length the desired length of the generated key, in bits (not bytes!)
|
||||
* @return {BufferSource}
|
||||
*/
|
||||
async pbkdf2(password, iterations, salt, hash, length) {
|
||||
// check for existance of deriveBits, which IE11 does not have
|
||||
const key = await subtleCryptoResult(this._subtleCrypto.importKey(
|
||||
'raw',
|
||||
password,
|
||||
{name: 'PBKDF2'},
|
||||
false,
|
||||
['deriveBits'],
|
||||
), "importKey");
|
||||
const keybits = await subtleCryptoResult(this._subtleCrypto.deriveBits(
|
||||
{
|
||||
name: 'PBKDF2',
|
||||
salt,
|
||||
iterations,
|
||||
hash: hashName(hash),
|
||||
},
|
||||
key,
|
||||
length,
|
||||
), "deriveBits");
|
||||
return new Uint8Array(keybits);
|
||||
}
|
||||
|
||||
/**
|
||||
* [hkdf description]
|
||||
* @param {BufferSource} key [description]
|
||||
* @param {BufferSource} salt [description]
|
||||
* @param {BufferSource} info [description]
|
||||
* @param {HashName} hash the hash to use
|
||||
* @param {Number} length desired length of the generated key in bits (not bytes!)
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
async hkdf(key, salt, info, hash, length) {
|
||||
const hkdfkey = await subtleCryptoResult(this._subtleCrypto.importKey(
|
||||
'raw',
|
||||
key,
|
||||
{name: "HKDF"},
|
||||
false,
|
||||
["deriveBits"],
|
||||
), "importKey");
|
||||
const keybits = await subtleCryptoResult(this._subtleCrypto.deriveBits({
|
||||
name: "HKDF",
|
||||
salt,
|
||||
info,
|
||||
hash: hashName(hash),
|
||||
},
|
||||
hkdfkey,
|
||||
length,
|
||||
), "deriveBits");
|
||||
return new Uint8Array(keybits);
|
||||
}
|
||||
}
|
||||
|
||||
class CryptoAESDriver {
|
||||
constructor(subtleCrypto) {
|
||||
this._subtleCrypto = subtleCrypto;
|
||||
}
|
||||
/**
|
||||
* [decrypt description]
|
||||
* @param {BufferSource} key [description]
|
||||
* @param {BufferSource} iv [description]
|
||||
* @param {BufferSource} ciphertext [description]
|
||||
* @return {BufferSource} [description]
|
||||
*/
|
||||
async decrypt(key, iv, ciphertext) {
|
||||
const opts = {
|
||||
name: "AES-CTR",
|
||||
counter: iv,
|
||||
length: 64,
|
||||
};
|
||||
let aesKey;
|
||||
try {
|
||||
aesKey = await subtleCryptoResult(this._subtleCrypto.importKey(
|
||||
'raw',
|
||||
key,
|
||||
opts,
|
||||
false,
|
||||
['decrypt'],
|
||||
), "importKey");
|
||||
} catch (err) {
|
||||
throw new Error(`Could not import key for AES-CTR decryption: ${err.message}`);
|
||||
}
|
||||
try {
|
||||
const plaintext = await subtleCryptoResult(this._subtleCrypto.decrypt(
|
||||
// see https://developer.mozilla.org/en-US/docs/Web/API/AesCtrParams
|
||||
opts,
|
||||
aesKey,
|
||||
ciphertext,
|
||||
), "decrypt");
|
||||
return new Uint8Array(plaintext);
|
||||
} catch (err) {
|
||||
throw new Error(`Could not decrypt with AES-CTR: ${err.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CryptoLegacyAESDriver {
|
||||
/**
|
||||
* [decrypt description]
|
||||
* @param {BufferSource} key [description]
|
||||
* @param {BufferSource} iv [description]
|
||||
* @param {BufferSource} ciphertext [description]
|
||||
* @return {BufferSource} [description]
|
||||
*/
|
||||
async decrypt(key, iv, ciphertext) {
|
||||
const aesjs = window.aesjs;
|
||||
var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(iv));
|
||||
return aesCtr.decrypt(ciphertext);
|
||||
}
|
||||
}
|
||||
|
||||
function hashName(name) {
|
||||
if (name !== "SHA-256" && name !== "SHA-512") {
|
||||
throw new Error(`Invalid hash name: ${name}`);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
export class CryptoDriver {
|
||||
constructor(subtleCrypto) {
|
||||
this.aes = new CryptoLegacyAESDriver();
|
||||
// this.aes = new CryptoAESDriver(subtleCrypto);
|
||||
//this.derive = new CryptoDeriveDriver(subtleCrypto);
|
||||
this.derive = new CryptoLegacyDeriveDriver(this);
|
||||
// subtleCrypto.deriveBits ?
|
||||
// new CryptoDeriveDriver(subtleCrypto) :
|
||||
// new CryptoLegacyDeriveDriver(this);
|
||||
this.hmac = new CryptoLegacyHMACDriver(new CryptoHMACDriver(subtleCrypto));
|
||||
this._subtleCrypto = subtleCrypto;
|
||||
}
|
||||
|
||||
/**
|
||||
* [digest description]
|
||||
* @param {HashName} hash
|
||||
* @param {BufferSource} data
|
||||
* @return {BufferSource}
|
||||
*/
|
||||
async digest(hash, data) {
|
||||
return await subtleCryptoResult(this._subtleCrypto.digest(hashName(hash), data));
|
||||
}
|
||||
|
||||
digestSize(hash) {
|
||||
switch (hashName(hash)) {
|
||||
case "SHA-512": return 64;
|
||||
case "SHA-256": return 32;
|
||||
default: throw new Error(`Not implemented for ${hashName(hash)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function decodeBase64(base64) {
|
||||
const binStr = window.atob(base64);
|
||||
const len = binStr.length;
|
||||
const bytes = new Uint8Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
bytes[i] = binStr.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
const DEFAULT_ITERATIONS = 500000;
|
||||
|
||||
const DEFAULT_BITSIZE = 256;
|
||||
|
||||
export async function deriveSSSSKey(cryptoDriver, passphrase, ssssKey) {
|
||||
const textEncoder = new TextEncoder();
|
||||
return await cryptoDriver.derive.pbkdf2(
|
||||
textEncoder.encode(passphrase),
|
||||
ssssKey.content.passphrase.iterations || DEFAULT_ITERATIONS,
|
||||
textEncoder.encode(ssssKey.content.passphrase.salt),
|
||||
"SHA-512",
|
||||
ssssKey.content.passphrase.bits || DEFAULT_BITSIZE);
|
||||
}
|
||||
|
||||
export async function decryptSecret(cryptoDriver, keyId, ssssKey, event) {
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
// now derive the aes and mac key from the 4s key
|
||||
const hkdfKey = await cryptoDriver.derive.hkdf(
|
||||
ssssKey,
|
||||
new Uint8Array(8).buffer, //salt
|
||||
textEncoder.encode(event.type), // info
|
||||
"SHA-256",
|
||||
512 // 512 bits or 64 bytes
|
||||
);
|
||||
const aesKey = hkdfKey.slice(0, 32);
|
||||
const hmacKey = hkdfKey.slice(32);
|
||||
|
||||
const data = event.content.encrypted[keyId];
|
||||
|
||||
const ciphertextBytes = decodeBase64(data.ciphertext);
|
||||
const isVerified = await cryptoDriver.hmac.verify(
|
||||
hmacKey, decodeBase64(data.mac),
|
||||
ciphertextBytes, "SHA-256");
|
||||
|
||||
if (!isVerified) {
|
||||
throw new Error("Bad MAC");
|
||||
}
|
||||
|
||||
const plaintext = await cryptoDriver.aes.decrypt(aesKey, decodeBase64(data.iv), ciphertextBytes);
|
||||
return textDecoder.decode(new Uint8Array(plaintext));
|
||||
}
|
||||
|
||||
|
||||
export async function decryptSession(backupKeyBase64, backupInfo, sessionResponse) {
|
||||
const privKey = decodeBase64(backupKeyBase64);
|
||||
console.log("privKey", privKey);
|
||||
|
||||
const decryption = new window.Olm.PkDecryption();
|
||||
let backupPubKey;
|
||||
try {
|
||||
backupPubKey = decryption.init_with_private_key(privKey);
|
||||
} catch (e) {
|
||||
decryption.free();
|
||||
throw e;
|
||||
}
|
||||
|
||||
// If the pubkey computed from the private data we've been given
|
||||
// doesn't match the one in the auth_data, the user has enetered
|
||||
// a different recovery key / the wrong passphrase.
|
||||
if (backupPubKey !== backupInfo.auth_data.public_key) {
|
||||
console.log("backupPubKey", backupPubKey.length, backupPubKey);
|
||||
throw new Error("bad backup key");
|
||||
}
|
||||
|
||||
const sessionInfo = decryption.decrypt(
|
||||
sessionResponse.session_data.ephemeral,
|
||||
sessionResponse.session_data.mac,
|
||||
sessionResponse.session_data.ciphertext,
|
||||
);
|
||||
return JSON.parse(sessionInfo);
|
||||
}
|
||||
|
||||
const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01];
|
||||
|
||||
|
||||
export async function deserializeSSSSKey(recoverykey) {
|
||||
const result = base58.decode(recoverykey.replace(/ /g, ''));
|
||||
|
||||
let parity = 0;
|
||||
for (const b of result) {
|
||||
parity ^= b;
|
||||
}
|
||||
if (parity !== 0) {
|
||||
throw new Error("Incorrect parity");
|
||||
}
|
||||
|
||||
for (let i = 0; i < OLM_RECOVERY_KEY_PREFIX.length; ++i) {
|
||||
if (result[i] !== OLM_RECOVERY_KEY_PREFIX[i]) {
|
||||
throw new Error("Incorrect prefix");
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
result.length !==
|
||||
OLM_RECOVERY_KEY_PREFIX.length + window.Olm.PRIVATE_KEY_LENGTH + 1
|
||||
) {
|
||||
throw new Error("Incorrect length");
|
||||
}
|
||||
|
||||
return Uint8Array.from(result.slice(
|
||||
OLM_RECOVERY_KEY_PREFIX.length,
|
||||
OLM_RECOVERY_KEY_PREFIX.length + window.Olm.PRIVATE_KEY_LENGTH,
|
||||
));
|
||||
}
|
100
prototypes/idb-continue-on-constrainterror.html
Normal file
100
prototypes/idb-continue-on-constrainterror.html
Normal file
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
class IDBError extends Error {
|
||||
constructor(errorEvent) {
|
||||
const request = errorEvent.target;
|
||||
const {error} = request;
|
||||
super(error.message);
|
||||
this.name = error.name;
|
||||
this.errorEvent = errorEvent;
|
||||
}
|
||||
|
||||
preventAbort() {
|
||||
this.errorEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
class AbortError extends Error {
|
||||
get name() { return "AbortError"; }
|
||||
}
|
||||
|
||||
function reqAsPromise(req) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function(e) {
|
||||
resolve(e.target.result);
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new IDBError(e));
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function txnAsPromise(txn) {
|
||||
return new Promise((resolve, reject) => {
|
||||
txn.addEventListener("complete", () => resolve());
|
||||
txn.addEventListener("abort", event => {
|
||||
reject(new AbortError());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function Storage(databaseName) {
|
||||
this._databaseName = databaseName;
|
||||
this._database = null;
|
||||
}
|
||||
|
||||
Storage.prototype = {
|
||||
open: function() {
|
||||
const req = window.indexedDB.open(this._databaseName);
|
||||
const self = this;
|
||||
req.onupgradeneeded = function(ev) {
|
||||
const db = ev.target.result;
|
||||
const oldVersion = ev.oldVersion;
|
||||
self._createStores(db, oldVersion);
|
||||
};
|
||||
return reqAsPromise(req).then(function() {
|
||||
self._database = req.result;
|
||||
});
|
||||
},
|
||||
readWriteTxn: function(storeName) {
|
||||
return this._database.transaction([storeName], "readwrite");
|
||||
},
|
||||
readTxn: function(storeName) {
|
||||
return this._database.transaction([storeName], "readonly");
|
||||
},
|
||||
_createStores: function(db) {
|
||||
db.createObjectStore("foos", {keyPath: "id"});
|
||||
}
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const storage = new Storage("idb-continue-on-constrainterror");
|
||||
await storage.open();
|
||||
const txn1 = storage.readWriteTxn("foos");
|
||||
const store = txn1.objectStore("foos");
|
||||
await reqAsPromise(store.clear());
|
||||
console.log("first foo read back", await reqAsPromise(store.get(5)));
|
||||
await reqAsPromise(store.add({id: 5, name: "Mr Foo"}));
|
||||
try {
|
||||
await reqAsPromise(store.add({id: 5, name: "bar"}));
|
||||
} catch (err) {
|
||||
console.log("we did get an error", err.name);
|
||||
err.preventAbort();
|
||||
}
|
||||
await txnAsPromise(txn1);
|
||||
|
||||
const txn2 = storage.readTxn("foos");
|
||||
const store2 = txn2.objectStore("foos");
|
||||
console.log("got name from second txn", await reqAsPromise(store2.get(5)));
|
||||
}
|
||||
main().catch(err => console.error(err));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
112
prototypes/idb-promises-es6.html
Normal file
112
prototypes/idb-promises-es6.html
Normal file
|
@ -0,0 +1,112 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="promifill.js"></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script> -->
|
||||
<script type="text/javascript">
|
||||
//window.Promise = Promifill;
|
||||
function reqAsPromise(req) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function() {
|
||||
resolve(req);
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function Storage(databaseName) {
|
||||
this._databaseName = databaseName;
|
||||
this._database = null;
|
||||
}
|
||||
|
||||
Storage.prototype = {
|
||||
open: function() {
|
||||
const req = window.indexedDB.open(this._databaseName);
|
||||
const self = this;
|
||||
req.onupgradeneeded = function(ev) {
|
||||
const db = ev.target.result;
|
||||
const oldVersion = ev.oldVersion;
|
||||
self._createStores(db, oldVersion);
|
||||
};
|
||||
return reqAsPromise(req).then(function() {
|
||||
self._database = req.result;
|
||||
});
|
||||
},
|
||||
openTxn: function(mode, storeName) {
|
||||
const txn = this._database.transaction([storeName], mode);
|
||||
const store = txn.objectStore(storeName);
|
||||
return Promise.resolve(store);
|
||||
},
|
||||
_createStores: function(db) {
|
||||
db.createObjectStore("foos", {keyPath: ["id"]});
|
||||
}
|
||||
};
|
||||
|
||||
function getAll(store) {
|
||||
const request = store.openCursor();
|
||||
const results = [];
|
||||
return new Promise(function(resolve, reject) {
|
||||
request.onsuccess = function(event) {
|
||||
const cursor = event.target.result;
|
||||
if(cursor) {
|
||||
results.push(cursor.value);
|
||||
cursor.continue();
|
||||
} else {
|
||||
resolve(results);
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
}
|
||||
};
|
||||
request.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
let storage = new Storage("idb-promises");
|
||||
await storage.open();
|
||||
const store = await storage.openTxn("readwrite", "foos");
|
||||
store.clear();
|
||||
store.add({id: 5, name: "foo"});
|
||||
store.add({id: 6, name: "bar"});
|
||||
console.log("all1", await getAll(store));
|
||||
store.add({id: 7, name: "bazzz"});
|
||||
console.log("all2", await getAll(store));
|
||||
} catch(err) {
|
||||
console.error(err.message + ": " + err.stack);
|
||||
};
|
||||
}
|
||||
main();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
we basically want something like this for IE11/Win7:
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function() {
|
||||
resolve(req);
|
||||
Promise?.flushQueue();
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise?.flushQueue();
|
||||
};
|
||||
});
|
||||
|
||||
we don't have this problem on platforms with a native promise implementation, so we can just have our own (forked) promise polyfill?
|
||||
*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
169
prototypes/idb-promises-safari.html
Normal file
169
prototypes/idb-promises-safari.html
Normal file
|
@ -0,0 +1,169 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
function reqAsPromise(req) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function() {
|
||||
resolve(req.result);
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + req.error));
|
||||
};
|
||||
});
|
||||
}
|
||||
function txnAsPromise(txn) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
txn.oncomplete = function() {
|
||||
resolve(txn);
|
||||
};
|
||||
txn.onabort = function(e) {
|
||||
reject(new Error("Transaction got aborted: " + txn.error));
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const BrowserMutationObserver = window.MutationObserver || window.WebKitMutationObserver;
|
||||
|
||||
function useMutationObserver(flush) {
|
||||
let iterations = 0;
|
||||
const observer = new BrowserMutationObserver(flush);
|
||||
const node = document.createTextNode('');
|
||||
observer.observe(node, { characterData: true });
|
||||
|
||||
return () => {
|
||||
node.data = (iterations = ++iterations % 2);
|
||||
};
|
||||
}
|
||||
|
||||
const wait = (function() {
|
||||
let resolve = null;
|
||||
const trigger = useMutationObserver(() => {
|
||||
resolve();
|
||||
});
|
||||
return () => {
|
||||
return new Promise(r => {
|
||||
resolve = r;
|
||||
trigger();
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
var _resolve = Promise.resolve.bind(Promise);
|
||||
var _then = Promise.prototype.then;
|
||||
|
||||
async function delay() {
|
||||
return Promise.resolve();
|
||||
// two consecutive macro tasks
|
||||
//await new Promise(r => setImmediate(r));
|
||||
// the next macro task will now be the complete event of the txn,
|
||||
// so schedule another macro task to execute after that
|
||||
//await new Promise(r => setImmediate(r));
|
||||
//return;
|
||||
// for (let i = 0; i < 1000; i+=1) {
|
||||
// console.log("await...");
|
||||
// await wait();
|
||||
// }
|
||||
let p = _resolve(0);
|
||||
for (let i=0;i<10;++i) {
|
||||
p = _then.call(p, x => x + 1);
|
||||
}
|
||||
let result = await p;
|
||||
console.log("Result: "+ result + " (should be 10)");
|
||||
}
|
||||
|
||||
class Storage {
|
||||
constructor(databaseName) {
|
||||
this._databaseName = databaseName;
|
||||
this._database = null;
|
||||
}
|
||||
|
||||
open() {
|
||||
const req = window.indexedDB.open(this._databaseName);
|
||||
const self = this;
|
||||
req.onupgradeneeded = function(ev) {
|
||||
const db = ev.target.result;
|
||||
const oldVersion = ev.oldVersion;
|
||||
self._createStores(db, oldVersion);
|
||||
};
|
||||
return reqAsPromise(req).then(function() {
|
||||
self._database = req.result;
|
||||
});
|
||||
}
|
||||
|
||||
openTxn(mode, storeName) {
|
||||
const txn = this._database.transaction([storeName], mode);
|
||||
txn.addEventListener("complete", () => {
|
||||
console.info(`transaction ${mode} for ${storeName} completed`);
|
||||
});
|
||||
txn.addEventListener("abort", e => {
|
||||
console.warn(`transaction ${mode} for ${storeName} aborted`, e.target.error);
|
||||
});
|
||||
return txn;
|
||||
}
|
||||
|
||||
_createStores(db) {
|
||||
db.createObjectStore("foos", {keyPath: "id"});
|
||||
}
|
||||
}
|
||||
|
||||
async function getAll(store, depth = 0) {
|
||||
if (depth < 15) {
|
||||
return await getAll(store, depth + 1);
|
||||
}
|
||||
const request = store.openCursor();
|
||||
const results = [];
|
||||
return await new Promise(function(resolve, reject) {
|
||||
request.onsuccess = function(event) {
|
||||
const cursor = event.target.result;
|
||||
if(cursor) {
|
||||
results.push(cursor.value);
|
||||
cursor.continue();
|
||||
} else {
|
||||
resolve(results);
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
}
|
||||
};
|
||||
request.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
let storage = new Storage("idb-promises");
|
||||
await storage.open();
|
||||
//await reqAsPromise(storage.openTxn("readwrite", "foos").objectStore("foos").clear());
|
||||
|
||||
for (let i = 0; i < 10; i += 1) {
|
||||
storage.openTxn("readonly", "foos").objectStore("foos").get(5);
|
||||
//console.log("from readtxn", await reqAsPromise(storage.openTxn("readonly", "foos").objectStore("foos").get(5)));
|
||||
const txn = storage.openTxn("readwrite", "foos");
|
||||
const store = txn.objectStore("foos");
|
||||
console.log("writing the foos");
|
||||
store.put({id: 5, name: "foo"});
|
||||
store.put({id: 6, name: "bar"});
|
||||
store.put({id: 7, name: "bazzz"});
|
||||
await delay();
|
||||
console.log("reading the foos");
|
||||
console.log("5", await reqAsPromise(store.get(5)));
|
||||
console.log("6", await reqAsPromise(store.get(6)));
|
||||
console.log("7", await reqAsPromise(store.get(7)));
|
||||
// await txnAsPromise(txn);
|
||||
}
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
};
|
||||
}
|
||||
main();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
118
prototypes/idb-promises.html
Normal file
118
prototypes/idb-promises.html
Normal file
|
@ -0,0 +1,118 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="promifill.js"></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script> -->
|
||||
<script type="text/javascript">
|
||||
//window.Promise = Promifill;
|
||||
function reqAsPromise(req) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function() {
|
||||
resolve(req);
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function Storage(databaseName) {
|
||||
this._databaseName = databaseName;
|
||||
this._database = null;
|
||||
}
|
||||
|
||||
Storage.prototype = {
|
||||
open: function() {
|
||||
const req = window.indexedDB.open(this._databaseName);
|
||||
const self = this;
|
||||
req.onupgradeneeded = function(ev) {
|
||||
const db = ev.target.result;
|
||||
const oldVersion = ev.oldVersion;
|
||||
self._createStores(db, oldVersion);
|
||||
};
|
||||
return reqAsPromise(req).then(function() {
|
||||
self._database = req.result;
|
||||
});
|
||||
},
|
||||
openTxn: function(mode, storeName) {
|
||||
const txn = this._database.transaction([storeName], mode);
|
||||
const store = txn.objectStore(storeName);
|
||||
return Promise.resolve(store);
|
||||
},
|
||||
_createStores: function(db) {
|
||||
db.createObjectStore("foos", {keyPath: ["id"]});
|
||||
}
|
||||
};
|
||||
|
||||
function getAll(store) {
|
||||
const request = store.openCursor();
|
||||
const results = [];
|
||||
return new Promise(function(resolve, reject) {
|
||||
request.onsuccess = function(event) {
|
||||
const cursor = event.target.result;
|
||||
if(cursor) {
|
||||
results.push(cursor.value);
|
||||
cursor.continue();
|
||||
} else {
|
||||
resolve(results);
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
}
|
||||
};
|
||||
request.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise.flushQueue && Promise.flushQueue();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function main() {
|
||||
let storage = new Storage("idb-promises");
|
||||
let store;
|
||||
storage.open().then(function() {
|
||||
return storage.openTxn("readwrite", "foos");
|
||||
}).then(function(s) {
|
||||
store = s;
|
||||
store.clear();
|
||||
store.add({id: 5, name: "foo"});
|
||||
store.add({id: 6, name: "bar"});
|
||||
return getAll(store);
|
||||
}).then(function(all) {
|
||||
console.log("all1", all);
|
||||
store.add({id: 7, name: "bazzz"});
|
||||
return getAll(store);
|
||||
}).then(function(all) {
|
||||
console.log("all2", all);
|
||||
}).catch(function(err) {
|
||||
console.error(err.message + ": " + err.stack);
|
||||
});
|
||||
}
|
||||
main();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
we basically want something like this for IE11/Win7:
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
req.onsuccess = function() {
|
||||
resolve(req);
|
||||
Promise?.flushQueue();
|
||||
};
|
||||
req.onerror = function(e) {
|
||||
reject(new Error("IDB request failed: " + e.target.error.message));
|
||||
Promise?.flushQueue();
|
||||
};
|
||||
});
|
||||
|
||||
we don't have this problem on platforms with a native promise implementation, so we can just have our own (forked) promise polyfill?
|
||||
*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
71
prototypes/idb-test-safari-close-txn.html
Normal file
71
prototypes/idb-test-safari-close-txn.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
const log = (...params) => {
|
||||
document.write(params.join(" ")+"<br>");
|
||||
};
|
||||
|
||||
function reqAsPromise(req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
req.onsuccess = () => resolve(req.result);
|
||||
req.onerror = (err) => reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
function txnAsPromise(txn) {
|
||||
return new Promise((resolve, reject) => {
|
||||
txn.addEventListener("complete", resolve);
|
||||
txn.addEventListener("abort", reject);
|
||||
});
|
||||
}
|
||||
|
||||
function openDatabase(name, createObjectStore, version) {
|
||||
const req = indexedDB.open(name, version);
|
||||
req.onupgradeneeded = (ev) => {
|
||||
const db = ev.target.result;
|
||||
const txn = ev.target.transaction;
|
||||
const oldVersion = ev.oldVersion;
|
||||
createObjectStore(db, txn, oldVersion, version);
|
||||
};
|
||||
return reqAsPromise(req);
|
||||
}
|
||||
|
||||
async function detectWebkitEarlyCloseTxnBug() {
|
||||
const dbName = "webkit_test_inactive_txn_" + Math.random() * Number.MAX_SAFE_INTEGER;
|
||||
try {
|
||||
const db = await openDatabase(dbName, db => {
|
||||
db.createObjectStore("test", {keyPath: "key"});
|
||||
}, 1);
|
||||
const readTxn = db.transaction(["test"], "readonly");
|
||||
await reqAsPromise(readTxn.objectStore("test").get("somekey"));
|
||||
// schedule a macro task in between the two txns
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
const writeTxn = db.transaction(["test"], "readwrite");
|
||||
await Promise.resolve();
|
||||
writeTxn.objectStore("test").add({key: "somekey", value: "foo"});
|
||||
await txnAsPromise(writeTxn);
|
||||
} catch (err) {
|
||||
if (err.name === "TransactionInactiveError") {
|
||||
return true;
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
indexedDB.deleteDatabase(dbName);
|
||||
} catch (err) {}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (await detectWebkitEarlyCloseTxnBug()) {
|
||||
log("the test failed, your browser seems to have the bug");
|
||||
} else {
|
||||
log("the test succeeded, your browser seems fine");
|
||||
}
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
24
prototypes/ie11-hashchange.html
Normal file
24
prototypes/ie11-hashchange.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<ul id="changes"></ul>
|
||||
<script type="text/javascript">
|
||||
const ul = document.getElementById("changes");
|
||||
window.onhashchange = function() {
|
||||
const hash = document.location.hash.substr(1);
|
||||
const li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode(hash));
|
||||
ul.appendChild(li);
|
||||
window.history.replaceState(null, null, "#" + hash + hash);
|
||||
}
|
||||
</script>
|
||||
<p>
|
||||
<a href="#foo">foo</a>
|
||||
<a href="#bar">bar</a>
|
||||
<a href="#baz">baz</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
91
prototypes/ie11-hmac.html
Normal file
91
prototypes/ie11-hmac.html
Normal file
|
@ -0,0 +1,91 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://dl.dropboxusercontent.com/s/r55397ld512etib/EncoderDecoderTogether.min.js?dl=0" nomodule="" type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>
|
||||
<script src="deps/jsSHA/dist/sha512.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function decodeBase64(base64) {
|
||||
const binStr = window.atob(base64);
|
||||
const len = binStr.length;
|
||||
const bytes = new Uint8Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
bytes[i] = binStr.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function encodeBase64(bytes) {
|
||||
let binStr = "";
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
binStr += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return window.btoa(binStr);
|
||||
}
|
||||
|
||||
function subtleCryptoResult(promiseOrOp, method) {
|
||||
if (promiseOrOp instanceof Promise) {
|
||||
return promiseOrOp;
|
||||
} else {
|
||||
return new Promise(function(resolve, reject) {
|
||||
promiseOrOp.oncomplete = function(e) {resolve(e.target.result);}
|
||||
promiseOrOp.onerror = function(e) {
|
||||
reject(new Error("Crypto error on " + method));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const subtleCrypto = (window.crypto || window.msCrypto).subtle;
|
||||
|
||||
function computeFallback(key, data, hash) {
|
||||
const shaObj = new jsSHA(hash, "UINT8ARRAY", {
|
||||
"hmacKey": {
|
||||
"value": key,
|
||||
"format": "UINT8ARRAY"
|
||||
}
|
||||
});
|
||||
shaObj.update(data);
|
||||
return Promise.resolve(shaObj.getHash("UINT8ARRAY"));
|
||||
}
|
||||
|
||||
function compute(key, data, hash) {
|
||||
const opts = {
|
||||
name: 'HMAC',
|
||||
hash: {name: hash},
|
||||
};
|
||||
return subtleCryptoResult(subtleCrypto.importKey(
|
||||
'raw',
|
||||
key,
|
||||
opts,
|
||||
false,
|
||||
['sign']
|
||||
), "importKey").then(function (hmacKey) {
|
||||
console.log("hmacKey", hmacKey);
|
||||
return subtleCryptoResult(subtleCrypto.sign(
|
||||
opts,
|
||||
hmacKey,
|
||||
data
|
||||
), "sign");
|
||||
}).then(function(buffer) {
|
||||
return new Uint8Array(buffer);
|
||||
});
|
||||
}
|
||||
|
||||
const te = new TextEncoder();
|
||||
computeFallback(
|
||||
new Uint8Array(te.encode("I am a key!!")),
|
||||
new Uint8Array(te.encode("I am some data!!")),
|
||||
"SHA-512"
|
||||
).then(function(mac) {
|
||||
// should be 9bpJS7myNR/ttCfts+woXJSapVb19qqFRntGh17rHydOBB8+pplZFG8Cc4Qkxxznri4nWyzhFWcWnenY9vd5rA==
|
||||
alert(encodeBase64(mac));
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
23
prototypes/ie11-textdecoder.html
Normal file
23
prototypes/ie11-textdecoder.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
const bytes = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100];
|
||||
const buffer = new Uint8Array(bytes.length);
|
||||
for (let i = 0; i < buffer.length; i += 1) {
|
||||
buffer[i] = bytes[i];
|
||||
}
|
||||
const blob = new Blob([buffer], {type: "text/plain"});
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", function(evt) {
|
||||
const result = evt.target.result;
|
||||
console.log("result", result);
|
||||
});
|
||||
reader.addEventListener("error", function(evt) {reject(evt.target.error);});
|
||||
reader.readAsText(blob, "utf-8");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
378
prototypes/menu-relative.html
Normal file
378
prototypes/menu-relative.html
Normal file
|
@ -0,0 +1,378 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.container {
|
||||
display: grid;
|
||||
grid-template: "left middle" 1fr /
|
||||
200px 1fr;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.container .left {
|
||||
display: grid;
|
||||
grid-template:
|
||||
"welcome" auto
|
||||
"rooms" 1fr /
|
||||
1fr;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.container .middle {
|
||||
display: grid;
|
||||
grid-template:
|
||||
"header" auto
|
||||
"timeline" 1fr
|
||||
"composer" auto /
|
||||
1fr;
|
||||
min-height: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.left { grid-area: left;}
|
||||
.left p {
|
||||
grid-area welcome;
|
||||
display: flex;
|
||||
}
|
||||
.left ul {
|
||||
grid-area: rooms;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.middle { grid-area: middle;}
|
||||
.middle .header { grid-area: header;}
|
||||
.middle .timeline {
|
||||
grid-area: timeline;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.middle .composer {
|
||||
grid-area: composer;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.header h2 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.composer {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.composer input {
|
||||
display: block;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.menu {
|
||||
position: absolute;
|
||||
border-radius: 8px;
|
||||
box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
|
||||
padding: 16px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="left">
|
||||
<p>Welcome!<button>⋮</button></p>
|
||||
<ul>
|
||||
<li>Room xyz <button>⋮</button></li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz <button>⋮</button></li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz</li>
|
||||
<li>Room xyz <button>⋮</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="middle">
|
||||
<div class="header">
|
||||
<h2>Room xyz</h2>
|
||||
<button>⋮</button>
|
||||
</div>
|
||||
<ul class="timeline">
|
||||
<li>Message abc</li>
|
||||
<li>Message abc <button>⋮</button></li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc <button>⋮</button></li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc</li>
|
||||
<li>Message abc <button>⋮</button></li>
|
||||
</ul>
|
||||
<div class="composer">
|
||||
<input type="text" name="">
|
||||
<button>⋮</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
let menu;
|
||||
|
||||
function createMenu(options) {
|
||||
const menu = document.createElement("ul");
|
||||
menu.className = "menu";
|
||||
for (const o of options) {
|
||||
const li = document.createElement("li");
|
||||
li.innerText = o;
|
||||
menu.appendChild(li);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
function showMenu(evt) {
|
||||
if (menu) {
|
||||
menu = menu.close();
|
||||
} else if (evt.target.tagName.toLowerCase() === "button") {
|
||||
menu = showPopup(evt.target, createMenu(["Send file", "Save contact", "Send picture", "Foo the bar"]), {
|
||||
horizontal: {
|
||||
relativeTo: "end",
|
||||
align: "start",
|
||||
after: 0,
|
||||
},
|
||||
vertical: {
|
||||
relativeTo: "end",
|
||||
align: "end",
|
||||
after: 10,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showMenuInScroller(evt) {
|
||||
if (!menu && evt.target.tagName.toLowerCase() === "button") {
|
||||
evt.stopPropagation();
|
||||
menu = showPopup(evt.target, createMenu(["Show reactions", "Share"]), {
|
||||
horizontal: {
|
||||
relativeTo: "start",
|
||||
align: "end",
|
||||
after: 10,
|
||||
},
|
||||
vertical: {
|
||||
relativeTo: "start",
|
||||
align: "center",
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener("click", showMenu, false);
|
||||
document.querySelector(".middle ul").addEventListener("click", showMenuInScroller, false);
|
||||
document.querySelector(".left ul").addEventListener("click", showMenuInScroller, false);
|
||||
|
||||
function showPopup(target, popup, arrangement) {
|
||||
targetAxes = elementToAxes(target);
|
||||
if (!arrangement) {
|
||||
arrangement = getAutoArrangement(targetAxes);
|
||||
}
|
||||
|
||||
target.offsetParent.appendChild(popup);
|
||||
|
||||
const popupAxes = elementToAxes(popup);
|
||||
const scrollerAxes = elementToAxes(findScrollParent(target));
|
||||
const offsetParentAxes = elementToAxes(target.offsetParent);
|
||||
|
||||
function reposition() {
|
||||
if (scrollerAxes && !isVisibleInScrollParent(targetAxes.vertical, scrollerAxes.vertical)) {
|
||||
popupObj.close();
|
||||
}
|
||||
applyArrangement(
|
||||
popupAxes.vertical,
|
||||
targetAxes.vertical,
|
||||
offsetParentAxes.vertical,
|
||||
scrollerAxes?.vertical,
|
||||
arrangement.vertical
|
||||
);
|
||||
applyArrangement(
|
||||
popupAxes.horizontal,
|
||||
targetAxes.horizontal,
|
||||
offsetParentAxes.horizontal,
|
||||
scrollerAxes?.horizontal,
|
||||
arrangement.horizontal
|
||||
);
|
||||
}
|
||||
reposition();
|
||||
|
||||
document.body.addEventListener("scroll", reposition, true);
|
||||
|
||||
const popupObj = {
|
||||
close() {
|
||||
document.body.removeEventListener("scroll", reposition, true);
|
||||
popup.remove();
|
||||
}
|
||||
};
|
||||
|
||||
return popupObj;
|
||||
}
|
||||
|
||||
function elementToAxes(element) {
|
||||
if (element) {
|
||||
return {
|
||||
horizontal: new HorizontalAxis(element),
|
||||
vertical: new VerticalAxis(element),
|
||||
element
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function findScrollParent(el) {
|
||||
let parent = el;
|
||||
do {
|
||||
parent = parent.parentElement;
|
||||
if (parent.scrollHeight > parent.clientHeight) {
|
||||
return parent;
|
||||
}
|
||||
} while (parent !== el.offsetParent);
|
||||
}
|
||||
|
||||
function isVisibleInScrollParent(targetAxis, scrollerAxis) {
|
||||
// clipped at start?
|
||||
if ((targetAxis.offsetStart + targetAxis.clientSize) < (
|
||||
scrollerAxis.offsetStart +
|
||||
scrollerAxis.scrollOffset
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
// clipped at end?
|
||||
if (targetAxis.offsetStart > (
|
||||
scrollerAxis.offsetStart +
|
||||
scrollerAxis.clientSize +
|
||||
scrollerAxis.scrollOffset
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyArrangement(elAxis, targetAxis, offsetParentAxis, scrollerAxis, {relativeTo, align, before, after}) {
|
||||
if (relativeTo === "end") {
|
||||
let end = offsetParentAxis.clientSize - targetAxis.offsetStart;
|
||||
if (align === "end") {
|
||||
end -= elAxis.offsetSize;
|
||||
} else if (align === "center") {
|
||||
end -= ((elAxis.offsetSize / 2) - (targetAxis.offsetSize / 2));
|
||||
}
|
||||
if (typeof before === "number") {
|
||||
end += before;
|
||||
} else if (typeof after === "number") {
|
||||
end -= (targetAxis.offsetSize + after);
|
||||
}
|
||||
elAxis.end = end;
|
||||
} else if (relativeTo === "start") {
|
||||
let scrollOffset = scrollerAxis?.scrollOffset || 0;
|
||||
let start = targetAxis.offsetStart - scrollOffset;
|
||||
if (align === "start") {
|
||||
start -= elAxis.offsetSize;
|
||||
} else if (align === "center") {
|
||||
start -= ((elAxis.offsetSize / 2) - (targetAxis.offsetSize / 2));
|
||||
}
|
||||
if (typeof before === "number") {
|
||||
start -= before;
|
||||
} else if (typeof after === "number") {
|
||||
start += (targetAxis.offsetSize + after);
|
||||
}
|
||||
elAxis.start = start;
|
||||
} else {
|
||||
throw new Error("unknown relativeTo: " + relativeTo);
|
||||
}
|
||||
}
|
||||
|
||||
class HorizontalAxis {
|
||||
constructor(el) {
|
||||
this.element = el;
|
||||
}
|
||||
get scrollOffset() {return this.element.scrollLeft;}
|
||||
get clientSize() {return this.element.clientWidth;}
|
||||
get offsetSize() {return this.element.offsetWidth;}
|
||||
get offsetStart() {return this.element.offsetLeft;}
|
||||
set start(value) {this.element.style.left = `${value}px`;}
|
||||
set end(value) {this.element.style.right = `${value}px`;}
|
||||
}
|
||||
class VerticalAxis {
|
||||
constructor(el) {
|
||||
this.element = el;
|
||||
}
|
||||
get scrollOffset() {return this.element.scrollTop;}
|
||||
get clientSize() {return this.element.clientHeight;}
|
||||
get offsetSize() {return this.element.offsetHeight;}
|
||||
get offsetStart() {return this.element.offsetTop;}
|
||||
set start(value) {this.element.style.top = `${value}px`;}
|
||||
set end(value) {this.element.style.bottom = `${value}px`;}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -38,13 +38,24 @@
|
|||
JSON.parse(bob.identity_keys()).curve25519,
|
||||
bobOneTimeKey,
|
||||
);
|
||||
const message = aliceSession.encrypt("hello secret world");
|
||||
const message = aliceSession.encrypt("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar pellentesque habitant morbi tristique. Pretium nibh ipsum consequat nisl. Molestie a iaculis at erat pellentesque adipiscing. Semper eget duis at tellus at urna condimentum. Malesuada fames ac turpis egestas maecenas pharetra convallis. Sed lectus vestibulum mattis ullamcorper. Elementum facilisis leo vel fringilla est. Mattis vulputate enim nulla aliquet porttitor lacus luctus accumsan tortor. Faucibus nisl tincidunt eget nullam non nisi est. Aliquam faucibus purus in massa tempor. Dui accumsan sit amet nulla facilisi morbi tempus iaculis. Pellentesque dignissim enim sit amet venenatis urna. Nisi porta lorem mollis aliquam ut porttitor leo. Adipiscing elit duis tristique sollicitudin nibh sit. Et netus et malesuada fames ac turpis. Ut diam quam nulla porttitor massa id neque. Pharetra convallis posuere morbi leo urna molestie. A pellentesque sit amet porttitor eget dolor morbi non arcu.");
|
||||
console.log("message", message);
|
||||
// decrypt
|
||||
const bobSession = new Olm.Session();
|
||||
bobSession.create_inbound(bob, message.body);
|
||||
const plaintext = bobSession.decrypt(message.type, message.body);
|
||||
|
||||
let plaintext;
|
||||
const iterations = 698;
|
||||
let decryptDuration = 0;
|
||||
for (let i = 0; i < iterations; i += 1) {
|
||||
bobSession.create_inbound(bob, message.body);
|
||||
const start = performance.now();
|
||||
plaintext = bobSession.decrypt(message.type, message.body);
|
||||
const end = performance.now();
|
||||
const duration = end - start;
|
||||
decryptDuration += duration;
|
||||
}
|
||||
console.log("plaintext", plaintext);
|
||||
console.log(`took avg of ${decryptDuration / iterations}ms to decrypt over ${iterations} iterations`);
|
||||
// remove Bob's OTK as it was used to start an olm session
|
||||
console.log("bob OTK before removing", bob.one_time_keys());
|
||||
bob.remove_one_time_keys(bobSession);
|
||||
|
|
62
prototypes/pkcrypto-ie11.html
Normal file
62
prototypes/pkcrypto-ie11.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
if (!Math.imul) Math.imul = function(a, b) {
|
||||
var aHi = (a >>> 16) & 0xffff;
|
||||
var aLo = a & 0xffff;
|
||||
var bHi = (b >>> 16) & 0xffff;
|
||||
var bLo = b & 0xffff;
|
||||
// the shift by 0 fixes the sign on the high part
|
||||
// the final |0 converts the unsigned value into a signed value
|
||||
return ((aLo * bLo) + (((aHi * bLo + aLo * bHi) << 16) >>> 0) | 0);
|
||||
};
|
||||
|
||||
if (!Math.clz32) Math.clz32 = (function(log, LN2){
|
||||
return function(x) {
|
||||
// Let n be ToUint32(x).
|
||||
// Let p be the number of leading zero bits in
|
||||
// the 32-bit binary representation of n.
|
||||
// Return p.
|
||||
var asUint = x >>> 0;
|
||||
if (asUint === 0) {
|
||||
return 32;
|
||||
}
|
||||
return 31 - (log(asUint) / LN2 | 0) |0; // the "| 0" acts like math.floor
|
||||
};
|
||||
})(Math.log, Math.LN2);
|
||||
</script>
|
||||
<!-- removing this line will make it work -->
|
||||
<script src="https://dl.dropboxusercontent.com/s/r55397ld512etib/EncoderDecoderTogether.min.js?dl=0" nomodule="" type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/olm/olm_legacy.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.Olm.init().then(function() {
|
||||
const bytes = [
|
||||
34, 123, 54, 9, 124, 89, 230, 120,
|
||||
43, 232, 19, 78, 129, 170, 255, 5,
|
||||
90, 143, 56, 99, 101, 140, 240, 3,
|
||||
7, 121, 41, 22, 67, 231, 85, 32
|
||||
];
|
||||
var privKey = new Uint8Array(32);
|
||||
for (var i = bytes.length - 1; i >= 0; i--) {
|
||||
privKey[i] = bytes[i];
|
||||
}
|
||||
console.log("privKey", privKey);
|
||||
const decryption = new window.Olm.PkDecryption();
|
||||
let backupPubKey;
|
||||
try {
|
||||
backupPubKey = decryption.init_with_private_key(privKey);
|
||||
console.log("backupPubKey", backupPubKey.length, backupPubKey);
|
||||
} catch (e) {
|
||||
decryption.free();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
444
prototypes/promifill.js
vendored
Normal file
444
prototypes/promifill.js
vendored
Normal file
|
@ -0,0 +1,444 @@
|
|||
"use strict";
|
||||
|
||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var PENDING = void 0,
|
||||
FULFILLED = true,
|
||||
REJECTED = false;
|
||||
|
||||
var Promifill = /*#__PURE__*/function () {
|
||||
_createClass(Promifill, [{
|
||||
key: "state",
|
||||
get: function get() {
|
||||
return PENDING;
|
||||
}
|
||||
}, {
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return void 0;
|
||||
}
|
||||
}, {
|
||||
key: "settled",
|
||||
get: function get() {
|
||||
return false;
|
||||
}
|
||||
}]);
|
||||
|
||||
function Promifill(executor) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, Promifill);
|
||||
|
||||
if (typeof executor != "function") {
|
||||
throw new TypeError("Promise resolver ".concat(Object.prototype.toString.call(executor), " is not a function"));
|
||||
}
|
||||
|
||||
defineProperty(this, "chain", []);
|
||||
defineProperty(this, "observers", []);
|
||||
var secret = [];
|
||||
|
||||
var resolve = function resolve(value, bypassKey) {
|
||||
if (_this.settled && bypassKey !== secret) {
|
||||
return;
|
||||
}
|
||||
|
||||
defineProperty(_this, "settled", true);
|
||||
var then_ = value && value.then;
|
||||
var thenable = typeof then_ == "function";
|
||||
|
||||
if (thenable) {
|
||||
defineProperty(value, "preventThrow", true);
|
||||
}
|
||||
|
||||
if (thenable && value.state === PENDING) {
|
||||
then_.call(value, function (v) {
|
||||
return resolve(v, secret);
|
||||
}, function (r) {
|
||||
return reject(r, secret);
|
||||
});
|
||||
} else {
|
||||
defineProperty(_this, "value", thenable ? value.value : value);
|
||||
defineProperty(_this, "state", thenable ? value.state : FULFILLED);
|
||||
schedule(_this.observers.map(function (observer) {
|
||||
return {
|
||||
handler: _this.state === FULFILLED ? observer.onfulfill : observer.onreject,
|
||||
value: _this.value
|
||||
};
|
||||
}));
|
||||
|
||||
if (_this.state === REJECTED) {
|
||||
raiseUnhandledPromiseRejectionException(_this.value, _this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var reject = function reject(reason, bypassKey) {
|
||||
if (_this.settled && bypassKey !== secret) {
|
||||
return;
|
||||
}
|
||||
|
||||
defineProperty(_this, "settled", true);
|
||||
defineProperty(_this, "value", reason);
|
||||
defineProperty(_this, "state", REJECTED);
|
||||
schedule(_this.observers.map(function (observer) {
|
||||
return {
|
||||
handler: observer.onreject,
|
||||
value: _this.value
|
||||
};
|
||||
}));
|
||||
raiseUnhandledPromiseRejectionException(_this.value, _this);
|
||||
};
|
||||
|
||||
try {
|
||||
executor(resolve, reject);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
_createClass(Promifill, [{
|
||||
key: "then",
|
||||
value: function then(onfulfill, onreject) {
|
||||
var _this2 = this;
|
||||
|
||||
var chainedPromise = new this.constructor(function (resolve, reject) {
|
||||
var internalOnfulfill = function internalOnfulfill(value) {
|
||||
try {
|
||||
resolve(typeof onfulfill == "function" ? onfulfill(value) : value);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
var internalOnreject = function internalOnreject(reason) {
|
||||
try {
|
||||
if (typeof onreject == "function") {
|
||||
resolve(onreject(reason));
|
||||
} else {
|
||||
reject(reason);
|
||||
}
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
if (_this2.state === PENDING) {
|
||||
_this2.observers.push({
|
||||
onfulfill: internalOnfulfill,
|
||||
onreject: internalOnreject
|
||||
});
|
||||
} else {
|
||||
schedule([{
|
||||
handler: _this2.state === FULFILLED ? internalOnfulfill : internalOnreject,
|
||||
value: _this2.value
|
||||
}]);
|
||||
}
|
||||
});
|
||||
this.chain.push(chainedPromise);
|
||||
return chainedPromise;
|
||||
}
|
||||
}, {
|
||||
key: "catch",
|
||||
value: function _catch(onreject) {
|
||||
return this.then(null, onreject);
|
||||
}
|
||||
}, {
|
||||
key: "finally",
|
||||
value: function _finally(oncomplete) {
|
||||
var _this3 = this;
|
||||
|
||||
var chainedPromise = new this.constructor(function (resolve, reject) {
|
||||
var internalOncomplete = function internalOncomplete() {
|
||||
try {
|
||||
oncomplete();
|
||||
|
||||
if (_this3.state === FULFILLED) {
|
||||
resolve(_this3.value);
|
||||
} else {
|
||||
reject(_this3.value);
|
||||
}
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
if (_this3.state === PENDING) {
|
||||
_this3.observers.push({
|
||||
onfulfill: internalOncomplete,
|
||||
onreject: internalOncomplete
|
||||
});
|
||||
} else {
|
||||
schedule([{
|
||||
handler: internalOncomplete
|
||||
}]);
|
||||
}
|
||||
});
|
||||
this.chain.push(chainedPromise);
|
||||
return chainedPromise;
|
||||
}
|
||||
}], [{
|
||||
key: "resolve",
|
||||
value: function resolve(value) {
|
||||
return value && value.constructor === Promifill ? value : new Promifill(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "reject",
|
||||
value: function reject(reason) {
|
||||
return new Promifill(function (_, reject) {
|
||||
reject(reason);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "all",
|
||||
value: function all(iterable) {
|
||||
return new Promifill(function (resolve, reject) {
|
||||
validateIterable(iterable);
|
||||
var iterableSize = 0;
|
||||
var values = [];
|
||||
|
||||
if (isEmptyIterable(iterable)) {
|
||||
return resolve(values);
|
||||
}
|
||||
|
||||
var add = function add(value, index) {
|
||||
values[index] = value;
|
||||
|
||||
if (values.filter(function () {
|
||||
return true;
|
||||
}).length === iterableSize) {
|
||||
resolve(values);
|
||||
}
|
||||
};
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(iterable),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var item = _step.value;
|
||||
|
||||
(function (entry, index) {
|
||||
Promifill.resolve(entry).then(function (value) {
|
||||
return add(value, index);
|
||||
}, reject);
|
||||
})(item, iterableSize++);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "race",
|
||||
value: function race(iterable) {
|
||||
return new Promifill(function (resolve, reject) {
|
||||
validateIterable(iterable);
|
||||
|
||||
if (isEmptyIterable(iterable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _iterator2 = _createForOfIteratorHelper(iterable),
|
||||
_step2;
|
||||
|
||||
try {
|
||||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
||||
var entry = _step2.value;
|
||||
Promifill.resolve(entry).then(resolve, reject);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator2.e(err);
|
||||
} finally {
|
||||
_iterator2.f();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "flushQueue",
|
||||
value: function flushQueue() {
|
||||
console.log("running promise sync by flushing queue");
|
||||
schedule.flushQueue();
|
||||
}
|
||||
}]);
|
||||
|
||||
return Promifill;
|
||||
}();
|
||||
|
||||
var defineProperty = function defineProperty(obj, propName, propValue) {
|
||||
Object.defineProperty(obj, propName, {
|
||||
value: propValue
|
||||
});
|
||||
};
|
||||
|
||||
var defer = function defer(handler) {
|
||||
return function () {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
setTimeout.apply(void 0, [handler, 0].concat(args));
|
||||
};
|
||||
};
|
||||
|
||||
var thrower = function thrower(error) {
|
||||
throw error instanceof Error ? error : new Error(error);
|
||||
};
|
||||
|
||||
var raiseUnhandledPromiseRejectionException = defer(function (error, promise) {
|
||||
if (promise.preventThrow || promise.chain.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
thrower(error);
|
||||
});
|
||||
|
||||
var MutationObserverStrategy = /*#__PURE__*/function () {
|
||||
function MutationObserverStrategy(handler) {
|
||||
_classCallCheck(this, MutationObserverStrategy);
|
||||
|
||||
var observer = new MutationObserver(handler);
|
||||
var node = this.node = document.createTextNode("");
|
||||
observer.observe(node, {
|
||||
characterData: true
|
||||
});
|
||||
}
|
||||
|
||||
_createClass(MutationObserverStrategy, [{
|
||||
key: "trigger",
|
||||
value: function trigger() {
|
||||
this.node.data = this.node.data === 1 ? 0 : 1;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MutationObserverStrategy;
|
||||
}();
|
||||
|
||||
var NextTickStrategy = /*#__PURE__*/function () {
|
||||
function NextTickStrategy(handler) {
|
||||
_classCallCheck(this, NextTickStrategy);
|
||||
|
||||
this.scheduleNextTick = function () {
|
||||
return process.nextTick(handler);
|
||||
};
|
||||
}
|
||||
|
||||
_createClass(NextTickStrategy, [{
|
||||
key: "trigger",
|
||||
value: function trigger() {
|
||||
this.scheduleNextTick();
|
||||
}
|
||||
}]);
|
||||
|
||||
return NextTickStrategy;
|
||||
}();
|
||||
|
||||
var BetterThanNothingStrategy = /*#__PURE__*/function () {
|
||||
function BetterThanNothingStrategy(handler) {
|
||||
_classCallCheck(this, BetterThanNothingStrategy);
|
||||
|
||||
this.scheduleAsap = function () {
|
||||
return setTimeout(handler, 0);
|
||||
};
|
||||
}
|
||||
|
||||
_createClass(BetterThanNothingStrategy, [{
|
||||
key: "trigger",
|
||||
value: function trigger() {
|
||||
this.scheduleAsap();
|
||||
}
|
||||
}]);
|
||||
|
||||
return BetterThanNothingStrategy;
|
||||
}();
|
||||
|
||||
var getStrategy = function getStrategy() {
|
||||
if (typeof window != "undefined" && typeof window.MutationObserver == "function") {
|
||||
return MutationObserverStrategy;
|
||||
}
|
||||
|
||||
if (typeof global != "undefined" && typeof process != "undefined" && typeof process.nextTick == "function") {
|
||||
return NextTickStrategy;
|
||||
}
|
||||
|
||||
return BetterThanNothingStrategy;
|
||||
};
|
||||
|
||||
var schedule = function () {
|
||||
var microtasks = [];
|
||||
|
||||
var run = function run() {
|
||||
var handler, value;
|
||||
|
||||
while (microtasks.length > 0 && (_microtasks$shift = microtasks.shift(), handler = _microtasks$shift.handler, value = _microtasks$shift.value, _microtasks$shift)) {
|
||||
var _microtasks$shift;
|
||||
console.log("running handler with", value);
|
||||
handler(value);
|
||||
}
|
||||
};
|
||||
|
||||
var Strategy = getStrategy();
|
||||
var ctrl = new Strategy(run);
|
||||
|
||||
var scheduleFn = function scheduleFn(observers) {
|
||||
if (observers.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
microtasks = microtasks.concat(observers);
|
||||
observers.length = 0;
|
||||
ctrl.trigger();
|
||||
};
|
||||
|
||||
scheduleFn.flushQueue = function () {
|
||||
run();
|
||||
};
|
||||
|
||||
return scheduleFn;
|
||||
}();
|
||||
|
||||
var isIterable = function isIterable(subject) {
|
||||
return subject != null && typeof subject[Symbol.iterator] == "function";
|
||||
};
|
||||
|
||||
var validateIterable = function validateIterable(subject) {
|
||||
if (isIterable(subject)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new TypeError("Cannot read property 'Symbol(Symbol.iterator)' of ".concat(Object.prototype.toString.call(subject), "."));
|
||||
};
|
||||
|
||||
var isEmptyIterable = function isEmptyIterable(subject) {
|
||||
var _iterator3 = _createForOfIteratorHelper(subject),
|
||||
_step3;
|
||||
|
||||
try {
|
||||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
||||
var _ = _step3.value;
|
||||
// eslint-disable-line no-unused-vars
|
||||
return false;
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator3.e(err);
|
||||
} finally {
|
||||
_iterator3.f();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
window.Promifill = Promifill;
|
23
prototypes/tools/package.json
Normal file
23
prototypes/tools/package.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.1",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@rollup/plugin-babel": "^5.1.0",
|
||||
"@rollup/plugin-commonjs": "^15.0.0",
|
||||
"@rollup/plugin-multi-entry": "^4.0.0",
|
||||
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||
"mdn-polyfills": "^5.20.0",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"rollup": "^2.26.4",
|
||||
"core-js": "^3.6.5"
|
||||
}
|
||||
}
|
46
prototypes/tools/transpile-ie11.mjs
Normal file
46
prototypes/tools/transpile-ie11.mjs
Normal file
|
@ -0,0 +1,46 @@
|
|||
import fsRoot from "fs";
|
||||
const fs = fsRoot.promises;
|
||||
import { rollup } from 'rollup';
|
||||
// needed for legacy bundle
|
||||
import babel from '@rollup/plugin-babel';
|
||||
// needed to find the polyfill modules in the main-legacy.js bundle
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
// needed because some of the polyfills are written as commonjs modules
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
// multi-entry plugin so we can add polyfill file to main
|
||||
import multi from '@rollup/plugin-multi-entry';
|
||||
import removeJsComments from 'rollup-plugin-cleanup';
|
||||
// replace urls of asset names with content hashed version
|
||||
|
||||
async function build(inputFile, outputFile) {
|
||||
// compile down to whatever IE 11 needs
|
||||
const babelPlugin = babel.babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: '../../node_modules/**',
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
corejs: "3",
|
||||
targets: "IE 11"
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
const polyfillFile = '../../src/worker-polyfill.js';
|
||||
// create js bundle
|
||||
const rollupConfig = {
|
||||
input: [polyfillFile, inputFile],
|
||||
plugins: [multi(), commonjs(), nodeResolve(), babelPlugin, removeJsComments({comments: "none"})]
|
||||
};
|
||||
const bundle = await rollup(rollupConfig);
|
||||
const {output} = await bundle.generate({
|
||||
format: 'iife',
|
||||
name: `bundle`
|
||||
});
|
||||
const code = output[0].code;
|
||||
await fs.writeFile(outputFile, code, "utf8");
|
||||
}
|
||||
|
||||
build(process.argv[2], process.argv[3]);
|
1485
prototypes/tools/yarn.lock
Normal file
1485
prototypes/tools/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
51
prototypes/webkit-blob-sandbox-fail/fail.html
Normal file
51
prototypes/webkit-blob-sandbox-fail/fail.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="iframe" sandbox="allow-scripts allow-downloads allow-downloads-without-user-activation"></iframe>
|
||||
<script type="text/javascript">
|
||||
const iframeHtml = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<button id="download">Download</button>
|
||||
<a id="link" href="#">Link to progamatically click</a>
|
||||
<script type="text/javascript">
|
||||
var link = document.getElementById("link");
|
||||
var button = document.getElementById("download");
|
||||
async function download(blob, filename) {
|
||||
const slice = blob.slice(0, 1);
|
||||
const reader = new FileReader();
|
||||
reader.readAsArrayBuffer(slice);
|
||||
const buffer = await new Promise((resolve, reject) => {
|
||||
reader.addEventListener("abort", () => reject(new Error("aborted")));
|
||||
reader.addEventListener("error", e => reject(e.error));
|
||||
reader.addEventListener("load", e => resolve(e.target.result));
|
||||
});
|
||||
document.body.appendChild(document.createTextNode("buffer: " + new Uint8Array(buffer)[0] + " (" + buffer.byteLength + ")"));
|
||||
var url = URL.createObjectURL(blob);
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.innerText = url;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
button.addEventListener("click", async function(event) {
|
||||
try {
|
||||
await download(new Blob(["a message from the iframe"], {type: "text/plain"}), "hello world.txt");
|
||||
} catch (err) {
|
||||
document.body.appendChild(document.createTextNode(err.toString()));
|
||||
}
|
||||
});
|
||||
</${"script"}>
|
||||
</body>
|
||||
</html>`;
|
||||
document.getElementById("iframe").setAttribute("srcdoc", iframeHtml);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
98
prototypes/webkit-blob-sandbox-fail/fix.html
Normal file
98
prototypes/webkit-blob-sandbox-fail/fix.html
Normal file
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<button id="download">Download</button>
|
||||
<iframe id="iframe" sandbox="allow-scripts allow-downloads allow-downloads-without-user-activation"></iframe>
|
||||
<script type="text/javascript">
|
||||
const iframeHtml = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<a id="link" href="#">Link to progamatically click</a>
|
||||
<script type="text/javascript">
|
||||
var link = document.getElementById("link");
|
||||
|
||||
function downloadBlob(blob, filename) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.innerText = url;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function toBase64(buffer) {
|
||||
let binaryStr = "";
|
||||
const bytes = new Uint8Array(buffer);
|
||||
for (let i = 0; i < bytes.byteLength; i++) {
|
||||
binaryStr += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return window.btoa(binaryStr);
|
||||
}
|
||||
|
||||
function downloadBuffer(buffer, mimeType, filename) {
|
||||
var url = "data:" + mimeType + ";base64," + toBase64(buffer);
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.innerText = url;
|
||||
link.click();
|
||||
}
|
||||
|
||||
window.addEventListener("message", async function(event) {
|
||||
// if (event.origin === window.location.origin) {
|
||||
if (event.data.type === "downloadBuffer") {
|
||||
await downloadBuffer(event.data.buffer, event.data.mimeType, event.data.filename);
|
||||
} else if (event.data.type === "downloadBlob") {
|
||||
await downloadBlob(event.data.blob, event.data.filename);
|
||||
}
|
||||
// }
|
||||
});
|
||||
</${"script"}>
|
||||
</body>
|
||||
</html>`;
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) && !window.MSStream;
|
||||
const iframe = document.getElementById("iframe");
|
||||
const button = document.getElementById("download");
|
||||
iframe.setAttribute("srcdoc", iframeHtml);
|
||||
const blob = new Blob(["a message from the iframe"], {type: "text/plain"});
|
||||
window.addEventListener("message", async event => {
|
||||
//if (event.origin === window.location.origin) {
|
||||
//}
|
||||
});
|
||||
button.addEventListener("click", async evt => {
|
||||
if (isIOS) {
|
||||
const reader = new FileReader();
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
reader.addEventListener("error", e => reject(e.error));
|
||||
reader.addEventListener("load", e => resolve(e.target.result));
|
||||
});
|
||||
reader.readAsArrayBuffer(blob);
|
||||
let buffer = await promise;
|
||||
|
||||
iframe.contentWindow.postMessage({type: "downloadBuffer", mimeType: "text/plain", buffer, filename: "hello world.txt"}, "*");
|
||||
} else {
|
||||
iframe.contentWindow.postMessage({type: "downloadBlob", blob, filename: "hello world.txt"}, "*");
|
||||
}
|
||||
/*
|
||||
if (window.SharedArrayBuffer) {
|
||||
const srcView = new Uint8Array(buffer);
|
||||
const sharedBuffer = new SharedArrayBuffer(buffer.byteLength);
|
||||
const dstView = new Uint8Array(sharedBuffer);
|
||||
for (var i = srcView.length - 1; i >= 0; i--) {
|
||||
dstView[i] = srcView[i];
|
||||
}
|
||||
buffer = sharedBuffer;
|
||||
}
|
||||
*/
|
||||
//iframe.contentWindow.postMessage({type: "downloadBlob", blob, filename: "hello world.txt"}, "*");
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
prototypes/webkit-blob-sandbox-fail/index.html
Normal file
38
prototypes/webkit-blob-sandbox-fail/index.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="iframe" sandbox="allow-scripts allow-downloads allow-downloads-without-user-activation"></iframe>
|
||||
<script type="text/javascript">
|
||||
const iframeHtml = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<button id="download">Download</button>
|
||||
<a id="link" href="#">Link to progamatically click</a>
|
||||
<script type="text/javascript">
|
||||
var link = document.getElementById("link");
|
||||
var button = document.getElementById("download");
|
||||
function download(str, filename) {
|
||||
var url = "data:text/plain;base64," + btoa(str);
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.innerText = url;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
button.addEventListener("click", function(event) {
|
||||
download("hello world", "hello world.txt");
|
||||
});
|
||||
</${"script"}>
|
||||
</body>
|
||||
</html>`;
|
||||
document.getElementById("iframe").setAttribute("srcdoc", iframeHtml);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
18
scripts/.eslintrc.js
Normal file
18
scripts/.eslintrc.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "off",
|
||||
"no-empty": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-unused-vars": "warn"
|
||||
},
|
||||
};
|
||||
|
51
scripts/build-plugins/manifest.js
Normal file
51
scripts/build-plugins/manifest.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function injectWebManifest(manifestFile) {
|
||||
let root;
|
||||
let base;
|
||||
let manifestHref;
|
||||
return {
|
||||
name: "hydrogen:injectWebManifest",
|
||||
apply: "build",
|
||||
configResolved: config => {
|
||||
root = config.root;
|
||||
base = config.base;
|
||||
},
|
||||
transformIndexHtml: {
|
||||
transform(html) {
|
||||
return [{
|
||||
tag: "link",
|
||||
attrs: {rel: "manifest", href: manifestHref},
|
||||
injectTo: "head"
|
||||
}];
|
||||
},
|
||||
},
|
||||
generateBundle: async function() {
|
||||
const absoluteManifestFile = path.resolve(root, manifestFile);
|
||||
const manifestDir = path.dirname(absoluteManifestFile);
|
||||
const json = await fs.readFile(absoluteManifestFile, {encoding: "utf8"});
|
||||
const manifest = JSON.parse(json);
|
||||
for (const icon of manifest.icons) {
|
||||
const iconFileName = path.resolve(manifestDir, icon.src);
|
||||
const imgData = await fs.readFile(iconFileName);
|
||||
const ref = this.emitFile({
|
||||
type: "asset",
|
||||
name: path.basename(iconFileName),
|
||||
source: imgData
|
||||
});
|
||||
// we take the basename as getFileName gives the filename
|
||||
// relative to the output dir, but the manifest is an asset
|
||||
// just like they icon, so we assume they end up in the same dir
|
||||
icon.src = path.basename(this.getFileName(ref));
|
||||
}
|
||||
const outputName = path.basename(absoluteManifestFile);
|
||||
const manifestRef = this.emitFile({
|
||||
type: "asset",
|
||||
name: outputName,
|
||||
source: JSON.stringify(manifest)
|
||||
});
|
||||
manifestHref = base + this.getFileName(manifestRef);
|
||||
}
|
||||
};
|
||||
}
|
376
scripts/build-plugins/rollup-plugin-build-themes.js
Normal file
376
scripts/build-plugins/rollup-plugin-build-themes.js
Normal file
|
@ -0,0 +1,376 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const path = require('path').posix;
|
||||
const {optimize} = require('svgo');
|
||||
|
||||
async function readCSSSource(location) {
|
||||
const fs = require("fs").promises;
|
||||
const resolvedLocation = path.resolve(__dirname, "../../", `${location}/theme.css`);
|
||||
const data = await fs.readFile(resolvedLocation);
|
||||
return data;
|
||||
}
|
||||
|
||||
function getRootSectionWithVariables(variables) {
|
||||
return `:root{\n${Object.entries(variables).reduce((acc, [key, value]) => acc + `--${key}: ${value};\n`, "")} }\n\n`;
|
||||
}
|
||||
|
||||
function appendVariablesToCSS(variables, cssSource) {
|
||||
return cssSource + getRootSectionWithVariables(variables);
|
||||
}
|
||||
|
||||
function addThemesToConfig(bundle, manifestLocations, defaultThemes) {
|
||||
for (const [fileName, info] of Object.entries(bundle)) {
|
||||
if (fileName === "config.json") {
|
||||
const source = new TextDecoder().decode(info.source);
|
||||
const config = JSON.parse(source);
|
||||
config["themeManifests"] = manifestLocations;
|
||||
config["defaultTheme"] = defaultThemes;
|
||||
info.source = new TextEncoder().encode(JSON.stringify(config, undefined, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object where keys are the svg file names and the values
|
||||
* are the svg code (optimized)
|
||||
* @param {*} icons Object where keys are css variable names and values are locations of the svg
|
||||
* @param {*} manifestLocation Location of manifest used for resolving path
|
||||
*/
|
||||
async function generateIconSourceMap(icons, manifestLocation) {
|
||||
const sources = {};
|
||||
const fileNames = [];
|
||||
const promises = [];
|
||||
const fs = require("fs").promises;
|
||||
for (const icon of Object.values(icons)) {
|
||||
const [location] = icon.split("?");
|
||||
// resolve location against manifestLocation
|
||||
const resolvedLocation = path.resolve(manifestLocation, location);
|
||||
const iconData = fs.readFile(resolvedLocation);
|
||||
promises.push(iconData);
|
||||
const fileName = path.basename(resolvedLocation);
|
||||
fileNames.push(fileName);
|
||||
}
|
||||
const results = await Promise.all(promises);
|
||||
for (let i = 0; i < results.length; ++i) {
|
||||
const svgString = results[i].toString();
|
||||
const result = optimize(svgString, {
|
||||
plugins: [
|
||||
{
|
||||
name: "preset-default",
|
||||
params: {
|
||||
overrides: { convertColors: false, },
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const optimizedSvgString = result.data;
|
||||
sources[fileNames[i]] = optimizedSvgString;
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mapping from location (of manifest file) to an array containing all the chunks (of css files) generated from that location.
|
||||
* To understand what chunk means in this context, see https://rollupjs.org/guide/en/#generatebundle.
|
||||
* @param {*} bundle Mapping from fileName to AssetInfo | ChunkInfo
|
||||
*/
|
||||
function getMappingFromLocationToChunkArray(bundle) {
|
||||
const chunkMap = new Map();
|
||||
for (const [fileName, info] of Object.entries(bundle)) {
|
||||
if (!fileName.endsWith(".css") || info.type === "asset" || info.facadeModuleId?.includes("type=runtime")) {
|
||||
continue;
|
||||
}
|
||||
const location = info.facadeModuleId?.match(/(.+)\/.+\.css/)?.[1];
|
||||
if (!location) {
|
||||
throw new Error("Cannot find location of css chunk!");
|
||||
}
|
||||
const array = chunkMap.get(location);
|
||||
if (!array) {
|
||||
chunkMap.set(location, [info]);
|
||||
}
|
||||
else {
|
||||
array.push(info);
|
||||
}
|
||||
}
|
||||
return chunkMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mapping from unhashed file name (of css files) to AssetInfo.
|
||||
* To understand what AssetInfo means in this context, see https://rollupjs.org/guide/en/#generatebundle.
|
||||
* @param {*} bundle Mapping from fileName to AssetInfo | ChunkInfo
|
||||
*/
|
||||
function getMappingFromFileNameToAssetInfo(bundle) {
|
||||
const assetMap = new Map();
|
||||
for (const [fileName, info] of Object.entries(bundle)) {
|
||||
if (!fileName.endsWith(".css")) {
|
||||
continue;
|
||||
}
|
||||
if (info.type === "asset") {
|
||||
/**
|
||||
* So this is the css assetInfo that contains the asset hashed file name.
|
||||
* We'll store it in a separate map indexed via fileName (unhashed) to avoid
|
||||
* searching through the bundle array later.
|
||||
*/
|
||||
assetMap.set(info.name, info);
|
||||
}
|
||||
}
|
||||
return assetMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mapping from location (of manifest file) to ChunkInfo of the runtime css asset
|
||||
* To understand what ChunkInfo means in this context, see https://rollupjs.org/guide/en/#generatebundle.
|
||||
* @param {*} bundle Mapping from fileName to AssetInfo | ChunkInfo
|
||||
*/
|
||||
function getMappingFromLocationToRuntimeChunk(bundle) {
|
||||
let runtimeThemeChunkMap = new Map();
|
||||
for (const [fileName, info] of Object.entries(bundle)) {
|
||||
if (!fileName.endsWith(".css") || info.type === "asset") {
|
||||
continue;
|
||||
}
|
||||
const location = info.facadeModuleId?.match(/(.+)\/.+\.css/)?.[1];
|
||||
if (!location) {
|
||||
throw new Error("Cannot find location of css chunk!");
|
||||
}
|
||||
if (info.facadeModuleId?.includes("type=runtime")) {
|
||||
/**
|
||||
* We have a separate field in manifest.source just for the runtime theme,
|
||||
* so store this separately.
|
||||
*/
|
||||
runtimeThemeChunkMap.set(location, info);
|
||||
}
|
||||
}
|
||||
return runtimeThemeChunkMap;
|
||||
}
|
||||
|
||||
module.exports = function buildThemes(options) {
|
||||
let manifest, variants, defaultDark, defaultLight, defaultThemes = {};
|
||||
let isDevelopment = false;
|
||||
const virtualModuleId = '@theme/'
|
||||
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
||||
const themeToManifestLocation = new Map();
|
||||
|
||||
return {
|
||||
name: "build-themes",
|
||||
enforce: "pre",
|
||||
|
||||
configResolved(config) {
|
||||
if (config.command === "serve") {
|
||||
isDevelopment = true;
|
||||
}
|
||||
},
|
||||
|
||||
async buildStart() {
|
||||
const { themeConfig } = options;
|
||||
for (const location of themeConfig.themes) {
|
||||
manifest = require(`${location}/manifest.json`);
|
||||
const themeCollectionId = manifest.id;
|
||||
themeToManifestLocation.set(themeCollectionId, location);
|
||||
variants = manifest.values.variants;
|
||||
for (const [variant, details] of Object.entries(variants)) {
|
||||
const fileName = `theme-${themeCollectionId}-${variant}.css`;
|
||||
if (themeCollectionId === themeConfig.default && details.default) {
|
||||
// This is the default theme, stash the file name for later
|
||||
if (details.dark) {
|
||||
defaultDark = fileName;
|
||||
defaultThemes["dark"] = `${themeCollectionId}-${variant}`;
|
||||
}
|
||||
else {
|
||||
defaultLight = fileName;
|
||||
defaultThemes["light"] = `${themeCollectionId}-${variant}`;
|
||||
}
|
||||
}
|
||||
// emit the css as built theme bundle
|
||||
if (!isDevelopment) {
|
||||
this.emitFile({ type: "chunk", id: `${location}/theme.css?variant=${variant}${details.dark ? "&dark=true" : ""}`, fileName, });
|
||||
}
|
||||
}
|
||||
// emit the css as runtime theme bundle
|
||||
if (!isDevelopment) {
|
||||
this.emitFile({ type: "chunk", id: `${location}/theme.css?type=runtime`, fileName: `theme-${themeCollectionId}-runtime.css`, });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
resolveId(id) {
|
||||
if (id.startsWith(virtualModuleId)) {
|
||||
return '\0' + id;
|
||||
}
|
||||
},
|
||||
|
||||
async load(id) {
|
||||
if (isDevelopment) {
|
||||
/**
|
||||
* To load the theme during dev, we need to take a different approach because emitFile is not supported in dev.
|
||||
* We solve this by resolving virtual file "@theme/name/variant" into the necessary css import.
|
||||
* This virtual file import is removed when hydrogen is built (see transform hook).
|
||||
*/
|
||||
if (id.startsWith(resolvedVirtualModuleId)) {
|
||||
let [theme, variant, file] = id.substr(resolvedVirtualModuleId.length).split("/");
|
||||
if (theme === "default") {
|
||||
theme = options.themeConfig.default;
|
||||
}
|
||||
const location = themeToManifestLocation.get(theme);
|
||||
const manifest = require(`${location}/manifest.json`);
|
||||
const variants = manifest.values.variants;
|
||||
if (!variant || variant === "default") {
|
||||
// choose the first default variant for now
|
||||
// this will need to support light/dark variants as well
|
||||
variant = Object.keys(variants).find(variantName => variants[variantName].default);
|
||||
}
|
||||
if (!file) {
|
||||
file = "index.js";
|
||||
}
|
||||
switch (file) {
|
||||
case "index.js": {
|
||||
const isDark = variants[variant].dark;
|
||||
return `import "${path.resolve(`${location}/theme.css`)}${isDark? "?dark=true": ""}";` +
|
||||
`import "@theme/${theme}/${variant}/variables.css"`;
|
||||
}
|
||||
case "variables.css": {
|
||||
const variables = variants[variant].variables;
|
||||
const css = getRootSectionWithVariables(variables);
|
||||
return css;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const result = id.match(/(.+)\/theme.css\?variant=([^&]+)/);
|
||||
if (result) {
|
||||
const [, location, variant] = result;
|
||||
const cssSource = await readCSSSource(location);
|
||||
const config = variants[variant];
|
||||
return appendVariablesToCSS(config.variables, cssSource);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
transform(code, id) {
|
||||
if (isDevelopment) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Removes develop-only script tag; this cannot be done in transformIndexHtml hook because
|
||||
* by the time that hook runs, the import is added to the bundled js file which would
|
||||
* result in a runtime error.
|
||||
*/
|
||||
|
||||
const devScriptTag =
|
||||
/<script type="module"> import "@theme\/.+"; <\/script>/;
|
||||
if (id.endsWith("index.html")) {
|
||||
const htmlWithoutDevScript = code.replace(devScriptTag, "");
|
||||
return htmlWithoutDevScript;
|
||||
}
|
||||
},
|
||||
|
||||
transformIndexHtml(_, ctx) {
|
||||
if (isDevelopment) {
|
||||
// Don't add default stylesheets to index.html on dev
|
||||
return;
|
||||
}
|
||||
let darkThemeLocation, lightThemeLocation;
|
||||
for (const [, bundle] of Object.entries(ctx.bundle)) {
|
||||
if (bundle.name === defaultDark) {
|
||||
darkThemeLocation = bundle.fileName;
|
||||
}
|
||||
if (bundle.name === defaultLight) {
|
||||
lightThemeLocation = bundle.fileName;
|
||||
}
|
||||
}
|
||||
return [
|
||||
{
|
||||
tag: "link",
|
||||
attrs: {
|
||||
rel: "stylesheet",
|
||||
type: "text/css",
|
||||
media: "(prefers-color-scheme: dark)",
|
||||
href: `./${darkThemeLocation}`,
|
||||
class: "theme",
|
||||
}
|
||||
},
|
||||
{
|
||||
tag: "link",
|
||||
attrs: {
|
||||
rel: "stylesheet",
|
||||
type: "text/css",
|
||||
media: "(prefers-color-scheme: light)",
|
||||
href: `./${lightThemeLocation}`,
|
||||
class: "theme",
|
||||
}
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
async generateBundle(_, bundle) {
|
||||
const assetMap = getMappingFromFileNameToAssetInfo(bundle);
|
||||
const chunkMap = getMappingFromLocationToChunkArray(bundle);
|
||||
const runtimeThemeChunkMap = getMappingFromLocationToRuntimeChunk(bundle);
|
||||
const manifestLocations = [];
|
||||
// Location of the directory containing manifest relative to the root of the build output
|
||||
const manifestLocation = "assets";
|
||||
for (const [location, chunkArray] of chunkMap) {
|
||||
const manifest = require(`${location}/manifest.json`);
|
||||
const compiledVariables = options.compiledVariables.get(location);
|
||||
const derivedVariables = compiledVariables["derived-variables"];
|
||||
const icon = compiledVariables["icon"];
|
||||
const builtAssets = {};
|
||||
let themeKey;
|
||||
for (const chunk of chunkArray) {
|
||||
const [, name, variant] = chunk.fileName.match(/theme-(.+)-(.+)\.css/);
|
||||
themeKey = name;
|
||||
const locationRelativeToBuildRoot = assetMap.get(chunk.fileName).fileName;
|
||||
const locationRelativeToManifest = path.relative(manifestLocation, locationRelativeToBuildRoot);
|
||||
builtAssets[`${name}-${variant}`] = locationRelativeToManifest;
|
||||
}
|
||||
// Emit the base svg icons as asset
|
||||
const nameToAssetHashedLocation = [];
|
||||
const nameToSource = await generateIconSourceMap(icon, location);
|
||||
for (const [name, source] of Object.entries(nameToSource)) {
|
||||
const ref = this.emitFile({ type: "asset", name, source });
|
||||
const assetHashedName = this.getFileName(ref);
|
||||
nameToAssetHashedLocation[name] = assetHashedName;
|
||||
}
|
||||
// Update icon section in output manifest with paths to the icon in build output
|
||||
for (const [variable, location] of Object.entries(icon)) {
|
||||
const [locationWithoutQueryParameters, queryParameters] = location.split("?");
|
||||
const name = path.basename(locationWithoutQueryParameters);
|
||||
const locationRelativeToBuildRoot = nameToAssetHashedLocation[name];
|
||||
const locationRelativeToManifest = path.relative(manifestLocation, locationRelativeToBuildRoot);
|
||||
icon[variable] = `${locationRelativeToManifest}?${queryParameters}`;
|
||||
}
|
||||
const runtimeThemeChunk = runtimeThemeChunkMap.get(location);
|
||||
const runtimeAssetLocation = path.relative(manifestLocation, assetMap.get(runtimeThemeChunk.fileName).fileName);
|
||||
manifest.source = {
|
||||
"built-assets": builtAssets,
|
||||
"runtime-asset": runtimeAssetLocation,
|
||||
"derived-variables": derivedVariables,
|
||||
"icon": icon,
|
||||
};
|
||||
const name = `theme-${themeKey}.json`;
|
||||
manifestLocations.push(`${manifestLocation}/${name}`);
|
||||
this.emitFile({
|
||||
type: "asset",
|
||||
name,
|
||||
source: JSON.stringify(manifest),
|
||||
});
|
||||
}
|
||||
addThemesToConfig(bundle, manifestLocations, defaultThemes);
|
||||
},
|
||||
}
|
||||
}
|
157
scripts/build-plugins/service-worker.js
Normal file
157
scripts/build-plugins/service-worker.js
Normal file
|
@ -0,0 +1,157 @@
|
|||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
const xxhash = require('xxhashjs');
|
||||
|
||||
function contentHash(str) {
|
||||
var hasher = new xxhash.h32(0);
|
||||
hasher.update(str);
|
||||
return hasher.digest();
|
||||
}
|
||||
|
||||
function injectServiceWorker(swFile, findUnhashedFileNamesFromBundle, placeholdersPerChunk) {
|
||||
const swName = path.basename(swFile);
|
||||
let root;
|
||||
let version;
|
||||
let logger;
|
||||
|
||||
return {
|
||||
name: "hydrogen:injectServiceWorker",
|
||||
apply: "build",
|
||||
enforce: "post",
|
||||
buildStart() {
|
||||
this.emitFile({
|
||||
type: "chunk",
|
||||
fileName: swName,
|
||||
id: swFile,
|
||||
});
|
||||
},
|
||||
configResolved: config => {
|
||||
root = config.root;
|
||||
version = JSON.parse(config.define.DEFINE_VERSION); // unquote
|
||||
logger = config.logger;
|
||||
},
|
||||
generateBundle: async function(options, bundle) {
|
||||
const otherUnhashedFiles = findUnhashedFileNamesFromBundle(bundle);
|
||||
const unhashedFilenames = [swName].concat(otherUnhashedFiles);
|
||||
const unhashedFileContentMap = unhashedFilenames.reduce((map, fileName) => {
|
||||
const chunkOrAsset = bundle[fileName];
|
||||
if (!chunkOrAsset) {
|
||||
throw new Error("could not get content for uncached asset or chunk " + fileName);
|
||||
}
|
||||
map[fileName] = chunkOrAsset.source || chunkOrAsset.code;
|
||||
return map;
|
||||
}, {});
|
||||
const assets = Object.values(bundle);
|
||||
const hashedFileNames = assets.map(o => o.fileName).filter(fileName => !unhashedFileContentMap[fileName]);
|
||||
const globalHash = getBuildHash(hashedFileNames, unhashedFileContentMap);
|
||||
const placeholderValues = {
|
||||
DEFINE_GLOBAL_HASH: `"${globalHash}"`,
|
||||
...getCacheFileNamePlaceholderValues(swName, unhashedFilenames, assets, placeholdersPerChunk)
|
||||
};
|
||||
replacePlaceholdersInChunks(assets, placeholdersPerChunk, placeholderValues);
|
||||
logger.info(`\nBuilt ${version} (${globalHash})`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getBuildHash(hashedFileNames, unhashedFileContentMap) {
|
||||
const unhashedHashes = Object.entries(unhashedFileContentMap).map(([fileName, content]) => {
|
||||
return `${fileName}-${contentHash(Buffer.from(content))}`;
|
||||
});
|
||||
const globalHashAssets = hashedFileNames.concat(unhashedHashes);
|
||||
globalHashAssets.sort();
|
||||
return contentHash(globalHashAssets.join(",")).toString();
|
||||
}
|
||||
|
||||
const NON_PRECACHED_JS = [
|
||||
"hydrogen-legacy",
|
||||
"olm_legacy.js",
|
||||
// most environments don't need the worker
|
||||
"main.js"
|
||||
];
|
||||
|
||||
function isPreCached(asset) {
|
||||
const {name, fileName} = asset;
|
||||
return name.endsWith(".svg") ||
|
||||
name.endsWith(".png") ||
|
||||
name.endsWith(".css") ||
|
||||
name.endsWith(".wasm") ||
|
||||
name.endsWith(".html") ||
|
||||
// the index and vendor chunks don't have an extension in `name`, so check extension on `fileName`
|
||||
fileName.endsWith(".js") && !NON_PRECACHED_JS.includes(path.basename(name));
|
||||
}
|
||||
|
||||
function getCacheFileNamePlaceholderValues(swName, unhashedFilenames, assets) {
|
||||
const unhashedPreCachedAssets = [];
|
||||
const hashedPreCachedAssets = [];
|
||||
const hashedCachedOnRequestAssets = [];
|
||||
|
||||
for (const asset of assets) {
|
||||
const {name, fileName} = asset;
|
||||
// the service worker should not be cached at all,
|
||||
// it's how updates happen
|
||||
if (fileName === swName) {
|
||||
continue;
|
||||
} else if (unhashedFilenames.includes(fileName)) {
|
||||
unhashedPreCachedAssets.push(fileName);
|
||||
} else if (isPreCached(asset)) {
|
||||
hashedPreCachedAssets.push(fileName);
|
||||
} else {
|
||||
hashedCachedOnRequestAssets.push(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
DEFINE_UNHASHED_PRECACHED_ASSETS: JSON.stringify(unhashedPreCachedAssets),
|
||||
DEFINE_HASHED_PRECACHED_ASSETS: JSON.stringify(hashedPreCachedAssets),
|
||||
DEFINE_HASHED_CACHED_ON_REQUEST_ASSETS: JSON.stringify(hashedCachedOnRequestAssets)
|
||||
}
|
||||
}
|
||||
|
||||
function replacePlaceholdersInChunks(assets, placeholdersPerChunk, placeholderValues) {
|
||||
for (const [name, placeholderMap] of Object.entries(placeholdersPerChunk)) {
|
||||
const chunk = assets.find(a => a.type === "chunk" && a.name === name);
|
||||
if (!chunk) {
|
||||
throw new Error(`could not find chunk ${name} to replace placeholders`);
|
||||
}
|
||||
for (const [placeholderName, placeholderLiteral] of Object.entries(placeholderMap)) {
|
||||
const replacedValue = placeholderValues[placeholderName];
|
||||
const oldCode = chunk.code;
|
||||
chunk.code = chunk.code.replaceAll(placeholderLiteral, replacedValue);
|
||||
if (chunk.code === oldCode) {
|
||||
throw new Error(`Could not replace ${placeholderName} in ${name}, looking for literal ${placeholderLiteral}:\n${chunk.code}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** creates a value to be include in the `define` build settings,
|
||||
* but can be replace at the end of the build in certain chunks.
|
||||
* We need this for injecting the global build hash and the final
|
||||
* filenames in the service worker and index chunk.
|
||||
* These values are only known in the generateBundle step, so we
|
||||
* replace them by unique strings wrapped in a prompt call so no
|
||||
* transformation will touch them (minifying, ...) and we can do a
|
||||
* string replacement still at the end of the build. */
|
||||
function definePlaceholderValue(mode, name, devValue) {
|
||||
if (mode === "production") {
|
||||
// note that `prompt(...)` will never be in the final output, it's replaced by the final value
|
||||
// once we know at the end of the build what it is and just used as a temporary value during the build
|
||||
// as something that will not be transformed.
|
||||
// I first considered Symbol but it's not inconceivable that babel would transform this.
|
||||
return `prompt(${JSON.stringify(name)})`;
|
||||
} else {
|
||||
return JSON.stringify(devValue);
|
||||
}
|
||||
}
|
||||
|
||||
function createPlaceholderValues(mode) {
|
||||
return {
|
||||
DEFINE_GLOBAL_HASH: definePlaceholderValue(mode, "DEFINE_GLOBAL_HASH", null),
|
||||
DEFINE_UNHASHED_PRECACHED_ASSETS: definePlaceholderValue(mode, "UNHASHED_PRECACHED_ASSETS", []),
|
||||
DEFINE_HASHED_PRECACHED_ASSETS: definePlaceholderValue(mode, "HASHED_PRECACHED_ASSETS", []),
|
||||
DEFINE_HASHED_CACHED_ON_REQUEST_ASSETS: definePlaceholderValue(mode, "HASHED_CACHED_ON_REQUEST_ASSETS", []),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {injectServiceWorker, createPlaceholderValues};
|
|
@ -1,417 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import cheerio from "cheerio";
|
||||
import fsRoot from "fs";
|
||||
const fs = fsRoot.promises;
|
||||
import path from "path";
|
||||
import xxhash from 'xxhashjs';
|
||||
import { rollup } from 'rollup';
|
||||
import postcss from "postcss";
|
||||
import postcssImport from "postcss-import";
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import commander from "commander";
|
||||
// needed for legacy bundle
|
||||
import babel from '@rollup/plugin-babel';
|
||||
// needed to find the polyfill modules in the main-legacy.js bundle
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
// needed because some of the polyfills are written as commonjs modules
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
// multi-entry plugin so we can add polyfill file to main
|
||||
import multi from '@rollup/plugin-multi-entry';
|
||||
import removeJsComments from 'rollup-plugin-cleanup';
|
||||
// replace urls of asset names with content hashed version
|
||||
import postcssUrl from "postcss-url";
|
||||
|
||||
import cssvariables from "postcss-css-variables";
|
||||
import flexbugsFixes from "postcss-flexbugs-fixes";
|
||||
|
||||
const PROJECT_ID = "hydrogen";
|
||||
const PROJECT_SHORT_NAME = "Hydrogen";
|
||||
const PROJECT_NAME = "Hydrogen Chat";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const projectDir = path.join(__dirname, "../");
|
||||
const cssSrcDir = path.join(projectDir, "src/ui/web/css/");
|
||||
const targetDir = path.join(projectDir, "target/");
|
||||
|
||||
const program = new commander.Command();
|
||||
program
|
||||
.option("--no-offline", "make a build without a service worker or appcache manifest")
|
||||
program.parse(process.argv);
|
||||
const {debug, noOffline} = program;
|
||||
const offline = !noOffline;
|
||||
|
||||
const olmFiles = {
|
||||
wasm: "olm-4289088762.wasm",
|
||||
legacyBundle: "olm_legacy-3232457086.js",
|
||||
wasmBundle: "olm-1421970081.js",
|
||||
};
|
||||
|
||||
async function build() {
|
||||
// only used for CSS for now, using legacy for all targets for now
|
||||
const legacy = true;
|
||||
// get version number
|
||||
const version = JSON.parse(await fs.readFile(path.join(projectDir, "package.json"), "utf8")).version;
|
||||
|
||||
const devHtml = await fs.readFile(path.join(projectDir, "index.html"), "utf8");
|
||||
const doc = cheerio.load(devHtml);
|
||||
const themes = [];
|
||||
findThemes(doc, themeName => {
|
||||
themes.push(themeName);
|
||||
});
|
||||
// clear target dir
|
||||
await removeDirIfExists(targetDir);
|
||||
await createDirs(targetDir, themes);
|
||||
// copy assets
|
||||
await copyFolder(path.join(projectDir, "lib/olm/"), targetDir, );
|
||||
// also creates the directories where the theme css bundles are placed in,
|
||||
// so do it first
|
||||
const themeAssets = await copyThemeAssets(themes, legacy);
|
||||
const jsBundlePath = await buildJs("src/main.js", `${PROJECT_ID}.js`);
|
||||
const jsLegacyBundlePath = await buildJsLegacy("src/main.js", `${PROJECT_ID}-legacy.js`);
|
||||
const jsWorkerPath = await buildWorkerJsLegacy("src/worker.js", `worker.js`);
|
||||
const cssBundlePaths = await buildCssBundles(legacy ? buildCssLegacy : buildCss, themes, themeAssets);
|
||||
const assetPaths = createAssetPaths(jsBundlePath, jsLegacyBundlePath, jsWorkerPath, cssBundlePaths, themeAssets);
|
||||
|
||||
let manifestPath;
|
||||
if (offline) {
|
||||
manifestPath = await buildOffline(version, assetPaths);
|
||||
}
|
||||
await buildHtml(doc, version, assetPaths, manifestPath);
|
||||
|
||||
console.log(`built ${PROJECT_ID} ${version} successfully`);
|
||||
}
|
||||
|
||||
function createAssetPaths(jsBundlePath, jsLegacyBundlePath, jsWorkerPath, cssBundlePaths, themeAssets) {
|
||||
function trim(path) {
|
||||
if (!path.startsWith(targetDir)) {
|
||||
throw new Error("invalid target path: " + targetDir);
|
||||
}
|
||||
return path.substr(targetDir.length);
|
||||
}
|
||||
return {
|
||||
jsBundle: () => trim(jsBundlePath),
|
||||
jsLegacyBundle: () => trim(jsLegacyBundlePath),
|
||||
jsWorker: () => trim(jsWorkerPath),
|
||||
cssMainBundle: () => trim(cssBundlePaths.main),
|
||||
cssThemeBundle: themeName => trim(cssBundlePaths.themes[themeName]),
|
||||
cssThemeBundles: () => Object.values(cssBundlePaths.themes).map(a => trim(a)),
|
||||
otherAssets: () => Object.values(themeAssets).map(a => trim(a))
|
||||
};
|
||||
}
|
||||
|
||||
async function findThemes(doc, callback) {
|
||||
doc("link[rel~=stylesheet][title]").each((i, el) => {
|
||||
const theme = doc(el);
|
||||
const href = theme.attr("href");
|
||||
const themesPrefix = "/themes/";
|
||||
const prefixIdx = href.indexOf(themesPrefix);
|
||||
if (prefixIdx !== -1) {
|
||||
const themeNameStart = prefixIdx + themesPrefix.length;
|
||||
const themeNameEnd = href.indexOf("/", themeNameStart);
|
||||
const themeName = href.substr(themeNameStart, themeNameEnd - themeNameStart);
|
||||
callback(themeName, theme);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function createDirs(targetDir, themes) {
|
||||
await fs.mkdir(targetDir);
|
||||
const themeDir = path.join(targetDir, "themes");
|
||||
await fs.mkdir(themeDir);
|
||||
for (const theme of themes) {
|
||||
await fs.mkdir(path.join(themeDir, theme));
|
||||
}
|
||||
}
|
||||
|
||||
async function copyThemeAssets(themes, legacy) {
|
||||
const assets = {};
|
||||
for (const theme of themes) {
|
||||
const themeDstFolder = path.join(targetDir, `themes/${theme}`);
|
||||
const themeSrcFolder = path.join(cssSrcDir, `themes/${theme}`);
|
||||
const themeAssets = await copyFolder(themeSrcFolder, themeDstFolder, file => {
|
||||
const isUnneededFont = legacy ? file.endsWith(".woff2") : file.endsWith(".woff");
|
||||
return !file.endsWith(".css") && !isUnneededFont;
|
||||
});
|
||||
Object.assign(assets, themeAssets);
|
||||
}
|
||||
return assets;
|
||||
}
|
||||
|
||||
async function buildHtml(doc, version, assetPaths, manifestPath) {
|
||||
// transform html file
|
||||
// change path to main.css to css bundle
|
||||
doc("link[rel=stylesheet]:not([title])").attr("href", assetPaths.cssMainBundle());
|
||||
// change paths to all theme stylesheets
|
||||
findThemes(doc, (themeName, theme) => {
|
||||
theme.attr("href", assetPaths.cssThemeBundle(themeName));
|
||||
});
|
||||
const pathsJSON = JSON.stringify({
|
||||
worker: assetPaths.jsWorker(),
|
||||
olm: olmFiles
|
||||
});
|
||||
doc("script#main").replaceWith(
|
||||
`<script type="module">import {main} from "./${assetPaths.jsBundle()}"; main(document.body, ${pathsJSON});</script>` +
|
||||
`<script type="text/javascript" nomodule src="${assetPaths.jsLegacyBundle()}"></script>` +
|
||||
`<script type="text/javascript" nomodule>${PROJECT_ID}Bundle.main(document.body, ${pathsJSON});</script>`);
|
||||
removeOrEnableScript(doc("script#service-worker"), offline);
|
||||
|
||||
const versionScript = doc("script#version");
|
||||
versionScript.attr("type", "text/javascript");
|
||||
let vSource = versionScript.contents().text();
|
||||
vSource = vSource.replace(`"%%VERSION%%"`, `"${version}"`);
|
||||
versionScript.text(vSource);
|
||||
|
||||
if (offline) {
|
||||
doc("html").attr("manifest", "manifest.appcache");
|
||||
doc("head").append(`<link rel="manifest" href="${manifestPath.substr(targetDir.length)}">`);
|
||||
}
|
||||
await fs.writeFile(path.join(targetDir, "index.html"), doc.html(), "utf8");
|
||||
}
|
||||
|
||||
async function buildJs(inputFile, outputName) {
|
||||
// create js bundle
|
||||
const bundle = await rollup({
|
||||
input: inputFile,
|
||||
plugins: [removeJsComments({comments: "none"})]
|
||||
});
|
||||
const {output} = await bundle.generate({
|
||||
format: 'es',
|
||||
// TODO: can remove this?
|
||||
name: `${PROJECT_ID}Bundle`
|
||||
});
|
||||
const code = output[0].code;
|
||||
const bundlePath = resource(outputName, code);
|
||||
await fs.writeFile(bundlePath, code, "utf8");
|
||||
return bundlePath;
|
||||
}
|
||||
|
||||
async function buildJsLegacy(inputFile, outputName) {
|
||||
// compile down to whatever IE 11 needs
|
||||
const babelPlugin = babel.babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: 'node_modules/**',
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
corejs: "3",
|
||||
targets: "IE 11"
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
// create js bundle
|
||||
const rollupConfig = {
|
||||
input: ['src/legacy-polyfill.js', inputFile],
|
||||
plugins: [multi(), commonjs(), nodeResolve(), babelPlugin, removeJsComments({comments: "none"})]
|
||||
};
|
||||
const bundle = await rollup(rollupConfig);
|
||||
const {output} = await bundle.generate({
|
||||
format: 'iife',
|
||||
name: `${PROJECT_ID}Bundle`
|
||||
});
|
||||
const code = output[0].code;
|
||||
const bundlePath = resource(outputName, code);
|
||||
await fs.writeFile(bundlePath, code, "utf8");
|
||||
return bundlePath;
|
||||
}
|
||||
|
||||
async function buildWorkerJsLegacy(inputFile, outputName) {
|
||||
// compile down to whatever IE 11 needs
|
||||
const babelPlugin = babel.babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: 'node_modules/**',
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
corejs: "3",
|
||||
targets: "IE 11"
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
// create js bundle
|
||||
const rollupConfig = {
|
||||
input: ['src/worker-polyfill.js', inputFile],
|
||||
plugins: [multi(), commonjs(), nodeResolve(), babelPlugin, removeJsComments({comments: "none"})]
|
||||
};
|
||||
const bundle = await rollup(rollupConfig);
|
||||
const {output} = await bundle.generate({
|
||||
format: 'iife',
|
||||
name: `${PROJECT_ID}Bundle`
|
||||
});
|
||||
const code = output[0].code;
|
||||
const bundlePath = resource(outputName, code);
|
||||
await fs.writeFile(bundlePath, code, "utf8");
|
||||
return bundlePath;
|
||||
}
|
||||
|
||||
async function buildOffline(version, assetPaths) {
|
||||
// write offline availability
|
||||
const offlineFiles = [
|
||||
assetPaths.cssMainBundle(),
|
||||
"index.html",
|
||||
"icon-192.png",
|
||||
].concat(assetPaths.cssThemeBundles());
|
||||
|
||||
// write appcache manifest
|
||||
const appCacheLines = [
|
||||
`CACHE MANIFEST`,
|
||||
`# v${version}`,
|
||||
`NETWORK`,
|
||||
`"*"`,
|
||||
`CACHE`,
|
||||
];
|
||||
appCacheLines.push(assetPaths.jsLegacyBundle(), ...offlineFiles);
|
||||
const swOfflineFiles = [assetPaths.jsBundle(), ...offlineFiles];
|
||||
const appCacheManifest = appCacheLines.join("\n") + "\n";
|
||||
await fs.writeFile(path.join(targetDir, "manifest.appcache"), appCacheManifest, "utf8");
|
||||
// write service worker
|
||||
let swSource = await fs.readFile(path.join(projectDir, "src/service-worker.template.js"), "utf8");
|
||||
swSource = swSource.replace(`"%%VERSION%%"`, `"${version}"`);
|
||||
swSource = swSource.replace(`"%%OFFLINE_FILES%%"`, JSON.stringify(swOfflineFiles));
|
||||
swSource = swSource.replace(`"%%CACHE_FILES%%"`, JSON.stringify(assetPaths.otherAssets()));
|
||||
await fs.writeFile(path.join(targetDir, "sw.js"), swSource, "utf8");
|
||||
// write web manifest
|
||||
const webManifest = {
|
||||
name:PROJECT_NAME,
|
||||
short_name: PROJECT_SHORT_NAME,
|
||||
display: "fullscreen",
|
||||
start_url: "index.html",
|
||||
icons: [{"src": "icon-192.png", "sizes": "192x192", "type": "image/png"}],
|
||||
};
|
||||
const manifestJson = JSON.stringify(webManifest);
|
||||
const manifestPath = resource("manifest.json", manifestJson);
|
||||
await fs.writeFile(manifestPath, manifestJson, "utf8");
|
||||
// copy icon
|
||||
// should this icon have a content hash as well?
|
||||
let icon = await fs.readFile(path.join(projectDir, "icon.png"));
|
||||
await fs.writeFile(path.join(targetDir, "icon-192.png"), icon);
|
||||
return manifestPath;
|
||||
}
|
||||
|
||||
async function buildCssBundles(buildFn, themes, themeAssets) {
|
||||
const bundleCss = await buildFn(path.join(cssSrcDir, "main.css"));
|
||||
const mainDstPath = resource(`${PROJECT_ID}.css`, bundleCss);
|
||||
await fs.writeFile(mainDstPath, bundleCss, "utf8");
|
||||
const bundlePaths = {main: mainDstPath, themes: {}};
|
||||
for (const theme of themes) {
|
||||
const urlBase = path.join(targetDir, `themes/${theme}/`);
|
||||
const assetUrlMapper = ({absolutePath}) => {
|
||||
const hashedDstPath = themeAssets[absolutePath];
|
||||
if (hashedDstPath && hashedDstPath.startsWith(urlBase)) {
|
||||
return hashedDstPath.substr(urlBase.length);
|
||||
}
|
||||
};
|
||||
const themeCss = await buildFn(path.join(cssSrcDir, `themes/${theme}/theme.css`), assetUrlMapper);
|
||||
const themeDstPath = resource(`themes/${theme}/bundle.css`, themeCss);
|
||||
await fs.writeFile(themeDstPath, themeCss, "utf8");
|
||||
bundlePaths.themes[theme] = themeDstPath;
|
||||
}
|
||||
return bundlePaths;
|
||||
}
|
||||
|
||||
async function buildCss(entryPath, urlMapper = null) {
|
||||
const preCss = await fs.readFile(entryPath, "utf8");
|
||||
const options = [postcssImport];
|
||||
if (urlMapper) {
|
||||
options.push(postcssUrl({url: urlMapper}));
|
||||
}
|
||||
const cssBundler = postcss(options);
|
||||
const result = await cssBundler.process(preCss, {from: entryPath});
|
||||
return result.css;
|
||||
}
|
||||
|
||||
async function buildCssLegacy(entryPath, urlMapper = null) {
|
||||
const preCss = await fs.readFile(entryPath, "utf8");
|
||||
const options = [
|
||||
postcssImport,
|
||||
cssvariables(),
|
||||
flexbugsFixes()
|
||||
];
|
||||
if (urlMapper) {
|
||||
options.push(postcssUrl({url: urlMapper}));
|
||||
}
|
||||
const cssBundler = postcss(options);
|
||||
const result = await cssBundler.process(preCss, {from: entryPath});
|
||||
return result.css;
|
||||
}
|
||||
|
||||
function removeOrEnableScript(scriptNode, enable) {
|
||||
if (enable) {
|
||||
scriptNode.attr("type", "text/javascript");
|
||||
} else {
|
||||
scriptNode.remove();
|
||||
}
|
||||
}
|
||||
|
||||
async function removeDirIfExists(targetDir) {
|
||||
try {
|
||||
await fs.rmdir(targetDir, {recursive: true});
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function copyFolder(srcRoot, dstRoot, filter) {
|
||||
const assetPaths = {};
|
||||
const dirEnts = await fs.readdir(srcRoot, {withFileTypes: true});
|
||||
for (const dirEnt of dirEnts) {
|
||||
const dstPath = path.join(dstRoot, dirEnt.name);
|
||||
const srcPath = path.join(srcRoot, dirEnt.name);
|
||||
if (dirEnt.isDirectory()) {
|
||||
await fs.mkdir(dstPath);
|
||||
Object.assign(assetPaths, await copyFolder(srcPath, dstPath, filter));
|
||||
} else if ((dirEnt.isFile() || dirEnt.isSymbolicLink()) && (!filter || filter(srcPath))) {
|
||||
const content = await fs.readFile(srcPath);
|
||||
const hashedDstPath = resource(dstPath, content);
|
||||
await fs.writeFile(hashedDstPath, content);
|
||||
assetPaths[srcPath] = hashedDstPath;
|
||||
}
|
||||
}
|
||||
return assetPaths;
|
||||
}
|
||||
|
||||
function resource(relPath, content) {
|
||||
let fullPath = relPath;
|
||||
if (!path.isAbsolute(relPath)) {
|
||||
fullPath = path.join(targetDir, relPath);
|
||||
}
|
||||
const hash = contentHash(Buffer.from(content));
|
||||
const dir = path.dirname(fullPath);
|
||||
const extname = path.extname(fullPath);
|
||||
const basename = path.basename(fullPath, extname);
|
||||
return path.join(dir, `${basename}-${hash}${extname}`);
|
||||
}
|
||||
|
||||
function contentHash(str) {
|
||||
var hasher = new xxhash.h32(0);
|
||||
hasher.update(str);
|
||||
return hasher.digest();
|
||||
}
|
||||
|
||||
|
||||
build().catch(err => console.error(err));
|
165
scripts/ci.sh
Executable file
165
scripts/ci.sh
Executable file
|
@ -0,0 +1,165 @@
|
|||
#!/bin/bash
|
||||
# ci.sh: Helper script to automate deployment operations on CI/CD
|
||||
# Copyright © 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -xEeuo pipefail
|
||||
#source $(pwd)/scripts/lib.sh
|
||||
|
||||
readonly SSH_ID_FILE=/tmp/ci-ssh-id
|
||||
readonly SSH_REMOTE_NAME=origin-ssh
|
||||
readonly PROJECT_ROOT=$(pwd)
|
||||
|
||||
match_arg() {
|
||||
if [ $1 == $2 ] || [ $1 == $3 ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
USAGE: ci.sh [SUBCOMMAND]
|
||||
Helper script to automate deployment operations on CI/CD
|
||||
|
||||
Subcommands
|
||||
|
||||
-c --clean cleanup secrets, SSH key and other runtime data
|
||||
-i --init <SSH_PRIVATE_KEY> initialize environment, write SSH private to file
|
||||
-d --deploy <PAGES-SECRET> <TARGET BRANCH> push branch to Gitea and call Pages server
|
||||
-h --help print this help menu
|
||||
EOF
|
||||
}
|
||||
|
||||
# $1: SSH private key
|
||||
write_ssh(){
|
||||
truncate --size 0 $SSH_ID_FILE
|
||||
echo "$1" > $SSH_ID_FILE
|
||||
chmod 600 $SSH_ID_FILE
|
||||
}
|
||||
|
||||
set_ssh_remote() {
|
||||
http_remote_url=$(git remote get-url origin)
|
||||
remote_hostname=$(echo $http_remote_url | cut -d '/' -f 3)
|
||||
repository_owner=$(echo $http_remote_url | cut -d '/' -f 4)
|
||||
repository_name=$(echo $http_remote_url | cut -d '/' -f 5)
|
||||
ssh_remote="git@$remote_hostname:$repository_owner/$repository_name"
|
||||
ssh_remote="git@git.batsense.net:mystiq/hydrogen-web.git"
|
||||
git remote add $SSH_REMOTE_NAME $ssh_remote
|
||||
}
|
||||
|
||||
clean() {
|
||||
if [ -f $SSH_ID_FILE ]
|
||||
then
|
||||
shred $SSH_ID_FILE
|
||||
rm $SSH_ID_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: branch name
|
||||
# $2: directory containing build assets
|
||||
# $3: Author in <author-name author@example.com> format
|
||||
commit_files() {
|
||||
cd $PROJECT_ROOT
|
||||
original_branch=$(git branch --show-current)
|
||||
tmp_dir=$(mktemp -d)
|
||||
cp -r $2/* $tmp_dir
|
||||
|
||||
if [[ -z $(git ls-remote --heads origin ${1}) ]]
|
||||
then
|
||||
echo "[*] Creating deployment branch $1"
|
||||
git checkout --orphan $1
|
||||
else
|
||||
echo "[*] Deployment branch $1 exists, pulling changes from remote"
|
||||
git fetch origin $1
|
||||
git switch $1
|
||||
fi
|
||||
|
||||
git rm -rf .
|
||||
/bin/rm -rf *
|
||||
cp -r $tmp_dir/* .
|
||||
git add --all
|
||||
if [ $(git status --porcelain | xargs | sed '/^$/d' | wc -l) -gt 0 ];
|
||||
then
|
||||
echo "[*] Repository has changed, committing changes"
|
||||
git commit \
|
||||
--author="$3" \
|
||||
--message="new deploy: $(date --iso-8601=seconds)"
|
||||
fi
|
||||
git checkout $original_branch
|
||||
}
|
||||
|
||||
# $1: Pages API secret
|
||||
# $2: Deployment target branch
|
||||
deploy() {
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
else
|
||||
git -c core.sshCommand="/usr/bin/ssh -oStrictHostKeyChecking=no -i $SSH_ID_FILE"\
|
||||
push --force $SSH_REMOTE_NAME $2
|
||||
curl -vv --location --request \
|
||||
POST "https://deploy.batsense.net/api/v1/update"\
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw "{ \"secret\": \"$1\", \"branch\": \"$2\" }"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( "$#" < 1 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
if match_arg $1 '-i' '--init'
|
||||
then
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
set_ssh_remote
|
||||
write_ssh "$2"
|
||||
elif match_arg $1 '-c' '--clean'
|
||||
then
|
||||
clean
|
||||
elif match_arg $1 '-cf' '--commit-files'
|
||||
then
|
||||
if (( "$#" < 4 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
commit_files $2 $3 $4
|
||||
elif match_arg $1 '-d' '--deploy'
|
||||
then
|
||||
if (( "$#" < 3 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
deploy $2 $3
|
||||
elif match_arg $1 '-h' '--help'
|
||||
then
|
||||
help
|
||||
else
|
||||
help
|
||||
fi
|
||||
|
||||
|
||||
|
3
scripts/cleanup.sh
Executable file
3
scripts/cleanup.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
# Remove icons created in .tmp
|
||||
rm -rf .tmp
|
|
@ -1,12 +0,0 @@
|
|||
import fsRoot from "fs";
|
||||
const fs = fsRoot.promises;
|
||||
|
||||
export async function removeDirIfExists(targetDir) {
|
||||
try {
|
||||
await fs.rmdir(targetDir, {recursive: true});
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
git checkout gh-pages
|
||||
cp -R target/* .
|
||||
git add $(find . -maxdepth 1 -type f)
|
||||
git add themes
|
||||
git commit -m "update hydrogen"
|
||||
git checkout master
|
51
scripts/logviewer/file.js
Normal file
51
scripts/logviewer/file.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
export function openFile(mimeType = null) {
|
||||
const input = document.createElement("input");
|
||||
input.setAttribute("type", "file");
|
||||
input.className = "hidden";
|
||||
if (mimeType) {
|
||||
input.setAttribute("accept", mimeType);
|
||||
}
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const checkFile = () => {
|
||||
input.removeEventListener("change", checkFile, true);
|
||||
const file = input.files[0];
|
||||
document.body.removeChild(input);
|
||||
if (file) {
|
||||
resolve(file);
|
||||
} else {
|
||||
reject(new Error("no file picked"));
|
||||
}
|
||||
}
|
||||
input.addEventListener("change", checkFile, true);
|
||||
});
|
||||
// IE11 needs the input to be attached to the document
|
||||
document.body.appendChild(input);
|
||||
input.click();
|
||||
return promise;
|
||||
}
|
||||
|
||||
export function readFileAsText(file) {
|
||||
const reader = new FileReader();
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
reader.addEventListener("load", evt => resolve(evt.target.result));
|
||||
reader.addEventListener("error", evt => reject(evt.target.error));
|
||||
});
|
||||
reader.readAsText(file);
|
||||
return promise;
|
||||
}
|
|
@ -92,9 +92,9 @@ export const SVG_NS = "http://www.w3.org/2000/svg";
|
|||
|
||||
export const TAG_NAMES = {
|
||||
[HTML_NS]: [
|
||||
"a", "ol", "ul", "li", "div", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||
"br", "a", "ol", "ul", "li", "div", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||
"p", "strong", "em", "span", "img", "section", "main", "article", "aside",
|
||||
"pre", "button", "time", "input", "textarea", "label"],
|
||||
"pre", "button", "time", "input", "textarea", "label", "form", "progress", "output"],
|
||||
[SVG_NS]: ["svg", "circle"]
|
||||
};
|
||||
|
209
scripts/logviewer/index.html
Normal file
209
scripts/logviewer/index.html
Normal file
|
@ -0,0 +1,209 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 1rem;
|
||||
margin: 0;
|
||||
display: grid;
|
||||
grid-template-areas: "nav nav" "items details";
|
||||
grid-template-columns: 1fr 400px;
|
||||
grid-template-rows: auto 1fr;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
grid-area: items;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
main section h2 {
|
||||
margin: 2px 14px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
aside {
|
||||
grid-area: details;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
aside h3 {
|
||||
word-wrap: anywhere;
|
||||
}
|
||||
|
||||
aside p {
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
aside .values li span {
|
||||
word-wrap: ;
|
||||
word-wrap: anywhere;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
aside .values {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
|
||||
aside .values span.key {
|
||||
width: 30%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
aside .values span.value {
|
||||
width: 70%;
|
||||
display: block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
aside .values li {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
aside .values li:not(:first-child) {
|
||||
border-top: 1px solid lightgray;
|
||||
}
|
||||
|
||||
nav {
|
||||
grid-area: nav;
|
||||
}
|
||||
|
||||
.timeline li:not(.expanded) > ol {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.timeline li > div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.timeline .toggleExpanded {
|
||||
border: none;
|
||||
background: none;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.timeline .toggleExpanded:before {
|
||||
content: "▶";
|
||||
}
|
||||
|
||||
.timeline li.expanded > div > .toggleExpanded:before {
|
||||
content: "▼";
|
||||
}
|
||||
|
||||
.timeline ol {
|
||||
list-style: none;
|
||||
padding: 0 0 0 20px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.timeline .item {
|
||||
--hue: 100deg;
|
||||
--brightness: 80%;
|
||||
background-color: hsl(var(--hue), 60%, var(--brightness));
|
||||
border: 1px solid hsl(var(--hue), 60%, calc(var(--brightness) - 40%));
|
||||
border-radius: 4px;
|
||||
padding: 2px;
|
||||
display: flex;
|
||||
margin: 1px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.timeline .item:not(.has-children) {
|
||||
margin-left: calc(24px + 4px + 1px);
|
||||
}
|
||||
|
||||
.timeline .item .caption {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.timeline .item.level-3 {
|
||||
--brightness: 90%;
|
||||
}
|
||||
|
||||
.timeline .item.level-2 {
|
||||
--brightness: 95%;
|
||||
}
|
||||
|
||||
.timeline .item.level-5 {
|
||||
--brightness: 80%;
|
||||
}
|
||||
|
||||
.timeline .item.level-6, .timeline .item.level-7 {
|
||||
--hue: 0deg !important;
|
||||
}
|
||||
|
||||
.timeline .item.level-7 {
|
||||
--brightness: 50%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.timeline .item.type-network {
|
||||
--hue: 30deg;
|
||||
}
|
||||
|
||||
.timeline .item.type-navigation {
|
||||
--hue: 200deg;
|
||||
}
|
||||
|
||||
.timeline .item.selected {
|
||||
background-color: Highlight;
|
||||
border-color: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
.timeline .item.highlighted {
|
||||
background-color: fuchsia;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#highlight {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
nav form {
|
||||
display: inline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<button id="openFile">Open log file</button>
|
||||
<button id="collapseAll">Collapse all</button>
|
||||
<button id="hideCollapsed">Hide collapsed root items</button>
|
||||
<button id="hideHighlightedSiblings" title="Hide collapsed siblings of highlighted">Hide non-highlighted</button>
|
||||
<button id="showAll">Show all</button>
|
||||
<form id="highlightForm">
|
||||
<input type="text" id="highlight" name="highlight" placeholder="Highlight a search term" autocomplete="on">
|
||||
<output id="highlightMatches"></output>
|
||||
</form>
|
||||
</nav>
|
||||
<main></main>
|
||||
<aside></aside>
|
||||
<script type="module" src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
398
scripts/logviewer/main.js
Normal file
398
scripts/logviewer/main.js
Normal file
|
@ -0,0 +1,398 @@
|
|||
/*
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {tag as t} from "./html.js";
|
||||
import {openFile, readFileAsText} from "./file.js";
|
||||
|
||||
const main = document.querySelector("main");
|
||||
|
||||
let selectedItemNode;
|
||||
let rootItem;
|
||||
let itemByRef;
|
||||
|
||||
const logLevels = [undefined, "All", "Debug", "Detail", "Info", "Warn", "Error", "Fatal", "Off"];
|
||||
|
||||
main.addEventListener("click", event => {
|
||||
if (event.target.classList.contains("toggleExpanded")) {
|
||||
const li = event.target.parentElement.parentElement;
|
||||
li.classList.toggle("expanded");
|
||||
} else {
|
||||
// allow clicking any links other than .item in the timeline, like refs
|
||||
if (event.target.tagName === "A" && !event.target.classList.contains("item")) {
|
||||
return;
|
||||
}
|
||||
const itemNode = event.target.closest(".item");
|
||||
if (itemNode) {
|
||||
// we don't want scroll to jump when clicking
|
||||
// so prevent default behaviour, and select and push to history manually
|
||||
event.preventDefault();
|
||||
selectNode(itemNode);
|
||||
history.pushState(null, null, `#${itemNode.id}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("hashchange", () => {
|
||||
const id = window.location.hash.substr(1);
|
||||
const itemNode = document.getElementById(id);
|
||||
if (itemNode && itemNode.closest("main")) {
|
||||
selectNode(itemNode);
|
||||
itemNode.scrollIntoView({behavior: "smooth", block: "nearest"});
|
||||
}
|
||||
});
|
||||
|
||||
function selectNode(itemNode) {
|
||||
if (selectedItemNode) {
|
||||
selectedItemNode.classList.remove("selected");
|
||||
}
|
||||
selectedItemNode = itemNode;
|
||||
selectedItemNode.classList.add("selected");
|
||||
let item = rootItem;
|
||||
let parent;
|
||||
const indices = selectedItemNode.id.split("/").map(i => parseInt(i, 10));
|
||||
for(const i of indices) {
|
||||
parent = item;
|
||||
item = itemChildren(item)[i];
|
||||
}
|
||||
showItemDetails(item, parent, selectedItemNode);
|
||||
}
|
||||
|
||||
function stringifyItemValue(value) {
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return JSON.stringify(value, undefined, 2);
|
||||
} else {
|
||||
return value + "";
|
||||
}
|
||||
}
|
||||
|
||||
function showItemDetails(item, parent, itemNode) {
|
||||
const parentOffset = itemStart(parent) ? `${itemStart(item) - itemStart(parent)}ms` : "none";
|
||||
const expandButton = t.button("Expand recursively");
|
||||
expandButton.addEventListener("click", () => expandResursively(itemNode.parentElement.parentElement));
|
||||
const start = itemStart(item);
|
||||
const aside = t.aside([
|
||||
t.h3(itemCaption(item)),
|
||||
t.p([t.strong("Log level: "), logLevels[itemLevel(item)]]),
|
||||
t.p([t.strong("Error: "), itemError(item) ? `${itemError(item).name} ${itemError(item).stack}` : "none"]),
|
||||
t.p([t.strong("Parent offset: "), parentOffset]),
|
||||
t.p([t.strong("Start: "), new Date(start).toString(), ` (${start})`]),
|
||||
t.p([t.strong("Duration: "), `${itemDuration(item)}ms`]),
|
||||
t.p([t.strong("Child count: "), itemChildren(item) ? `${itemChildren(item).length}` : "none"]),
|
||||
t.p([t.strong("Forced finish: "), (itemForcedFinish(item) || false) + ""]),
|
||||
t.p(t.strong("Values:")),
|
||||
t.ul({class: "values"}, Object.entries(itemValues(item)).map(([key, value]) => {
|
||||
let valueNode;
|
||||
if (key === "ref") {
|
||||
const refItem = itemByRef.get(value);
|
||||
if (refItem) {
|
||||
valueNode = t.a({href: `#${refItem.id}`}, itemCaption(refItem));
|
||||
} else {
|
||||
valueNode = `unknown ref ${value}`;
|
||||
}
|
||||
} else {
|
||||
valueNode = stringifyItemValue(value);
|
||||
}
|
||||
return t.li([
|
||||
t.span({className: "key"}, normalizeValueKey(key)),
|
||||
t.span({className: "value"}, valueNode)
|
||||
]);
|
||||
})),
|
||||
t.p(expandButton)
|
||||
]);
|
||||
document.querySelector("aside").replaceWith(aside);
|
||||
}
|
||||
|
||||
function expandResursively(li) {
|
||||
li.classList.add("expanded");
|
||||
const ol = li.querySelector("ol");
|
||||
if (ol) {
|
||||
const len = ol.children.length;
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
expandResursively(ol.children[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("openFile").addEventListener("click", loadFile);
|
||||
|
||||
function getRootItemHeader(prevItem, item) {
|
||||
if (prevItem) {
|
||||
const diff = itemStart(item) - itemEnd(prevItem);
|
||||
if (diff >= 0) {
|
||||
return `+ ${formatTime(diff)}`;
|
||||
} else {
|
||||
const overlap = -diff;
|
||||
if (overlap >= itemDuration(item)) {
|
||||
return `ran entirely in parallel with`;
|
||||
} else {
|
||||
return `ran ${formatTime(-diff)} in parallel with`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return new Date(itemStart(item)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadFile() {
|
||||
const file = await openFile();
|
||||
const json = await readFileAsText(file);
|
||||
const logs = JSON.parse(json);
|
||||
logs.items.sort((a, b) => itemStart(a) - itemStart(b));
|
||||
rootItem = {c: logs.items};
|
||||
itemByRef = new Map();
|
||||
preprocessRecursively(rootItem, null, itemByRef, []);
|
||||
|
||||
const fragment = logs.items.reduce((fragment, item, i, items) => {
|
||||
const prevItem = i === 0 ? null : items[i - 1];
|
||||
fragment.appendChild(t.section([
|
||||
t.h2(getRootItemHeader(prevItem, item)),
|
||||
t.div({className: "timeline"}, t.ol(itemToNode(item, [i])))
|
||||
]));
|
||||
return fragment;
|
||||
}, document.createDocumentFragment());
|
||||
main.replaceChildren(fragment);
|
||||
}
|
||||
|
||||
// TODO: make this use processRecursively
|
||||
function preprocessRecursively(item, parentElement, refsMap, path) {
|
||||
item.s = (parentElement?.s || 0) + item.s;
|
||||
if (itemRefSource(item)) {
|
||||
refsMap.set(itemRefSource(item), item);
|
||||
}
|
||||
if (itemChildren(item)) {
|
||||
for (let i = 0; i < itemChildren(item).length; i += 1) {
|
||||
// do it in advance for a child as we don't want to do it for the rootItem
|
||||
const child = itemChildren(item)[i];
|
||||
const childPath = path.concat(i);
|
||||
child.id = childPath.join("/");
|
||||
preprocessRecursively(child, item, refsMap, childPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const MS_IN_SEC = 1000;
|
||||
const MS_IN_MIN = MS_IN_SEC * 60;
|
||||
const MS_IN_HOUR = MS_IN_MIN * 60;
|
||||
const MS_IN_DAY = MS_IN_HOUR * 24;
|
||||
function formatTime(ms) {
|
||||
let str = "";
|
||||
if (ms > MS_IN_DAY) {
|
||||
const days = Math.floor(ms / MS_IN_DAY);
|
||||
ms -= days * MS_IN_DAY;
|
||||
str += `${days}d`;
|
||||
}
|
||||
if (ms > MS_IN_HOUR) {
|
||||
const hours = Math.floor(ms / MS_IN_HOUR);
|
||||
ms -= hours * MS_IN_HOUR;
|
||||
str += `${hours}h`;
|
||||
}
|
||||
if (ms > MS_IN_MIN) {
|
||||
const mins = Math.floor(ms / MS_IN_MIN);
|
||||
ms -= mins * MS_IN_MIN;
|
||||
str += `${mins}m`;
|
||||
}
|
||||
if (ms > MS_IN_SEC) {
|
||||
const secs = ms / MS_IN_SEC;
|
||||
str += `${secs.toFixed(2)}s`;
|
||||
} else if (ms > 0 || !str.length) {
|
||||
str += `${ms}ms`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function itemChildren(item) { return item.c; }
|
||||
function itemStart(item) { return item.s; }
|
||||
function itemEnd(item) { return item.s + item.d; }
|
||||
function itemDuration(item) { return item.d; }
|
||||
function itemValues(item) { return item.v; }
|
||||
function itemLevel(item) { return item.l; }
|
||||
function itemLabel(item) { return item.v?.l; }
|
||||
function itemType(item) { return item.v?.t; }
|
||||
function itemError(item) { return item.e; }
|
||||
function itemForcedFinish(item) { return item.f; }
|
||||
function itemRef(item) { return item.v?.ref; }
|
||||
function itemRefSource(item) { return item.v?.refId; }
|
||||
function itemShortErrorMessage(item) {
|
||||
if (itemError(item)) {
|
||||
const e = itemError(item);
|
||||
return e.name || e.stack.substr(0, e.stack.indexOf("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
function itemCaption(item) {
|
||||
if (itemType(item) === "network") {
|
||||
return `${itemValues(item)?.method} ${itemValues(item)?.url}`;
|
||||
} else if (itemLabel(item) && itemValues(item)?.id) {
|
||||
return `${itemLabel(item)} ${itemValues(item).id}`;
|
||||
} else if (itemLabel(item) && itemValues(item)?.status) {
|
||||
return `${itemLabel(item)} (${itemValues(item).status})`;
|
||||
} else if (itemLabel(item) && itemError(item)) {
|
||||
return `${itemLabel(item)} (${itemShortErrorMessage(item)})`;
|
||||
} else if (itemRef(item)) {
|
||||
const refItem = itemByRef.get(itemRef(item));
|
||||
if (refItem) {
|
||||
return `ref "${itemCaption(refItem)}"`
|
||||
} else {
|
||||
return `unknown ref ${itemRef(item)}`
|
||||
}
|
||||
} else {
|
||||
return itemLabel(item) || itemType(item);
|
||||
}
|
||||
}
|
||||
function normalizeValueKey(key) {
|
||||
switch (key) {
|
||||
case "t": return "type";
|
||||
case "l": return "label";
|
||||
default: return key;
|
||||
}
|
||||
}
|
||||
|
||||
// returns the node and the total range (recursively) occupied by the node
|
||||
function itemToNode(item) {
|
||||
const hasChildren = !!itemChildren(item)?.length;
|
||||
const className = {
|
||||
item: true,
|
||||
"has-children": hasChildren,
|
||||
error: itemError(item),
|
||||
[`type-${itemType(item)}`]: !!itemType(item),
|
||||
[`level-${itemLevel(item)}`]: true,
|
||||
};
|
||||
|
||||
const id = item.id;
|
||||
let captionNode;
|
||||
if (itemRef(item)) {
|
||||
const refItem = itemByRef.get(itemRef(item));
|
||||
if (refItem) {
|
||||
captionNode = ["ref ", t.a({href: `#${refItem.id}`}, itemCaption(refItem))];
|
||||
}
|
||||
}
|
||||
if (!captionNode) {
|
||||
captionNode = itemCaption(item);
|
||||
}
|
||||
const li = t.li([
|
||||
t.div([
|
||||
hasChildren ? t.button({className: "toggleExpanded"}) : "",
|
||||
t.a({className, id, href: `#${id}`}, [
|
||||
t.span({class: "caption"}, captionNode),
|
||||
t.span({class: "duration"}, `(${formatTime(itemDuration(item))})`),
|
||||
])
|
||||
])
|
||||
]);
|
||||
if (itemChildren(item) && itemChildren(item).length) {
|
||||
li.appendChild(t.ol(itemChildren(item).map(item => {
|
||||
return itemToNode(item);
|
||||
})));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
const highlightForm = document.getElementById("highlightForm");
|
||||
|
||||
highlightForm.addEventListener("submit", evt => {
|
||||
evt.preventDefault();
|
||||
const matchesOutput = document.getElementById("highlightMatches");
|
||||
const query = document.getElementById("highlight").value;
|
||||
if (query) {
|
||||
matchesOutput.innerText = "Searching…";
|
||||
let matches = 0;
|
||||
processRecursively(rootItem, item => {
|
||||
let domNode = document.getElementById(item.id);
|
||||
if (itemMatchesFilter(item, query)) {
|
||||
matches += 1;
|
||||
domNode.classList.add("highlighted");
|
||||
domNode = domNode.parentElement;
|
||||
while (domNode.nodeName !== "SECTION") {
|
||||
if (domNode.nodeName === "LI") {
|
||||
domNode.classList.add("expanded");
|
||||
}
|
||||
domNode = domNode.parentElement;
|
||||
}
|
||||
} else {
|
||||
domNode.classList.remove("highlighted");
|
||||
}
|
||||
});
|
||||
matchesOutput.innerText = `${matches} matches`;
|
||||
} else {
|
||||
for (const node of document.querySelectorAll(".highlighted")) {
|
||||
node.classList.remove("highlighted");
|
||||
}
|
||||
matchesOutput.innerText = "";
|
||||
}
|
||||
});
|
||||
|
||||
function itemMatchesFilter(item, query) {
|
||||
if (itemError(item)) {
|
||||
if (valueMatchesQuery(itemError(item), query)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return valueMatchesQuery(itemValues(item), query);
|
||||
}
|
||||
|
||||
function valueMatchesQuery(value, query) {
|
||||
if (typeof value === "string") {
|
||||
return value.includes(query);
|
||||
} else if (typeof value === "object" && value !== null) {
|
||||
for (const key in value) {
|
||||
if (value.hasOwnProperty(key) && valueMatchesQuery(value[key], query)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (typeof value === "number") {
|
||||
return value.toString().includes(query);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function processRecursively(item, callback, parentItem) {
|
||||
if (item.id) {
|
||||
callback(item, parentItem);
|
||||
}
|
||||
if (itemChildren(item)) {
|
||||
for (let i = 0; i < itemChildren(item).length; i += 1) {
|
||||
// do it in advance for a child as we don't want to do it for the rootItem
|
||||
const child = itemChildren(item)[i];
|
||||
processRecursively(child, callback, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("collapseAll").addEventListener("click", () => {
|
||||
for (const node of document.querySelectorAll(".expanded")) {
|
||||
node.classList.remove("expanded");
|
||||
}
|
||||
});
|
||||
document.getElementById("hideCollapsed").addEventListener("click", () => {
|
||||
for (const node of document.querySelectorAll("section > div.timeline > ol > li:not(.expanded)")) {
|
||||
node.closest("section").classList.add("hidden");
|
||||
}
|
||||
});
|
||||
document.getElementById("hideHighlightedSiblings").addEventListener("click", () => {
|
||||
for (const node of document.querySelectorAll(".highlighted")) {
|
||||
const list = node.closest("ol");
|
||||
const siblings = Array.from(list.querySelectorAll("li > div > a:not(.highlighted)")).map(n => n.closest("li"));
|
||||
for (const sibling of siblings) {
|
||||
if (!sibling.classList.contains("expanded")) {
|
||||
sibling.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
document.getElementById("showAll").addEventListener("click", () => {
|
||||
for (const node of document.querySelectorAll(".hidden")) {
|
||||
node.classList.remove("hidden");
|
||||
}
|
||||
});
|
7
scripts/package-overrides/buffer/index.js
Normal file
7
scripts/package-overrides/buffer/index.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
var Buffer = {
|
||||
isBuffer: function(array) {return array instanceof Uint8Array;},
|
||||
from: function(arrayBuffer) {return arrayBuffer;},
|
||||
allocUnsafe: function(size) {return Buffer.alloc(size);},
|
||||
alloc: function(size) {return new Uint8Array(size);}
|
||||
};
|
||||
export default Buffer;
|
2
scripts/package-overrides/safe-buffer/index.js
Normal file
2
scripts/package-overrides/safe-buffer/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
import Buffer from "buffer";
|
||||
export {Buffer};
|
|
@ -2,6 +2,9 @@ VERSION=$(jq -r ".version" package.json)
|
|||
PACKAGE=hydrogen-web-$VERSION.tar.gz
|
||||
yarn build
|
||||
pushd target
|
||||
# move config file so we don't override it
|
||||
# when deploying a new version
|
||||
mv config.json config.sample.json
|
||||
tar -czvf ../$PACKAGE ./
|
||||
popd
|
||||
echo $PACKAGE
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import fsRoot from "fs";
|
||||
const fs = fsRoot.promises;
|
||||
import path from "path";
|
||||
import { rollup } from 'rollup';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
// needed to translate commonjs modules to esm
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
// multi-entry plugin so we can add polyfill file to main
|
||||
import {removeDirIfExists} from "./common.mjs";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const projectDir = path.join(__dirname, "../");
|
||||
|
||||
async function commonjsToESM(src, dst) {
|
||||
// create js bundle
|
||||
const bundle = await rollup({
|
||||
input: src,
|
||||
plugins: [commonjs()]
|
||||
});
|
||||
const {output} = await bundle.generate({
|
||||
format: 'es'
|
||||
});
|
||||
const code = output[0].code;
|
||||
await fs.writeFile(dst, code, "utf8");
|
||||
}
|
||||
|
||||
async function populateLib() {
|
||||
const libDir = path.join(projectDir, "lib/");
|
||||
const modulesDir = path.join(projectDir, "node_modules/");
|
||||
await removeDirIfExists(libDir);
|
||||
await fs.mkdir(libDir);
|
||||
const olmSrcDir = path.join(modulesDir, "olm/");
|
||||
const olmDstDir = path.join(libDir, "olm/");
|
||||
await fs.mkdir(olmDstDir);
|
||||
for (const file of ["olm.js", "olm.wasm", "olm_legacy.js"]) {
|
||||
await fs.symlink(path.join(olmSrcDir, file), path.join(olmDstDir, file));
|
||||
}
|
||||
// transpile another-json to esm
|
||||
await fs.mkdir(path.join(libDir, "another-json/"));
|
||||
await commonjsToESM(
|
||||
path.join(modulesDir, 'another-json/another-json.js'),
|
||||
path.join(libDir, "another-json/index.js")
|
||||
);
|
||||
}
|
||||
|
||||
populateLib();
|
180
scripts/postcss/css-compile-variables.js
Normal file
180
scripts/postcss/css-compile-variables.js
Normal file
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const valueParser = require("postcss-value-parser");
|
||||
|
||||
/**
|
||||
* This plugin derives new css variables from a given set of base variables.
|
||||
* A derived css variable has the form --base--operation-argument; meaning that the derived
|
||||
* variable has a value that is generated from the base variable "base" by applying "operation"
|
||||
* with given "argument".
|
||||
*
|
||||
* eg: given the base variable --foo-color: #40E0D0, --foo-color--darker-20 is a css variable
|
||||
* derived from foo-color by making it 20% more darker.
|
||||
*
|
||||
* All derived variables are added to the :root section.
|
||||
*
|
||||
* The actual derivation is done outside the plugin in a callback.
|
||||
*/
|
||||
|
||||
function getValueFromAlias(alias, {aliasMap, baseVariables, resolvedMap}) {
|
||||
const derivedVariable = aliasMap.get(alias);
|
||||
return baseVariables.get(derivedVariable) ?? resolvedMap.get(derivedVariable);
|
||||
}
|
||||
|
||||
function parseDeclarationValue(value) {
|
||||
const parsed = valueParser(value);
|
||||
const variables = [];
|
||||
parsed.walk(node => {
|
||||
if (node.type !== "function") {
|
||||
return;
|
||||
}
|
||||
switch (node.value) {
|
||||
case "var": {
|
||||
const variable = node.nodes[0];
|
||||
variables.push(variable.value);
|
||||
break;
|
||||
}
|
||||
case "url": {
|
||||
const url = node.nodes[0].value;
|
||||
// resolve url with some absolute url so that we get the query params without using regex
|
||||
const params = new URL(url, "file://foo/bar/").searchParams;
|
||||
const primary = params.get("primary");
|
||||
const secondary = params.get("secondary");
|
||||
if (primary) { variables.push(primary); }
|
||||
if (secondary) { variables.push(secondary); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return variables;
|
||||
}
|
||||
|
||||
function resolveDerivedVariable(decl, derive, maps, isDark) {
|
||||
const { baseVariables, resolvedMap } = maps;
|
||||
const RE_VARIABLE_VALUE = /(?:--)?((.+)--(.+)-(.+))/;
|
||||
const variableCollection = parseDeclarationValue(decl.value);
|
||||
for (const variable of variableCollection) {
|
||||
const matches = variable.match(RE_VARIABLE_VALUE);
|
||||
if (matches) {
|
||||
const [, wholeVariable, baseVariable, operation, argument] = matches;
|
||||
const value = baseVariables.get(baseVariable) ?? getValueFromAlias(baseVariable, maps);
|
||||
if (!value) {
|
||||
throw new Error(`Cannot derive from ${baseVariable} because it is neither defined in config nor is it an alias!`);
|
||||
}
|
||||
const derivedValue = derive(value, operation, argument, isDark);
|
||||
resolvedMap.set(wholeVariable, derivedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function extract(decl, {aliasMap, baseVariables}) {
|
||||
if (decl.variable) {
|
||||
// see if right side is of form "var(--foo)"
|
||||
const wholeVariable = decl.value.match(/var\(--(.+)\)/)?.[1];
|
||||
// remove -- from the prop
|
||||
const prop = decl.prop.substring(2);
|
||||
if (wholeVariable) {
|
||||
aliasMap.set(prop, wholeVariable);
|
||||
// Since this is an alias, we shouldn't store it in baseVariables
|
||||
return;
|
||||
}
|
||||
baseVariables.set(prop, decl.value);
|
||||
}
|
||||
}
|
||||
|
||||
function addResolvedVariablesToRootSelector(root, {Rule, Declaration}, {resolvedMap}) {
|
||||
const newRule = new Rule({ selector: ":root", source: root.source });
|
||||
// Add derived css variables to :root
|
||||
resolvedMap.forEach((value, key) => {
|
||||
const declaration = new Declaration({prop: `--${key}`, value});
|
||||
newRule.append(declaration);
|
||||
});
|
||||
root.append(newRule);
|
||||
}
|
||||
|
||||
function populateMapWithDerivedVariables(map, cssFileLocation, {resolvedMap, aliasMap}) {
|
||||
const location = cssFileLocation.match(/(.+)\/.+\.css/)?.[1];
|
||||
const derivedVariables = [
|
||||
...([...resolvedMap.keys()].filter(v => !aliasMap.has(v))),
|
||||
...([...aliasMap.entries()].map(([alias, variable]) => `${alias}=${variable}`))
|
||||
];
|
||||
const sharedObject = map.get(location);
|
||||
const output = { "derived-variables": derivedVariables };
|
||||
if (sharedObject) {
|
||||
Object.assign(sharedObject, output);
|
||||
}
|
||||
else {
|
||||
map.set(location, output);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @callback derive
|
||||
* @param {string} value - The base value on which an operation is applied
|
||||
* @param {string} operation - The operation to be applied (eg: darker, lighter...)
|
||||
* @param {string} argument - The argument for this operation
|
||||
* @param {boolean} isDark - Indicates whether this theme is dark
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param {Object} opts - Options for the plugin
|
||||
* @param {derive} opts.derive - The callback which contains the logic for resolving derived variables
|
||||
* @param {Map} opts.compiledVariables - A map that stores derived variables so that manifest source sections can be produced
|
||||
*/
|
||||
module.exports = (opts = {}) => {
|
||||
const aliasMap = new Map();
|
||||
const resolvedMap = new Map();
|
||||
const baseVariables = new Map();
|
||||
const maps = { aliasMap, resolvedMap, baseVariables };
|
||||
|
||||
return {
|
||||
postcssPlugin: "postcss-compile-variables",
|
||||
|
||||
Once(root, {Rule, Declaration, result}) {
|
||||
const cssFileLocation = root.source.input.from;
|
||||
if (cssFileLocation.includes("type=runtime")) {
|
||||
// If this is a runtime theme, don't derive variables.
|
||||
return;
|
||||
}
|
||||
const isDark = cssFileLocation.includes("dark=true");
|
||||
/*
|
||||
Go through the CSS file once to extract all aliases and base variables.
|
||||
We use these when resolving derived variables later.
|
||||
*/
|
||||
root.walkDecls(decl => extract(decl, maps));
|
||||
root.walkDecls(decl => resolveDerivedVariable(decl, opts.derive, maps, isDark));
|
||||
addResolvedVariablesToRootSelector(root, {Rule, Declaration}, maps);
|
||||
if (opts.compiledVariables){
|
||||
populateMapWithDerivedVariables(opts.compiledVariables, cssFileLocation, maps);
|
||||
}
|
||||
// Also produce a mapping from alias to completely resolved color
|
||||
const resolvedAliasMap = new Map();
|
||||
aliasMap.forEach((value, key) => {
|
||||
resolvedAliasMap.set(key, resolvedMap.get(value));
|
||||
});
|
||||
// Publish the base-variables, derived-variables and resolved aliases to the other postcss-plugins
|
||||
const combinedMap = new Map([...baseVariables, ...resolvedMap, ...resolvedAliasMap]);
|
||||
result.messages.push({
|
||||
type: "resolved-variable-map",
|
||||
plugin: "postcss-compile-variables",
|
||||
colorMap: combinedMap,
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.postcss = true;
|
92
scripts/postcss/css-url-processor.js
Normal file
92
scripts/postcss/css-url-processor.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const valueParser = require("postcss-value-parser");
|
||||
const resolve = require("path").resolve;
|
||||
|
||||
function colorsFromURL(url, colorMap) {
|
||||
const params = new URL(`file://${url}`).searchParams;
|
||||
const primary = params.get("primary");
|
||||
if (!primary) {
|
||||
return null;
|
||||
}
|
||||
const secondary = params.get("secondary");
|
||||
const primaryColor = colorMap.get(primary);
|
||||
const secondaryColor = colorMap.get(secondary);
|
||||
if (!primaryColor) {
|
||||
throw new Error(`Variable ${primary} not found in resolved color variables!`);
|
||||
}
|
||||
if (secondary && !secondaryColor) {
|
||||
throw new Error(`Variable ${secondary} not found in resolved color variables!`);
|
||||
}
|
||||
return [primaryColor, secondaryColor];
|
||||
}
|
||||
|
||||
function processURL(decl, replacer, colorMap, cssPath) {
|
||||
const value = decl.value;
|
||||
const parsed = valueParser(value);
|
||||
parsed.walk(node => {
|
||||
if (node.type !== "function" || node.value !== "url") {
|
||||
return;
|
||||
}
|
||||
const urlStringNode = node.nodes[0];
|
||||
const oldURL = urlStringNode.value;
|
||||
const oldURLAbsolute = resolve(cssPath, oldURL);
|
||||
const colors = colorsFromURL(oldURLAbsolute, colorMap);
|
||||
if (!colors) {
|
||||
// If no primary color is provided via url params, then this url need not be handled.
|
||||
return;
|
||||
}
|
||||
const newURL = replacer(oldURLAbsolute.replace(/\?.+/, ""), ...colors);
|
||||
if (!newURL) {
|
||||
throw new Error("Replacer failed to produce a replacement URL!");
|
||||
}
|
||||
urlStringNode.value = newURL;
|
||||
});
|
||||
decl.assign({prop: decl.prop, value: parsed.toString()})
|
||||
}
|
||||
|
||||
/* *
|
||||
* @type {import('postcss').PluginCreator}
|
||||
*/
|
||||
module.exports = (opts = {}) => {
|
||||
return {
|
||||
postcssPlugin: "postcss-url-to-variable",
|
||||
|
||||
Once(root, {result}) {
|
||||
const cssFileLocation = root.source.input.from;
|
||||
if (cssFileLocation.includes("type=runtime")) {
|
||||
// If this is a runtime theme, don't process urls.
|
||||
return;
|
||||
}
|
||||
/*
|
||||
postcss-compile-variables should have sent the list of resolved colours down via results
|
||||
*/
|
||||
const {colorMap} = result.messages.find(m => m.type === "resolved-variable-map");
|
||||
if (!colorMap) {
|
||||
throw new Error("Postcss results do not contain resolved colors!");
|
||||
}
|
||||
/*
|
||||
Go through each declaration and if it contains an URL, replace the url with the result
|
||||
of running replacer(url)
|
||||
*/
|
||||
const cssPath = root.source?.input.file.replace(/[^/]*$/, "");
|
||||
root.walkDecls(decl => processURL(decl, opts.replacer, colorMap, cssPath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.postcss = true;
|
97
scripts/postcss/css-url-to-variables.js
Normal file
97
scripts/postcss/css-url-to-variables.js
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const valueParser = require("postcss-value-parser");
|
||||
|
||||
/**
|
||||
* This plugin extracts content inside url() into css variables and adds the variables to the root section.
|
||||
* This plugin is used in conjunction with css-url-processor plugin to colorize svg icons.
|
||||
*/
|
||||
const idToPrepend = "icon-url";
|
||||
|
||||
function findAndReplaceUrl(decl, urlVariables, counter) {
|
||||
const value = decl.value;
|
||||
const parsed = valueParser(value);
|
||||
parsed.walk(node => {
|
||||
if (node.type !== "function" || node.value !== "url") {
|
||||
return;
|
||||
}
|
||||
const url = node.nodes[0].value;
|
||||
if (!url.match(/\.svg\?primary=.+/)) {
|
||||
return;
|
||||
}
|
||||
const count = counter.next().value;
|
||||
const variableName = `${idToPrepend}-${count}`;
|
||||
urlVariables.set(variableName, url);
|
||||
node.value = "var";
|
||||
node.nodes = [{ type: "word", value: `--${variableName}` }];
|
||||
});
|
||||
decl.assign({prop: decl.prop, value: parsed.toString()})
|
||||
}
|
||||
|
||||
function addResolvedVariablesToRootSelector(root, { Rule, Declaration }, urlVariables) {
|
||||
const newRule = new Rule({ selector: ":root", source: root.source });
|
||||
// Add derived css variables to :root
|
||||
urlVariables.forEach((value, key) => {
|
||||
const declaration = new Declaration({ prop: `--${key}`, value: `url("${value}")`});
|
||||
newRule.append(declaration);
|
||||
});
|
||||
root.append(newRule);
|
||||
}
|
||||
|
||||
function populateMapWithIcons(map, cssFileLocation, urlVariables) {
|
||||
const location = cssFileLocation.match(/(.+)\/.+\.css/)?.[1];
|
||||
const sharedObject = map.get(location);
|
||||
const output = {"icon": Object.fromEntries(urlVariables)};
|
||||
if (sharedObject) {
|
||||
Object.assign(sharedObject, output);
|
||||
}
|
||||
else {
|
||||
map.set(location, output);
|
||||
}
|
||||
}
|
||||
|
||||
function *createCounter() {
|
||||
for (let i = 0; ; ++i) {
|
||||
yield i;
|
||||
}
|
||||
}
|
||||
|
||||
/* *
|
||||
* @type {import('postcss').PluginCreator}
|
||||
*/
|
||||
module.exports = (opts = {}) => {
|
||||
return {
|
||||
postcssPlugin: "postcss-url-to-variable",
|
||||
|
||||
Once(root, { Rule, Declaration }) {
|
||||
const urlVariables = new Map();
|
||||
const counter = createCounter();
|
||||
root.walkDecls(decl => findAndReplaceUrl(decl, urlVariables, counter));
|
||||
const cssFileLocation = root.source.input.from;
|
||||
if (urlVariables.size && !cssFileLocation.includes("type=runtime")) {
|
||||
addResolvedVariablesToRootSelector(root, { Rule, Declaration }, urlVariables);
|
||||
}
|
||||
if (opts.compiledVariables){
|
||||
const cssFileLocation = root.source.input.from;
|
||||
populateMapWithIcons(opts.compiledVariables, cssFileLocation, urlVariables);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.postcss = true;
|
||||
|
51
scripts/postcss/svg-builder.mjs
Normal file
51
scripts/postcss/svg-builder.mjs
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {readFileSync, mkdirSync, writeFileSync} from "fs";
|
||||
import {resolve} from "path";
|
||||
import {h32} from "xxhashjs";
|
||||
import {getColoredSvgString} from "../../src/platform/web/theming/shared/svg-colorizer.mjs";
|
||||
|
||||
function createHash(content) {
|
||||
const hasher = new h32(0);
|
||||
hasher.update(content);
|
||||
return hasher.digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a new svg with the colors replaced and returns its location.
|
||||
* @param {string} svgLocation The location of the input svg file
|
||||
* @param {string} primaryColor Primary color for the new svg
|
||||
* @param {string} secondaryColor Secondary color for the new svg
|
||||
*/
|
||||
export function buildColorizedSVG(svgLocation, primaryColor, secondaryColor) {
|
||||
const svgCode = readFileSync(svgLocation, { encoding: "utf8"});
|
||||
const coloredSVGCode = getColoredSvgString(svgCode, primaryColor, secondaryColor);
|
||||
const fileName = svgLocation.match(/.+[/\\](.+\.svg)/)[1];
|
||||
const outputName = `${fileName.substring(0, fileName.length - 4)}-${createHash(coloredSVGCode)}.svg`;
|
||||
const outputPath = resolve(__dirname, "./.tmp");
|
||||
try {
|
||||
mkdirSync(outputPath);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== "EEXIST") {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
const outputFile = `${outputPath}/${outputName}`;
|
||||
writeFileSync(outputFile, coloredSVGCode);
|
||||
return outputFile;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -14,22 +14,17 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
export class RoomStateStore {
|
||||
constructor(idbStore) {
|
||||
this._roomStateStore = idbStore;
|
||||
}
|
||||
const postcss = require("postcss");
|
||||
|
||||
async getAllForType(type) {
|
||||
|
||||
}
|
||||
|
||||
async get(type, stateKey) {
|
||||
|
||||
}
|
||||
|
||||
async set(roomId, event) {
|
||||
const key = `${roomId}|${event.type}|${event.state_key}`;
|
||||
const entry = {roomId, event, key};
|
||||
return this._roomStateStore.put(entry);
|
||||
}
|
||||
module.exports.createTestRunner = function (plugin) {
|
||||
return async function run(input, output, opts = {}, assert) {
|
||||
let result = await postcss([plugin(opts)]).process(input, { from: undefined, });
|
||||
assert.strictEqual(
|
||||
result.css.replaceAll(/\s/g, ""),
|
||||
output.replaceAll(/\s/g, "")
|
||||
);
|
||||
assert.strictEqual(result.warnings().length, 0);
|
||||
};
|
||||
}
|
||||
|
||||
|
156
scripts/postcss/tests/css-compile-variables.test.js
Normal file
156
scripts/postcss/tests/css-compile-variables.test.js
Normal file
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const offColor = require("off-color").offColor;
|
||||
const postcss = require("postcss");
|
||||
const plugin = require("../css-compile-variables");
|
||||
const derive = require("../color").derive;
|
||||
const run = require("./common").createTestRunner(plugin);
|
||||
|
||||
module.exports.tests = function tests() {
|
||||
return {
|
||||
"derived variables are resolved": async (assert) => {
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--foo-color: #ff0;
|
||||
}
|
||||
div {
|
||||
background-color: var(--foo-color--lighter-50);
|
||||
}`;
|
||||
const transformedColor = offColor("#ff0").lighten(0.5);
|
||||
const outputCSS =
|
||||
inputCSS +
|
||||
`
|
||||
:root {
|
||||
--foo-color--lighter-50: ${transformedColor.hex()};
|
||||
}
|
||||
`;
|
||||
await run( inputCSS, outputCSS, {derive}, assert);
|
||||
},
|
||||
|
||||
"derived variables work with alias": async (assert) => {
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--icon-color: #fff;
|
||||
}
|
||||
div {
|
||||
background: var(--icon-color--darker-20);
|
||||
--my-alias: var(--icon-color--darker-20);
|
||||
color: var(--my-alias--lighter-15);
|
||||
}`;
|
||||
const colorDarker = offColor("#fff").darken(0.2).hex();
|
||||
const aliasLighter = offColor(colorDarker).lighten(0.15).hex();
|
||||
const outputCSS = inputCSS + `:root {
|
||||
--icon-color--darker-20: ${colorDarker};
|
||||
--my-alias--lighter-15: ${aliasLighter};
|
||||
}
|
||||
`;
|
||||
await run(inputCSS, outputCSS, {derive}, assert);
|
||||
},
|
||||
|
||||
"derived variable throws if base not present in config": async (assert) => {
|
||||
const css = `:root {
|
||||
color: var(--icon-color--darker-20);
|
||||
}`;
|
||||
assert.rejects(async () => await postcss([plugin({ variables: {} })]).process(css, { from: undefined, }));
|
||||
},
|
||||
|
||||
"multiple derived variable in single declaration is parsed correctly": async (assert) => {
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--foo-color: #ff0;
|
||||
}
|
||||
div {
|
||||
background-color: linear-gradient(var(--foo-color--lighter-50), var(--foo-color--darker-20));
|
||||
}`;
|
||||
const transformedColor1 = offColor("#ff0").lighten(0.5);
|
||||
const transformedColor2 = offColor("#ff0").darken(0.2);
|
||||
const outputCSS =
|
||||
inputCSS +
|
||||
`
|
||||
:root {
|
||||
--foo-color--lighter-50: ${transformedColor1.hex()};
|
||||
--foo-color--darker-20: ${transformedColor2.hex()};
|
||||
}
|
||||
`;
|
||||
await run( inputCSS, outputCSS, {derive}, assert);
|
||||
},
|
||||
|
||||
"multiple aliased-derived variable in single declaration is parsed correctly": async (assert) => {
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--foo-color: #ff0;
|
||||
}
|
||||
div {
|
||||
--my-alias: var(--foo-color);
|
||||
background-color: linear-gradient(var(--my-alias--lighter-50), var(--my-alias--darker-20));
|
||||
}`;
|
||||
const transformedColor1 = offColor("#ff0").lighten(0.5);
|
||||
const transformedColor2 = offColor("#ff0").darken(0.2);
|
||||
const outputCSS =
|
||||
inputCSS +
|
||||
`
|
||||
:root {
|
||||
--my-alias--lighter-50: ${transformedColor1.hex()};
|
||||
--my-alias--darker-20: ${transformedColor2.hex()};
|
||||
}
|
||||
`;
|
||||
await run( inputCSS, outputCSS, {derive}, assert);
|
||||
},
|
||||
|
||||
"compiledVariables map is populated": async (assert) => {
|
||||
const compiledVariables = new Map();
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--icon-color: #fff;
|
||||
}
|
||||
div {
|
||||
background: var(--icon-color--darker-20);
|
||||
--my-alias: var(--icon-color--darker-20);
|
||||
color: var(--my-alias--lighter-15);
|
||||
}`;
|
||||
await postcss([plugin({ derive, compiledVariables })]).process(inputCSS, { from: "/foo/bar/test.css", });
|
||||
const actualArray = compiledVariables.get("/foo/bar")["derived-variables"];
|
||||
const expectedArray = ["icon-color--darker-20", "my-alias=icon-color--darker-20", "my-alias--lighter-15"];
|
||||
assert.deepStrictEqual(actualArray.sort(), expectedArray.sort());
|
||||
},
|
||||
|
||||
"derived variable are supported in urls": async (assert) => {
|
||||
const inputCSS = `
|
||||
:root {
|
||||
--foo-color: #ff0;
|
||||
}
|
||||
div {
|
||||
background-color: var(--foo-color--lighter-50);
|
||||
background: url("./foo/bar/icon.svg?primary=foo-color--darker-5");
|
||||
}
|
||||
a {
|
||||
background: url("foo/bar/icon.svg");
|
||||
}`;
|
||||
const transformedColorLighter = offColor("#ff0").lighten(0.5);
|
||||
const transformedColorDarker = offColor("#ff0").darken(0.05);
|
||||
const outputCSS =
|
||||
inputCSS +
|
||||
`
|
||||
:root {
|
||||
--foo-color--lighter-50: ${transformedColorLighter.hex()};
|
||||
--foo-color--darker-5: ${transformedColorDarker.hex()};
|
||||
}
|
||||
`;
|
||||
await run( inputCSS, outputCSS, {derive}, assert);
|
||||
}
|
||||
};
|
||||
};
|
71
scripts/postcss/tests/css-url-to-variables.test.js
Normal file
71
scripts/postcss/tests/css-url-to-variables.test.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const plugin = require("../css-url-to-variables");
|
||||
const run = require("./common").createTestRunner(plugin);
|
||||
const postcss = require("postcss");
|
||||
|
||||
module.exports.tests = function tests() {
|
||||
return {
|
||||
"url is replaced with variable": async (assert) => {
|
||||
const inputCSS = `div {
|
||||
background: no-repeat center/80% url("../img/image.svg?primary=main-color--darker-20");
|
||||
}
|
||||
button {
|
||||
background: url("/home/foo/bar/cool.svg?primary=blue&secondary=green");
|
||||
}`;
|
||||
const outputCSS =
|
||||
`div {
|
||||
background: no-repeat center/80% var(--icon-url-0);
|
||||
}
|
||||
button {
|
||||
background: var(--icon-url-1);
|
||||
}`+
|
||||
`
|
||||
:root {
|
||||
--icon-url-0: url("../img/image.svg?primary=main-color--darker-20");
|
||||
--icon-url-1: url("/home/foo/bar/cool.svg?primary=blue&secondary=green");
|
||||
}
|
||||
`;
|
||||
await run(inputCSS, outputCSS, { }, assert);
|
||||
},
|
||||
"non svg urls without query params are not replaced": async (assert) => {
|
||||
const inputCSS = `div {
|
||||
background: no-repeat url("./img/foo/bar/image.png");
|
||||
}`;
|
||||
await run(inputCSS, inputCSS, {}, assert);
|
||||
},
|
||||
"map is populated with icons": async (assert) => {
|
||||
const compiledVariables = new Map();
|
||||
compiledVariables.set("/foo/bar", { "derived-variables": ["background-color--darker-20", "accent-color--lighter-15"] });
|
||||
const inputCSS = `div {
|
||||
background: no-repeat center/80% url("../img/image.svg?primary=main-color--darker-20");
|
||||
}
|
||||
button {
|
||||
background: url("/home/foo/bar/cool.svg?primary=blue&secondary=green");
|
||||
}`;
|
||||
const expectedObject = {
|
||||
"icon-url-0": "../img/image.svg?primary=main-color--darker-20",
|
||||
"icon-url-1": "/home/foo/bar/cool.svg?primary=blue&secondary=green",
|
||||
};
|
||||
await postcss([plugin({compiledVariables})]).process(inputCSS, { from: "/foo/bar/test.css", });
|
||||
const sharedVariable = compiledVariables.get("/foo/bar");
|
||||
assert.deepEqual(["background-color--darker-20", "accent-color--lighter-15"], sharedVariable["derived-variables"]);
|
||||
assert.deepEqual(expectedObject, sharedVariable["icon"]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
set -e
|
||||
if [ -z "$1" ]; then
|
||||
echo "provide a new version, current version is $(jq '.version' package.json)"
|
||||
exit 1
|
||||
|
|
19
scripts/sdk/base-manifest.json
Normal file
19
scripts/sdk/base-manifest.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "hydrogen-view-sdk",
|
||||
"description": "Embeddable matrix client library, including view components",
|
||||
"version": "0.1.0",
|
||||
"main": "./lib-build/hydrogen.cjs.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./lib-build/hydrogen.es.js",
|
||||
"require": "./lib-build/hydrogen.cjs.js"
|
||||
},
|
||||
"./paths/vite": "./paths/vite.js",
|
||||
"./style.css": "./asset-build/assets/theme-element-light.css",
|
||||
"./theme-element-light.css": "./asset-build/assets/theme-element-light.css",
|
||||
"./theme-element-dark.css": "./asset-build/assets/theme-element-dark.css",
|
||||
"./main.js": "./asset-build/assets/main.js",
|
||||
"./download-sandbox.html": "./asset-build/assets/download-sandbox.html",
|
||||
"./assets/*": "./asset-build/assets/*"
|
||||
}
|
||||
}
|
25
scripts/sdk/build.sh
Executable file
25
scripts/sdk/build.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# Exit whenever one of the commands fail with a non-zero exit code
|
||||
set -e
|
||||
set -o pipefail
|
||||
# Enable extended globs so we can use the `!(filename)` glob syntax
|
||||
shopt -s extglob
|
||||
|
||||
# Only remove the directory contents instead of the whole directory to maintain
|
||||
# the `npm link`/`yarn link` symlink
|
||||
rm -rf target/*
|
||||
yarn run vite build -c vite.sdk-assets-config.js
|
||||
yarn run vite build -c vite.sdk-lib-config.js
|
||||
yarn tsc -p tsconfig-declaration.json
|
||||
./scripts/sdk/create-manifest.js ./target/package.json
|
||||
mkdir target/paths
|
||||
# this doesn't work, the ?url imports need to be in the consuming project, so disable for now
|
||||
# ./scripts/sdk/transform-paths.js ./src/platform/web/sdk/paths/vite.js ./target/paths/vite.js
|
||||
cp doc/SDK.md target/README.md
|
||||
pushd target/asset-build
|
||||
rm index.html
|
||||
popd
|
||||
pushd target/asset-build/assets
|
||||
# Remove all `*.wasm` and `*.js` files except for `main.js`
|
||||
rm !(main).js *.wasm
|
||||
popd
|
23
scripts/sdk/create-manifest.js
Executable file
23
scripts/sdk/create-manifest.js
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env node
|
||||
const fs = require("fs");
|
||||
const appManifest = require("../../package.json");
|
||||
const baseSDKManifest = require("./base-manifest.json");
|
||||
/*
|
||||
Need to leave typescript type definitions out until the
|
||||
typescript conversion is complete and all imports in the d.ts files
|
||||
exists.
|
||||
```
|
||||
"types": "types/lib.d.ts"
|
||||
```
|
||||
*/
|
||||
const mergeOptions = require('merge-options');
|
||||
|
||||
const manifestExtension = {
|
||||
devDependencies: undefined,
|
||||
scripts: undefined,
|
||||
};
|
||||
|
||||
const manifest = mergeOptions(appManifest, baseSDKManifest, manifestExtension);
|
||||
const json = JSON.stringify(manifest, undefined, 2);
|
||||
const outFile = process.argv[2];
|
||||
fs.writeFileSync(outFile, json, {encoding: "utf8"});
|
3
scripts/sdk/test/.gitignore
vendored
Normal file
3
scripts/sdk/test/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
dist
|
||||
yarn.lock
|
2
scripts/sdk/test/deps.d.ts
vendored
Normal file
2
scripts/sdk/test/deps.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Keep TypeScripts from complaining about hydrogen-view-sdk not having types yet
|
||||
declare module "hydrogen-view-sdk";
|
21
scripts/sdk/test/esm-entry.ts
Normal file
21
scripts/sdk/test/esm-entry.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import * as hydrogenViewSdk from "hydrogen-view-sdk";
|
||||
import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url';
|
||||
import workerPath from 'hydrogen-view-sdk/main.js?url';
|
||||
import olmWasmPath from '@matrix-org/olm/olm.wasm?url';
|
||||
import olmJsPath from '@matrix-org/olm/olm.js?url';
|
||||
import olmLegacyJsPath from '@matrix-org/olm/olm_legacy.js?url';
|
||||
const assetPaths = {
|
||||
downloadSandbox: downloadSandboxPath,
|
||||
worker: workerPath,
|
||||
olm: {
|
||||
wasm: olmWasmPath,
|
||||
legacyBundle: olmLegacyJsPath,
|
||||
wasmBundle: olmJsPath
|
||||
}
|
||||
};
|
||||
import "hydrogen-view-sdk/assets/theme-element-light.css";
|
||||
|
||||
console.log('hydrogenViewSdk', hydrogenViewSdk);
|
||||
console.log('assetPaths', assetPaths);
|
||||
|
||||
console.log('Entry ESM works ✅');
|
12
scripts/sdk/test/index.html
Normal file
12
scripts/sdk/test/index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" class="hydrogen"></div>
|
||||
<script type="module" src="./esm-entry.ts"></script>
|
||||
</body>
|
||||
</html>
|
8
scripts/sdk/test/package.json
Normal file
8
scripts/sdk/test/package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "test-sdk",
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"hydrogen-view-sdk": "link:../../../target"
|
||||
}
|
||||
}
|
13
scripts/sdk/test/test-sdk-in-commonjs-env.js
Normal file
13
scripts/sdk/test/test-sdk-in-commonjs-env.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Make sure the SDK can be used in a CommonJS environment.
|
||||
// Usage: node scripts/sdk/test/test-sdk-in-commonjs-env.js
|
||||
const hydrogenViewSdk = require('hydrogen-view-sdk');
|
||||
|
||||
// Test that the "exports" are available:
|
||||
// Worker
|
||||
require.resolve('hydrogen-view-sdk/main.js');
|
||||
// Styles
|
||||
require.resolve('hydrogen-view-sdk/assets/theme-element-light.css');
|
||||
// Can access files in the assets/* directory
|
||||
require.resolve('hydrogen-view-sdk/assets/main.js');
|
||||
|
||||
console.log('SDK works in CommonJS ✅');
|
19
scripts/sdk/test/test-sdk-in-esm-vite-build-env.js
Normal file
19
scripts/sdk/test/test-sdk-in-esm-vite-build-env.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const { resolve } = require('path');
|
||||
const { build } = require('vite');
|
||||
|
||||
async function main() {
|
||||
await build({
|
||||
outDir: './dist',
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'index.html')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log('SDK works in Vite build ✅');
|
||||
}
|
||||
|
||||
main();
|
36
scripts/sdk/transform-paths.js
Executable file
36
scripts/sdk/transform-paths.js
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
This script transforms the string literals in the sdk path files to adjust paths
|
||||
from what they are at development time to what they will be in the sdk package.
|
||||
|
||||
It does this by looking in all string literals in the paths file and looking for file names
|
||||
that we expect and need replacing (as they are bundled with the sdk).
|
||||
|
||||
Usage: ./transform-paths.js <input file> <output file>
|
||||
*/
|
||||
|
||||
const acorn = require("acorn");
|
||||
const walk = require("acorn-walk")
|
||||
const escodegen = require("escodegen");
|
||||
const fs = require("fs");
|
||||
|
||||
const code = fs.readFileSync(process.argv[2], {encoding: "utf8"});
|
||||
const ast = acorn.parse(code, {ecmaVersion: "13", sourceType: "module"});
|
||||
|
||||
function changePrefix(value, file, newPrefix = "") {
|
||||
const idx = value.indexOf(file);
|
||||
if (idx !== -1) {
|
||||
return newPrefix + value.substr(idx);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
walk.simple(ast, {
|
||||
Literal(node) {
|
||||
node.value = changePrefix(node.value, "download-sandbox.html", "../");
|
||||
node.value = changePrefix(node.value, "main.js", "../");
|
||||
}
|
||||
});
|
||||
const transformedCode = escodegen.generate(ast);
|
||||
fs.writeFileSync(process.argv[3], transformedCode, {encoding: "utf8"})
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const finalhandler = require('finalhandler')
|
||||
const http = require('http')
|
||||
const serveStatic = require('serve-static')
|
||||
const path = require('path');
|
||||
|
||||
// Serve up parent directory with cache disabled
|
||||
const serve = serveStatic(
|
||||
path.resolve(__dirname, "../"),
|
||||
{
|
||||
etag: false,
|
||||
setHeaders: res => {
|
||||
res.setHeader("Pragma", "no-cache");
|
||||
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
res.setHeader("Expires", "Wed, 21 Oct 2015 07:28:00 GMT");
|
||||
},
|
||||
index: ['index.html', 'index.htm']
|
||||
}
|
||||
);
|
||||
|
||||
// Create server
|
||||
const server = http.createServer(function onRequest (req, res) {
|
||||
serve(req, res, finalhandler(req, res))
|
||||
});
|
||||
|
||||
// Listen
|
||||
server.listen(3000);
|
5
scripts/test-derived-theme/test-theme.sh
Executable file
5
scripts/test-derived-theme/test-theme.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
cp scripts/test-derived-theme/theme.json target/assets/theme-customer.json
|
||||
cat target/config.json | jq '.themeManifests += ["assets/theme-customer.json"]' | cat > target/config.temp.json
|
||||
rm target/config.json
|
||||
mv target/config.temp.json target/config.json
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue