Compare commits
2065 Commits
Author | SHA1 | Date |
---|---|---|
fred | 96cd96a789 | |
fred | 4da568195b | |
fred | 7913f3b436 | |
fred | 604a159712 | |
fred | 5a08a1563d | |
fred | e678d62f06 | |
fred | 946ccd826a | |
fred | da9f8bb55d | |
fred | 1b491454c2 | |
fred | fa96adf059 | |
fred | 594b8328c2 | |
fred | 26d52c2722 | |
fred | 26a5217682 | |
fred | 2d635c0528 | |
fred | 8e32370ef5 | |
fred | 9a9f2382e5 | |
fred | 2c958a6f76 | |
fred | a5953940e8 | |
fred | 91e06a1395 | |
fred | 57ba0be37c | |
fred | 5cc2302be7 | |
fred | 207577868e | |
fred | a366a1fcb8 | |
fred | 8bd4b9743b | |
fred | cc16986393 | |
fred | 165742b78e | |
fred | a22517e71d | |
fred | 7a9609aa2c | |
fred | 31d9ae87b7 | |
fred | ecfa63be83 | |
fred | f70e612bcf | |
fred | 4ba06a8be1 | |
fred | 2c26bdd2d8 | |
fred | 517f384181 | |
fred | 275604a4e5 | |
fred | d51002338c | |
fred | bf10b85b0f | |
fred | b053de0b68 | |
fred | 02a9302237 | |
fred | ceeb79bdf6 | |
fred | d397e94ec2 | |
fred | 48df6ceb7a | |
fred | 28c074ebcc | |
fred | a9fbd36db7 | |
fred | bdbd11eaaa | |
fred | cbd6d189ca | |
fred | a64fe3524b | |
fred | 0617e8084f | |
fred | 3a48aab030 | |
fred | f44755117d | |
fred | 065d8e854c | |
fred | 1217b669f2 | |
fred | a102147949 | |
fred | 5b3edd97e2 | |
fred | 6e44b2710b | |
fred | 58395d1f3e | |
fred | a486cb29e5 | |
fred | 82ddec38d9 | |
fred | 9063d416a0 | |
fred | 15724ce9a2 | |
fred | cf8187e597 | |
fred | f6154003bd | |
fred | ceee8c8f18 | |
fred | e9d0be5ecf | |
fred | d15d5ca9c1 | |
fred | 59c72f73ea | |
fred | 3bdd48a2c4 | |
fred | 147215cc55 | |
fred | 1ef36f23c5 | |
fred | 98d8b88c7d | |
fred | cffbb9c700 | |
fred | b2834b0bc1 | |
fred | 7b94539e24 | |
fred | b36cc445e1 | |
fred | 2b93275ec4 | |
fred | 175ed36609 | |
fred | 5e96fe2353 | |
fred | ab2dec9762 | |
fred | a0bafae461 | |
fred | 8c7c098eec | |
fred | fbe7aa2b10 | |
fred | 1645c082c8 | |
fred | 121b6f9fad | |
fred | f933ac1069 | |
fred | 84184acfd4 | |
fred | 6fb0996f89 | |
fred | 70c209682e | |
fred | d53fa8d0e8 | |
fred | 75a8bc54b3 | |
fred | dfc7339015 | |
fred | 7b1076250c | |
fred | 4c18df9c9f | |
fred | 3e3ac3d9da | |
fred | 9551c5bcb4 | |
fred | e7998f7bf8 | |
fred | 54d4837fd6 | |
fred | 974d506af5 | |
fred | 9de45bd4c5 | |
fred | 12f6a50596 | |
fred | 7046274894 | |
fred | 07f3ab165f | |
fred | 05c171dd97 | |
fred | 36b000426b | |
fred | 47764387cc | |
fred | f530cf8cdd | |
fred | a9a7f23a3b | |
fred | 1d4527c72e | |
fred | b331dcc990 | |
fred | e8b2cdf6f4 | |
fred | 8ff8ab1fe9 | |
fred | 8ebbe138ac | |
papiche | 39bb53897d | |
fred | 0beafcc374 | |
fred | dc169aa474 | |
papiche | 5e409f3680 | |
papiche | 2b495af068 | |
papiche | 6fbd7eb1df | |
papiche | fc6c31d626 | |
fred | 591526c734 | |
fred | 08603176f2 | |
fred | fd390d80f0 | |
fred | bf8d36fd44 | |
fred | 3eddcad0eb | |
fred | 855d2877f5 | |
fred | 0f75a07103 | |
fred | 04cfc8bdc8 | |
fred | 9a3b7b5931 | |
fred | 527c09838a | |
fred | a39a0cd272 | |
fred | 523f068a30 | |
fred | 1e5e9a2194 | |
fred | 5cf9f0b6cb | |
fred | 0dc2498ae6 | |
fred | ddb4a14502 | |
fred | c925b1a701 | |
fred | 7a87f96907 | |
fred | b273422f0d | |
fred | f9814e1cb4 | |
fred | 5152d4ccf7 | |
fred | 7b32f25da3 | |
fred | 1186c77d55 | |
fred | 21f745c418 | |
fred | e1069d26f1 | |
fred | b24354a416 | |
fred | d0db377309 | |
fred | 71d24341b3 | |
fred | 102c3b362d | |
fred | 3e684587df | |
fred | 42164bda55 | |
fred | 308a60b2e4 | |
fred | 0914213adb | |
fred | 4eeb9dd5ef | |
fred | a8d3ed8b05 | |
fred | 06348bb089 | |
fred | a9dc335427 | |
fred | d65ed3a5b6 | |
fred | 84da189bde | |
fred | 12e4b7ceea | |
fred | 767b29c5fa | |
fred | eb8aa0a940 | |
fred | a443f0ff5b | |
fred | 5f33de4791 | |
fred | 09bc666616 | |
fred | 0655b4d758 | |
fred | 5a10e1bbe3 | |
fred | e9265a043b | |
fred | db67b64364 | |
fred | 9f51fdf40e | |
fred | 953029af4b | |
fred | 54ffc346ce | |
fred | be3d9531e8 | |
fred | 24e3c0f8b3 | |
fred | 09c961f05a | |
fred | aa819977e6 | |
fred | 9b1549f689 | |
fred | b89bc01ada | |
fred | 7fd87cdf1c | |
fred | f23fd79c00 | |
fred | 7d8a9b3d7f | |
fred | 9164b6a265 | |
fred | 16ad9eb9e3 | |
fred | 3888414580 | |
fred | 9527d5e5f5 | |
fred | b97a869f39 | |
fred | 3896be3845 | |
fred | 751ed3158a | |
fred | a69e38bd53 | |
fred | 5ae650718a | |
fred | c476d7d3d7 | |
fred | b2d9d27647 | |
fred | b6f92ed4dc | |
fred | de6c7543c5 | |
fred | 8a3f78f36e | |
fred | 673d2fbf62 | |
fred | 278cd4e730 | |
fred | c7b01acb65 | |
fred | 7c81362146 | |
fred | 0a7a90401b | |
fred | 7fb9188076 | |
fred | 29e6bb6203 | |
fred | a0046d31e0 | |
fred | 5e9cebfbac | |
fred | 862d6562bf | |
fred | a132d32b9e | |
fred | 659c7aeee7 | |
fred | d25d25dd30 | |
fred | 99f62a58c4 | |
fred | 77f298ed11 | |
fred | 2bcaaf95bc | |
fred | c50afc49b6 | |
fred | 5ffc1954af | |
fred | f83435cd39 | |
fred | 48d925fd52 | |
fred | 7df2748b83 | |
fred | adcb6ee8fc | |
fred | 52b7d6f841 | |
fred | fe206e1565 | |
fred | 0bb1684190 | |
fred | 59204dc421 | |
fred | 03845c69a6 | |
fred | bbbc4174f6 | |
fred | 62aa6cd563 | |
fred | 9429c9c472 | |
fred | 42f6fdc39f | |
fred | b3d66ffd58 | |
fred | 026b97c908 | |
fred | e52490638f | |
fred | d6d4e55689 | |
fred | 1ae58895f3 | |
fred | 4abd3ec77d | |
fred | e2a30e747d | |
fred | 43534ef24e | |
fred | f88d5ea7a9 | |
fred | 4d94dec156 | |
fred | 365a9df5d6 | |
fred | cb30d0f773 | |
fred | ae344dd369 | |
fred | 3efdfd297b | |
Fabien-Vidor | d06b418ca8 | |
papiche | 6e602a7754 | |
lou0608 | 7e54ba5d22 | |
fred | fdc6a4c5fd | |
Jean-bouger | 0daca449ff | |
Jean-bouger | ff981d9c41 | |
gaetancorin | 681c438485 | |
Willd27 | 1cd026dd50 | |
Nathan Piazzi | 34a549d3d1 | |
Nathan Piazzi | 26ceac3c50 | |
fred | ce6b8de059 | |
papiche | 8c9379a53b | |
anatolethien | 4b04a7ca6b | |
Willd27 | bf951f8a2e | |
Nathan Piazzi | d23c1fdbae | |
fred | 8a231fd284 | |
fred | a059c53bbe | |
fred | fe5c337881 | |
fred | a8b6f46a14 | |
fred | 50ebc469ab | |
fred | 50e8a17a51 | |
fred | 8925e199d4 | |
fred | 727e67ab23 | |
fred | 06024545c8 | |
fred | 78a540fd4c | |
fred | 8dc4956ab1 | |
fred | 288c909a43 | |
fred | 01746aa91a | |
fred | 9882b99f47 | |
fred | 0b54a92801 | |
fred | cdbc3d162f | |
fred | 2b290452f9 | |
fred | 636a920160 | |
fred | 5fc35a7880 | |
fred | 2abd32a8ad | |
fred | 8cb7ce12c5 | |
fred | 99dead74f9 | |
fred | 30a9274005 | |
fred | c024c745ef | |
fred | ab541d2206 | |
fred | 1b8c2e9924 | |
fred | 9afcb013bd | |
fred | cf8f3f06ab | |
fred | aac9cd6340 | |
fred | d32b9938ab | |
fred | eb07ce7e86 | |
fred | 59b12d4aae | |
fred | 81e65cd97b | |
fred | c81436b83a | |
fred | 63f71ddec9 | |
fred | b2a03f0f4e | |
fred | 9bd0f2a816 | |
fred | 74d505759f | |
fred | ffe82a6119 | |
fred | 1afb1faa9e | |
fred | 893295807f | |
fred | 68ba56f8fe | |
fred | cfffdd4667 | |
fred | f45cb14b24 | |
fred | 81add31667 | |
fred | 9c16c0064a | |
fred | b23920381a | |
fred | 2e1c414fb6 | |
fred | e644780bfe | |
fred | e27182ea46 | |
fred | 5acc7a44c3 | |
fred | 195ce6f0f6 | |
fred | 425fcec892 | |
fred | deb589c922 | |
fred | 20b54192b1 | |
fred | cd16642363 | |
fred | eca57a149f | |
fred | 308e24699c | |
fred | 98ad6ffec2 | |
fred | ca2c8d0a76 | |
fred | 32e4ca89a2 | |
fred | 79bdced18c | |
fred | c5977abff0 | |
fred | 2f8b7f17d6 | |
fred | 5ad1eee561 | |
fred | 4a952f84f4 | |
fred | 24a2af152e | |
fred | 818bcdd00b | |
fred | 6fb3ca8325 | |
fred | 711eb86f67 | |
fred | 153caaa7d2 | |
fred | 4bfdb4af73 | |
fred | bf6cffebc2 | |
fred | 2d26e82a3f | |
fred | 3205aadd7f | |
fred | 1623f95012 | |
fred | fec61bf5a5 | |
fred | 66811e7a0a | |
fred | 9cad79fdae | |
fred | 6e2636d7d9 | |
fred | fd52a7e0fb | |
fred | e3b5332aec | |
fred | 2a61784d3c | |
fred | ff35d8c5cb | |
fred | 3e51735bce | |
fred | 80b395d74e | |
fred | 3da38260e6 | |
fred | a51542a1e1 | |
fred | 9569832e75 | |
fred | 66adbb3f79 | |
fred | 60279e7621 | |
fred | 11b776dab3 | |
fred | 68975f3d0f | |
fred | dbb50dade4 | |
fred | eeb963d9f0 | |
fred | 2d25538466 | |
fred | e8f9a9c62d | |
fred | be8cc678f8 | |
fred | 9956a13378 | |
fred | 4a92c664ef | |
fred | 84b841941a | |
fred | d05759045a | |
fred | 0f6c3f786d | |
fred | c227bfd8a8 | |
fred | c885afb076 | |
fred | 692f37bd4c | |
fred | 4899de4e68 | |
fred | ec68072cc1 | |
fred | 7d3ebe6e34 | |
fred | c70982d333 | |
fred | 218ffa0095 | |
fred | e955023b24 | |
fred | 431d54d1ae | |
fred | a323db6c82 | |
fred | 7987449290 | |
fred | 4c6051e800 | |
fred | 899add82b9 | |
fred | 962e273916 | |
fred | 3c4e5a5ff8 | |
fred | a0b81691c1 | |
fred | d0013000e2 | |
fred | 991149a3ca | |
fred | 11f1995ea1 | |
fred | 4b956fe62e | |
fred | de92f38788 | |
fred | bac8936d00 | |
fred | a3fd0e877f | |
fred | 3c91a43698 | |
fred | 1c8b16a9de | |
fred | 8be2fb525b | |
fred | 3d663012f9 | |
fred | b1cdea1508 | |
fred | e93770bc66 | |
fred | c7bd474922 | |
fred | 2ee5f66b5c | |
fred | 3233d8d6e4 | |
fred | 712e0303cf | |
fred | 1e9cf9aeac | |
fred | d3da9a6455 | |
fred | 61cb2f34b1 | |
fred | 1862bf1492 | |
fred | 79f832bdfe | |
fred | 8829baf8ad | |
fred | ee9b3c3858 | |
fred | bd27f1b698 | |
fred | eff345b7b3 | |
fred | d84d9ce1f4 | |
fred | 3cd2e186c2 | |
fred | 41cb844f32 | |
fred | 4128344e8e | |
fred | c208e403f0 | |
fred | 77e0144a00 | |
fred | 61bf1b9a04 | |
fred | 3c306690e6 | |
fred | 69731ff435 | |
fred | 4d784941bc | |
fred | 766fd6dc79 | |
fred | a2990e9420 | |
fred | 0ea7169bac | |
fred | 5cc3fcff4a | |
papiche | e4428cc3a3 | |
papiche | c0333f9b28 | |
papiche | 8e6625ef3d | |
papiche | 39ede01263 | |
papiche | 4910495491 | |
fred | 13c839b3ea | |
Jean-bouger | 8d5bb0de98 | |
gaetancorin | 80931e495b | |
vboxuser | 5b35ffb40e | |
NathanPzi | d876cdc290 | |
NathanPzi | 1e459a8133 | |
NathanPzi | fd46c28fba | |
gabriel cancel | b8868e39d3 | |
fred | c99d25ce36 | |
papiche | 92b9389fd6 | |
papiche | 12a7958ea8 | |
gabriel cancel | 2f07c5976b | |
anatolethien | 79c4ef0db9 | |
fred | 49d53e8120 | |
fred | 5fcaddfc85 | |
papiche | 120294a5b6 | |
gabriel cancel | 9c37df8494 | |
papiche | 9f367f7101 | |
papiche | 31a3924b2d | |
papiche | 179140427b | |
papiche | 600dab43b1 | |
Fabien-Vidor | 5b5190b1fd | |
AMARSILLE | 421c160af1 | |
lou0608 | 114b849a2d | |
gaetancorin | f6fff6d50c | |
tess | 7a1660e91d | |
gaetancorin | a49f41eb48 | |
fred | 26776d1c54 | |
fred | 2d8dc171aa | |
fred | 332f0f2880 | |
fred | d2e7963b7d | |
fred | b1ddcc1747 | |
fred | d1394d5332 | |
fred | 134f219fa9 | |
fred | dceffe0229 | |
fred | c53c0dfc3a | |
fred | ae7a2ea964 | |
fred | 909219a73a | |
fred | f33c4d04dd | |
fred | 605d66b913 | |
fred | 3d76bd5243 | |
fred | c508c7cb0a | |
fred | 9a266c583d | |
fred | 4989583264 | |
fred | 911576a24c | |
fred | 2de86d120c | |
fred | 747f3d5b16 | |
fred | 8c9ce2c3dd | |
fred | bfaa5bbe2b | |
fred | 37311e89f1 | |
fred | a411d9c516 | |
fred | a773872558 | |
fred | 81e7930e1a | |
fred | 7e299e905e | |
fred | 0d0d1c947e | |
FaycoTLS | 6154d5ca0a | |
fred | c6bce9a13b | |
fred | 80302af0f5 | |
fred | 5a19b71d02 | |
fred | 4831125504 | |
fred | 1c85b79dbe | |
fred | daaaf455d7 | |
fred | 6bbf606c02 | |
fred | 6bc90788c8 | |
fred | 96d7215b57 | |
fred | 143c60d139 | |
papiche | 3944b28305 | |
fred | 3afec1738a | |
fred | 58df7898f3 | |
fred | c8353f69ad | |
fred | 12b8d50303 | |
fred | 5643f79535 | |
fred | ea7ba67add | |
fred | 066710056b | |
fred | a3acca4f94 | |
fred | 863aa4add4 | |
fred | c44839ae38 | |
fred | c921b12b87 | |
fred | 8fb5a09f86 | |
fred | 5394fd2f75 | |
fred | b6af41c9ee | |
fred | ca18c6912e | |
fred | e467e49980 | |
fred | 0004d449e2 | |
fred | bf5e117fc1 | |
fred | c681b66728 | |
fred | c93ef5ba34 | |
fred | f561134897 | |
fred | c2cddee226 | |
fred | 8687b76751 | |
fred | 4306bb03b6 | |
fred | e53d7c70d3 | |
fred | c253cae4d0 | |
fred | 98600faf81 | |
fred | 9bf2a4b1a8 | |
fred | f8d2b3307f | |
fred | 80d9d385e9 | |
fred | a0fdaf6e62 | |
fred | 055e66c79f | |
papiche | 7bedcc05eb | |
Nathan Piazzi | 026ce41b6b | |
NathanPzi | 9675f50ea0 | |
= | 46883dd838 | |
Fabien-Vidor | e01bcd05d2 | |
NathanPzi | bad7e7bd39 | |
papiche | aed0809785 | |
fred | 15b96181ec | |
fred | 628e4a9e5c | |
fred | d28c1d0734 | |
fred | 3c7bdc278c | |
fred | 29a55e25f2 | |
fred | 5fe84e4c76 | |
fred | 3006bc8deb | |
fred | 84b544f978 | |
fred | becbc20b73 | |
fred | 8b10839328 | |
fred | 0b2870f3b9 | |
fred | c15bb02b10 | |
fred | 9d82cc493e | |
fred | a4293b20b8 | |
fred | b5c5906321 | |
papiche | ba41be7f2d | |
fred | 5497d86c21 | |
fred | c9575a9ffa | |
fred | ffff6c59e2 | |
fred | 7e5859c8ba | |
Anais031 | b6bb2c2601 | |
fred | eb2b29f0b1 | |
papiche | c1f5fae6e7 | |
papiche | fe0f693dc2 | |
fred | f55768249a | |
fred | 12f2883b07 | |
Ant0n10x78 | 9f52166d17 | |
fred | eb30e49b70 | |
Ant0n10x78 | 117cbe65f2 | |
Ant0n10x78 | f25c1d03d1 | |
fred | 5df64847ea | |
fred | 8fc9f46aac | |
fred | f15d3d947a | |
fred | e2772ac2c8 | |
fred | 81fda26724 | |
fred | 7a20666c6d | |
fred | 1d5e35bcee | |
fred | 015d01e769 | |
fred | 1b65a0a0f9 | |
fred | 699b65962b | |
fred | 93ac6daa8e | |
fred | 17dca2cafc | |
fred | c2e9655e75 | |
fred | e56956da3a | |
papiche | d203840d03 | |
anto | 0ce75a3fdb | |
anto | 5e72580c14 | |
papiche | 91cc00bdea | |
anto | 2a6c094602 | |
fred | e9ae6773cb | |
papiche | 996784b951 | |
milla | ea53f879cb | |
papiche | 3e19a53ab5 | |
milla | 4b5a3541ee | |
Haaze9 | 45d7dfff71 | |
papiche | af1f9b40aa | |
fred | 4426278983 | |
fred | 75d1c5f401 | |
kholius | 1cdffe8387 | |
papiche | a010e9bab5 | |
ershad.ramezani | e1e87ced54 | |
papiche | 2090d3f3ec | |
papiche | 99eb4f8d5b | |
Ershad Ramezani | f15a11e159 | |
ershad.ramezani | 96f2a17293 | |
ershad.ramezani | eb921650c7 | |
scripting | 0559d23ec9 | |
papiche | 830b609899 | |
papiche | 3ce72ce054 | |
qaktuss | f1b8e5f4b1 | |
papiche | 89ef6a5ef3 | |
papiche | 7682fc5179 | |
papiche | ccc389c07c | |
Ershad Ramezani | 49c29bd50a | |
papiche | 2afb31a788 | |
papiche | d553ac1034 | |
papiche | 5d256d000c | |
papiche | 71e2ae764e | |
papiche | d7a39a1862 | |
mcaparros | e479a68641 | |
milla | e8fb53a180 | |
SayTeK | 89f639b7cb | |
papiche | d76b233556 | |
qaktuss | 03abe9de3c | |
debian | 8cbf0c5310 | |
anto | cb1f100acb | |
Dorito | 4db6026549 | |
mcaparros | 745d651325 | |
ershad.ramezani | 6c5322bcb8 | |
damien.khadir | a1b5f8a246 | |
scripting | 8fc48dcbc1 | |
Rémi Montagut | 0c62b841d4 | |
user | fc8fd3cf5c | |
fred | dbcc503225 | |
fred | 837b9aaaa8 | |
fred | 80d331029e | |
fred | 15bd82b2f7 | |
fred | 84a04ab62d | |
fred | 916f119a09 | |
fred | 6a48b90128 | |
fred | 51a769cc9d | |
fred | 9887e2eb66 | |
fred | 965fec5951 | |
fred | 9f875876a7 | |
fred | 313e1a2d6c | |
fred | 98769ed48a | |
fred | 9042e54ab3 | |
fred | 7181149511 | |
fred | 49fa403354 | |
fred | 03ec5b072c | |
fred | 3200133cc9 | |
fred | 1c2979231a | |
fred | f12cf474bf | |
fred | 5fb54b2287 | |
fred | ceaedaa4be | |
fred | 774363089b | |
fred | a8ab380a94 | |
fred | d6467e159a | |
fred | 7a88b9fc72 | |
fred | 97677b4024 | |
fred | 052ec4e539 | |
fred | a96508cbab | |
fred | dc205f29ca | |
fred | f37ce3edca | |
fred | bc64e703f2 | |
fred | 2a779f63dd | |
fred | 0fdd37e43c | |
fred | c188f6b194 | |
fred | d11e07eb10 | |
fred | dd76dcbc5b | |
fred | 86f388a633 | |
fred | e787072f21 | |
fred | 98a02cddb3 | |
fred | 2755277ffa | |
fred | b591656c30 | |
fred | a6c491ac2d | |
fred | 622d5e3fda | |
papiche | 53ad40b1e0 | |
fred | 2be174d251 | |
fred | 79c596ce0e | |
fred | 801ea1c9f5 | |
fred | d06892c791 | |
fred | 3833963b26 | |
fred | 58f7ae6bb4 | |
fred | bec8748886 | |
fred | b520f49762 | |
janick | 941592ce44 | |
fred | b4b1880085 | |
fred | b09b7704bf | |
fred | 99854c9cb9 | |
fred | a5ec8c8678 | |
fred | 2562dd6294 | |
fred | 7e6268d0c5 | |
fred | f43c476ab4 | |
fred | 1664e4cbd0 | |
fred | 99d44c8291 | |
fred | a656913db8 | |
fred | edb0fee3a9 | |
fred | 678e9cafdf | |
fred | ec4186f9ee | |
fred | 6fbb42a3d3 | |
fred | c533e1c8a6 | |
fred | b5fa8ad10b | |
fred | 1d394616ae | |
fred | 2073e80de4 | |
fred | 9d9d0e722e | |
fred | 64172434f7 | |
fred | fff9ae8d31 | |
fred | 1f77420eb1 | |
fred | 51a8451310 | |
fred | 6046854f7d | |
fred | 6fbd4e2730 | |
fred | a47a2a7416 | |
fred | 3940b577b8 | |
papiche | cbfd192d63 | |
fred | c1a7ce25b2 | |
fred | 2a4391fc11 | |
fred | 05283313b7 | |
fred | 1095fd1b70 | |
fred | fea2d06d6e | |
fred | 9a8c779877 | |
fred | 3a5b41991b | |
aristo | 215164a59d | |
fred | 16ca189b54 | |
fred | 64f199fec4 | |
fred | 9a159ccd5c | |
papiche | 5564dc4307 | |
fred | 9ba87b27d9 | |
Mickael Fernandez | c5320eff15 | |
fred | 7417ae952e | |
papiche | ab6cb86818 | |
papiche | ffd274949a | |
fred | b8692146a6 | |
papiche | d406880ce3 | |
fred | 138ee637b2 | |
papiche | b7271bd302 | |
fred | 3b4ed03409 | |
papiche | 5e43185cb8 | |
papiche | f5c9aa5393 | |
papiche | ec2744b621 | |
fred | 6683abba22 | |
papiche | 92ec6c956f | |
fred | 19f5b15dec | |
fred | 0946b2d4e2 | |
papiche | f34dcf18dc | |
fred | e7bb5d3fce | |
papiche | c7331f7c40 | |
fred | 66010597dd | |
fred | a5be43c570 | |
FaycoTLS | 0e953757e3 | |
fred | fec76615ba | |
fred | 716630094e | |
fred | 37de4e3c38 | |
papiche | add49445be | |
papiche | b7a3ceb943 | |
papiche | 7a79ede598 | |
fred | fb30f3904e | |
fred | 36d6cf9727 | |
Mickael Fernandez | 0070b54be1 | |
Thiam-moussa | aeb882b802 | |
Mickado31 | f4dcff26c4 | |
FaycoTLS | 2797600d0f | |
Morgan Riviere | 120673ef3b | |
FaycoTLS | ae369f805d | |
SiriusTuks | fbf236b0e7 | |
FaycoTLS | 53858cbdd7 | |
PuigB | 0213eac553 | |
MCAzertox | f4cb8a9bb6 | |
Jonio | b0cf825813 | |
user | d7412899cd | |
Yassine | 798cf3907f | |
Jonio | d88b5523c3 | |
FaycoTLS | 02da0c339e | |
Jonio | 17137be26d | |
IlanDoumenc | 3953c8c950 | |
Yassine | b410295c63 | |
Vansxur | 1f9641f143 | |
cyril | 9979313215 | |
Ant0n10x78 | 924baa11ae | |
fred | 3e9b4a2e81 | |
jonathanbordes | 2c9d6b70e7 | |
Kali | 12d2285380 | |
jonathanbordes | 5d7e8e732f | |
jonathanbordes | 86b2c5ebb5 | |
Vansxur | 9ef81d639d | |
jonathanbordes | d500888247 | |
root | 19cc43fce7 | |
Vansxur | f8e09eb54d | |
fred | 14ef3a1cbe | |
fred | 68b4628e82 | |
fred | e380648293 | |
fred | 6f4acb87cf | |
Vansxur | de7ac6f33a | |
Vansxur | 0bfa38773b | |
Kali | 021d282c89 | |
Ant0n10x78 | c5e031c02b | |
jonathanbordes | 3fb48c969c | |
jonathanbordes | 057a173420 | |
jonathanbordes | 6d93eb1755 | |
jonathanbordes | 492563c006 | |
jonathanbordes | 8abfe06b59 | |
jonathanbordes | 1d0e657b8b | |
Kali | f2eaa4ac65 | |
Vansxur | a4ed113595 | |
jonathanbordes | c1f0e4437d | |
jonathanbordes | 57fcd41e87 | |
jonathanbordes | bba10c8e25 | |
jonathanbordes | 0b82ee0d79 | |
Vansxur | 7d783c4c62 | |
jonathanbordes | c6c1a24f15 | |
jonathanbordes | 39e13e2367 | |
jonathanbordes | ca9bda5907 | |
jonathanbordes | d45922f982 | |
jonathanbordes | 7adf945724 | |
jonathanbordes | 9019dc9b9c | |
jonathanbordes | f3b18c1242 | |
jonathanbordes | 27146f4155 | |
jonathanbordes | 1ed34c1ccf | |
fred | f2f3515550 | |
fred | c216d7002e | |
fred | 2aa0581541 | |
fred | 6b457a71dc | |
fred | 0d4f95d6ff | |
fred | 29a07a95c3 | |
fred | 6661e8b9ed | |
fred | e111e5c1b5 | |
fred | b8f30ba6e7 | |
fred | 5a7a29c3be | |
fred | 5223dd640f | |
fred | 0c3b8346dd | |
fred | 751041bb85 | |
fred | f4a6814ccb | |
fred | d2f5b87463 | |
fred | 5b247ca935 | |
fred | 1d04eb627b | |
fred | aac7c76dde | |
fred | 99e065d25f | |
fred | 6aa2ad05b9 | |
fred | e306b8ba1d | |
fred | 57a7f823f6 | |
fred | c63e09a54d | |
fred | c6771bf5ca | |
fred | 24a6b49567 | |
fred | fa8a42ef5a | |
fred | 42b7d07df8 | |
fred | 1d905650a1 | |
fred | b0d26b8233 | |
fred | 2870305b10 | |
fred | b66c1be838 | |
fred | 7da4287b58 | |
fred | 5361bc4bd1 | |
fred | c2d48c4136 | |
fred | 9c85c98f63 | |
fred | 0c074b48c0 | |
fred | 5bc2f6636a | |
fred | 36af558ec3 | |
fred | efe04f0ca6 | |
fred | d8ebf31d39 | |
fred | 157f49149a | |
fred | 4842096007 | |
fred | 23d369f967 | |
fred | 75e755ab1d | |
fred | ed24f05f52 | |
fred | 12a30e8aef | |
fred | 33e5188d68 | |
fred | 4e476c632b | |
fred | 44ffccfb0d | |
fred | ab2be9ec5c | |
fred | 8503605c21 | |
fred | 145253025b | |
fred | d9c6429d6a | |
fred | 9eccd70b3d | |
fred | 5262ddaf6f | |
fred | 4761e5609b | |
fred | 52db869aa1 | |
fred | 47e0bee33f | |
fred | 395b8bf4fc | |
fred | 3ed11810c7 | |
fred | f5011e3ac8 | |
fred | dc0e9c8053 | |
fred | ad6c467e1c | |
fred | 0f69af3438 | |
fred | 1e3749f0c7 | |
fred | f77412d20f | |
fred | 51f760f35b | |
fred | df55740e80 | |
fred | fcff04ed35 | |
fred | b5b60759fa | |
fred | d76688ceab | |
fred | 0e1ccd9fe9 | |
fred | 8826624d6d | |
fred | 6c9ea2a113 | |
fred | 8091df0618 | |
fred | 3385dfb8fd | |
fred | ed238e577d | |
fred | c460c37921 | |
fred | b0dd4fa377 | |
fred | 7301c42bb3 | |
fred | 1e3e419bd2 | |
fred | 6df8b22d36 | |
fred | 86354516c6 | |
fred | 5249433ee5 | |
fred | 60b7916d71 | |
fred | 04ca4f4e33 | |
fred | 4fc9b0caf3 | |
fred | b6b3d55750 | |
fred | 0523eff6ab | |
fred | 657dd0f684 | |
fred | 05c6c1625f | |
fred | 4f4074d5cb | |
fred | c734750abd | |
fred | 7997784146 | |
fred | 522eb0b961 | |
fred | ab3fa43d1d | |
fred | 2351202bdd | |
fred | d81951d9bc | |
fred | 0049ee502c | |
fred | 0871685d1b | |
fred | 3f985dce3d | |
fred | 229ed6ac9b | |
fred | 068536a84c | |
fred | ffa0a7ecbf | |
fred | beb3a70fce | |
fred | a81a7849c8 | |
fred | 2e08fd7764 | |
fred | 27a5b5dccb | |
fred | 733b848c5b | |
fred | 5e28d385fc | |
fred | 46c29df78c | |
fred | 385ef6b17c | |
fred | 865993d4ef | |
fred | 983b9487f7 | |
fred | 883987e60b | |
fred | 833267847f | |
fred | 0fbe606cbf | |
fred | 6d497ef1d4 | |
fred | 0501e33ace | |
fred | 16fd20ae7e | |
fred | 190494352a | |
fred | c4108606b3 | |
fred | e0cc11371e | |
fred | 5b2cb8c9ba | |
fred | c94d8ac11d | |
fred | ad8cfdaf27 | |
fred | e2ba742772 | |
fred | fada606761 | |
fred | 6c644850ab | |
fred | c2080ce9fd | |
fred | 6dcddfc3c2 | |
fred | 5d693051d5 | |
fred | 2ab1327d6d | |
fred | a428d6551f | |
fred | e23c3bc1a6 | |
fred | c9a253371d | |
fred | 46c442ab72 | |
fred | a20573c292 | |
fred | 5ff26d06b9 | |
fred | fcd3879da2 | |
fred | 73b18b08cd | |
fred | e937e8764d | |
fred | 947ac2f4dc | |
fred | e6f3a1cc37 | |
fred | f5d5ed5928 | |
fred | bf75affd2c | |
fred | d1cde08d55 | |
fred | 3d44af8b83 | |
fred | 53128a0c26 | |
fred | 91ba51cb3a | |
fred | 9396d2a7d7 | |
fred | 5a2a1a400c | |
fred | 0f3701b843 | |
fred | dc463a1eb6 | |
fred | 19830a9dc2 | |
fred | 16eb0f7b1a | |
fred | 4f19e9a7f5 | |
fred | 55d8fc7810 | |
fred | 477b105656 | |
fred | bad174f473 | |
fred | 05c3649e13 | |
fred | 48c9103b9d | |
fred | 2eb14fd885 | |
fred | 841f3f4422 | |
fred | f5022ddec1 | |
fred | 8db9e5b15e | |
fred | d553cdf1b6 | |
fred | 019e0eb886 | |
fred | 02ab090bd0 | |
fred | ccfe274719 | |
fred | 1dd2495a2e | |
fred | fde01d2478 | |
fred | f3964ee438 | |
fred | 02028858e7 | |
fred | c6bd4d7d49 | |
fred | 749c1127c2 | |
fred | 7710562046 | |
fred | 349ca75f67 | |
fred | 92cd3a1028 | |
fred | 5000f8dbf5 | |
fred | 67d44af782 | |
fred | b05de8cf2a | |
fred | 1015677488 | |
fred | 8375a38a43 | |
fred | 92f7dd0386 | |
fred | 5d4a405020 | |
fred | 1fc4f783bf | |
fred | 5c7cf37272 | |
fred | 883813bb8e | |
fred | abe8acf479 | |
fred | 4fad876f66 | |
fred | 65e332cd04 | |
fred | fe619429cc | |
fred | 4e153f9ef3 | |
fred | 1c4ced0b80 | |
fred | 2082197e66 | |
fred | 455870d33a | |
fred | 0f91309598 | |
fred | 002d9ff599 | |
fred | a8990ce2df | |
fred | 4fea205f55 | |
fred | 3f19d12b54 | |
fred | 52ae17019a | |
fred | 0a40ff9d91 | |
fred | a7991fe9e7 | |
fred | f14b329b4d | |
Jonio | 44cb0999e3 | |
JonioDiPonio | c977b22a0f | |
fred | 5f903b7dd3 | |
fred | aecd5baecc | |
fred | 86e77936a1 | |
fred | f77c001b75 | |
fred | e857837c9b | |
fred | 22c2814b3a | |
fred | e320ed4161 | |
fred | 252709f8d9 | |
fred | 3af864f5de | |
fred | d4ddfd15d3 | |
fred | 7888472307 | |
fred | e933bdbb11 | |
fred | caa667f3f8 | |
fred | 7005c995b6 | |
fred | 6386accc27 | |
fred | a4e5e201e0 | |
fred | c367454f87 | |
fred | 0f2148a29b | |
fred | c76739652b | |
fred | f28bed7224 | |
fred | 46db511e2a | |
fred | f3bfe7178e | |
fred | 398529dffd | |
fred | 17c35ce894 | |
fred | 5c81299ef1 | |
fred | 0c9299bb8d | |
fred | 420dbf35f0 | |
fred | ffeba37cd2 | |
fred | 1a2041a280 | |
fred | b3b663ccc6 | |
fred | 65bff37712 | |
fred | 595a37c38b | |
fred | 1822563569 | |
fred | 3eddfbeccb | |
fred | 9d6daccf29 | |
fred | 8cee5c3b9c | |
fred | 526a67114a | |
fred | 68881f008d | |
fred | 22fd4a481b | |
fred | c878cfffa8 | |
fred | 58e38a4b09 | |
fred | d92aa2d88d | |
fred | f5c1911773 | |
fred | d7fb8260f3 | |
fred | 4bc73417fc | |
fred | 839974abc1 | |
fred | 843a32e522 | |
fred | 0a8a1188c6 | |
fred | f18256ec8b | |
fred | 100fccfcc0 | |
fred | 9d912e5247 | |
fred | f7002dce99 | |
fred | 2717a9f97e | |
fred | eb5bda3b10 | |
fred | 81087d3a04 | |
fred | 66272bb99f | |
fred | 76df4cde8d | |
fred | 121e139621 | |
fred | 8c3c8ac157 | |
fred | 774d6f7e7a | |
fred | d5c4414747 | |
fred | 59753a3d45 | |
fred | d28f21bc0a | |
fred | e1bb6cfadd | |
fred | 8d6329eda6 | |
fred | 159d7d54b3 | |
fred | ff3075386d | |
fred | b74aa9f37b | |
fred | b3c3856963 | |
fred | e867cb3960 | |
fred | efe8a15a4c | |
fred | ff780ca171 | |
fred | dde884d38e | |
fred | c9fd71a52c | |
fred | 49098cd614 | |
fred | d17a164776 | |
fred | 7888a31830 | |
fred | 85eb8221ee | |
fred | 2d9b301064 | |
fred | 66a6233a85 | |
fred | 44837aff91 | |
fred | b2095a6156 | |
fred | b5a50781da | |
fred | 8ef8a39185 | |
fred | 4b65ab00d6 | |
fred | c013c6f0e5 | |
fred | 49747a6ef1 | |
fred | 6199854076 | |
fred | 91109a0918 | |
fred | c0914a2393 | |
fred | 922adfcafb | |
fred | 192943be08 | |
fred | 80f70d84b4 | |
fred | cdb75fb8cd | |
fred | 89b2b06694 | |
fred | 50c95d9a32 | |
fred | adce8d8c10 | |
fred | c8d96e82e4 | |
fred | ebd0ef5c07 | |
aynic.os | dd2046f587 | |
aynic.os | 174f620460 | |
fred | b1d87c0a11 | |
fred | 0a8988152f | |
aynic.os | 5fd1bb48c5 | |
fred | af183456ca | |
fred | 2db1c4153b | |
fred | 814c8e4e7a | |
fred | 64c4d5af23 | |
fred | 72f450da0d | |
fred | 2f0725affe | |
fred | d9de4f7c69 | |
fred | 66b0f7d035 | |
fred | f0ae1d65dc | |
fred | 2dd3dd411d | |
aynic.os | b95b9853ad | |
fred | 07a7f68d73 | |
fred | d72eafc405 | |
fred | 91ca169fb2 | |
fred | b0a2343886 | |
fred | 73e394d538 | |
fred | 1c2133460d | |
fred | c3a57ca481 | |
fred | 8b6531988c | |
fred | a1ad191d30 | |
fred | e16d8777c3 | |
fred | 96b5fd260d | |
fred | 830a11ee83 | |
fred | db7cbaa9fa | |
fred | dcb471c0ad | |
fred | 7820691038 | |
fred | e4fead53b5 | |
fred | 4f6be54321 | |
fred | b360ba3ab9 | |
fred | 0660aff78b | |
fred | 3bdd958828 | |
fred | 58994e2aa4 | |
fred | cf4a688c05 | |
fred | eb115a37db | |
fred | 6fa5508b92 | |
fred | e11fe58bdc | |
fred | 3cf1422eac | |
fred | 8eb67e2a3a | |
fred | 5185c473a9 | |
fred | 81f6c817f6 | |
fred | bea59680fa | |
fred | 167486cb92 | |
fred | 8ba27150bd | |
fred | 521c7d5469 | |
fred | b3f2bd5a0f | |
fred | 214727741c | |
fred | 258faa6609 | |
fred | 46aee42115 | |
fred | 89727c2ab1 | |
fred | ea1d10354b | |
fred | b0ef9af415 | |
fred | ba010ce3a7 | |
fred | 95f61c4f6e | |
fred | 3db5b854b9 | |
fred | 8eb0660a34 | |
fred | d8decf671b | |
fred | e7feddd775 | |
fred | d8ec646a3f | |
fred | a9fb7a85c5 | |
fred | c66c233989 | |
fred | ebb2ff59f7 | |
fred | 7b3fbf1a1f | |
fred | 24701e1aac | |
fred | 8cfa5cf76c | |
fred | 36d04f8447 | |
fred | 56df7fccc2 | |
fred | 5bba9d4000 | |
fred | a4726a115d | |
fred | 8b94f603df | |
fred | 33833ed708 | |
fred | aedd8e1b52 | |
fred | 442ceb04d4 | |
fred | 1e137bbe82 | |
fred | 014fb5a99e | |
fred | 4affb86489 | |
fred | 76ca27a5a4 | |
fred | a1f9fe05f9 | |
fred | 5b6e2473e5 | |
fred | e96fabb97d | |
fred | 5bfad89065 | |
fred | 4715efb4e3 | |
fred | 216dc1dbd7 | |
fred | e9dee076e1 | |
fred | 2a293d1fc3 | |
fred | 9978e606f0 | |
fred | e10a318a91 | |
fred | 3a5b7a3335 | |
fred | 56e29ea22d | |
fred | 20ff5746ca | |
fred | f9dbfd8dc9 | |
fred | 45647e3037 | |
fred | b485b60325 | |
fred | f81ac4c1a6 | |
fred | dbccb945c7 | |
fred | d08dce6d72 | |
fred | 85d09aa14b | |
fred | 40f51e375c | |
fred | ed4a2b49a3 | |
fred | d638fc4793 | |
fred | 8ee934ab00 | |
fred | 4d8baec5b5 | |
fred | 6f0e94fd3e | |
fred | 6aecccba2c | |
fred | 9c19754d24 | |
fred | 924808ac04 | |
fred | b5c21d825c | |
fred | e21c6e4e59 | |
fred | 1051fabf20 | |
fred | eddae0c7c9 | |
fred | 9aadaa4e55 | |
fred | 699e51a576 | |
fred | b51be6bb09 | |
fred | afed1ac6b4 | |
fred | 522dbcef3a | |
fred | b86b154785 | |
fred | 914025775d | |
fred | 541570f145 | |
fred | f034722f8b | |
fred | bd0abd9c39 | |
fred | 420a488e67 | |
fred | 4af28a8840 | |
fred | 04a210ddbb | |
fred | 4bf875dabf | |
fred | f1b48fb7d1 | |
fred | 601d33a463 | |
fred | a68d8b33ab | |
fred | 618ad5eaca | |
fred | c6bae83332 | |
fred | 7612da2fca | |
fred | 3469acc3e6 | |
fred | 1ff1d5e305 | |
fred | 2d59456951 | |
fred | 551d2d911f | |
fred | 5500a240c2 | |
fred | 70ee8cebb8 | |
fred | f2cb1ea33e | |
fred | d215546de1 | |
fred | 0e49836467 | |
fred | 72f4e77b77 | |
fred | a1838a1cc0 | |
fred | 255001d7f8 | |
fred | 98f765f1c2 | |
fred | 47345bdc67 | |
fred | f4830b85d9 | |
fred | 5e561ae3f5 | |
fred | bd44f61755 | |
fred | 2224544b95 | |
fred | 73ee81cc12 | |
fred | 4cd7ca89d8 | |
fred | 30ade33e4b | |
fred | c4b316c658 | |
fred | 65e0e557ce | |
fred | ba748e85c1 | |
fred | 72ae1d7855 | |
fred | fb64f253d1 | |
fred | 92fc6780d4 | |
fred | 18ffeafb41 | |
fred | 69ed051b7a | |
fred | 7337de7000 | |
fred | a59d4d9ccc | |
fred | 0a18b3b362 | |
fred | a9717a78d0 | |
fred | 6e62165480 | |
fred | 998af2376d | |
fred | 420c5e03f7 | |
fred | 5e581dbaed | |
fred | 207b28875d | |
fred | 6cd0fc7403 | |
fred | 8a4ceabf1a | |
fred | 176202d48f | |
fred | 044f429770 | |
fred | 57f62ba254 | |
fred | 10309bc08d | |
fred | 5ed0b7797b | |
fred | 7fd22aa70c | |
fred | df70031910 | |
fred | 042e1ce670 | |
fred | 8a1f1635ca | |
fred | d87550beb0 | |
fred | 4edf93fea5 | |
fred | 901e5e6bd7 | |
fred | 8fab358bc1 | |
fred | 209c9515c9 | |
fred | ddc5a7dee4 | |
fred | f7fef2fdb4 | |
fred | c3176d2a4b | |
fred | f029251571 | |
fred | 9c3ad6bf08 | |
fred | 5d4798f331 | |
fred | 1afc0e9a2b | |
fred | f6daf7f322 | |
fred | a99b69f11e | |
fred | ec3bdaf4c5 | |
fred | 95a555dbbe | |
fred | 23b7f674a4 | |
fred | 2c19d599b5 | |
fred | 8d2df19b73 | |
fred | e58ca592ac | |
fred | 1ce78004e8 | |
fred | e93a3aa785 | |
fred | 46c1fb5c22 | |
fred | 374903ddb4 | |
fred | 3a3d70a5cc | |
fred | 8370eb9424 | |
fred | dfec4fea65 | |
fred | 2d0da3df18 | |
fred | 4fa66ada1a | |
fred | b6f35e9ebd | |
fred | bf22b7968e | |
fred | 7b34d77c38 | |
fred | 39852a73c7 | |
fred | 51448e48fd | |
fred | 132e7bbea4 | |
fred | 3708707231 | |
fred | d714c15b69 | |
fred | 7df4a6cb68 | |
fred | 5e0230294c | |
fred | ef43755c81 | |
fred | de6d3fe012 | |
fred | 6dc269f58c | |
fred | e1f908c3df | |
fred | 8344a12dd1 | |
fred | 38659ad19a | |
fred | 7dd90e385e | |
fred | 901bb879b3 | |
fred | ad53814c69 | |
fred | 8d1c5f01b2 | |
fred | 9d72e401fe | |
fred | b174e15995 | |
fred | 201c276a19 | |
fred | 7c698e38a1 | |
fred | 32b42cf07c | |
fred | 119f3b9b0c | |
fred | 1bfca63e46 | |
fred | a9da1f3fd2 | |
fred | f9798a2dab | |
fred | 036dedc322 | |
fred | 271f4b6b8f | |
fred | b0f385bd5d | |
fred | 94ee9dd562 | |
fred | 5ee755686d | |
fred | 76dc9e1bd4 | |
fred | 02e01939ba | |
fred | 082408b957 | |
fred | c767f69b69 | |
fred | 9ec2df17f7 | |
fred | 5b123d9d5c | |
fred | 37445d7ba2 | |
fred | e4eaaa5728 | |
fred | e37392e54a | |
fred | 45b6d276e0 | |
fred | 182b665010 | |
fred | ac25e42e73 | |
fred | f205a51009 | |
fred | 5f1d43a0b3 | |
fred | 149f830186 | |
fred | c1821444cf | |
fred | c29aeb3c7a | |
fred | 3205d0bb1d | |
fred | e305b21a9c | |
fred | 671f9161d6 | |
fred | f83e1606e0 | |
fred | 6a409ad5c1 | |
fred | 087a6ad1f6 | |
fred | 6963bdc84d | |
fred | 2c94b442e5 | |
fred | 508022fe8f | |
fred | 8f8166d9d5 | |
fred | 3cd930f911 | |
fred | 6728075d91 | |
fred | 26670c8cec | |
fred | 472905d6f3 | |
fred | e6e56e1919 | |
fred | 6e0c3d789c | |
aynic.os | 7637d213b7 | |
fred | 6a2f262d1c | |
fred | 10e3da0044 | |
fred | 501843b7bb | |
fred | 684ef63909 | |
fred | faf693ab97 | |
fred | 5a4468ff07 | |
fred | 81e2b16824 | |
fred | a1b82be754 | |
fred | d883a207ad | |
fred | 7cd484b776 | |
fred | d2d1e0ec80 | |
fred | aa91a4f708 | |
fred | b3fd287519 | |
fred | fa1323366b | |
fred | 955ac3d382 | |
fred | b6cd5ab63d | |
fred | d15696d2ef | |
fred | 15ef3a8a8a | |
fred | f19081f12a | |
fred | ec83600bf9 | |
fred | 4ac4eca9fe | |
fred | 05a5ef867a | |
fred | 4ce31a812a | |
fred | 041cbf94ed | |
fred | b16b26459c | |
fred | 24f0043948 | |
fred | b8345de735 | |
fred | 6c623bfa03 | |
fred | 842df7e71d | |
fred | 48d13b7a48 | |
fred | d2dfdec89e | |
fred | 78b5c7aeee | |
fred | bc686e2b11 | |
fred | 08ab7d774a | |
fred | 9b685a3da0 | |
fred | ebf9d4d212 | |
fred | f3e36a3dcd | |
fred | 5331d46957 | |
fred | a52f53faad | |
fred | 18e85edc8d | |
fred | 09df72499f | |
fred | f9ca8a13a7 | |
fred | 763556fb4b | |
fred | 80b329f4c0 | |
fred | fe239b77bb | |
fred | 02dd2e8329 | |
fred | af8f3ecdb4 | |
fred | 79c7b50c24 | |
fred | 3acb4c366f | |
fred | 2a93d99965 | |
fred | dd4ea64cfb | |
fred | d57b639e47 | |
fred | 43fe8ac749 | |
fred | 7674062569 | |
fred | 8479bf7c97 | |
fred | f714cd3801 | |
fred | c4b8658aa1 | |
fred | d35944962e | |
fred | aff11948ba | |
fred | a0a39c8af7 | |
fred | 81308cf6c0 | |
fred | 4e919399b5 | |
fred | 4067b64c60 | |
fred | df7d2eb972 | |
fred | f56314a0fd | |
fred | 234ce18aef | |
fred | a532345130 | |
fred | 8914fde3eb | |
fred | 0a6c811c4c | |
fred | e284a53d4d | |
fred | 59954771cc | |
fred | a5975d19d5 | |
fred | bf102fe71a | |
fred | d3a2835dbd | |
fred | 36aac6bb74 | |
fred | 6aa24b62d4 | |
fred | c937a75292 | |
fred | 4e5d206b64 | |
fred | 34c6383ce6 | |
fred | 8c223a140f | |
fred | 1b61a767c4 | |
fred | 66e766563f | |
fred | 1e12d683d2 | |
fred | c7bd3b2298 | |
fred | f4371a1375 | |
fred | 779df0d09e | |
fred | 63f96bd547 | |
fred | e0a3f5ad84 | |
fred | c6e668c548 | |
fred | 5f7748c1ea | |
fred | d294eeaafb | |
fred | 752a1072da | |
fred | 6471dcab15 | |
fred | 2218958d85 | |
fred | cf97839a81 | |
fred | 09fe26c632 | |
fred | 95a0abd229 | |
fred | 416da3cec5 | |
fred | 663f7a26d2 | |
fred | e7bb21149a | |
fred | 5b0dfbabba | |
fred | 37fbc674e0 | |
fred | b43123c578 | |
fred | 68465e63bf | |
fred | 7d36c2fcab | |
fred | 9ce47f0157 | |
fred | 7ed17f22e8 | |
fred | 3d40288540 | |
fred | 19cfeeb04e | |
fred | 20eae30528 | |
fred | 9c38d6e954 | |
fred | 155a5cfc54 | |
fred | 06abde6e36 | |
fred | 18878b602c | |
fred | 4e3119f576 | |
fred | 323c9ff40e | |
fred | 708b0a3e87 | |
fred | f572c4470d | |
fred | 39849e1254 | |
fred | 4460b23a87 | |
fred | e495e860a8 | |
fred | 95507e0315 | |
fred | 87e30178fe | |
fred | f4eaad73e3 | |
fred | 74071104b0 | |
fred | c9eb4eb2e4 | |
fred | 8708c2cb50 | |
fred | 53003497bb | |
fred | 8d8e15e1a4 | |
fred | 302ae697fa | |
fred | bc2d16c840 | |
fred | 1f382574a4 | |
fred | 2cec42fa8e | |
fred | 68e1246d63 | |
fred | 9a6ea83c9d | |
fred | fccd11e623 | |
fred | 2769c656d9 | |
fred | 905d7f132a | |
fred | f0f64bd180 | |
fred | bd919b0394 | |
fred | 98668ba4a7 | |
fred | ab1411750c | |
fred | 8f7ab6099e | |
fred | 87781f3236 | |
fred | aabe8c01f6 | |
fred | 01b860d8cf | |
fred | f039d5958b | |
fred | effab20e3e | |
fred | b2fb1f1bfe | |
fred | 82b4d60519 | |
fred | 50e44c7415 | |
fred | 0a723be3e0 | |
fred | 8bba2dacb5 | |
fred | 553373180f | |
fred | 5e3638b7d6 | |
fred | 26ee21b165 | |
fred | b9076d6cd1 | |
fred | f13be7b276 | |
fred | 0d55f29d6a | |
fred | 5ee4f1d4ed | |
fred | a89cd69631 | |
fred | b1949789c6 | |
fred | d7fab30ab7 | |
fred | 9bd0ed4094 | |
fred | 3b9048cdcc | |
fred | ce2c04eac6 | |
fred | b5e78178eb | |
fred | bf956f35ba | |
fred | 423280f29c | |
fred | d15fe6fb2b | |
fred | 3b4d24ba64 | |
fred | e59eb98d31 | |
fred | c056afdd48 | |
fred | 6963fd8f1e | |
fred | d5093f90db | |
fred | 027d947ea4 | |
fred | 8a482a4648 | |
fred | 28395c89f5 | |
fred | d9b86f3f0e | |
fred | 834edad954 | |
fred | 024e9cd972 | |
fred | cee27162f0 | |
fred | fa04f27710 | |
fred | b82fa2f134 | |
fred | 6cb83834b2 | |
fred | ba8845d1aa | |
fred | d6e73b500b | |
fred | 620659f710 | |
fred | 6e431a9da1 | |
fred | 15ee4afdad | |
fred | 4627dbcda0 | |
fred | ffbfef7304 | |
fred | ddfae0e423 | |
fred | 3ba64d1be9 | |
fred | e689bfd354 | |
fred | 1b63e7c449 | |
fred | 6ab293ff05 | |
fred | f78c8041f0 | |
fred | 666a0a8dc8 | |
fred | 278255feb4 | |
fred | 21ca95fe0f | |
fred | 4590d0b7a3 | |
fred | f877cceba7 | |
fred | 6b53a9093b | |
fred | f256523637 | |
fred | 8807970cdb | |
fred | 3d91fb0cd0 | |
fred | f31aa39c80 | |
fred | 0b800bf4f8 | |
fred | 414609a859 | |
fred | ad07d6d88c | |
fred | 7e639eb414 | |
fred | c2b9ced029 | |
fred | dbaa4a9cbd | |
fred | 8339311d19 | |
fred | e316d5f1c4 | |
fred | 81066d12e7 | |
fred | dab40e065a | |
fred | 34f72ea274 | |
fred | 333cc6cdc1 | |
fred | 025df24806 | |
fred | 6272e89a24 | |
fred | fbf9ded5ef | |
fred | 9c35624413 | |
fred | 93e40403f3 | |
fred | 33926d0e0f | |
fred | f5cb83cfb4 | |
fred | cbad92edb1 | |
fred | 1ee302a622 | |
fred | 9b3c72dca4 | |
fred | 482e6fe920 | |
fred | 0290d4017b | |
fred | 46ab6f015f | |
fred | 6fb049c192 | |
fred | 75cf71307f | |
fred | e681137d6d | |
fred | 400c9f6358 | |
fred | 4d6cf631fa | |
fred | dc729542aa | |
fred | 282509fe28 | |
fred | 26bf94f0fe | |
fred | 78a5d496b7 | |
fred | 435aeeb883 | |
fred | 3abe9eb39a | |
fred | 776f36259e | |
fred | e372c80769 | |
fred | c6cc502203 | |
fred | 1c8d64fd53 | |
fred | a83257c215 | |
fred | 261f527f20 | |
fred | 45cb56070a | |
fred | 1c669d1dd3 | |
fred | f99cdd2e1c | |
fred | 26179c0ff2 | |
fred | 9346938eed | |
fred | 491f509e0c | |
fred | a81b92ac6a | |
fred | 851079ef02 | |
fred | f74624d725 | |
fred | 164c6bf7a1 | |
fred | 5888e06eb6 | |
fred | b99e3bc8a1 | |
fred | 9da9f92582 | |
fred | e3b7a26e26 | |
fred | fd50ffad45 | |
fred | edaac3df42 | |
fred | 7b280f585f | |
fred | d31fd9cfee | |
fred | eb1dbad28e | |
fred | 1f69d2d9c4 | |
fred | 505df45d61 | |
fred | a052f681fd | |
fred | 9f7ea817aa | |
fred | 92a6e42f22 | |
fred | bdb1a12b88 | |
fred | c2bbaca55a | |
fred | 9c6607d865 | |
fred | 2fa7bc613a | |
fred | 1d727af793 | |
fred | e8eb8fa8cd | |
fred | e36c8e8f2a | |
fred | 17681e86a8 | |
fred | 7baeb14ca2 | |
fred | cb0e58d395 | |
fred | 05131bca38 | |
fred | 0805e918fc | |
fred | 3cdeb73053 | |
fred | 3190f0795a | |
fred | b9d1b5beff | |
fred | fc6e3bbbd1 | |
fred | 96bc4b48cf | |
fred | f85c2b82ed | |
fred | bd475abb2f | |
fred | 5fdaa737f4 | |
fred | 9a6ad5b7a2 | |
fred | 68528599c2 | |
fred | 9f06e445bb | |
fred | b837f4cd4d | |
fred | 44ffa4c4a0 | |
fred | fe81ad0fea | |
fred | 8d41fbb484 | |
fred | 8cdd1471bb | |
fred | bb9b7bf070 | |
fred | 3d29a5b36f | |
fred | d50dae7ee6 | |
fred | 21cf3d8998 | |
fred | b086446dfc | |
fred | 1279f1d198 | |
fred | c2d2b61f92 | |
fred | 5a06a1232b | |
fred | 1594599785 | |
fred | 87bcfbac34 | |
fred | a6940e2bc3 | |
fred | 60e7669f52 | |
fred | a938a81c32 | |
fred | cb335842ca | |
fred | 4ffc937304 | |
fred | f8847a776a | |
fred | 6ddd839231 | |
fred | 94cba1e6ed | |
fred | a83f770933 | |
fred | 2584bb7376 | |
fred | ea05694891 | |
fred | f458d74b79 | |
fred | 7f676804a2 | |
fred | 94e4db5ba4 | |
fred | 2f239feaa6 | |
fred | bd4c9e8ca9 | |
fred | bde14d4bc8 | |
fred | 8e2141b35f | |
fred | d593908810 | |
fred | 8972651f8c | |
fred | 6760beb631 | |
fred | 9d851aadf6 | |
fred | 33e653a8b8 | |
fred | 103e7805e6 | |
fred | 4811fb33e0 | |
fred | 661add1ed1 | |
fred | 6ce3f9c0b8 | |
fred | 1baf358815 | |
fred | c6c864d612 | |
fred | 1f22c8ad7a | |
fred | ca1ee54682 | |
fred | fbe2d97ad3 | |
fred | 09f4b78a06 | |
fred | d91e8e9628 | |
fred | 7e0d2fe193 | |
fred | 5528b3d0b0 | |
fred | 964ac5e4a9 | |
fred | 7fbae8bfeb | |
fred | c1f8201a85 | |
fred | 9bcd7724fe | |
fred | af9465b80d | |
fred | aa2bc61b9d | |
fred | 43f1b8d1b6 | |
fred | 3840a3002c | |
fred | 1cc89cf654 | |
fred | 68b351ca3d | |
fred | 689ca72487 | |
fred | ec6a99a278 | |
fred | 056c9f9c50 | |
fred | 8d9e31a9fa | |
fred | 04cbd612d9 | |
fred | 4dd0c1f4d4 | |
fred | a86a1a2f46 | |
fred | 73d89a42a5 | |
fred | 79159a53e3 | |
fred | 08549d37ca | |
fred | 07a59dba57 | |
fred | 0746bbf639 | |
fred | f59c4b3d9c | |
fred | f7a413ce36 | |
fred | acc3c79417 | |
fred | 9115f4b136 | |
fred | 624e06544a | |
fred | 3f549b8dee | |
fred | 637b1816ad | |
fred | 6fe4f63965 | |
fred | b83852a172 | |
fred | ba40f680c3 | |
fred | 6e1d3a5ccb | |
fred | 0846815031 | |
fred | e63bcc1899 | |
fred | 39dca34629 | |
fred | f328559f82 | |
fred | 9b8c51de5d | |
fred | 0cf83a5d51 | |
fred | 838779469d | |
fred | 87364ad711 | |
fred | 1b7a7f4ab0 | |
fred | eea9199356 | |
fred | 6d0a510032 | |
fred | 0022173acd | |
fred | 3e534461d0 | |
fred | 11d875ebf0 | |
fred | 79af5d395d | |
fred | 5563061104 | |
fred | 9ca6a52718 | |
fred | 96416bd126 | |
fred | de43c71fcd | |
fred | cdba41aa52 | |
fred | ec34535245 | |
fred | aea265a1fd | |
fred | 3bf28044b0 | |
fred | 26e841caf3 | |
fred | aa75d8a6a5 | |
fred | 77c033fa80 | |
fred | 81384aaecd | |
fred | 081c330277 | |
fred | 2d04627169 | |
fred | 30adac7b5a | |
fred | bca4bea4c0 | |
fred | f4cccc2343 | |
fred | 26cdb3bbed | |
fred | 91735a9b8e | |
fred | 8a9a3f9cd8 | |
fred | d5c2e07450 | |
fred | e636ef09e9 | |
fred | b655bebdd4 | |
fred | 3df723b300 | |
fred | 28d98e01ee | |
fred | 9d55782823 | |
fred | d2221566cb | |
fred | e9649fce94 | |
fred | d5aec2b9cc | |
fred | 44f2aa2872 | |
fred | 14a46e2b2c | |
fred | 291a480dde | |
fred | d9696fdbeb | |
fred | 9ffab4c3fd | |
fred | 514994260f | |
fred | 887a26cafc | |
fred | 317e1efaf9 | |
fred | 1d2a7470e6 | |
fred | 0976735cd7 | |
fred | 04c88a4af9 | |
fred | f1ff2d4d20 | |
fred | dfdee394e5 | |
fred | c6a9c7c764 | |
fred | 09d9c3e5e4 | |
fred | 3b9a7155d9 | |
fred | 0ecd9ee77b | |
fred | 192763dc80 | |
fred | 4f7ba1ec93 | |
fred | 1677814e7b | |
fred | 11a197cfca | |
fred | 72103666e0 | |
fred | a1eb3f235f | |
fred | 72c571dcd9 | |
fred | c5f2c18f18 | |
fred | 7458e23752 | |
fred | 6509780051 | |
fred | b5d6003379 | |
fred | 019bdfe8bb | |
fred | 47d4138685 | |
fred | a78e391bdb | |
fred | a5130ba926 | |
fred | 42c0513b91 | |
fred | f2facf526d | |
fred | 98e4b62bb6 | |
fred | 1618fa2924 | |
fred | 0d27f4d88b | |
fred | 1a6b4d653c | |
fred | 701261c5f0 | |
fred | 54f767c116 | |
fred | 42801f6525 | |
fred | e646c91443 | |
fred | c9cfd1976a | |
fred | 66ac4b8fdb | |
fred | 8909459dce | |
fred | a11f8a5355 | |
fred | f21832937f | |
fred | 27bcef2e63 | |
fred | 1aa277ee09 | |
fred | 5703a4e81e | |
fred | 45487ac41f | |
fred | 8a10eb9c53 | |
fred | 73a20e82f7 | |
fred | 90b8ff7013 | |
fred | 36409d10f3 | |
fred | 5b4bee5066 | |
fred | 78535de293 | |
fred | 0485eb431f | |
fred | f9bffdd305 | |
fred | 20b8a6e41c | |
fred | d634c9c673 | |
fred | fba77af447 | |
fred | 45e421b89f | |
fred | d8c206fd36 | |
fred | 809c61561b | |
fred | e1899099ac | |
fred | ce226d741a | |
fred | bff56cd062 | |
fred | 787768aba5 | |
fred | a189833eb6 | |
fred | 1afe72d6ba | |
fred | 0c55445a0f | |
fred | d69ac4bf14 | |
fred | eee9bb2a2a | |
fred | ad57993444 | |
fred | b4215a550a | |
fred | 4e9c4a5050 | |
fred | 1dc9a4fb0a | |
fred | 4ca5ef07ce | |
fred | efc6bb4c91 | |
fred | d9ebd8b955 | |
fred | e98d0d1ebc | |
fred | eeac171c52 | |
fred | 3a81b50313 | |
fred | bf3ce311ff | |
fred | bf338b368a | |
fred | e6bad0633c | |
fred | fe19934100 | |
fred | 9368e21a17 | |
fred | d4f915e94d | |
fred | aef6e5a89c | |
fred | b5c6dd6c65 | |
fred | 45abea9b80 | |
fred | 5c507268bb | |
fred | 3186726f76 | |
fred | 3500911874 | |
fred | 9bf211fae9 | |
fred | 823588beb8 | |
fred | cc88d690df | |
fred | 716fc91737 | |
fred | d562f3ab7b | |
fred | c0190f7880 | |
fred | d1e56500fb | |
fred | c9d16af39c | |
fred | 9095333b5c | |
fred | 382a10a415 | |
fred | 2ea072ed25 | |
fred | e16d200333 | |
fred | 31ba8c9552 | |
fred | bd5ae1939b | |
fred | 0b8ab3c608 | |
fred | 3624003355 | |
fred | 392687f8d0 | |
fred | 17cddeb5d5 | |
fred | fc16efd83f | |
fred | e5ddce0b79 | |
fred | 33ac36f226 | |
fred | 01da5a332f | |
fred | 487abdcd80 | |
fred | 89541c5ff5 | |
fred | d472f9682f | |
fred | 8865ab418d | |
fred | 55a49fdf3c | |
fred | 9c113ae94d | |
fred | f767e5cc2c | |
fred | b62d00d0c3 | |
fred | 68013d01ac | |
fred | 53bba36065 | |
fred | c702c67a98 | |
fred | ec52ea6366 | |
fred | bb829938cf | |
fred | ccc807dfd5 | |
fred | f0d58decfb | |
fred | 63353dc702 | |
fred | cceda4a195 | |
fred | a0b270a347 | |
fred | df7d41bfc7 | |
fred | 3b49124306 | |
fred | 446ac51391 | |
fred | 32dce24893 | |
fred | 21ffedfbe3 | |
fred | ed7146cfa9 | |
fred | 4154652817 | |
fred | 1ad01d0aec | |
fred | 4a6b87acd4 | |
fred | 0756e6c5eb | |
fred | cf1da7a9d5 | |
fred | df0bee625a | |
fred | 45e7624417 | |
fred | ad331f7e5f | |
fred | d50eff367e | |
fred | c8e841b609 | |
fred | 5ae461e6cc | |
fred | 65bfc83050 | |
fred | 1877115dcc | |
fred | a012b67e08 | |
fred | e31f00d0e4 | |
fred | eb8ab6433b | |
fred | 55fbfdf46e | |
fred | 7d0818f5da | |
fred | 6b7f31d795 | |
fred | 4ea28098f5 | |
fred | 0c97990741 | |
fred | 8c94147fed | |
fred | c40423a2a3 | |
fred | 123907887d | |
fred | 274d1df66f | |
fred | 8b65637833 | |
fred | 27673e3977 | |
fred | 36654944a1 | |
fred | c7e654cf39 | |
fred | f27de9657f | |
fred | f72c77638c | |
fred | 274780d002 | |
fred | f3e463827d | |
fred | 3889d3ee1e | |
fred | bdeb411f4c | |
fred | 30617eb9a8 | |
fred | 3074add864 | |
fred | a9a19425fc | |
fred | 45fb8275ff | |
fred | 8b6bb474cc | |
fred | f32614f925 | |
fred | 9ac4e04cd8 | |
fred | 569c64be00 | |
fred | 4fd9fa4ed2 | |
fred | 1a00441a81 | |
fred | 83cc6c1a9b | |
fred | 23cd457369 | |
fred | bfde0c967f | |
fred | c9982c4a7e | |
fred | 11d69d658f | |
fred | 4110474930 | |
fred | 739fe351e2 | |
fred | 87f44a5adf | |
fred | 19ecb90a75 | |
fred | 63175f63fa | |
fred | d05520ca4a | |
fred | d039bf5a02 | |
fred | 1db9f05d7c | |
fred | 71f68b74dc | |
fred | 3899cc8e84 | |
fred | 11fca8cdba | |
fred | f93f0a0612 | |
fred | f4c584ef65 | |
fred | d574d880c7 | |
fred | 949218da6e | |
fred | c13c1e1b7e | |
fred | 4abae956ba | |
fred | 5be23f02f2 | |
fred | 0e8c0a4ea0 | |
fred | 610b93ea63 | |
fred | 997d75bb31 | |
fred | b5ba93b20f | |
fred | 34c5e9d1c5 | |
fred | 7816a0c707 | |
fred | 8a282df3cb | |
fred | 7e44594ca4 | |
fred | 9bea4bcb9a | |
fred | 73124bdfcf | |
fred | e709bc9b88 | |
fred | 1b3e9c4fbc | |
fred | 9fbd55e70b | |
fred | e46a86ad74 | |
fred | cac4f43687 | |
fred | 8fc3f1e72a | |
fred | d1546bf557 | |
fred | 6fd76563dc | |
fred | 633cca724c | |
fred | b6f1576b3f | |
fred | 412ccf6e3a | |
fred | 7a875bf2ea | |
fred | d06e6c6019 | |
fred | bb263ca071 | |
fred | 05ed91f091 | |
fred | fd3cb48fae | |
fred | 63caa30c64 | |
fred | beee918361 | |
fred | debf88d8bd | |
fred | 4d26b1d8b7 | |
fred | 688debb7ee | |
fred | 149cf00408 | |
fred | a203885dc3 | |
aynic.os | 84e6c11dbf | |
fred | b60b36eb45 | |
aynic.os | 004ce85c50 | |
fred | aee32ff597 | |
fred | 30d053d6ad | |
fred | aaa84cb7b8 | |
fred | bd2eccccf8 | |
fred | 9ffb90ecbe |
|
@ -1,2 +1,5 @@
|
|||
.env
|
||||
*.pyc
|
||||
__pycache__
|
||||
tiddlywiki.html
|
||||
tools/jaklis/.env
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# .readthedocs.yaml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the OS, Python version and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.12"
|
||||
# You can also specify other tool versions:
|
||||
# nodejs: "19"
|
||||
# rust: "1.64"
|
||||
# golang: "1.19"
|
||||
|
||||
# Build documentation in the "docs/" directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF and ePub
|
||||
# formats:
|
||||
# - pdf
|
||||
# - epub
|
||||
|
||||
# Optional but recommended, declare the Python requirements required
|
||||
# to build your documentation
|
||||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
||||
# python:
|
||||
# install:
|
||||
# - requirements: docs/requirements.txt
|
155
12345.sh
|
@ -13,7 +13,7 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/tools/my.sh"
|
||||
|
||||
PORT=12345
|
||||
PORT=45779
|
||||
|
||||
YOU=$(myIpfsApi); ## API of $USER running ipfs
|
||||
echo "YOU=$YOU"
|
||||
|
@ -22,34 +22,24 @@ PORT=12345
|
|||
TUBE=$(myTube)
|
||||
echo "TUBE=$TUBE"
|
||||
|
||||
mkdir -p ~/.zen/tmp/coucou/ ~/.zen/game/players/localhost
|
||||
mkdir -p ~/.zen/tmp ~/.zen/game/players/localhost # ~/.zen & myos compatibility
|
||||
|
||||
## CHECK FOR ANY ALREADY RUNNING nc
|
||||
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||
ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ $ncrunning ]] && echo "RESTARTING" && kill -9 $ncrunning
|
||||
## NOT RUNNING TWICE
|
||||
|
||||
# Some client needs to respect that
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
HTTPCORS='HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Methods: GET
|
||||
Server: Astroport.ONE
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
"
|
||||
echo "_________________________________________________________ $(date)"
|
||||
echo "LAUNCHING Astroport API Server - TUBE : $LIBRA - "
|
||||
'
|
||||
echo "_____________________ $PORT ________________________________ $(date)"
|
||||
echo "LAUNCHING Astroport API Server : ASTROPORT : ${myASTROPORT}"
|
||||
echo
|
||||
echo "GCHANGE ${myASTROPORT}/?salt=totodu56&pepper=totodu56&g1pub"
|
||||
echo "OPEN TW ${myASTROPORT}/?salt=totodu56&pepper=totodu56&g1pub=astro"
|
||||
echo "GCHANGE MESSAGING ${myASTROPORT}/?salt=totodu56&pepper=totodu56&messaging"
|
||||
echo "CREATE SAME PLAYER : ${myASTROPORT}/?salt=totodu56&pepper=totodu56&g1pub=on&email=totodu56@yopmail.com"
|
||||
echo
|
||||
echo "NEW PLAYER : ${myASTROPORT}/?salt=${RANDOM}&pepper=${RANDOM}&g1pub=on&email=astro${RANDOM}@yopmail.com"
|
||||
echo
|
||||
echo "BunkerBOX : ${myASTROPORT}/?salt=totodu56&pepper=totodu56&g1pub=_URL_&email=totodu56@yopmail.com"
|
||||
echo
|
||||
echo "TESTCRAFT ${myASTROPORT}/?salt=totodu56&pepper=totodu56&testcraft=on&dataid=QmPXhrqQrS1bePKJUPH9cJ2qe4RrNjaJdRXaJzSjxWuvDi"
|
||||
echo "_________________________________________________________"
|
||||
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
@ -59,69 +49,89 @@ function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
|||
#############################
|
||||
while true; do
|
||||
|
||||
########################################################
|
||||
## /ipfs/QmQ9MdCEY1aMmpxBqZKcHTLafRxRFeK1Ku1DES1LCPaimA
|
||||
## TODO: STOP API ACCESS AFTER 20H12
|
||||
|
||||
start=`date +%s`
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
|
||||
# EACH VISITOR RECEIVE COMMAND RESPONSE ON
|
||||
## RANDOM PORT = RESPONSE SOCKET & IPNS SESSION TOKEN
|
||||
PORT=$(cat ~/.zen/tmp/PORT) || PORT=45779
|
||||
|
||||
[ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2}))
|
||||
## RANDOM PORT SWAPPINESS AVOIDING COLLISION
|
||||
PORT=$((PORT+1)) && [ ${PORT} -ge 45791 ] && PORT=45780 ## WAN ASTROPORT 45780 45781 ... 45790
|
||||
|
||||
# ZIP (LAN Boostrap)
|
||||
if [[ $(zIp) ]]; then
|
||||
[ ${PORT} -ge 45782 ] && PORT=45780 ## ♥Box LAN Boostrap : OPEN FIREWALL 1234 12345 45780 45781
|
||||
fi ## Use "nginx proxy manager" for SSL
|
||||
|
||||
echo ${PORT} > ~/.zen/tmp/PORT
|
||||
|
||||
## CHECK PORT IS FREE & KILL OLD ONE
|
||||
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)
|
||||
[[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING $pidportinuse" && continue
|
||||
echo "SEARCHING FOR PORT ${PORT}"
|
||||
ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep'
|
||||
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ $pidportinuse ]] && kill -9 $pidportinuse && echo "$(date) KILLING LOST $pidportinuse"
|
||||
|
||||
### START MAP STATION 12345
|
||||
## CHECK 12345 PORT RUNNING (STATION FoF MAP)
|
||||
maprunning=$(ps auxf --sort=+utime | grep -w '_12345.sh' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||
maprunning=$(ps auxf --sort=+utime | grep -w '_12345.sh' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ ! $maprunning ]] \
|
||||
&& echo '(ᵔ◡◡ᵔ) LAUNCHING '${myASTROPORT}:'12345 (ᵔ◡◡ᵔ)' \
|
||||
&& echo '(ᵔ◡◡ᵔ) MAP LAUNCHING http://'${myIP}':12345 (ᵔ◡◡ᵔ)' \
|
||||
&& exec $MY_PATH/_12345.sh &
|
||||
|
||||
############### ACTIVATE USE ON QUICK IPFS DRIVE
|
||||
### CREATE IPNS KEY - ACTIVATE WHITH ENOUGH BOOTSTRAP
|
||||
#~ echo
|
||||
#~ ipfs key rm ${PORT} > /dev/null 2>&1
|
||||
#~ SESSIONNS=$(ipfs key gen ${PORT})
|
||||
#~ echo "IPNS SESSION ${myIPFS}/ipns/$SESSIONNS CREATED"
|
||||
|
||||
### # USE IT #
|
||||
### MIAM=$(echo ${PORT} | ipfs add -q)
|
||||
### ipfs name publish --allow-offline -t 180s --key=${PORT} /ipfs/$MIAM &
|
||||
|
||||
###############
|
||||
###############
|
||||
|
||||
# RESET VARIABLES
|
||||
CMD="" THAT="" AND="" THIS="" APPNAME="" WHAT="" OBJ="" VAL=""
|
||||
############### ############### ############### ###############
|
||||
# THIS SCRIPT STORES $i PARAMETER IN
|
||||
# THOSE VARIABLES
|
||||
CMD="" THAT="" AND="" THIS="" APPNAME="" WHAT="" OBJ="" VAL=""
|
||||
|
||||
############### ############### ############### ############### templates/index.http
|
||||
# REPLACE myHOST in http response template (fixing next API meeting point)
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
myHtml >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
sed -i -e "s~\"${myIPFS}/\"~\"$(myIpfs)\"~g" \
|
||||
-e "s~http://${myHOST}:12345~http://${myHOST}:${PORT}~g" \
|
||||
~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http
|
||||
myHtml >> ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http
|
||||
|
||||
## REPLACE RESPONSE PORT
|
||||
sed -i -e "s~http://127.0.0.1:12345~http://127.0.0.1:${PORT}~g" \
|
||||
~/.zen/tmp/${MOATS}/${PORT}.myHOST.http
|
||||
|
||||
## WAN REDIRECT TO HTTPS:// + /${PORT}
|
||||
[ -z "$isLAN" ] \
|
||||
&& sed -i -e "s~http://127.0.0.1:${PORT}~${myASTROPORT}/${PORT}~g" ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http \
|
||||
&& echo "WAN STATION"
|
||||
|
||||
[ -n "$(zIp)" ]\
|
||||
&& sed -i -e "s~http://127.0.0.1:${PORT}~$(zIp):${PORT}~g" ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http \
|
||||
&& echo "COEURBOX STATION"
|
||||
|
||||
## UPLANET HOME LINK REPLACEMENT
|
||||
sed -i -e "s~https://qo-op.com~${myUPLANET}~g" ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http
|
||||
|
||||
############################################################################
|
||||
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/coucou/${MOATS}.myHOST.http on PORT 1234 (LOOP BLOCKING POINT)
|
||||
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/${MOATS}/${PORT}.myHOST.http on PORT 1234 (LOOP BLOCKING POINT)
|
||||
############################################################################
|
||||
REQ=$(cat $HOME/.zen/tmp/coucou/${MOATS}.myHOST.http | nc -l -p 1234 -q 1) ## # WAIT FOR 1234 PORT CONTACT
|
||||
############### ############### ############### ############### WAIT FOR
|
||||
############### ############### ############### ############### 1234 KNOC
|
||||
REQ=$(cat $HOME/.zen/tmp/${MOATS}/${PORT}.myHOST.http | nc -l -p 1234 -q 1 && rm $HOME/.zen/tmp/${MOATS}/${PORT}.myHOST.http) ## # WAIT FOR 1234 PORT CONTACT
|
||||
############### ############### ############### ############### KNOC !!
|
||||
############### ############### ############### ###############
|
||||
|
||||
URL=$(echo "$REQ" | grep '^GET' | cut -d ' ' -f2 | cut -d '?' -f2)
|
||||
HOSTP=$(echo "$REQ" | grep '^Host:' | cut -d ' ' -f2 | cut -d '?' -f2)
|
||||
AGENT=$(echo "$REQ" | grep '^User-Agent:') ### TODO : BAN LESS THAN 3 SEC REQUEST
|
||||
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
|
||||
|
||||
## COOKIE RETRIEVAL ##
|
||||
COOKIE=$(echo "$REQ" | grep '^Cookie:' | cut -d ' ' -f2)
|
||||
echo "COOKIE=$COOKIE"
|
||||
############### ############### ############### ###############
|
||||
[[ $XDG_SESSION_TYPE == 'x11' ]] && espeak "Ding" >/dev/null 1>&2 &
|
||||
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] && espeak "Dong" >/dev/null 1>&2 &
|
||||
############################################################################
|
||||
[[ $URL == "/test" || $URL == "" ]] && continue
|
||||
|
||||
echo "************************************************************************* $(date)"
|
||||
echo "ASTROPORT 1234 UP & RUNNING.......................... $myASTROPORT"
|
||||
echo "${MOATS} NEXT COMMAND DELIVERY PAGE http://$myHOST:${PORT}"
|
||||
|
||||
echo "URL" > ~/.zen/tmp/coucou/${MOATS}.url ## LOGGING URL
|
||||
echo "******* ${MOATS} ********************************** $(date)"
|
||||
echo "ASTROPORT 1234 UP & RUNNING // API : $myASTROPORT // IPFS : $myIPFS"
|
||||
echo "NEXT COMMAND DELIVERY PAGE http://$myHOST:${PORT}"
|
||||
|
||||
############################################################################
|
||||
start=`date +%s`
|
||||
|
@ -130,10 +140,20 @@ while true; do
|
|||
## / CONTACT
|
||||
if [[ $URL == "/" ]]; then
|
||||
echo "/ CONTACT : $HOSTP"
|
||||
echo "$HTTPCORS
|
||||
DING : ${MOATS} : $(date)" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo " (‿/‿) $myHOST:$PORT / Execution time was "`expr $end - $start` seconds.
|
||||
|
||||
if [ -z "$isLAN" ]; then
|
||||
mySalt | \
|
||||
sed "s~http://127.0.0.1:12345~http://${myIP}:${PORT}~g" | \
|
||||
sed "s~http://${myIP}:${PORT}~${myASTROPORT}/${PORT}~g" | \
|
||||
sed "s~https://qo-op.com~${myUPLANET}~g" | \
|
||||
( nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && echo " (‿/‿) $PORT CONSUMED in "`expr $(date +%s) - $start`" seconds." ) &
|
||||
else
|
||||
mySalt | \
|
||||
sed "s~http://127.0.0.1:12345~http://${myASTROPORT}:${PORT}~g" | \
|
||||
sed "s~https://qo-op.com~${myUPLANET}~g" | \
|
||||
( nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && echo " (‿/‿) $PORT CONSUMED in "`expr $(date +%s) - $start`" seconds." ) &
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -152,6 +172,7 @@ while true; do
|
|||
if [[ ${arr[0]} == "poule" ]]; then
|
||||
echo "UPDATING CODE git pull > ~/.zen/tmp/.lastpull"
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/.lastpull
|
||||
cd ~/.zen/Astroport.ONE
|
||||
git pull >> ~/.zen/tmp/.lastpull
|
||||
rm ~/.zen/game/players/localhost/latest
|
||||
(cat ~/.zen/tmp/.lastpull | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||
|
@ -180,15 +201,23 @@ while true; do
|
|||
|
||||
case $CMD in
|
||||
"salt")
|
||||
exec ${MY_PATH}/API/SALT.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" &
|
||||
exec ${MY_PATH}/API/SALT.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
;;
|
||||
|
||||
"player")
|
||||
exec ${MY_PATH}/API/PLAYER.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" &
|
||||
exec ${MY_PATH}/API/PLAYER.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
;;
|
||||
|
||||
"qrcode")
|
||||
exec ${MY_PATH}/API/QRCODE.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" &
|
||||
exec ${MY_PATH}/API/QRCODE.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
;;
|
||||
|
||||
"uplanet")
|
||||
exec ${MY_PATH}/API/UPLANET.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
;;
|
||||
|
||||
"amzqr")
|
||||
exec ${MY_PATH}/API/AMZQR.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
;;
|
||||
|
||||
"")
|
||||
|
@ -203,7 +232,7 @@ while true; do
|
|||
[[ ! -s ${MY_PATH}/API/${CMD^^}.sh ]] \
|
||||
&& ( echo "$HTTPCORS
|
||||
ERROR UNKNOWN $CMD : ${MOATS} : $(date)" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & ) \
|
||||
|| exec ${MY_PATH}/API/${CMD^^}.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" &
|
||||
|| exec ${MY_PATH}/API/${CMD^^}.sh "$PORT" "$THAT" "$AND" "$THIS" "$APPNAME" "$WHAT" "$OBJ" "$VAL" "${MOATS}" "$COOKIE" &
|
||||
|
||||
;;
|
||||
|
||||
|
|
194
20h12.process.sh
|
@ -1,71 +1,197 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.3
|
||||
# Version: 0.4
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/tools/my.sh"
|
||||
MY_PATH="`( cd \"${MY_PATH}\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/tools/my.sh"
|
||||
start=`date +%s`
|
||||
echo "20H12 (♥‿‿♥) $(hostname -f) $(date)"
|
||||
espeak "Ding" > /dev/null 2>&1
|
||||
|
||||
## CLEANING ~/.zen/tmp
|
||||
########################################################################
|
||||
## IPFS DAEMON STATUS
|
||||
LOWMODE=$(sudo systemctl status ipfs | grep disabled) ## IPFS DISABLED - START ONLY FOR SYNC -
|
||||
[[ ! $(netstat -tan | grep 5001 | grep LISTEN) ]] && LOWMODE="NO 5001" ## IPFS IS STOPPED
|
||||
[[ ! $isLAN ]] && LOWMODE="" ## LOWMODE ONLY FOR LAN STATION
|
||||
|
||||
########################################################################
|
||||
## CHECK IF IPFS NODE IS RESPONDING (ipfs name resolve ?)
|
||||
########################################################################
|
||||
ipfs --timeout=30s swarm peers 2>/dev/null > ~/.zen/tmp/ipfs.swarm.peers
|
||||
[[ ! -s ~/.zen/tmp/ipfs.swarm.peers || $? != 0 ]] \
|
||||
&& echo "---- SWARM COMMUNICATION BROKEN / RESTARTING IPFS DAEMON ----" \
|
||||
&& sudo systemctl restart ipfs \
|
||||
&& sleep 60
|
||||
|
||||
floop=0
|
||||
while [[ ! $(netstat -tan | grep 5001 | grep LISTEN) ]]; do
|
||||
sleep 10
|
||||
((floop++)) && [ $floop -gt 36 ] \
|
||||
&& echo "ERROR. IPFS daemon not restarting" \
|
||||
&& ${MY_PATH}/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log" "IPFS RESTART ERROR 20H12" \
|
||||
&& exit 1
|
||||
done
|
||||
|
||||
########################################################################
|
||||
# show ZONE.sh cache of the day
|
||||
echo "TODAY UPlanet landings"
|
||||
ls ~/.zen/tmp/ZONE_* 2>/dev/null
|
||||
|
||||
########################################################################
|
||||
## REMOVE TMP BUT KEEP swarm, flashmem and coucou
|
||||
mv ~/.zen/tmp/swarm ~/.zen/swarm
|
||||
mv ~/.zen/tmp/coucou ~/.zen/coucou
|
||||
mv ~/.zen/tmp/flashmem ~/.zen/flashmem
|
||||
rm -Rf ~/.zen/tmp/*
|
||||
mv ~/.zen/swarm ~/.zen/tmp/swarm
|
||||
mv ~/.zen/coucou ~/.zen/tmp/coucou
|
||||
mv ~/.zen/flashmem ~/.zen/tmp/flashmem
|
||||
|
||||
## RESTART IPFS DAEMON
|
||||
# echo "$USER ALL=(ALL) NOPASSWD:/bin/systemctl" | (sudo su -c 'EDITOR="tee" visudo -f /etc/sudoers.d/systemctl')
|
||||
[[ -s /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && sleep 5
|
||||
########################################################################
|
||||
### DELAY _12345 ASTROPORT DURING 20H12 UPDATE ###
|
||||
if [[ "${LOWMODE}" == "" ]]; then
|
||||
### NOT REFRESHING SWARM
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
MOATS_plus_5_hours=$(date -d "now + 5 hours" +"%Y%m%d%H%M%S%4N")
|
||||
mkdir ~/.zen/tmp/${IPFSNODEID}
|
||||
echo ${MOATS_plus_5_hours} > ~/.zen/tmp/${IPFSNODEID}/_MySwarm.moats
|
||||
echo 9000 > ~/.zen/tmp/random.sleep
|
||||
else
|
||||
# REFRESHING SWARM
|
||||
echo 0 > ~/.zen/tmp/${IPFSNODEID}/_MySwarm.moats
|
||||
curl -s "http://127.0.0.1:12345"
|
||||
sleep 300 ## WAIT FOR 5MN
|
||||
fi
|
||||
|
||||
espeak "CODE git pull" > /dev/null 2>&1
|
||||
########################################################################
|
||||
## UPDATE G1BILLETS code
|
||||
[[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] \
|
||||
&& cd ~/.zen/G1BILLET/ && git pull \
|
||||
&& rm -Rf ~/.zen/G1BILLET/tmp/*
|
||||
|
||||
## PROCESS TW BACKOFFICE TREATMENT
|
||||
cd ~/.zen/Astroport.ONE/
|
||||
########################################################################
|
||||
## UPDATE Astroport.ONE code
|
||||
cd ${MY_PATH}/
|
||||
git pull
|
||||
## SOON /ipns/ Address !!!
|
||||
|
||||
espeak "20 HOURS 12 MINUTES. START NU ONE UPDATE" > /dev/null 2>&1
|
||||
########################################################################
|
||||
## Updating yt-dlp
|
||||
$MY_PATH/youtube-dl.sh
|
||||
${MY_PATH}/youtube-dl.sh
|
||||
sudo youtube-dl -U
|
||||
|
||||
# Refresh ~/.zen/game/world/G1VOEU
|
||||
# NOW RUN FROM PLAYER.refresh.sh !! ~/.zen/Astroport.ONE/ASTROBOT/VOEUX.refresh.sh
|
||||
########################################################################
|
||||
## DRAGON SSH WOT
|
||||
echo "DRAGONS WOT OFF"
|
||||
${MY_PATH}/RUNTIME/DRAGON_p2p_ssh.sh off
|
||||
|
||||
espeak "Players refresh" > /dev/null 2>&1
|
||||
# Refresh ~/.zen/game/players/PLAYER
|
||||
~/.zen/Astroport.ONE/ASTROBOT/PLAYER.refresh.sh
|
||||
########################################################################
|
||||
## PING BOOSTRAP & SWARM NODES
|
||||
${MY_PATH}/ping_bootstrap.sh > /dev/null 2>&1
|
||||
|
||||
## if [[ ! $isLAN ]]; then
|
||||
## REFRESH BOOTSTRAP LIST (OFFICIAL SWARM)
|
||||
########################################################################
|
||||
######################################################### UPLANET ######
|
||||
#####################################
|
||||
# GeoKeys UMAP / SECTOR / REGION ...
|
||||
#####################################
|
||||
${MY_PATH}/RUNTIME/UPLANET.refresh.sh
|
||||
#####################################
|
||||
#####################################
|
||||
# Players TW analyse & ASTROBOT run
|
||||
#####################################
|
||||
${MY_PATH}/RUNTIME/PLAYER.refresh.sh
|
||||
#####################################
|
||||
#####################################
|
||||
# Node refreshing
|
||||
#####################################
|
||||
${MY_PATH}/RUNTIME/NODE.refresh.sh
|
||||
#####################################
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
## REMOVE TMP BUT KEEP swarm, flashmem and coucou
|
||||
mv ~/.zen/tmp/${IPFSNODEID} ~/.zen/${IPFSNODEID}
|
||||
mv ~/.zen/tmp/swarm ~/.zen/swarm
|
||||
mv ~/.zen/tmp/coucou ~/.zen/coucou
|
||||
mv ~/.zen/tmp/flashmem ~/.zen/flashmem
|
||||
rm -Rf ~/.zen/tmp/*
|
||||
mv ~/.zen/${IPFSNODEID} ~/.zen/tmp/${IPFSNODEID}
|
||||
mv ~/.zen/swarm ~/.zen/tmp/swarm
|
||||
mv ~/.zen/coucou ~/.zen/tmp/coucou
|
||||
mv ~/.zen/flashmem ~/.zen/tmp/flashmem
|
||||
|
||||
########################################################################
|
||||
################################# updating ipfs bootstrap
|
||||
espeak "bootstrap refresh" > /dev/null 2>&1
|
||||
|
||||
ipfs bootstrap rm --all > /dev/null 2>&1
|
||||
for bootnode in $(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#") # remove comments
|
||||
|
||||
[[ -s ${HOME}/.zen/game/MY_boostrap_nodes.txt ]] \
|
||||
&& STRAPFILE="${HOME}/.zen/game/MY_boostrap_nodes.txt" \
|
||||
|| STRAPFILE="${MY_PATH}/A_boostrap_nodes.txt"
|
||||
|
||||
for bootnode in $(cat ${STRAPFILE} | grep -Ev "#") # remove comments
|
||||
do
|
||||
ipfsnodeid=${bootnode##*/}
|
||||
ipfs bootstrap add $bootnode
|
||||
done
|
||||
## fi
|
||||
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo "20H12 (♥‿‿♥) Execution time was $dur" seconds.
|
||||
hours=$((dur / 3600))
|
||||
minutes=$(( (dur % 3600) / 60 ))
|
||||
seconds=$((dur % 60))
|
||||
echo "DURATION ${hours} hours ${minutes} minutes ${seconds} seconds"
|
||||
echo "20H12 (♥‿‿♥) Execution time was $dur seconds."
|
||||
|
||||
~/.zen/Astroport.ONE/tools/ipfs_P2P_forward.sh
|
||||
|
||||
## MAIL LOG : support@qo-op.com
|
||||
$MY_PATH/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log" &
|
||||
## MAIL LOG : support@qo-op.com ##
|
||||
${MY_PATH}/tools/mailjet.sh "support@qo-op.com" "/tmp/20h12.log" "20H12"
|
||||
|
||||
espeak "20 12 Storm & Thunder duration was $dur seconds" > /dev/null 2>&1
|
||||
espeak "DURATION ${hours} hours ${minutes} minutes ${seconds} seconds" > /dev/null 2>&1
|
||||
|
||||
espeak "Restarting Astroport Station API" > /dev/null 2>&1
|
||||
## RESTART
|
||||
|
||||
# espeak "Restarting Astroport Services" > /dev/null 2>&1
|
||||
## CLOSING API PORT
|
||||
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid)
|
||||
## OPEN API ENGINE
|
||||
~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log &
|
||||
PID=$!
|
||||
echo $PID > ~/.zen/.pid
|
||||
[[ -s ~/.zen/.pid ]] && kill -9 $(cat ~/.zen/.pid) > /dev/null 2>&1
|
||||
## KILL ALL REMAINING nc
|
||||
killall nc 12345.sh > /dev/null 2>&1
|
||||
|
||||
## SYSTEMD OR NOT SYSTEMD
|
||||
if [[ ! -f /etc/systemd/system/astroport.service ]]; then
|
||||
${MY_PATH}/12345.sh > ~/.zen/tmp/12345.log &
|
||||
PID=$!
|
||||
echo $PID > ~/.zen/.pid
|
||||
else
|
||||
sudo systemctl restart astroport
|
||||
[[ -s ~/.zen/G1BILLET/G1BILLETS.sh ]] && sudo systemctl restart g1billet
|
||||
echo "Astroport processes systemd restart"
|
||||
|
||||
fi
|
||||
|
||||
echo "IPFS DAEMON LEVEL"
|
||||
######### IPFS DAMEON NOT RUNNING ALL DAY
|
||||
## IF IPFS DAEMON DISABLED : WAIT 1H & STOP IT
|
||||
[[ $LOWMODE != "" ]] \
|
||||
&& echo "STOP IPFS $LOWMODE" \
|
||||
&& sleep 3600 \
|
||||
&& sudo systemctl stop ipfs \
|
||||
&& exit 0
|
||||
|
||||
echo "HIGH. RESTART IPFS"
|
||||
sleep 60
|
||||
sudo systemctl restart ipfs
|
||||
|
||||
#################################
|
||||
### DRAGON WOT : SSH P2P RING OPENING
|
||||
#################################
|
||||
sleep 30
|
||||
echo "DRAGONS WOT ON"
|
||||
${MY_PATH}/RUNTIME/DRAGON_p2p_ssh.sh
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
# 3 2 1 DU
|
||||
|
||||
Comment utiliser le DU pour gérer et construire le commun?
|
||||
|
||||
*en cours de rédaction...*
|
||||
|
||||
# INTRO
|
||||
|
||||
L'aventure se déroule à la frontière entre l'ancien (UNL) et le nouveau monde (ML).
|
||||
|
||||
C'est un jeu de société qui s'adresse aux personnes qui possèdent un lieu et souhaitent l'ouvrir à une gestion aggradative démocratique.
|
||||
|
||||
Un lieu a pour fonction d'assurer gîte et couvert à ses visiteurs et résidents. Il acceuillera des ateliers de construction où seront transmis les savoir-faire.
|
||||
|
||||
|
||||
# REGLES DU JEU
|
||||
|
||||
Il s'agit d'un jeu qui permet de réduire sa dépendance à l'UNL (Euro), il se base sur le réseau de confiance de la JUNE et active une dynamique de maintien et progrès.
|
||||
|
||||
Ici, "Le Lieu" possède un portefeuille et fait partie du jeu. Les paramètres du Jeu peuvent être adaptées selon la balance (UNL/ML) pour permettre à la partie de se dérouler.
|
||||
|
||||
Les règles du jeu sont Libres et "Open Source", elles décrivent la façon que nous avons mis en pratique lors du "Geconomicus Terraformation Forêt Jardin" il s'adaptera à un lieu collectif orienté vers l'autoconstruction, composé de 6 à 20 personnes. https://ipfs.asycn.io/ipfs/QmUtGpGeMZvwp47ftqebVmoFWCmvroy5wEtWsKvWvDWJpR/Foret%20Enchant%C3%A9e%20-%20PROJET%20ASTROPORT.pdf
|
||||
|
||||
|
||||
### PARTICIPATION AUX FRAIS
|
||||
|
||||
Avant de démarrer le jeu, listez les frais de fonctionnement en UNL du Lieu. En fonction de la capacité d'accueil, définissez une estimation de la PAF / jour / pers.
|
||||
|
||||
Ce montant sert de balise. Il s'agira lors des cycles de réflexion du jeu de le réduire. Il définit les échanges à la frontière monétaire du Lieu.
|
||||
|
||||
En effet, un première règle du Lieu est qu'il n'existe aucun moyen de breveter ni faire valoir la propriété intellectuelle sur une idée, ou un processus la mettant en pratique (SOLUTIONS DIY ONLY).
|
||||
https://www.levif.be/belgique/richard-stallman-la-propriete-intellectuelle-est-un-terme-de-propagande/
|
||||
|
||||
### PARTICIPANTS
|
||||
|
||||
Sur place, la Monnaie Libre est utilisée. Chaque joueur créé 1 DU par jour qui s'ajoute au jeu. On pourra selon la communauté souhaitant participer démarrer un nouveau DU ou accepter le DU d'autres monnaies libres (cf. TRM)
|
||||
|
||||
Afin de créer une dynamique entre le Lieu et ses visiteurs ou résidents, il est convenu que chaque participant doit verser dans une caisse propre au Lieu un certain nombre de DU.
|
||||
|
||||
#### NIVEAUX
|
||||
|
||||
Le barême du montant versé quotidiennement au Lieu par chaque participant est établi selon le "niveau" atteint par le joueur:
|
||||
|
||||
* Visiteur. 3 DU
|
||||
* Acteur. 2 DU
|
||||
* Batisseur. 1 DU
|
||||
* Ordonateur. 0 DU
|
||||
|
||||
**Ordonateur** est le niveau du "Organisateur du Jeu", celui qui assure le bon respect des règles par les autres et/ou celui qui a ouvert sa propriété au Jeu.
|
||||
|
||||
**Batisseur** est le niveau atteint après avoir participé à un chantier participatif sur un des Lieux du Jeu et obtenu un Niveau de Confiance. Ces toiles de confiance seront normalisées et affinées au fur et à mesure du déroulement du Jeu.
|
||||
|
||||
**Acteur** désigne le niveau de base. Il s'appliquer à tous les individus qui participent à réaliser les Actions du Lieu.
|
||||
|
||||
**Visiteur** n'implique aucune participation aux actions, ni aux ateliers du Lieu, mais permet de profiter de l'accueil et des activités proposées sur place.
|
||||
|
||||
Les G1 échangées dans la blockchain permettent de dessiner de nouvelles toiles de confiances. En analysant les transactions portant certains commentaires à égalité comptable (jugement & aquitement).
|
||||
|
||||
Par exemple : https://forum.duniter.org/t/il-manque-une-tdc-a-notre-tdc/10500/22?u=frederic_renault (principe à fixer et normaliser)
|
||||
|
||||
## INITIALISATION
|
||||
|
||||
Pour commencer une partie.
|
||||
Chaque joeur ajoute 30 DU répartis sur 10 jetons (max 12 DU, min 1 DU, moy 3 DU) dans une "**boite à gratitude**" dans laquelle ceux qui réalisent une action vont pouvoir piocher...
|
||||
|
||||
NB: Le montant ajouté par chacun correspond à "10 jours de tourisme", on pourra modifier les chiffres en conséquence du montant choisi pour ce niveau.
|
||||
|
||||
|
||||
### ACTIONS
|
||||
|
||||
L'organisateur et les participants établissent la liste des actions à réaliser pour maintenir le lieu en bon état. ex: Ménage, vaisselle, ramassage de bois, collecte, rangement, etc...
|
||||
|
||||
Faire figurer la liste sur un tableau afin que tous puissent la voir (et éventuellement la modifier)
|
||||
|
||||
Le fait de réaliser une action fait passer le joeur du niveau Touriste au niveau "Coopérateur" et lui permet de tirer une "gratitude" (cf. G1Ronds ```/ipns/k51qzi5uqu5dmdjma9ew6vqrbqp3hrzh3aen1c37ahq4tm9tt738cpd19r86e4```).
|
||||
|
||||
A ce niveau, chaque joueur gagne en moyenne 1 DU par jour. On peut réaliser plusieurs actions par jour et les suivantes rapportent 3 DU en moyenne ;)
|
||||
|
||||
|
||||
#### LIMITE
|
||||
|
||||
Afin de ne pas laisser se vider la boite à gratitude, on limite le nombre de DU que chacun peut gagner en réalisant des Actions à 12 DU. Une fois ce montant atteint, le joueur devra investir ses DU sur-numéraires dans les CrowdFunding du Lieu.
|
||||
|
||||
### VOEUX
|
||||
|
||||
Chaque joueur du niveau Acteur peut émettre un Voeu, et proposer un atelier pour ajouter une amélioration au Lieu.
|
||||
|
||||
ex: chambre en plus, nouvelles toilettes, système de chauffage, garage, etc ...
|
||||
|
||||
Les Voeux sont établis entre le Lieu et le Joeur et apparaissent dans le Jeu.
|
||||
|
||||
Chaque participant pourra verser ML ou UNL aux Voeux qu'il souhaite voir se réaliser.
|
||||
|
||||
#### VOTE QUADRATIQUE
|
||||
|
||||
Chaque joueur peut (doit) verser 1 DU / jour à au moins un Voeu qu'il souhaite se voir réaliser... Le Lieu publie la liste de ses "Voeux" qui voit monter leur financement avec le temps.
|
||||
|
||||
Lorsque qu'un joueur verse plusieurs DU à un Voeu, seule la racine carré du montant y est attribué. La différence est répartie à l'ensemble des autres voeux en fonction de leur niveau de DU respectivement atteint.
|
||||
|
||||
Exemple : https://www.wtfisqf.com/
|
||||
|
||||
https://ipfs.copylaradio.com/ipns/k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0#Discussion%20avec%20ChatGPT%20au%20sujet%20de%20la%20G1%20et%20du%20vote%20quadratique
|
||||
|
||||
|
||||
### CHANTIERS COLLECTIFS
|
||||
|
||||
https://forum.monnaie-libre.fr/t/les-explorateurs-du-libre-rencontre-et-partage-des-constructeurs-du-monde-libre/24040?u=qoop
|
||||
|
||||
Le Lieu possède un "Agenda". A certaines période il acceuille l'organisation d'ateliers pour réaliser certains des Voeux dont le niveau de crowdfunding motive la réalisation.
|
||||
|
||||
A chaque réalisation d'un Voeu (chantier collectif), les G1 de la cagnote sont distribuées aux participants.
|
||||
|
||||
On pensera à ajouter en commentaire des transactions :MIZ:NomDuVoeu:OK nous pourrons nous servir de ces informations pour construire des toiles de confiance qualitatives.
|
||||
|
||||
**Le Jeu établit une gestion démocratique de prise de décision collective.**
|
||||
|
||||
# Annexe
|
||||
## Calcul du forfait "inter opérateur monétaire"
|
||||
|
||||
Le Lieu produit des valeurs qui sont mise à disposition selon 3 forfaits.
|
||||
|
||||
Le PAF correspond au prix pratiqué en UNL sur le marché UNL. Le PIF est le nombre de DU souhaité par unité.
|
||||
|
||||
Voici comment sont calculé les "Forfaits" :
|
||||
|
||||
* Le Forfait Cool : payer le PAF, et recevoir le PIF
|
||||
* Le Forfait Juste : payer le 1/2 PAF + le PIF
|
||||
* Le Forfait Carré : payer le 1/4 PAF + le PIF²
|
||||
|
||||
CALCULATEUR DE FORFAIT (PIF "ML" / PAF "UNL")
|
||||
http://ipfs.asycn.io/ipfs/QmRm1NXy5DZS8ftxeTjHrWgFGuMzouzTJrjEHE4uuUbPX2
|
||||
|
||||
|
||||
> Pour plus d'info, et si vous souhaitez lancer le Jeu chez vous, contactez support@qo-op.com
|
|
@ -0,0 +1,39 @@
|
|||
# Pourquoi ?
|
||||
|
||||
## La Monnaie est Buggée !
|
||||
Dans l'écosystème actuel, la notion de monnaie est sujette à des défauts.
|
||||
La distinction entre une unité non libre et une monnaie libre révèle des imperfections
|
||||
dans les échanges économiques.
|
||||
|
||||
## Blockchain = Registre Global
|
||||
La blockchain, en tant que registre global, offre une opportunité de remédier aux lacunes du
|
||||
système financier actuel. Elle peut être envisagée comme une carte d'identité pour le Web3,
|
||||
offrant transparence et traçabilité.
|
||||
|
||||
## IA Apprentissage et Contrôle
|
||||
La gestion de l'intelligence artificielle est cruciale. La comparaison entre un ChatGPT privé
|
||||
et Mistral libre souligne la nécessité d'un contrôle plus étendu.
|
||||
"The PILE", source d'information, demande une cohérence accrue pour garantir une
|
||||
diffusion fiable des connaissances.
|
||||
|
||||
## Loi de Moore vs Industrie
|
||||
La cadence effrénée de la Loi de Moore, avec une progression tous les 1,5 ans,
|
||||
se heurte à la réalité industrielle où les cycles d'investissement s'étendent de 3 à 11 ans.
|
||||
Les rendements sur investissements sont souvent compromis, créant des opportunités pour de nouveaux acteurs.
|
||||
|
||||
## Web2.0 Épileptique
|
||||
Les soubresauts du Web2.0, caractérisés par l'instabilité des données et de leur localisation,
|
||||
soulignent la nécessité d'une approche plus stable et cohérente.
|
||||
|
||||
# Comment ?
|
||||
|
||||
## UPlanet / Astroport.ONE
|
||||
La solution réside dans UPlanet et Astroport.ONE, des initiatives axées sur la décentralisation et la régulation.
|
||||
En adoptant une blockchain multi-grille sphérique et des clés géospatiales, ces plateformes créent un réseau de :
|
||||
* stations index (300€)
|
||||
* stations de stockage (1500€)
|
||||
* stations IA avec GPU (5000€)
|
||||
|
||||
|
||||
Ces stations, en synergie, visent à résoudre les problèmes évoqués, offrant une alternative innovante
|
||||
pour les investisseurs souhaitant participer à la transformation du paysage technologique.
|
|
@ -0,0 +1,79 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: AMZQR
|
||||
## An API to create QRCode with logo
|
||||
# ?amzqr=URLENCODEDSTRING&logo=IMAGE
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
||||
|
||||
[[ "$PORT" == "" ]] && echo "$MY_PATH/AMZQR.sh '0' 'la chaine a mettre en QRCODE' 'et' 'TV'" && exit 1
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Methods: GET
|
||||
Server: Astroport.ONE
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
|
||||
[[ ${MOATS} == "" ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
|
||||
##################################################
|
||||
USTRING=$(urldecode "${THAT}")
|
||||
IMAGE="${THIS}"
|
||||
|
||||
[[ ! -s ${MY_PATH}/../images/${IMAGE}.png || ${USTRING} == "" ]] \
|
||||
&& echo "UNKNOW IMAGE ${IMAGE}" \
|
||||
&& ( [[ $PORT != "0" ]] && echo "$HTTPCORS ERROR - BAD PARAMS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 1
|
||||
|
||||
echo amzqr "${USTRING}" -l H -c -p ${MY_PATH}/../images/${IMAGE}.png -n ${MOATS}.png -d ~/.zen/tmp/${MOATS}/
|
||||
|
||||
## RUN AMZQR
|
||||
amzqr "${USTRING}" -l H -c -p ${MY_PATH}/../images/${IMAGE}.png -n ${MOATS}.png -d ~/.zen/tmp/${MOATS}/
|
||||
IPFSMG=$(ipfs add -q ~/.zen/tmp/${MOATS}/${MOATS}.png | tail -n 1)
|
||||
echo "${myIPFS}/ipfs/${IPFSMG}"
|
||||
|
||||
echo "$HTTPCORS <meta http-equiv=\"refresh\" content=\"0; url='${myIPFS}/ipfs/${IPFSMG}'\" />" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
if [[ $PORT == "0" ]]; then
|
||||
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] && xdg-open ${myIPFS}/ipfs/${IPFSMG}
|
||||
|
||||
LP=$(ls /dev/usb/lp* 2>/dev/null | head -n1)
|
||||
if [[ $LP ]]; then
|
||||
echo "IMPRESSION QRCODE"
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/${MOATS}/${MOATS}.png > ~/.zen/tmp/${MOATS}/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/${MOATS}/toprint.bin $LP
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -Rf ~/.zen/tmp/${MOATS}/
|
||||
end=`date +%s`
|
||||
echo "(AMZQR) Operation time was "`expr $end - $start` seconds.
|
||||
echo "/ipfs/${IPFSMG}"
|
||||
exit 0
|
|
@ -0,0 +1,79 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: DRAGONS
|
||||
## Used by OSM2IPFS welcome.html
|
||||
# ?zone=DEG&ulat=LAT&ulon=LON
|
||||
## Search for TW numbers in received zone # >> return json
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
||||
### transfer variables according to script
|
||||
|
||||
[[ $MOATS == "" ]] && echo "MISSING MOATS" && exit 1
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Methods: GET
|
||||
Server: Astroport.ONE
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
# PREPARE HTTP RESPONSE (application/json)
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}/http
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/http
|
||||
|
||||
# ------------------------------------------------------------------- #
|
||||
# GET/?dragons
|
||||
# ------------------------------------------------------------------- #
|
||||
## RUNNING UPLANET STATIONS GPS DETECTION
|
||||
rm ~/.zen/tmp/DRAGONS.json
|
||||
|
||||
if [[ ! -s ~/.zen/tmp/DRAGONS.json ]]; then
|
||||
|
||||
echo " ## cat ***/GPS.json"
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/GPS.json 2>/dev/null | jq -c '.[] + {ipfsnodeid: "'$IPFSNODEID'"}' > ~/.zen/tmp/${MOATS}/gps.grid
|
||||
cat ~/.zen/tmp/swarm/12D*/GPS.json 2>/dev/null | jq -c '.[] + {ipfsnodeid: "'$IPFSNODEID'"}' | sort -u >> ~/.zen/tmp/${MOATS}/gps.grid
|
||||
|
||||
cat ~/.zen/tmp/${MOATS}/gps.grid | jq -s '.' | sed -e 's/\[/[/' -e 's/\]/]/' -e 's/},{/},\n{/g' > ~/.zen/tmp/DRAGONS.json
|
||||
fi
|
||||
|
||||
#~ jq 'unique_by(.umap)' ~/.zen/tmp/DRAGONS.json > ~/.zen/tmp/DRAGONS_no_duplicates.json
|
||||
#~ mv ~/.zen/tmp/DRAGONS_no_duplicates.json ~/.zen/tmp/DRAGONS.json
|
||||
echo " ***** WELCOME DRAGONS =========== "
|
||||
cat ~/.zen/tmp/DRAGONS.json
|
||||
|
||||
### SEND RESPONSE ON PORT
|
||||
cat ~/.zen/tmp/DRAGONS.json >> ~/.zen/tmp/${MOATS}/http
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
rm -Rf ~/.zen/tmp/${MOATS} && echo "BLURP DRAGONS.json"
|
||||
) &
|
||||
|
||||
## TIMING
|
||||
end=`date +%s`
|
||||
echo "(DRAGONS) Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
136
API/PLAYER.sh
|
@ -4,12 +4,30 @@
|
|||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: SALT & PEPPER
|
||||
## API: PLAYER - PUBLIC KEY AUTH
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
PORT=$1 THAT=$2 ANDcyberD0G!
|
||||
=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9 COOKIE=$10
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
|
||||
### transfer variables according to script (TODO REMOVE THAT)
|
||||
PORT=$1 PLAYER=$2 APPNAME=$3 OBJ=$5
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
Access-Control-Allow-Credentials: true
|
||||
|
@ -18,70 +36,80 @@ Server: Astroport.ONE
|
|||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
### transfer variables according to script
|
||||
PORT=$1 PLAYER=$2 APPNAME=$3 WHAT=$4 OBJ=$5 VAL=$6
|
||||
|
||||
echo "- $PLAYER - $APPNAME : $WHAT $OBJ $VAL"
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && (echo "$HTTPCORS UNKNOWN PLAYER $PLAYER - EXIT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
|
||||
##############################################
|
||||
# PAY : /?player=PLAYER&pay=1&dest=G1PUB
|
||||
##############################################
|
||||
if [[ $APPNAME == "pay" ]]; then
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
|
||||
if [[ $WHAT =~ ^[0-9]+$ ]]; then
|
||||
|
||||
echo "${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${WHAT} -p ${VAL} -c 'Bro' -m"
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${WHAT} -p ${VAL} -c 'Bro' -m 2>&1 >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "history" ]]; then
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey history -j >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "get" ]]; then
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey get >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "balance" ]]; then
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey balance >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo "(G_G ) G1BANK Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
[[ ! ${PLAYER} ]] && (echo "${HTTPCORS} BAD PLAYER - EXIT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! ${ASTRONAUTENS} ]] && (echo "${HTTPCORS} UNKNOWN PLAYER ${PLAYER} - EXIT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
|
||||
##############################################
|
||||
# MOATUBE : /?player=PLAYER&moa=json&tag=FILTER
|
||||
##############################################
|
||||
if [[ $APPNAME == "moa" ]]; then
|
||||
if [[ ${APPNAME} == "moa" ]]; then
|
||||
|
||||
[[ ! $VAL ]] && VAL="G1CopierYoutube"
|
||||
echo "EXPORT MOATUBE $PLAYER $VAL"
|
||||
[[ ! ${WHAT} ]] && WHAT="G1CopierYoutube"
|
||||
echo "EXPORT MOATUBE ${PLAYER} ${WHAT}"
|
||||
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}.$PLAYER.http
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}.$PLAYER.http
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/ --render '.' "${PLAYER}.moatube.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "[tag[${WHAT}]]"
|
||||
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/ --render '.' "$PLAYER.moatube.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "[tag[$VAL]]"
|
||||
if [[ ! ${THIS} || ${THIS} == "json" ]]; then
|
||||
|
||||
echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
cat ~/.zen/tmp/${PLAYER}.moatube.json >> ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
cat ~/.zen/tmp/${MOATS}.${PLAYER}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
fi
|
||||
|
||||
cat ~/.zen/tmp/$PLAYER.moatube.json >> ~/.zen/tmp/${MOATS}.$PLAYER.http
|
||||
cat ~/.zen/tmp/${MOATS}.$PLAYER.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo "(TW) MOA Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# ATPASS : /?player=PLAYER&atpass=G1PUB&$VoeuName=ONELINE
|
||||
##############################################
|
||||
#~ if [[ ${APPNAME} == "atpass" ]]; then
|
||||
|
||||
#~ echo "CREATING @PASS"
|
||||
|
||||
#~ end=`date +%s`
|
||||
#~ echo "(@PASS) creation time was "`expr $end - $start` seconds.
|
||||
#~ exit 0
|
||||
#~ fi
|
||||
|
||||
##############################################
|
||||
# YOUTUBE : /?player=PLAYER&(youtube | pdf | image) =_URL_
|
||||
##############################################
|
||||
#~ if [[ ${APPNAME} == "youtube" || ${APPNAME} == "pdf" || ${APPNAME} == "image" ]]; then
|
||||
|
||||
#~ APPNAME=$(echo ${APPNAME} | sed -r 's/\<./\U&/g' | sed 's/ //g') ## First letter Capital
|
||||
|
||||
#~ [[ ! ${THIS} ]] && THIS="https://www.youtube.com/watch?v=BCl2-0HBJ2c"
|
||||
|
||||
#~ echo ">>> COPY ${APPNAME} for ${PLAYER} from ${THIS}"
|
||||
|
||||
#~ G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
#~ [[ ! ${G1PUB} ]] && espeak "NOT MY PLAYER " && echo "${PLAYER} IS NOT MY PLAYER" && exit 1
|
||||
|
||||
#~ echo "================================================"
|
||||
#~ echo "${PLAYER} : ${myIPFS}/ipns/${ASTRONAUTENS}"
|
||||
#~ echo " = /ipfs/${TW}"
|
||||
#~ echo "================================================"
|
||||
|
||||
#~ ${MY_PATH}/../ajouter_media.sh "${THIS}" "${PLAYER}" "${APPNAME}" &
|
||||
|
||||
#~ echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
#~ echo "${myIPFS}/ipns/${ASTRONAUTENS}" >> ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
#~ (
|
||||
#~ cat ~/.zen/tmp/${MOATS}.${PLAYER}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
#~ rm ~/.zen/tmp/${MOATS}.${PLAYER}.http
|
||||
#~ ) &
|
||||
|
||||
#~ # ### REFRESH CHANNEL COPY
|
||||
|
||||
#~ end=`date +%s`
|
||||
#~ echo "(TW) MOA Operation time was "`expr $end - $start` seconds.
|
||||
#~ exit 0
|
||||
|
||||
#~ fi
|
||||
|
||||
exit 1
|
||||
|
|
721
API/QRCODE.sh
|
@ -4,12 +4,28 @@
|
|||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: SALT & PEPPER
|
||||
## API: QRCODE - ANY/MULTI KEY OPERATIONS
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
||||
### transfer variables according to script
|
||||
QRCODE=$(echo "$THAT" | cut -d ':' -f 1) # G1nkgo compatible
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
Access-Control-Allow-Credentials: true
|
||||
|
@ -19,90 +35,667 @@ Content-Type: text/html; charset=UTF-8
|
|||
|
||||
"
|
||||
|
||||
start=`date +%s`
|
||||
# function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
### transfer variables according to script
|
||||
QRCODE=$THAT
|
||||
URL=$THIS
|
||||
TYPE=$WHAT
|
||||
function urldecode() {
|
||||
local string="${1//+/ }"
|
||||
printf '%b' "${string//%/\\x}"
|
||||
}
|
||||
|
||||
urlencode() {
|
||||
local string="$1"
|
||||
local length="${#string}"
|
||||
local url_encoded=""
|
||||
|
||||
for ((i = 0; i < length; i++)); do
|
||||
local c="${string:i:1}"
|
||||
case "$c" in
|
||||
[a-zA-Z0-9.~_-])
|
||||
url_encoded+="$c"
|
||||
;;
|
||||
*)
|
||||
printf -v hex_val "%02X" "'$c" # Uppercase hex values
|
||||
url_encoded+="%$hex_val"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "$url_encoded"
|
||||
}
|
||||
|
||||
## GET TW
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
|
||||
ASTRONAUTENS=$(~/.zen/Astroport.ONE/tools/g1_to_ipfs.py ${QRCODE})
|
||||
[[ ! ${ASTRONAUTENS} ]] \
|
||||
&& (echo "$HTTPCORS ERROR - ASTRONAUTENS !!" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& exit 1
|
||||
|
||||
echo "ipfs --timeout 120s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${MOATS}/index.html"
|
||||
ipfs --timeout 120s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${MOATS}/index.html
|
||||
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/index.html ]]; then
|
||||
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/index.html --output ~/.zen/tmp/${MOATS} --render '.' "MadeInZion.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json ]] \
|
||||
&& ( echo "~~~ NO /ipns/$ASTRONAUTENS (☓‿‿☓) CREATE A TW ~~~" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & ) \
|
||||
&& exit 1
|
||||
|
||||
GPLAYER=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
||||
|
||||
|
||||
REPLACE="https://$myTUBE/ipns/${ASTRONAUTENS}" \
|
||||
|
||||
## REDIRECT TO TW OR GCHANGE PROFILE
|
||||
sed "s~_TWLINK_~${REPLACE}/~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
|
||||
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/${MOATS}/index.redirect
|
||||
|
||||
################################################################################
|
||||
## QRCODE IS HTTP LINK REDIRECT TO
|
||||
###############################################################################
|
||||
if [[ ${QRCODE:0:4} == "http" ]]; then
|
||||
## THIS IS A WEB LINK
|
||||
sed "s~_TWLINK_~${QRCODE}/~g" ${MY_PATH}/../templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
|
||||
sed -i "s~Set-Cookie*~Set-Cookie: $COOKIE~" ~/.zen/tmp/${MOATS}/index.redirect
|
||||
echo "url='"${QRCODE}"'" >> ~/.zen/tmp/${MOATS}/index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## QRCODE="station" : REFRESH STATION & OPEN G1PalPay INTERFACE
|
||||
###############################################################################
|
||||
if [[ ${QRCODE} == "station" ]]; then
|
||||
|
||||
## CHECK FOR ANY ALREADY RUNNING make_image_ipfs_index_carousel
|
||||
carouselrunning=$(ps axf --sort=+utime | grep -w 'make_image_ipfs_index_carousel' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
|
||||
if [[ ! -s ~/.zen/tmp/ISTATION ]]; then
|
||||
if [[ $carouselrunning ]]; then
|
||||
ISTATION="/ipfs/QmVTHH8sTXEqRBsvcKo5jDo16rvp7Q7ERyHZP5vmWUxeS6" ## G1WorldCrafting.jpg
|
||||
else
|
||||
## GENERATE PLAYER G1 TO ZEN ACCOUNTING
|
||||
ISTATION=$($MY_PATH/../tools/make_image_ipfs_index_carousel.sh | tail -n 1)
|
||||
echo $ISTATION > ~/.zen/tmp/ISTATION ## STATION G1WALLET CAROUSEL
|
||||
fi
|
||||
else
|
||||
ISTATION=$(cat ~/.zen/tmp/ISTATION)
|
||||
fi
|
||||
|
||||
## LOG IPFSNODEID : IPCity + Wheater + more...
|
||||
${MY_PATH}/../tools/IPFSNODEID.weather.sh > ~/.zen/tmp/${IPFSNODEID}/weather.txt
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='${ISTATION}'\" />" > ~/.zen/tmp/${IPFSNODEID}/_index.html
|
||||
|
||||
## SHOW ZenStation FRONT
|
||||
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../templates/ZenStation/index.html > ~/.zen/tmp/${MOATS}/index.htm
|
||||
sed -i "s~2L8vaYixCf97DMT8SistvQFeBj7vb6RQL7tvwyiv1XVH~${WORLDG1PUB}~g" ~/.zen/tmp/${MOATS}/index.htm
|
||||
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/${MOATS}/index.htm
|
||||
sed -i "s~http://127.0.0.1:33101~${myG1BILLET}~g" ~/.zen/tmp/${MOATS}/index.htm
|
||||
sed -i "s~http://astroport.localhost:1234~${myASTROPORT}~g" ~/.zen/tmp/${MOATS}/index.htm
|
||||
|
||||
WSTATION="/ipfs/$(ipfs add -q ~/.zen/tmp/${MOATS}/index.htm)"
|
||||
echo $WSTATION > ~/.zen/tmp/WSTATION
|
||||
|
||||
end=`date +%s`
|
||||
echo "NEW WSTATION ${myIPFS}${WSTATION} Execution time was "`expr $end - $start` seconds.
|
||||
|
||||
##302 REDIRECT TO WSTATION IPFS
|
||||
sed "s~_TWLINK_~${myIPFS}${WSTATION}/~g" ${MY_PATH}/../templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
|
||||
sed -i "s~Set-Cookie*~Set-Cookie: $COOKIE~" ~/.zen/tmp/${MOATS}/index.redirect
|
||||
echo "url='"${myIPFSW}${WSTATION}"'" >> ~/.zen/tmp/${MOATS}/index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## QRCODE = PGP ENCRYPTED STRING
|
||||
# /?qrcode=-----BEGIN%20PGP%20MESSAGE-----~~jA0ECQMC5iq8 [ ......... ] _Q%3D%3D~%3D9UIj~-----END%20PGP%20MESSAGE-----~
|
||||
# &pass=coucou&history/read/pay/login=(1|email)&g1pub=_DESTINATAIRE_
|
||||
################################################################################
|
||||
if [[ ${QRCODE:0:5} == "~~~~~" ]]; then
|
||||
PASS=$(urldecode ${THIS})
|
||||
echo "## THIS IS A PGP ENCRYPTED QRCODE ZENCARD - PASS ${PASS} - $APPNAME"
|
||||
|
||||
if [[ ${PASS} != "" ]]; then
|
||||
echo "WHAT=${WHAT} VAL=${VAL}"
|
||||
|
||||
## Recreate GPG aes file
|
||||
urldecode "${QRCODE}" | tr '_' '+' | tr '-' '\n' | tr '~' '-' > ~/.zen/tmp/${MOATS}/disco.aes
|
||||
sed -i '$ d' ~/.zen/tmp/${MOATS}/disco.aes
|
||||
# Decoding
|
||||
echo "cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "${PASS}" --batch"
|
||||
cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "${PASS}" --batch > ~/.zen/tmp/${MOATS}/decoded
|
||||
|
||||
# cat ~/.zen/tmp/${MOATS}/disco
|
||||
## FORMAT IS "/?salt=${USALT}&pepper=${UPEPPER}"
|
||||
DISCO=$(cat ~/.zen/tmp/${MOATS}/decoded | cut -d '?' -f2)
|
||||
arr=(${DISCO//[=&]/ })
|
||||
s=$(urldecode ${arr[0]} | xargs)
|
||||
salt=$(urldecode ${arr[1]} | xargs)
|
||||
p=$(urldecode ${arr[2]} | xargs)
|
||||
pepper=$(urldecode ${arr[3]} | xargs)
|
||||
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
if [[ ${salt} != "" && ${pepper} != "" ]]; then
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/secret.key "$salt" "$pepper"
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
||||
|
||||
echo "COINScheck.sh ${G1PUB}"
|
||||
${MY_PATH}/../tools/COINScheck.sh ${G1PUB} > ~/.zen/tmp/${G1PUB}.curcoin
|
||||
CURCOINS=$(cat ~/.zen/tmp/${G1PUB}.curcoin | tail -n 1 | xargs | cut -d '.' -f 1)
|
||||
CURZEN=$(echo "($CURCOINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
echo "= $CURCOINS G1 / $CURZEN ZEN"
|
||||
|
||||
[[ ${WHAT} == "" ]] && echo "<br> Missing WHAT <br>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
[[ ${VAL} == "" || ${VAL} == "undefined" ]] && echo "<br> Missing Destination PublicKey <br>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
G1DEST=$(echo "$VAL" | cut -d ':' -f 1) ## G1PUB:CHK format
|
||||
CHK=$(echo "$VAL" | cut -d ':' -f 2) ## G1 CHECKSUM or ZEN
|
||||
[[ ${CHK::3} == "ZEN" ]] && echo "ZENCARD $VAL"
|
||||
|
||||
## GET DESTINATION ACCOUNT AMOUNT
|
||||
DESTM=$(${MY_PATH}/../tools/COINScheck.sh ${G1DEST} | tail -n 1)
|
||||
DESTMZEN=$(echo "($DESTM - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
echo "DEST WALLET = $DESTM G1 / $DESTMZEN ZEN"
|
||||
|
||||
if [[ ${APPNAME} == "pay" ]]; then
|
||||
|
||||
if [[ ${WHAT} != "" && ${G1DEST} != "" && ${CURCOINS} != "null" && ${CURCOINS} != "" && ${CURCOINS} > ${WHAT} ]]; then
|
||||
## COMMAND PAYMENT MAX : 999.99
|
||||
if [[ ${WHAT} =~ ^-?[0-9]{1,3}(\.[0-9]{1,2})?$ ]]; then
|
||||
|
||||
${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/secret.key "${WHAT}" "${G1DEST}" "ZEN:${MOATS}"
|
||||
echo "<h1>OK</h1><h2>PAYMENT PROCESSING</h2>ZEN:${MOATS}" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
else
|
||||
|
||||
echo "<h2>${WHAT} FORMAT ERROR</h2>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "<h2> ERROR - ${G1DEST} ? ${CURCOINS} < ${WHAT} ? - ERROR </h2>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${APPNAME} == "flipper" ]]; then
|
||||
## Open OSM2IPF "getreceiver" App
|
||||
|
||||
BASE="qrcode=${QRCODE}&pass=${PASS}"
|
||||
LINK="${myIPFS}${FLIPPERCID}/?${BASE}&coins=${CURCOINS}"
|
||||
echo "LINK:$LINK"
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/disco
|
||||
echo "<script>window.location.href = '${LINK}';</script>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${APPNAME} == "history" || ${APPNAME} == "read" ]]; then
|
||||
|
||||
## history & read ## CANNOT USE jaklis CLI formated output (JSON output)
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/disco
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/disco
|
||||
# cp ~/.zen/tmp/${MOATS}/secret.key ~/.zen/tmp/
|
||||
echo "${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/secret.key $APPNAME -j"
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/secret.key $APPNAME -j >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${APPNAME} == "balance" ]]; then
|
||||
|
||||
## history & read
|
||||
# cp ~/.zen/tmp/${MOATS}/secret.key ~/.zen/tmp/
|
||||
qrencode -s 6 -o "${HOME}/.zen/tmp/${MOATS}/disco.qr.png" "${G1PUB}"
|
||||
QRURL=${myIPFS}/ipfs/$(ipfs add -q ~/.zen/tmp/${MOATS}/disco.qr.png)
|
||||
ONVADIRE="<h1> ${CURZEN} ẐEN </h1>${G1PUB}<br><br><img src=${QRURL} />"
|
||||
echo "${ONVADIRE}" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${APPNAME} == "friend" ]]; then
|
||||
|
||||
# CHECK IF ${G1DEST} HAS A PROFILE
|
||||
${MY_PATH}/../tools/timeout.sh -t 5 \
|
||||
curl -s ${myDATA}/user/profile/${G1DEST} > ~/.zen/tmp/${MOATS}/gchange.json
|
||||
|
||||
## Send ॐ★ॐ
|
||||
[[ -s ~/.zen/tmp/${MOATS}/gchange.json ]] \
|
||||
&& ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/secret.key stars -p ${G1DEST} -n ${WHAT} >> ~/.zen/tmp/${MOATS}/disco \
|
||||
&& rm ~/.zen/tmp/${MOATS}/gchange.json \
|
||||
|| echo "/${G1DEST} profile is not existing yet..." >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# LOGIN / LOGOUT
|
||||
##############################################
|
||||
if [[ ${APPNAME} == "logout" ]]; then
|
||||
|
||||
player=$(echo "${salt}" | cut -d '_' -f 1 | cut -d ' ' -f 1) ## EMAIL_dice_words kind
|
||||
## REMOVE PLAYER IPNS KEY FROM STATION
|
||||
[[ "${player}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] \
|
||||
&& PLAYER=${player} \
|
||||
|| PLAYER=${WHAT}
|
||||
|
||||
ISTHERE=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
if [[ ! ${ISTHERE} ]]; then
|
||||
(
|
||||
echo "$HTTPCORS
|
||||
<h1>LOGOUT ERROR</h1><h2>${PLAYER} keys not found on ZEN Station</h2>" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 \
|
||||
&& echo "SLURP PLAYER ERROR ${player}"
|
||||
) &
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "<h1><a href='$myIPFS/ipns/${ISTHERE}'>TW</a></h1>" > ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
echo "<h2>$PLAYER LOGOUT ...</h2>removing keys : " >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
ipfs key rm ${G1PUB} >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
ipfs key rm ${PLAYER} >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
ipfs key rm "${PLAYER}_feed" >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
|
||||
echo "$HTTPCORS $(cat ~/.zen/tmp/${MOATS}/${MOATS}.log)"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) Execution time was "`expr $end - $start` seconds.
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}.*
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${APPNAME} == "login" ]]; then
|
||||
|
||||
player=$(echo "${salt}" | cut -d '_' -f 1 | cut -d ' ' -f 1) ## EMAIL_dice_words kind
|
||||
|
||||
[[ "${player}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] \
|
||||
&& PLAYER=${player} \
|
||||
|| PLAYER=${WHAT}
|
||||
|
||||
ISTHERE=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
echo "IS THERE ? $ISTHERE"
|
||||
|
||||
[[ ${ISTHERE} == "" ]] \
|
||||
&& ${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/secret.ipns "$salt" "$pepper" \
|
||||
&& ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/secret.ipns \
|
||||
&& ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/secret.ipns \
|
||||
&& ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1) \
|
||||
|| ASTRONAUTENS=${ISTHERE}
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/feed.ipfskey "$salt" "$G1PUB"
|
||||
FEEDNS=$(ipfs key import "${PLAYER}_feed" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/feed.ipfskey)
|
||||
|
||||
( ## 1 HOUR SESSION
|
||||
[[ ${ISTHERE} == "" ]] \
|
||||
&& echo "${PLAYER} SESSION STARTED" \
|
||||
&& sleep 3600 \
|
||||
&& echo "${PLAYER} SESSION ENDED" \
|
||||
&& ipfs key rm ${PLAYER} \
|
||||
&& ipfs key rm ${PLAYER}_feed \
|
||||
&& ipfs key rm ${G1PUB}
|
||||
) &
|
||||
|
||||
REPLACE=${myIPFS}/ipns/${ASTRONAUTENS}
|
||||
echo "${PLAYER} LOGIN - TW : ${REPLACE}"
|
||||
|
||||
sed "s~_TWLINK_~${REPLACE}~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}.index.redirect
|
||||
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/${MOATS}.index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP " && rm -Rf ~/.zen/tmp/${MOATS} && rm ~/.zen/tmp/${MOATS}/${MOATS}*
|
||||
) &
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "<br><h1>${PASS} : MAUVAIS PASS</h1>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
echo "<br><img src='http://127.0.0.1:8080/ipfs/QmVnQ3GkQjNeXw9qM7Fb1TFzwwxqRMqD9AQyHfgx47rNdQ/your-own-data-cloud.svg' />" >> ~/.zen/tmp/${MOATS}/disco
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "<br>DATA MISSING" >> ~/.zen/tmp/${MOATS}/disco
|
||||
fi
|
||||
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/disco | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP ~~ $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
### THIS QRCODE IS EMAIL/PASS/PIN STYLE
|
||||
#~ if [[ ${QRCODE:0:5} == "&&&&&" ]]; then
|
||||
#~ PASS=$(urldecode ${THIS})
|
||||
#~ echo "ZENCARD UPlanet QRCODE : PIN=${PASS}"
|
||||
|
||||
#~ fi
|
||||
|
||||
################################################################################
|
||||
## QRCODE = G1Milgram G1Missive PGP ENCRYPTED STRING
|
||||
# /?qrcode=@@@@@BEGIN%20PGP%20MESSAGE@@@@@~~jA0ECQM...............
|
||||
# &pass=YYYYMM&milgram=NEWLINE&email=DESTMAIL
|
||||
################################################################################
|
||||
if [[ ${QRCODE:0:5} == "@@@@@" ]]; then
|
||||
PASS=$(urldecode ${THIS})
|
||||
NEWLINE=$(urldecode ${WHAT})
|
||||
DESTMAIL=$(urldecode ${VAL,,}) # lowercase
|
||||
|
||||
echo "## G1BILLET+ - @PASS ${PASS} - $APPNAME"
|
||||
|
||||
if [[ ${PASS} != "" ]]; then
|
||||
|
||||
## Recreate GPG aes file
|
||||
urldecode ${QRCODE} | tr '_' '+' | tr '-' '\n' | tr '@' '-' > ~/.zen/tmp/${MOATS}/disco.aes
|
||||
sed -i '$ d' ~/.zen/tmp/${MOATS}/disco.aes
|
||||
# Decoding
|
||||
echo "cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "${PASS}" --batch"
|
||||
cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "${PASS}" --batch > ~/.zen/tmp/${MOATS}/decoded
|
||||
|
||||
## ASTROID COULD BE UP TO 12 MONTH OLD
|
||||
if [[ ! -s ~/.zen/tmp/${MOATS}/decoded ]]; then
|
||||
for ((i = 1; i < 13; i++)); do
|
||||
UPASS=$(date -d "$i months ago" +"%Y%m")
|
||||
cat ~/.zen/tmp/${MOATS}/disco.aes | gpg -d --passphrase "${UPASS}" --batch > ~/.zen/tmp/${MOATS}/decoded
|
||||
[[ -s ~/.zen/tmp/${MOATS}/decoded ]] && WARNING="=== CARD IS ${i} MONTH OLD ===" && CAGE=${i} && break
|
||||
done
|
||||
fi
|
||||
|
||||
# cat ~/.zen/tmp/${MOATS}/disco
|
||||
## FORMAT IS "/?salt=${USALT}&pepper=${UPEPPER}"
|
||||
## MADE by tools/VOEUX.print.sh WITH USALT="EMAIL(_SEC1_SEC2)" UPEPPER="G1VoeuName OriG1PUB"
|
||||
DISCO=$(cat ~/.zen/tmp/${MOATS}/decoded | cut -d '?' -f2)
|
||||
arr=(${DISCO//[=&]/ })
|
||||
s=$(urldecode ${arr[0]} | xargs)
|
||||
salt=$(urldecode ${arr[1]} | xargs)
|
||||
p=$(urldecode ${arr[2]} | xargs)
|
||||
pepper=$(urldecode ${arr[3]} | xargs)
|
||||
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
if [[ ${salt} != "" && ${pepper} != "" ]]; then
|
||||
|
||||
echo "secret1=$salt" ## CONTAINS "EMAIL(_SEC1_SEC2)"
|
||||
player=$(echo $salt | cut -d '_' -f 1 | cut -d ' ' -f 1 | grep '@')
|
||||
echo "player=$player"
|
||||
|
||||
# # G1BILLET+ interlinked ? ## POSSIBLE BUG WITH EMAIL CONTAINING "_" # TODO
|
||||
[[ $(echo "$salt" | grep '_') ]] \
|
||||
&& echo "G1BILLET+ interlinked : salt pepper refining" \
|
||||
&& murge=($(echo $salt | cut -d '_' -f 2- | sed 's/_/ /g' | xargs)) \
|
||||
&& echo "${#murge[@]} dice words" && i=$(( ${#murge[@]} / 2 )) && i=$(( i + 1 )) \
|
||||
&& extra1=$(echo "${murge[@]}" | rev | cut -d ' ' -f $i- | rev) \
|
||||
&& extra2=$(echo "${murge[@]}" | cut -d ' ' -f $i-) \
|
||||
&& VoeuName="G1BILLET+" \
|
||||
&& billkeyname=$(echo "${extra1} ${extra2}" | sha512sum | awk '{print $1}')
|
||||
|
||||
echo "salt=$salt" ## CONTAINS "EMAIL"
|
||||
echo "pepper=$pepper" ## CONTAINS "G1VoeuName ORIGING1PUB" or G1BILLET+ secret2
|
||||
|
||||
[[ ${pepper:0:2} == "G1" ]] \
|
||||
&& VoeuName=$(echo $pepper | cut -d ' ' -f 1 | cut -c 3-) \
|
||||
&& PLAYERORIG1=$(echo $pepper | rev | cut -d ' ' -f 1 | rev) \
|
||||
&& echo "$VoeuName $PLAYERORIG1 @PASS"
|
||||
|
||||
## CHECK PLAYERORIG1 WALLETS
|
||||
echo "${MY_PATH}/../tools/jaklis/jaklis.py balance -p ${PLAYERORIG1}"
|
||||
PLAYERCOINS=$(${MY_PATH}/../tools/COINScheck.sh ${PLAYERORIG1} | tail -n 1)
|
||||
echo "<br><b>${player} $PLAYERCOINS G1</b>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
### IF EMPTY ??? WHAT TODO
|
||||
|
||||
orikeyname="${player}_${VoeuName}"
|
||||
destkeyname="${DESTMAIL}_${VoeuName}"
|
||||
echo "@PASS KEYS :
|
||||
ORIGIN=$orikeyname
|
||||
DEST=$destkeyname
|
||||
BILL=$billkeyname"
|
||||
## REVEAL THE KEYS
|
||||
# G1VOEU & IPNS KEY
|
||||
[[ ${player} != "" ]] \
|
||||
&& ${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/playersecret.ipfs "${player}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}" \
|
||||
&& ${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/player.secret.key "${player}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}" \
|
||||
&& G1VOEUPUB=$(cat ~/.zen/tmp/${MOATS}/player.secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
||||
# INSTALL orikeyname IPNS KEY ON NODE
|
||||
IK=$(ipfs key list -l | grep -w "${orikeyname}" | cut -d ' ' -f 1 )
|
||||
[[ ! $IK ]] && ipfs key import ${orikeyname} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/playersecret.ipfs
|
||||
|
||||
## IS IT A TRANSFER ? MILGRAM G1MISSIVE
|
||||
[[ ${DESTMAIL} != "" ]] \
|
||||
&& echo "MILGRAM :: ${player} :: ${DESTMAIL}"
|
||||
#~ && DESTG1=$(${MY_PATH}/../tools/keygen "${DESTMAIL}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}") \
|
||||
#~ && ${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/destsecret.ipfs "${DESTMAIL}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}"
|
||||
|
||||
# INSTALL orikeyname IPNS KEY ON NODE
|
||||
IK=$(ipfs key list -l | grep -w "${orikeyname}" | cut -d ' ' -f 1 )
|
||||
[[ ! $IK ]] && ipfs key import ${orikeyname} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/playersecret.ipfs
|
||||
|
||||
## IS IT LINKED WITH extra G1BILLET+
|
||||
[[ ${extra1} != "" && ${extra2} != "" ]] \
|
||||
&& echo "@PASS LINK TO G1BILLET+ :: ${extra1} :: ${extra2}" \
|
||||
&& EXTRAG1=$(${MY_PATH}/../tools/keygen "${extra1}" "${extra2}") \
|
||||
&& ${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/extrasecret.ipfs "${extra1}" "${extra2}" \
|
||||
&& EXTRAG1COINS=$(${MY_PATH}/../tools/COINScheck.sh ${EXTRAG1} | tail -n 1) \
|
||||
&& echo "<br><b>EXTRA ${VoeuName} $EXTRAG1COINS G1</b>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
# Don't care if ORIGIN PLAYER is THERE
|
||||
#~ ISTHERE=$(ipfs key list -l | grep -w ${player} | cut -d ' ' -f1)
|
||||
#~ echo "<h1>$player G1MISSIVE<h1> $ISTHERE" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
echo "${MY_PATH}/../tools/jaklis/jaklis.py balance -p ${G1VOEUPUB}"
|
||||
G1VOEUCOINS=$(${MY_PATH}/../tools/COINScheck.sh ${G1VOEUPUB} | tail -n 1)
|
||||
echo "<br><b>${VoeuName} $G1VOEUCOINS G1</b>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
echo ${WARNING} >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
#CONVERT TO IPNS KEY
|
||||
G1VOEUNS=$(${MY_PATH}/../tools/g1_to_ipfs.py ${G1VOEUPUB})
|
||||
## RETRIEVE IPNS CONTENT
|
||||
echo "${myIPFS}/ipns/$G1VOEUNS"
|
||||
if [[ ! -s ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt ]]; then
|
||||
HELLO="@PASS :: G1BILLET+ :: ${G1VOEUPUB} :: $(date) :: ${player} :: ${PLAYERORIG1}"
|
||||
echo "${HELLO}"
|
||||
avanla=$(ps axf --sort=+utime | grep -w 'ipfs cat /ipns/$G1VOEUNS' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ ! $avanla ]] \
|
||||
&& ( ipfs cat /ipns/$G1VOEUNS > ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt \
|
||||
&& [[ ! -s ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt ]] \
|
||||
&& echo "@PASS G1BILLET+ INIT" \
|
||||
&& echo "${HELLO}" > ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt \
|
||||
&& MILGRAM=$(ipfs add -q ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt) \
|
||||
&& ipfs name publish -k ${player}_${VoeuName} /ipfs/${MILGRAM} &
|
||||
) &
|
||||
|
||||
echo "<br>PLEASE RETRY IN 30 SECONDS GETTING MESSAGE FROM IPFS<bipfsr>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/disco | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
|
||||
fi
|
||||
echo "<br><br>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
cat ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
[[ ${NEWLINE} == "" || ${NEWLINE} == "undefined" ]] && echo "<br> NO NEW LINE <br>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
[[ ${DESTMAIL} == "" || ${DESTMAIL} == "undefined" ]] && echo "<br> Missing Destination EMAIL <br>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
## CHECK VALID EMAIL FORMAT
|
||||
[[ "${DESTMAIL}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] \
|
||||
&& echo "<br> GOOD $DESTMAIL <br>" >> ~/.zen/tmp/${MOATS}/disco \
|
||||
&& GOMAIL=1
|
||||
|
||||
if [[ $APPNAME == "milgram" && ${GOMAIL} == 1 ]]; then
|
||||
|
||||
# SEARCH FOR DESTMAIL IN SWARM
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${DESTMAIL}) ## export ASTROTW and more
|
||||
echo "export ASTROTW=${ASTROTW} ASTROG1=${ASTROG1} ASTROMAIL=${DESTMAIL} ASTROFEED=${FEEDNS}"
|
||||
|
||||
# Create Next G1 & IPNS KEY
|
||||
DESTG1PUB=$(${MY_PATH}/../tools/keygen"${DESTMAIL}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}")
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/newsecret.ipfs "${DESTMAIL}${UPLANETNAME}" "G1${VoeuName} ${PLAYERORIG1}${UPLANETNAME}"
|
||||
|
||||
orikeyname="${DESTMAIL}_${VoeuName}"
|
||||
# INSTALL NEXT IPNS KEY ON NODE
|
||||
IK=$(ipfs key list -l | grep -w "${orikeyname}" | cut -d ' ' -f 1 )
|
||||
[[ ! $IK ]] && ipfs key import ${orikeyname} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/newsecret.ipfs
|
||||
|
||||
## CREATE NEXT G1Missive !
|
||||
NEWIMAGIC=$(${MY_PATH}/../tools/VOEUX.print.sh "${DESTMAIL}" "${VoeuName}" "${MOATS}" "${PLAYERORIG1}" | tail -n 1)
|
||||
|
||||
## ADD NEWLINE TO MESSAGE
|
||||
if [[ ${NEWLINE} != "" ]]; then
|
||||
CLINE=$(echo "${NEWLINE}" | detox --inline)
|
||||
echo "$CLINE" >> ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt ## NB: File could still being into "ipfs cat" process... TODO MAKE BETTER
|
||||
fi
|
||||
|
||||
echo "UPDATED" >> ~/.zen/tmp/${MOATS}/disco
|
||||
cat ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt >> ~/.zen/tmp/${MOATS}/disco
|
||||
echo "<br><img src=/ipfs/$NEWIMAGIC />" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
MILGRAM=$(ipfs add -q ~/.zen/tmp/${MOATS}/${PLAYERORIG1}.${VoeuName}.missive.txt)
|
||||
|
||||
(
|
||||
ipfs name publish -k ${DESTMAIL}_${VoeuName} /ipfs/${MILGRAM}
|
||||
echo "${VoeuName} ${PASS} G1Milgram emitted ${DESTMAIL}"
|
||||
) &
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
## TODO : EMPTY WALLET BACK TO ORIGIN
|
||||
echo "<br><h1>${PASS} ${UPASS} ARE BAD</h1>" >> ~/.zen/tmp/${MOATS}/disco
|
||||
echo "<br><img src='/ipfs/QmVnQ3GkQjNeXw9qM7Fb1TFzwwxqRMqD9AQyHfgx47rNdQ/your-own-data-cloud.svg' />" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "<br>DATA MISSING" >> ~/.zen/tmp/${MOATS}/disco
|
||||
|
||||
fi
|
||||
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/disco | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP @@ $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
###################################################################################################
|
||||
###################################################################################################
|
||||
# API TWO : ?qrcode=G1PUB&url=____&type=____
|
||||
|
||||
|
||||
## Astroport.ONE local use QRCODE Contains ${WHAT} G1PUB
|
||||
g1pubpath=$(grep $QRCODE ~/.zen/game/players/*/.g1pub | cut -d ':' -f 1 2>/dev/null)
|
||||
PLAYER=$(echo "$g1pubpath" | rev | cut -d '/' -f 2 | rev 2>/dev/null)
|
||||
################################################################################
|
||||
## QRCODE = G1* : MODE G1VOEU : RETURN WISHNS - IPNS App link - or direct tw tag selected json
|
||||
# ~/?qrcode=G1Tag&tw=_IPNS_PLAYER_(&json)
|
||||
################################################################################
|
||||
if [[ ${QRCODE:0:2} == "G1" && ${AND} == "tw" ]]; then
|
||||
|
||||
## FORCE LOCAL USE ONLY. Remove to open 1234 API
|
||||
[[ ! -d ~/.zen/game/players/${PLAYER} || ${PLAYER} == "" ]] \
|
||||
&& (echo "$HTTPCORS ERROR - QRCODE - NO ${PLAYER} ON BOARD !!" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& exit 1
|
||||
VOEU=${QRCODE:2} ## "G1G1Voeu" => "G1Voeu"
|
||||
# THIS is TW IPNS
|
||||
ASTROPATH=$(grep -r ${THIS} ~/.zen/game/players/*/ipfs/moa | tail -n 1 | xargs | cut -d ':' -f 1 | rev | cut -d '/' -f 2- | rev 2>/dev/null)
|
||||
echo "ASTROPATH=${ASTROPATH}"
|
||||
|
||||
## Demande de copie d'une URL reçue.
|
||||
if [[ $URL ]]; then
|
||||
[[ ${TYPE} ]] && CHOICE="${TYPE}" || CHOICE="Youtube"
|
||||
INDEX=${ASTROPATH}/index.html
|
||||
echo $INDEX
|
||||
|
||||
## CREATION TIDDLER "G1Voeu" G1CopierYoutube
|
||||
# CHOICE = "Video" Page MP3 Web
|
||||
~/.zen/Astropor.ONE/ajouter_media.sh "${URL}" "$PLAYER" "$CHOICE" &
|
||||
if [[ -s ${INDEX} ]]; then
|
||||
|
||||
echo "## Insertion tiddler : G1CopierYoutube"
|
||||
echo '[
|
||||
{
|
||||
"title": "'${MOATS}'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"text": "'${URL}'",
|
||||
"tags": "'CopierYoutube ${WHAT}'"
|
||||
}
|
||||
]
|
||||
' > ~/.zen/tmp/${WHAT}.${MOATS}.import.json
|
||||
echo "OK FOUND TW: ${INDEX}"
|
||||
|
||||
## TODO ASTROBOT "G1AstroAPI" READS ~/.zen/tmp/${WHAT}.${MOATS}.import.json
|
||||
if [[ ${APPNAME} == "json" ]]; then
|
||||
##############################################
|
||||
echo "DIRECT Tag = ${VOEU} OUTPUT"
|
||||
## DIRECT JSON OUTPUT
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag['${VOEU}']]'
|
||||
|
||||
(echo "$HTTPCORS OK - ~/.zen/tmp/${WHAT}.${MOATS}.import.json WORKS IF YOU MAKE THE WISH voeu 'AstroAPI'" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 0
|
||||
|
||||
else
|
||||
|
||||
(echo "$HTTPCORS ERROR - ${AND} - ${THIS} UNKNOWN" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/index.redirect
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/index.redirect
|
||||
cat ~/.zen/tmp/${MOATS}/g1voeu.json >> ~/.zen/tmp/${MOATS}/index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP g1voeu.json $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
|
||||
fi
|
||||
##############################################
|
||||
echo "## IPNS G1Voeu APP REDIRECT"
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp --render '.' "${MOATS}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]'
|
||||
cat ~/.zen/tmp/${MOATS}.g1voeu.json | jq -r 'map(select(.wish != null)) | .[].wish' > ~/.zen/tmp/${MOATS}.g1wishes.txt
|
||||
cat ~/.zen/tmp/${MOATS}.g1wishes.txt
|
||||
while read WISH
|
||||
do
|
||||
[[ ${WISH} == "" || ${WISH} == "null" ]] && echo "BLURP. EMPTY WISH" && continue
|
||||
WISHNAME=$(cat ~/.zen/tmp/${MOATS}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title')
|
||||
WISHNS=$(cat ~/.zen/tmp/${MOATS}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wishns')
|
||||
|
||||
[[ ${WISHNS} == null ]] && WISHNS="/ipns/"$(cat ~/.zen/tmp/${MOATS}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .ipns') ## KEEP OLD PROTOCOL COMPATIBLE
|
||||
|
||||
echo "${WISHNAME} : ${WISHNS} "
|
||||
[[ "G1${WISHNAME}" == "$VOEU" ]] \
|
||||
&& echo "FOUND" \
|
||||
&& LINK=${myIPFS}${WISHNS} \
|
||||
&& break
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}.g1wishes.txt
|
||||
|
||||
fi
|
||||
|
||||
[[ $LINK == "" ]] && LINK="$myIPFS/ipfs/QmWUZr62SpriLPuqauMbMxvw971qnu741hV8EhrHmKF2Y4" ## 404 LOST IN CYBERSPACE
|
||||
|
||||
## REDIRECT TO G1VOEU IPNS ADDRESS
|
||||
echo "#>>> DISPLAY WISHNS >>>> # $VOEU : $LINK"
|
||||
sed "s~_TWLINK_~${LINK}~g" ${MY_PATH}/../templates/index.302 > ~/.zen/tmp/${MOATS}/index.redirect
|
||||
sed -i "s~Set-Cookie*~Set-Cookie: $COOKIE~" ~/.zen/tmp/${MOATS}/index.redirect
|
||||
echo "url='"${LINK}"'" >> ~/.zen/tmp/${MOATS}/index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP ${LINK} $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## QRCODE = IPNS or G1PUB ? Can be ASTRONAUTENS or G1PUB format
|
||||
ZCHK="$(echo $THAT | cut -d ':' -f 2-)" # ChK or ZEN
|
||||
[[ $ZCHK == $THAT ]] && ZCHK=""
|
||||
QRCODE="${QRCODE%%:*}" ## TRIM :ChK
|
||||
################################################################################
|
||||
################################################################################
|
||||
## QRCODE IS IPNS FORMAT "12D3Koo" ( try ipfs_to_g1 )
|
||||
IPNS2G1=$(${MY_PATH}/../tools/ipfs_to_g1.py ${QRCODE} 2>/dev/null)
|
||||
echo "IPNS2G1=${IPNS2G1} ZCHK=${ZCHK}"
|
||||
[[ ${ZCHK} == "" && ${#IPNS2G1} -ge 40 && ${QRCODE::4} == "12D3" ]] \
|
||||
&& echo "${PORT} QRCODE IS IPNS ADDRESS : ${myIPFS}/ipns/${QRCODE}" \
|
||||
&& (echo "$HTTPCORS <meta http-equiv=\"refresh\" content=\"0; url='${myIPFS}/ipns/${QRCODE}'\" />Loading from IPFS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& echo "GLUPS /ipns/${QRCODE} $PORT" && rm -Rf ~/.zen/tmp/${MOATS} \
|
||||
&& exit 0
|
||||
|
||||
## TEST G1 TYPE ( try g1_to_ipfs )
|
||||
ASTROTOIPNS=$(${MY_PATH}/../tools/g1_to_ipfs.py ${QRCODE} 2>/dev/null)
|
||||
[[ ! ${ASTROTOIPNS} ]] \
|
||||
&& echo "${PORT} INVALID QRCODE : ${QRCODE}" \
|
||||
&& (echo "$HTTPCORS ERROR - INVALID QRCODE : ${QRCODE}" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& echo "GLUPS INVALID ${QRCODE} $PORT" && rm -Rf ~/.zen/tmp/${MOATS} \
|
||||
&& exit 1
|
||||
################################################################################
|
||||
echo "############################################################################"
|
||||
echo ">>> ${QRCODE} g1_to_ipfs $ASTROTOIPNS"
|
||||
|
||||
## GET VISITOR G1 WALLET AMOUNT : VISITORCOINS
|
||||
echo "${ZCHK} COINScheck ${QRCODE}"
|
||||
VISITORCOINS=$(${MY_PATH}/../tools/COINScheck.sh ${QRCODE} | tail -n 1)
|
||||
COINSFILE=$HOME/.zen/tmp/${MOATS}/${QRCODE}.COINS
|
||||
|
||||
[[ ${VISITORCOINS} != "null" ]] \
|
||||
&& ZEN=$(echo "($VISITORCOINS - 1) * 10" | bc | cut -d '.' -f 1) \
|
||||
|| ZEN="-10"
|
||||
|
||||
DISPLAY="<h1>$VISITORCOINS G1</h1>"
|
||||
|
||||
## WALLET VIERGE
|
||||
###########################################
|
||||
if [[ $VISITORCOINS == "null" || ${ZEN} -lt 10 ]]; then
|
||||
|
||||
DISPLAY="$DISPLAY
|
||||
<h2>!! LOW ZEN WALLET ZEN=${ZEN}<h2>"
|
||||
|
||||
DISPLAY="$DISPLAY<h3>LOW ZEN WARNING</h3>
|
||||
PLEASE CHARGE... ${ZEN} ZEN"
|
||||
|
||||
fi
|
||||
|
||||
## WE SEND WALLET AMOUNT DISPLAY
|
||||
(
|
||||
echo "$HTTPCORS ${QRCODE}:${ZCHK}:${DISPLAY}<h2><a href='$myUPLANET/g1gate/?pubkey="$QRCODE"'>SCAN WALLET</a><h2>" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP ${DISPLAY} $PORT" && rm -Rf ~/.zen/tmp/${MOATS}
|
||||
) &
|
||||
|
||||
exit 0
|
||||
|
|
680
API/SALT.sh
|
@ -4,12 +4,18 @@
|
|||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: SALT & PEPPER
|
||||
## API: SALT & PEPPER - PRIVATE KEY AUTH
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
SALT=$THAT
|
||||
PEPPER=$THIS
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
Access-Control-Allow-Credentials: true
|
||||
|
@ -18,147 +24,197 @@ Server: Astroport.ONE
|
|||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
|
||||
start=`date +%s`
|
||||
[[ ! $APPNAME || $SALT == "pepper" ]] \
|
||||
&& echo "NO APPNAME - BAD APP - CONTINUE" \
|
||||
&& (echo "$HTTPCORS ERROR - BAD CREDENTIALS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& exit 1
|
||||
|
||||
PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
SALT=$THAT
|
||||
PEPPER=$THIS
|
||||
############################################################################
|
||||
# WRITING API # SALT # PEPPER # MAKING THE KEY EXIST #########
|
||||
################### KEY GEN ###################################
|
||||
echo ">>>>>>>>>>>>>> Application LaBureautique >><< APPNAME = $APPNAME <<<<<<<<<<<<<<<<<<<<"
|
||||
|
||||
[[ ! $APPNAME || $SALT == "pepper" ]] && echo "NO APPNAME - BAD APP - CONTINUE" && exit 1
|
||||
############################################################################
|
||||
# WRITING API # SALT # PEPPER # MAKING THE KEY EXIST #########
|
||||
################### KEY GEN ###################################
|
||||
echo ">>>>>>>>>>>>>> Application LaBureautique >><< APPNAME = $APPNAME <<<<<<<<<<<<<<<<<<<<"
|
||||
[[ ! $SALT ]] && (echo "$HTTPCORS ERROR - SALT MISSING" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
[[ ! $PEPPER || ${PEPPER:0:2} == "G1" ]] && (echo "$HTTPCORS ERROR - BAD OR PEPPER MISSING" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
|
||||
[[ ! $SALT ]] && (echo "$HTTPCORS ERROR - SALT MISSING" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
[[ ! $PEPPER ]] && (echo "$HTTPCORS ERROR - PEPPER MISSING" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
## SAVE "salt" "pepper" DEBUG REMOVE OR PASS ENCRYPT FOR SECURITY REASON
|
||||
echo "PLAYER : \"$SALT\" \"$PEPPER\" : $APPNAME ($WHAT)"
|
||||
echo "\"$SALT\" \"$PEPPER\"" > ~/.zen/tmp/${MOATS}/${MOATS}.secret.june
|
||||
|
||||
## SAVE "salt" "pepper" DEBUG REMOVE OR PASS ENCRYPT FOR SECURITY REASON
|
||||
echo "PLAYER : \"$SALT\" \"$PEPPER\" : $APPNAME ($WHAT)"
|
||||
echo "\"$SALT\" \"$PEPPER\"" > ~/.zen/tmp/coucou/${MOATS}.secret.june
|
||||
# CALCULATING ${MOATS}.secret.key + G1PUB
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${MOATS}.secret.key "$SALT" "$PEPPER"
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/${MOATS}.secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[[ ! ${G1PUB} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - KEYGEN COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
echo "G1PUB : ${G1PUB}"
|
||||
|
||||
# CALCULATING ${MOATS}.secret.key + G1PUB
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/coucou/${MOATS}.secret.key "$SALT" "$PEPPER"
|
||||
G1PUB=$(cat ~/.zen/tmp/coucou/${MOATS}.secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[[ ! ${G1PUB} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - KEYGEN COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
echo "G1PUB : ${G1PUB}"
|
||||
## CALCULATING ${MOATS}.${G1PUB}.ipns.key ADDRESS
|
||||
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
||||
rm -f ~/.zen/tmp/${MOATS}/${MOATS}.${G1PUB}.ipns.key
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${MOATS}.${G1PUB}.ipns.key "$SALT" "$PEPPER"
|
||||
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${MOATS}.${G1PUB}.ipns.key )
|
||||
[[ ! ${ASTRONAUTENS} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - ASTRONAUTENS COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
|
||||
## CALCULATING ${MOATS}.${G1PUB}.ipns.key ADDRESS
|
||||
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
||||
rm -f ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key "$SALT" "$PEPPER"
|
||||
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key )
|
||||
[[ ! ${ASTRONAUTENS} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - ASTRONAUTENS COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 1
|
||||
|
||||
echo "TW ADDRESS : $myIPFS/ipns/${ASTRONAUTENS}"
|
||||
echo
|
||||
|
||||
################### KEY GEN ###################################
|
||||
|
||||
# Get PLAYER wallet amount
|
||||
( ## SUB PROCESS
|
||||
COINS=$(${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key balance)
|
||||
echo "+++ WALLET BALANCE _ $COINS (G1) _"
|
||||
[[ $COINS == "" || $COINS == "null" ]] && ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key send -d "${G1PUB}" -t "BRO" -m "0 G1 (ᵔ◡◡ᵔ) FLASH TON G1VISA"
|
||||
end=`date +%s`
|
||||
echo "G1WALLET (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
) &
|
||||
########################################
|
||||
|
||||
########################################
|
||||
## ARCHIVE TOCTOC ${WHAT}S KEEP LOG (TODO : ERASE)
|
||||
########################################
|
||||
mkdir -p ~/.zen/game/players/.toctoc/
|
||||
ISTHERE=$(ls -t ~/.zen/game/players/.toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1 | cut -d '.' -f 1)
|
||||
TTIME=$(echo $ISTHERE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
||||
if [[ ! $ISTHERE ]]; then
|
||||
echo "${APPNAME} 1ST TOCTOC : ${MOATS}"
|
||||
cp ~/.zen/tmp/coucou/${MOATS}.* ~/.zen/game/players/.toctoc/
|
||||
else ## KEEP 1ST CONTACT ONLY
|
||||
OLDONE=$(ls -t ~/.zen/tmp/coucou/*.${G1PUB}.ipns.key | tail -n 1)
|
||||
DTIME=$(echo $OLDONE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
||||
[[ $DTIME != ${MOATS} ]] && rm ~/.zen/tmp/coucou/$DTIME.*
|
||||
fi
|
||||
echo "TW ADDRESS : $myIPFS/ipns/${ASTRONAUTENS}"
|
||||
echo
|
||||
|
||||
########################################
|
||||
## APPNAME SELECTION ########################
|
||||
########################################
|
||||
|
||||
##############################################
|
||||
# MESSAGING
|
||||
# MESSAGING : GET MESSAGE FROM GCHANGE+
|
||||
##############################################
|
||||
if [[ $APPNAME == "messaging" ]]; then
|
||||
if [[ $APPNAME == "messaging" ]]; then
|
||||
|
||||
( ## & SUB PROCESS
|
||||
( ## & SUB PROCESS
|
||||
|
||||
echo "Extracting ${G1PUB} messages..."
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/coucou/messin.${G1PUB}.json
|
||||
[[ ! -s ~/.zen/tmp/coucou/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messin.${G1PUB}.json
|
||||
echo "Extracting ${G1PUB} messages..."
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/${MOATS}/messin.${G1PUB}.json
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/${MOATS}/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/${MOATS}/messin.${G1PUB}.json
|
||||
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/coucou/messout.${G1PUB}.json
|
||||
[[ ! -s ~/.zen/tmp/coucou/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messout.${G1PUB}.json
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/${MOATS}/messout.${G1PUB}.json
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/${MOATS}/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/${MOATS}/messout.${G1PUB}.json
|
||||
|
||||
echo "Creating messages In/Out JSON ~/.zen/tmp/coucou/${MOATS}.messaging.json"
|
||||
echo '[' > ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||
cat ~/.zen/tmp/coucou/messin.${G1PUB}.json >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||
echo "," >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||
cat ~/.zen/tmp/coucou/messout.${G1PUB}.json >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||
echo ']' >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||
echo "Creating messages In/Out JSON ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json"
|
||||
echo '[' > ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json
|
||||
cat ~/.zen/tmp/${MOATS}/messin.${G1PUB}.json >> ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json
|
||||
echo "," >> ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json
|
||||
cat ~/.zen/tmp/${MOATS}/messout.${G1PUB}.json >> ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json
|
||||
echo ']' >> ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json
|
||||
|
||||
## ADDING HTTP/1.1 PROTOCOL HEADER
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
cat ~/.zen/tmp/coucou/${MOATS}.messaging.json >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
## ADDING HTTP/1.1 PROTOCOL HEADER
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
cat ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json >> ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
|
||||
## SEND REPONSE PROCESS IN BACKGROUD
|
||||
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
#~ ( ## USING IPNS SESSION KEY
|
||||
#~ REPONSE=$(cat ~/.zen/tmp/coucou/${MOATS}.messaging.json | ipfs add -q)
|
||||
#~ ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||
#~ echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
|
||||
#~ ) &
|
||||
## SEND REPONSE PROCESS IN BACKGROUD
|
||||
( cat ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && rm ~/.zen/tmp/${MOATS}/${MOATS}* ) &
|
||||
#~ ( ## USING IPNS SESSION KEY
|
||||
#~ REPONSE=$(cat ~/.zen/tmp/${MOATS}/${MOATS}.messaging.json | ipfs add -q)
|
||||
#~ ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||
#~ echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
|
||||
#~ ) &
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:${APPNAME}:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:${APPNAME}:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
|
||||
) & ## & SUB PROCESS
|
||||
) & ## & SUB PROCESS
|
||||
|
||||
end=`date +%s`
|
||||
echo " Messaging launch (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
end=`date +%s`
|
||||
echo " Messaging launch (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
######################## MESSAGING END
|
||||
|
||||
########################################
|
||||
# G1PUB : REDIRECT TO GCHANGE OR TW + EMAIL => CREATE PLAYER !
|
||||
########################################
|
||||
if [[ "$APPNAME" == "g1pub" ]]; then
|
||||
|
||||
if [[ "$OBJ" != "email" ]]; then
|
||||
## WITH NO EMAIL -> Open Gchange Profile & Update TW cache
|
||||
[[ ${WHAT} == "astro" ]] && REPLACE="https://$myTUBE/ipns/${ASTRONAUTENS}" \
|
||||
|| REPLACE="$myGCHANGE/#/app/user/${G1PUB}"
|
||||
echo ${REPLACE}
|
||||
|
||||
## REDIRECT TO TW OR GCHANGE PROFILE
|
||||
sed "s~_TWLINK_~${REPLACE}/~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
## USED BY https://git.p2p.legal/La_Bureautique/zeg1jeux/src/branch/main/lib/Fred.class.php#L81
|
||||
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
|
||||
### REPONSE=$(echo $myGCHANGE/#/app/user/${G1PUB}/ | ipfs add -q)
|
||||
### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||
### echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
${MY_PATH}/../tools/TW.cache.sh ${ASTRONAUTENS} ${MOATS}
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}*
|
||||
) &
|
||||
end=`date +%s`
|
||||
echo $APPNAME" (0‿‿0) ${WHAT} Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
|
||||
else
|
||||
|
||||
# CREATE PLAYER : ?salt=PHRASE%20UNE&pepper=PHRASE%20DEUX&g1pub=on&email=EMAIL&pseudo=PROFILENAME
|
||||
# WHAT can contain urlencoded FullURL
|
||||
EMAIL="${VAL,,}" # lowercase
|
||||
|
||||
[[ ! ${EMAIL} ]] && (echo "$HTTPCORS ERROR - MISSING ${EMAIL} FOR ${WHAT} CONTACT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
## CHECK WHAT IS EMAIL
|
||||
if [[ "${EMAIL}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]; then
|
||||
echo "VALID EMAIL OK"
|
||||
else
|
||||
echo "BAD EMAIL"
|
||||
(echo "$HTTPCORS KO ${EMAIL} : bad '" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 0
|
||||
fi
|
||||
######################## MESSAGING END
|
||||
|
||||
########################################
|
||||
# G1PUB WITH NO EMAIL -> Open Gchange Profile & Update TW cache
|
||||
########################################
|
||||
if [[ "$APPNAME" == "g1pub" && "$OBJ" != "email" ]]; then
|
||||
## CREATE PSEUDO FROM
|
||||
if [[ ! $PSEUDO ]]; then
|
||||
PSEUDO=$(echo ${EMAIL} | cut -d '@' -f 1)
|
||||
PSEUDO=${PSEUDO,,}; PSEUDO=${PSEUDO%%[0-9]*}${RANDOM:0:4}
|
||||
fi
|
||||
|
||||
[[ ${WHAT} == "astro" ]] && REPLACE="https://$myTUBE/ipns/${ASTRONAUTENS}" \
|
||||
|| REPLACE="$myGCHANGE/#/app/user/${G1PUB}"
|
||||
echo ${REPLACE}
|
||||
if [[ ! -d ~/.zen/game/players/${EMAIL} ]]; then
|
||||
|
||||
## REDIRECT TO TW OR GCHANGE PROFILE
|
||||
sed "s~_TWLINK_~${REPLACE}/~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
## USED BY https://git.p2p.legal/La_Bureautique/zeg1jeux/src/branch/main/lib/Fred.class.php#L81
|
||||
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
echo "# ASTRONAUT NEW VISA Create VISA.new.sh in background (~/.zen/tmp/email.${EMAIL}.${MOATS}.txt)"
|
||||
|
||||
### REPONSE=$(echo $myGCHANGE/#/app/user/${G1PUB}/ | ipfs add -q)
|
||||
### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||
### echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
|
||||
(
|
||||
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
${MY_PATH}/../tools/TW.cache.sh ${ASTRONAUTENS} ${MOATS}
|
||||
) &
|
||||
startvisa=`date +%s`
|
||||
[[ "$SALT" == "0" && "$PEPPER" == "0" ]] && SALT="" && PEPPER="" # "0" "0" means random salt pepper
|
||||
#~ echo "VISA.new : \"$SALT\" \"$PEPPER\" \"${EMAIL}\" \"$PSEUDO\" \"${WHAT}\"" > ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
${MY_PATH}/../RUNTIME/VISA.new.sh "$SALT" "$PEPPER" "${EMAIL}" "$PSEUDO" "${WHAT}" >> ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
|
||||
#~ ${MY_PATH}/../tools/mailjet.sh "${EMAIL}" ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt "LOG ZenCard creation" ## Send VISA.new log to EMAIL
|
||||
|
||||
echo "ASTROID PIN=${PASS}, operate on all La♥Box Web3 ẐenStation (WWW : https://astroport.copylaradio.com)"
|
||||
## :: TRICK :: EXECUTE LAST VISA.new.sh output LINE : export above VARs
|
||||
$(cat ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt | tail -n 1)
|
||||
echo "export ASTROTW=/ipns/$ASTRONAUTENS ASTROG1=$G1PUB ASTROMAIL=$PLAYER ASTROFEED=$FEEDNS PASS=$PASS"
|
||||
|
||||
BILLETNAME=$(echo "$SALT" | sed 's/ /_/g')
|
||||
#~ mpack -a -s "La♥Box : ASTROID :+: TW :+: " -d ~/.zen/tmp/${MOATS}/intro.txt \
|
||||
#~ ~/.zen/G1BILLET/tmp/g1billet/${PASS}/${BILLETNAME}.BILLET.jpg ${PLAYER}
|
||||
|
||||
end=`date +%s`
|
||||
echo $APPNAME" (0‿‿0) ${WHAT} Execution time was "`expr $end - $start` seconds.
|
||||
dur=`expr $end - $startvisa`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:VISA:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
) &
|
||||
|
||||
echo "$HTTPCORS
|
||||
<meta http-equiv='refresh' content='30; url=\""${myIPFS}"/ipns/"${ASTRONAUTENS}"\"'/>
|
||||
<h1>ASTRONAUTE $PSEUDO</h1>
|
||||
<br>KEY : $SALT:$PEPPER:${EMAIL}
|
||||
<br>TW : ${myIPFS}/ipns/${ASTRONAUTENS}
|
||||
<br>STATION : ${myIPFS}/ipns/$IPFSNODEID<br><br>please wait....<br>
|
||||
export ASTROTW=/ipns/${ASTRONAUTENS} ASTROG1=${G1PUB} ASTROMAIL=${EMAIL} ASTROIPFS=${myIPFS}" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# ASTRONAUT EXISTING ${EMAIL}
|
||||
CHECK=$(cat ~/.zen/game/players/${EMAIL}/secret.june | grep -w "$SALT")
|
||||
[[ $CHECK ]] && CHECK=$(cat ~/.zen/game/players/${EMAIL}/secret.june | grep -w "$PEPPER")
|
||||
[[ ! $CHECK ]] && (echo "$HTTPCORS - WARNING - PLAYER ${EMAIL} ALREADY HERE" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
fi
|
||||
|
||||
###################################################################################################
|
||||
end=`date +%s`
|
||||
echo " (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
########################################
|
||||
|
||||
########################################
|
||||
|
@ -166,210 +222,294 @@ PEPPER=$THIS
|
|||
#TESTCRAFT=ON nodeid dataid
|
||||
########################################
|
||||
########################################
|
||||
if [[ "$APPNAME" == "testcraft" ]]; then
|
||||
if [[ "$APPNAME" == "testcraft" ]]; then
|
||||
|
||||
( # testcraft & SUB PROCESS
|
||||
( # testcraft & SUB PROCESS
|
||||
|
||||
start=`date +%s`
|
||||
## RECORD DATA MADE IN BROWSER (JSON)
|
||||
OBJID=$OBJ
|
||||
DATAID=$VAL
|
||||
start=`date +%s`
|
||||
## RECORD DATA MADE IN BROWSER (JSON)
|
||||
OBJID=$OBJ
|
||||
DATAID=$VAL
|
||||
|
||||
## export PLAYER
|
||||
${MY_PATH}/../tools/TW.cache.sh ${ASTRONAUTENS} ${MOATS}
|
||||
## export PLAYER
|
||||
${MY_PATH}/../tools/TW.cache.sh ${ASTRONAUTENS} ${MOATS}
|
||||
|
||||
## IS IT INDEX JSON
|
||||
echo "${PLAYER} $APPNAME IS ${WHAT}"
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}
|
||||
## IS IT INDEX JSON
|
||||
echo "${PLAYER} $APPNAME IS ${WHAT}"
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}
|
||||
|
||||
[[ $WHAT == "on" ]] && WHAT="json" # data mimetype (default "on" = json)
|
||||
[[ $WHAT == "on" ]] && WHAT="json" # data mimetype (default "on" = json)
|
||||
|
||||
## TODO : modify timeout if isLAN or NOT
|
||||
[[ $isLAN ]] && WAIT=3 || WAIT=12
|
||||
echo "1ST TRY : ipfs --timeout ${WAIT}s cat /ipfs/$DATAID > ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}"
|
||||
ipfs --timeout ${WAIT}s cat /ipfs/$DATAID > ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}
|
||||
## TODO : modify timeout if isLAN or NOT
|
||||
[[ $isLAN ]] && WAIT=3 || WAIT=12
|
||||
echo "1ST TRY : ipfs --timeout ${WAIT}s cat --progress=false /ipfs/$DATAID > ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}"
|
||||
ipfs --timeout ${WAIT}s cat --progress=false /ipfs/$DATAID > ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}
|
||||
|
||||
echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
|
||||
|
||||
if [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then
|
||||
if [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then
|
||||
|
||||
echo "IPFS TIMEOUT >>> (°▃▃°) $DATAID STILL MISSING GATEWAY BANGING FOR IT (°▃▃°)"
|
||||
array=(${myIPFSGW}/ipfs/:hash https://ipns.co/:hash https://dweb.link/ipfs/:hash https://ipfs.io/ipfs/:hash https://ipfs.fleek.co/ipfs/:hash https://ipfs.best-practice.se/ipfs/:hash https://gateway.pinata.cloud/ipfs/:hash https://gateway.ipfs.io/ipfs/:hash https://cf-ipfs.com/ipfs/:hash https://cloudflare-ipfs.com/ipfs/:hash)
|
||||
# size=${#array[@]}; index=$(($RANDOM % $size)); echo ${array[$index]} ## TODO CHOOSE RANDOM
|
||||
echo "IPFS TIMEOUT >>> (°▃▃°) $DATAID STILL MISSING GATEWAY BANGING FOR IT (°▃▃°)"
|
||||
array=(${myIPFSGW}/ipfs/:hash https://ipns.co/:hash https://dweb.link/ipfs/:hash https://ipfs.io/ipfs/:hash https://ipfs.fleek.co/ipfs/:hash https://ipfs.best-practice.se/ipfs/:hash https://gateway.pinata.cloud/ipfs/:hash https://gateway.ipfs.io/ipfs/:hash https://cf-ipfs.com/ipfs/:hash https://cloudflare-ipfs.com/ipfs/:hash)
|
||||
# size=${#array[@]}; index=$(($RANDOM % $size)); echo ${array[$index]} ## TODO CHOOSE RANDOM
|
||||
|
||||
# official ipfs best gateway from https://luke.lol/ipfs.php
|
||||
for nicegw in ${array[@]}; do
|
||||
# official ipfs best gateway from https://luke.lol/ipfs.php
|
||||
for nicegw in ${array[@]}; do
|
||||
|
||||
[[ $(cat ~/.zen/tmp/.ipfsgw.bad.twt | grep -w $nicegw) ]] && echo "<<< BAD GATEWAY >>> $nicegw" && exit 0
|
||||
gum=$(echo "$nicegw" | sed "s~:hash~$DATAID~g")
|
||||
echo "LOADING $gum"
|
||||
curl -m 5 -so ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} "$gum"
|
||||
[[ $? != 0 ]] && echo "(✜‿‿✜) BYPASSING"
|
||||
[[ $(cat ~/.zen/tmp/.ipfsgw.bad.twt | grep -w $nicegw) ]] && echo "<<< BAD GATEWAY >>> $nicegw" && exit 0
|
||||
gum=$(echo "$nicegw" | sed "s~:hash~$DATAID~g")
|
||||
echo "LOADING $gum"
|
||||
curl -m 5 -so ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} "$gum"
|
||||
[[ $? != 0 ]] && echo "(✜‿‿✜) BYPASSING"
|
||||
|
||||
if [[ -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then
|
||||
if [[ -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]]; then
|
||||
|
||||
MIME=$(mimetype -b ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT})
|
||||
GOAL=$(ipfs add -q ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT})
|
||||
MIME=$(mimetype -b ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT})
|
||||
GOAL=$(ipfs add -q ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT})
|
||||
|
||||
if [[ ${GOAL} != ${DATAID} ]]; then
|
||||
echo " (╥☁╥ ) - BAD ${WHAT} FORMAT ERROR ${MIME} - (╥☁╥ )"
|
||||
ipfs pin rm /ipfs/${GOAL}
|
||||
rm ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}
|
||||
# NOT A JSON AVOID BANISHMENT
|
||||
echo $nicegw >> ~/.zen/tmp/.ipfsgw.bad.twt
|
||||
exit 0
|
||||
if [[ ${GOAL} != ${DATAID} ]]; then
|
||||
echo " (╥☁╥ ) - BAD ${WHAT} FORMAT ERROR ${MIME} - (╥☁╥ )"
|
||||
ipfs pin rm /ipfs/${GOAL}
|
||||
rm ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT}
|
||||
# NOT A JSON AVOID BANISHMENT
|
||||
echo $nicegw >> ~/.zen/tmp/.ipfsgw.bad.twt
|
||||
exit 0
|
||||
|
||||
else
|
||||
## GOT IT !! IPFS ADD
|
||||
ipfs pin add /ipfs/${GOAL}
|
||||
## + TW ADD (new_file_in_astroport.sh)
|
||||
else
|
||||
## GOT IT !! IPFS ADD
|
||||
ipfs pin add /ipfs/${GOAL}
|
||||
## + TW ADD (new_file_in_astroport.sh)
|
||||
|
||||
echo "(♥‿‿♥) FILE UPLOAD OK"; echo
|
||||
break
|
||||
echo "(♥‿‿♥) FILE UPLOAD OK"; echo
|
||||
break
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
else
|
||||
|
||||
echo " (⇀‿‿↼) - NO FILE - (⇀‿‿↼)"
|
||||
exit 0
|
||||
echo " (⇀‿‿↼) - NO FILE - (⇀‿‿↼)"
|
||||
exit 0
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
fi ## NO DIRECT IPFS - GATEWAY TRY
|
||||
fi ## NO DIRECT IPFS - GATEWAY TRY
|
||||
|
||||
## REALLY NO FILE FOUND !!!
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]] && \
|
||||
echo "$HTTPCORS ERROR (╥☁╥ ) - $DATAID TIMEOUT - (╥☁╥ )" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
## REALLY NO FILE FOUND !!!
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ]] && \
|
||||
echo "$HTTPCORS ERROR (╥☁╥ ) - $DATAID TIMEOUT - (╥☁╥ )" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
## SPECIAL index.[json/html/...] MODE.
|
||||
[[ ${WHAT} == "index" ]] && cp ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/index.json
|
||||
## SPECIAL index.[json/html/...] MODE.
|
||||
[[ ${WHAT} == "index" ]] && cp ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/index.json
|
||||
## TODO MAKE MULTIFORMAT DATA & INDEX
|
||||
# RWHAT=$(echo "$WHAT" | cut -d '.' -f 1)
|
||||
# TWHAT=$(echo "$WHAT" | cut -d '.' -f 2)
|
||||
# cp ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${RWHAT}.${TWHAT}
|
||||
|
||||
## REPONSE ON PORT
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
## REPONSE ON PORT
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/${APPNAME}/${PLAYER}/${MOATS}.data.${WHAT} >> ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
|
||||
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
## REPONSE ON IPFSNODEID
|
||||
(
|
||||
start=`date +%s`
|
||||
echo "¯\_༼<O͡〰o>༽_/¯ $IPFSNODEID $PLAYER SIGNALING"
|
||||
ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 )
|
||||
ipfs name publish --allow-offline /ipfs/$ROUTING
|
||||
echo "DONE"
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:SELF:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
) &
|
||||
(cat ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && rm ~/.zen/tmp/${MOATS}/${MOATS}.* ) &
|
||||
|
||||
## REPONSE ON IPFSNODEID
|
||||
(
|
||||
start=`date +%s`
|
||||
echo "¯\_༼<O͡〰o>༽_/¯ $IPFSNODEID $PLAYER SIGNALING"
|
||||
ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 )
|
||||
ipfs name publish /ipfs/$ROUTING
|
||||
echo "DONE"
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:${APPNAME}:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:SELF:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
) &
|
||||
|
||||
) & # testcraft & SUB PROCESS
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:${APPNAME}:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
|
||||
end=`date +%s`
|
||||
echo "(☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
) & # testcraft & SUB PROCESS
|
||||
|
||||
end=`date +%s`
|
||||
echo "(☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# PAY : /?salt=SALT&pepper=PEPPER&pay=1&dest=G1PUB APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
##############################################
|
||||
if [[ $APPNAME == "pay" ]]; then
|
||||
(
|
||||
echo "$HTTPCORS" > ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
|
||||
if [[ $WHAT =~ ^[0-9]+$ ]]; then
|
||||
|
||||
echo "${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/${MOATS}.secret.key pay -a ${WHAT} -p ${VAL} -c 'Bro'"
|
||||
${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/tmp/${MOATS}/${MOATS}.secret.key" "${WHAT}" "${VAL}" "Bro"
|
||||
echo "PAY4SURE " >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "history" ]]; then
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key history -j >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "get" ]]; then
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key get >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
if [[ "$WHAT" == "balance" ]]; then
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key balance >> ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
fi
|
||||
|
||||
cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http
|
||||
(cat ~/.zen/tmp/$PLAYER.pay.$WHAT.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && rm ~/.zen/tmp/$PLAYER.pay.$WHAT.http ) &
|
||||
end=`date +%s`
|
||||
echo "(G_G ) G1BANK Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
) &
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# FRIEND ★ &friend=G1PUB&stars=1 // APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9
|
||||
##############################################
|
||||
if [[ $APPNAME == "friend" ]]; then
|
||||
|
||||
## CHECK IF ASKING FRIEND TW EXISTS
|
||||
#~ ipfs --timeout 60s ls /ipns/${ASTRONAUTENS}
|
||||
#~ [ $? != 0 ] && echo "BAD VISITOR" && exit 0
|
||||
|
||||
g1friend=${WHAT}
|
||||
stars=${VAL:-1} // Default 1 ★
|
||||
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${MOATS}.secret.key stars -p $g1friend -n $stars > ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
|
||||
(
|
||||
echo "$HTTPCORS $(cat ~/.zen/tmp/${MOATS}/${MOATS}.log)"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
) &
|
||||
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}.*
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) ${MESTAR} Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
##############################################
|
||||
# GETIPNS
|
||||
##############################################
|
||||
if [[ $APPNAME == "getipns" ]]; then
|
||||
echo "$HTTPCORS /ipns/${ASTRONAUTENS}"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) /ipns/${ASTRONAUTENS} Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
fi
|
||||
if [[ $APPNAME == "getipns" ]]; then
|
||||
( echo "$HTTPCORS
|
||||
url='"${ASTRONAUTENS}"'" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && echo "SLURP getipns : ${ASTRONAUTENS}" ) &
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) /ipns/${ASTRONAUTENS} Execution time was "`expr $end - $start` seconds.
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}.*
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# GETG1PUB
|
||||
##############################################
|
||||
if [[ $APPNAME == "getg1pub" ]]; then
|
||||
(
|
||||
echo "$HTTPCORS
|
||||
url='"${G1PUB}"'" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 && echo "SLURP getg1pub : ${G1PUB}"
|
||||
echo "BLURP ${PORT}"
|
||||
) &
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) /ipns/${ASTRONAUTENS} Execution time was "`expr $end - $start` seconds.
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}*
|
||||
exit 0
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# LOGIN
|
||||
##############################################
|
||||
if [[ $APPNAME == "login" ]]; then
|
||||
|
||||
## INSTALL PLAYER IPNS KEY ON STATION
|
||||
[[ "${SALT}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] \
|
||||
&& PLAYER=${SALT} \
|
||||
|| PLAYER=${WHAT}
|
||||
|
||||
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${MOATS}.${G1PUB}.ipns.key
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
||||
|
||||
#~ WSTATION=$(cat ~/.zen/tmp/WSTATION 2>/dev/null)
|
||||
#~ [[ $WSTATION != "" ]] \
|
||||
#~ && REPLACE=${myIPFS}${WSTATION} \
|
||||
#~ || REPLACE=${myIPFS}/ipns/${ASTRONAUTENS}
|
||||
|
||||
REPLACE=${myIPFS}/ipns/${ASTRONAUTENS}
|
||||
|
||||
USALT=$(echo "$SALT" | jq -Rr @uri)
|
||||
UPEPPER=$(echo "$PEPPER" | jq -Rr @uri)
|
||||
echo "/?salt=${USALT}&pepper=${UPEPPER} IS LOGIN - OPEN TW -"
|
||||
sed "s~_TWLINK_~${REPLACE}~g" ~/.zen/Astroport.ONE/templates/index.302 > ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
## SET COOKIE
|
||||
#~ sed -i "s~_USALT_~${USALT}~g" ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
#~ sed -i "s~_UPEPPER_~${UPEPPER}~g" ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
echo "url='"${REPLACE}"'" >> ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
echo "BLURP ${PORT}"
|
||||
) &
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}*
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) Execution time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
##############################################
|
||||
# LOGOUT
|
||||
##############################################
|
||||
if [[ $APPNAME == "logout" ]]; then
|
||||
|
||||
## REMOVE PLAYER IPNS KEY FROM STATION
|
||||
[[ "${SALT}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] \
|
||||
&& PLAYER=${SALT} \
|
||||
|| PLAYER=${WHAT}
|
||||
|
||||
echo "<h1>$PLAYER LOGOUT OK</h1>" > ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
|
||||
ipfs key rm ${G1PUB} >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
ipfs key rm ${PLAYER} >> ~/.zen/tmp/${MOATS}/${MOATS}.log
|
||||
|
||||
echo "$HTTPCORS $(cat ~/.zen/tmp/${MOATS}/${MOATS}.log)"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
end=`date +%s`
|
||||
echo $APPNAME "(☉_☉ ) Execution time was "`expr $end - $start` seconds.
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}.*
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
|
||||
###################################################################################################
|
||||
###################################################################################################
|
||||
# API ONE : ?salt=PHRASE%20UNE&pepper=PHRASE%20DEUX&g1pub=on&email=EMAIL&pseudo=PROFILENAME
|
||||
if [[ ${OBJ} == "email" && "${VAL}" != "" ]]; then
|
||||
|
||||
[[ $APPNAME != "g1pub" ]] && (echo "$HTTPCORS ERROR - BAD COMMAND $APPNAME" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
# WHAT can contain urlencoded FullURL
|
||||
EMAIL="${VAL}"
|
||||
|
||||
[[ ! ${EMAIL} ]] && (echo "$HTTPCORS ERROR - MISSING ${EMAIL} FOR ${WHAT} CONTACT" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
## CHECK WHAT IS EMAIL
|
||||
if [[ "${EMAIL}" =~ ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]; then
|
||||
echo "VALID EMAIL OK"
|
||||
else
|
||||
echo "BAD EMAIL"
|
||||
(echo "$HTTPCORS KO ${EMAIL} : bad '" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && exit 0
|
||||
fi
|
||||
|
||||
## CREATE PSEUDO FROM
|
||||
if [[ ! $PSEUDO ]]; then
|
||||
PSEUDO=$(echo ${EMAIL} | cut -d '@' -f 1)
|
||||
PSEUDO=${PSEUDO,,}; PSEUDO=${PSEUDO%%[0-9]*}${RANDOM:0:4}
|
||||
fi
|
||||
|
||||
if [[ ! -d ~/.zen/game/players/${EMAIL} ]]; then
|
||||
|
||||
echo "# ASTRONAUT NEW VISA Create VISA.new.sh in background (~/.zen/tmp/email.${EMAIL}.${MOATS}.txt)"
|
||||
|
||||
(
|
||||
startvisa=`date +%s`
|
||||
[[ "$SALT" == "0" && "$PEPPER" == "0" ]] && SALT="" && PEPPER="" # "0" "0" means random salt pepper
|
||||
echo "VISA.new : \"$SALT\" \"$PEPPER\" \"${EMAIL}\" \"$PSEUDO\" \"${WHAT}\"" > ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
${MY_PATH}/../tools/VISA.new.sh "$SALT" "$PEPPER" "${EMAIL}" "$PSEUDO" "${WHAT}" >> ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
${MY_PATH}/../tools/mailjet.sh "${EMAIL}" ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt ## Send VISA.new log to EMAIL
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $startvisa`
|
||||
echo ${MOATS}:${G1PUB}:${PLAYER}:VISA:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
|
||||
) &
|
||||
|
||||
echo "$HTTPCORS
|
||||
<meta http-equiv='refresh' content='30; url=\""${myIPFS}"/ipns/"${ASTRONAUTENS}"\"'/>
|
||||
<h1>ASTRONAUTE $PSEUDO</h1>
|
||||
<br>KEY : $SALT:$PEPPER:${EMAIL}
|
||||
<br>TW : ${myIPFS}/ipns/${ASTRONAUTENS}
|
||||
<br>STATION : ${myIPFS}/ipns/$IPFSNODEID<br><br>please wait....<br>
|
||||
export ASTROTW=/ipns/${ASTRONAUTENS} ASTROG1=${G1PUB} ASTROMAIL=${EMAIL} ASTROIPFS=${myIPFS}" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
exit 0
|
||||
|
||||
else
|
||||
|
||||
# ASTRONAUT EXISTING ${EMAIL}
|
||||
CHECK=$(cat ~/.zen/game/players/${EMAIL}/secret.june | grep -w "$SALT")
|
||||
[[ $CHECK ]] && CHECK=$(cat ~/.zen/game/players/${EMAIL}/secret.june | grep -w "$PEPPER")
|
||||
[[ ! $CHECK ]] && (echo "$HTTPCORS - WARNING - PLAYER ${EMAIL} ALREADY HERE" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
fi
|
||||
|
||||
###################################################################################################
|
||||
end=`date +%s`
|
||||
echo " (☓‿‿☓) Execution time was "`expr $end - $start` seconds.
|
||||
|
||||
fi
|
||||
###################################################################################################
|
||||
###################################################################################################
|
||||
|
||||
|
||||
## RESPONDING
|
||||
[[ ! -s ~/.zen/tmp/coucou/${MOATS}.index.redirect ]] && echo "$HTTPCORS PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9" > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > ~/.zen/tmp/coucou/${MOATS}.official.swallow &
|
||||
echo "HTTP 1.1 PROTOCOL DOCUMENT READY"
|
||||
echo "${MOATS} -----> PAGE AVAILABLE -----> http://${myHOST}:${PORT}"
|
||||
|
||||
end=`date +%s`
|
||||
echo $type" (J‿‿J) Execution time was "`expr $end - $start` seconds.
|
||||
## END RESPONDING
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect ]] \
|
||||
&& echo "$HTTPCORS PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9 url=/user/$G1PUB" \
|
||||
> ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect
|
||||
|
||||
cat ~/.zen/tmp/${MOATS}/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > ~/.zen/tmp/${MOATS}/${MOATS}.official.swallow &
|
||||
echo "HTTP 1.1 PROTOCOL DOCUMENT READY"
|
||||
echo "${MOATS} -----> PAGE AVAILABLE -----> http://${myHOST}:${PORT}"
|
||||
|
||||
end=`date +%s`
|
||||
echo $type" (J‿‿J) Execution time was "`expr $end - $start` seconds.
|
||||
rm ~/.zen/tmp/${MOATS}/${MOATS}.*
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: UPLANET
|
||||
## Dedicated to OSM2IPFS & UPlanet Client App
|
||||
# ?uplanet=EMAIL&zlat=LAT&zlon=LON&g1pub=PASS
|
||||
## https://git.p2p.legal/qo-op/OSM2IPFS
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
||||
### transfer variables according to script
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: ${myASTROPORT}
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Methods: GET
|
||||
Server: Astroport.ONE
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
## CHECK FOR NOT PUBLISHING ALREADY (AVOID IPNS CRUSH)
|
||||
alreadypublishing=$(ps axf --sort=+utime | grep -w 'ipfs name publish --key=' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
if [[ ${alreadypublishing} ]]; then
|
||||
echo "$HTTPCORS ERROR - (╥☁╥ ) - IPFS ALREADY PUBLISHING RETRY LATER" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## START MANAGING UPLANET LAT/LON & PLAYER
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
|
||||
## GET & VERIFY PARAM
|
||||
PLAYER=${THAT}
|
||||
[[ ${PLAYER} == "zlat" ]] && PLAYER="@"
|
||||
|
||||
[[ ${AND} != "zlat" ]] \
|
||||
&& (echo "$HTTPCORS ERROR - BAD PARAMS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
[[ ${APPNAME} != "zlon" ]] \
|
||||
&& (echo "$HTTPCORS ERROR - BAD PARAMS" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && exit 0
|
||||
|
||||
ZLAT=${THIS}
|
||||
ZLON=${WHAT}
|
||||
LAT=$(makecoord ${ZLAT})
|
||||
LON=$(makecoord ${ZLON})
|
||||
|
||||
#~ ## RECEIVED VAL ## CAN BE USED TO SELECT TW TEMPLATE
|
||||
VAL="$(echo ${VAL} | detox --inline)" ## DETOX VAL
|
||||
############################################
|
||||
#### TODO USE THIS PARAMETER TO SELECT TW TEMPLATE
|
||||
|
||||
### CHECK PLAYER EMAIL
|
||||
EMAIL="${PLAYER,,}" # lowercase
|
||||
|
||||
[[ ! ${EMAIL} ]] \
|
||||
&& (echo "$HTTPCORS ERROR - MISSING ${EMAIL} FOR UPLANET LANDING" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& echo "(☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. \
|
||||
&& exit 0
|
||||
|
||||
## CHECK WHAT IS EMAIL
|
||||
if [[ "${EMAIL}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]]; then
|
||||
|
||||
echo "VALID ${EMAIL} EMAIL OK"
|
||||
|
||||
## CHECK if PLAYER exists in SWARM
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${EMAIL}) ## export ASTROTW and more
|
||||
echo "export ASTROPORT=${ASTROPORT} ASTROTW=${ASTROTW} ASTROG1=${ASTROG1} ASTROMAIL=${EMAIL} ASTROFEED=${FEEDNS}"
|
||||
|
||||
## YES = OPEN TW
|
||||
[[ ${ASTROTW} ]] \
|
||||
&& (echo "$HTTPCORS <meta http-equiv=\"refresh\" content=\"0; url='${myIPFS}${ASTROTW}'\" />" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) \
|
||||
&& exit 0
|
||||
|
||||
else
|
||||
|
||||
echo "BAD EMAIL $EMAIL $LAT $LON"
|
||||
|
||||
### GET ENV FOR "$LAT" "$LON"
|
||||
$(${MY_PATH}/../tools/getUMAP_ENV.sh "${LAT}" "${LON}" | tail -n 1)
|
||||
REDIR="${myIPFS}${UMAPIPNS}"
|
||||
echo "Umap : $REDIR"
|
||||
|
||||
if [[ ${UMAPIPNS} != "/ipns/" ]]; then
|
||||
echo "$HTTPCORS <html>BAD EMAIL $EMAIL $LAT $LON <a href=${REDIR}> - OPEN UMAP LINK - </a></html>" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
else
|
||||
echo "$HTTPCORS <html>BAD EMAIL $EMAIL ($LAT $LON)</html>" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
# UPLANET #############################################
|
||||
## OCCUPY COMMON CRYPTO KEY CYBERSPACE
|
||||
## LAT="$LAT" LON="$LON"
|
||||
######################################################
|
||||
echo "UMAP = $LAT:$LON"
|
||||
echo "# GET UMAP ENV"
|
||||
${MY_PATH}/../tools/getUMAP_ENV.sh "${LAT}" "${LON}"
|
||||
|
||||
## ALL TEST PASSED -> CREATE ZENCARD + ASTROID
|
||||
#~ choose salt pepper with variable words count
|
||||
PPASS=$(${MY_PATH}/../tools/diceware.sh $(( $(${MY_PATH}/../tools/getcoins_from_gratitude_box.sh) + 3 )) | xargs)
|
||||
NPASS=$(${MY_PATH}/../tools/diceware.sh $(( $(${MY_PATH}/../tools/getcoins_from_gratitude_box.sh) + 3 )) | xargs)
|
||||
|
||||
## CREATE ASTRONAUTE TW ON CURRENT ASTROPORT
|
||||
(
|
||||
echo VISA.new.sh "${PPASS}" "${NPASS}" "${EMAIL}" "UPlanet" "${VAL}" "${LAT}" "${LON}"
|
||||
##### (☉_☉ ) #######
|
||||
${MY_PATH}/../RUNTIME/VISA.new.sh "${PPASS}" "${NPASS}" "${EMAIL}" "UPlanet" "${VAL}" "${LAT}" "${LON}" >> ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
|
||||
end=`date +%s`
|
||||
echo "(TW REGISTRATION) Operation time was "`expr $end - $start` seconds.
|
||||
) &
|
||||
|
||||
########################################
|
||||
## Calculating TW IPNS ADDRESS
|
||||
TWADD=$(${MY_PATH}/../tools/keygen -t ipfs "${PPASS}" "${NPASS}")
|
||||
|
||||
IMGTW=$(${MY_PATH}/../API/AMZQR.sh '0' "${myIPFS}/ipns/${TWADD}" 'et' 'TV' | tail -n 1)
|
||||
|
||||
|
||||
## HTTP nc ON PORT RESPONSE
|
||||
echo "$HTTPCORS
|
||||
<html>
|
||||
<head>
|
||||
<title>[Astroport] $LAT $LON + ${EMAIL} </title>
|
||||
<meta http-equiv=\"refresh\" content=\"100; url='${myIPFS}/ipns/${TWADD}#AstroID'\" />
|
||||
<style>
|
||||
#countdown { display: flex; justify-content: center; align-items: center; color: #0e2c4c; font-size: 20px; width: 60px; height: 60px; background-color: #e7d9fc; border-radius: 50%;}
|
||||
</style>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
text-align: center;
|
||||
background-color: #f0f0f0;
|
||||
padding: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #0077cc;
|
||||
}
|
||||
h2 {
|
||||
color: #333;
|
||||
}
|
||||
img {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<h1>UPlanet Registration</h1>
|
||||
${EMAIL} (⌐■_■)<br>
|
||||
<br>Check your mailbox ! Relevez votre boite mail !
|
||||
<hr>
|
||||
<h2><a target=\"_new\" href=\"${myIPFS}/ipns/${TWADD}\">TW5</a></h2>
|
||||
<h1><center><div id='countdown'></div></center></h1>
|
||||
<script>
|
||||
var timeLeft = 90;
|
||||
var elem = document.getElementById('countdown');
|
||||
var timerId = setInterval(countdown, 1000);
|
||||
|
||||
function countdown() {
|
||||
if (timeLeft == -1) {
|
||||
clearTimeout(timerId);
|
||||
doSomething();
|
||||
} else {
|
||||
elem.innerHTML = timeLeft + ' s';
|
||||
timeLeft--;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
---
|
||||
<br>( ⚆_⚆) TW5 MOBILE APP<br>
|
||||
<img src='${myIPFSGW}${IMGTW}'\>
|
||||
<br>CONSOLE<br>
|
||||
$(cat ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt 2>/dev/null)
|
||||
<br>(☉_☉ ) use above credentials... utilisez les identiants ci-dessus<br>
|
||||
<br><br>${EMAIL} REGISTERED on UPlanet UMAP($LAT/$LON) : ${MOATS} : $(date)
|
||||
</body>
|
||||
</html>" > ~/.zen/tmp/${MOATS}/http.rep
|
||||
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}/http.rep | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
end=`date +%s`
|
||||
echo "(UPLANET) Operation time was "`expr $end - $start` seconds.
|
||||
) &
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,195 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
## API: ZONE
|
||||
## Used by OSM2IPFS map_render.html & other UPlanet Client App
|
||||
# ?zone=DEG&ulat=LAT&ulon=LON
|
||||
## Search for TW numbers in received zone # >> return json
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo "PORT=$1
|
||||
THAT=$2
|
||||
AND=$3
|
||||
THIS=$4
|
||||
APPNAME=$5
|
||||
WHAT=$6
|
||||
OBJ=$7
|
||||
VAL=$8
|
||||
MOATS=$9
|
||||
COOKIE=$10"
|
||||
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
||||
### transfer variables according to script
|
||||
|
||||
HTTPCORS="HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Access-Control-Allow-Credentials: true
|
||||
Access-Control-Allow-Methods: GET
|
||||
Server: Astroport.ONE
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
"
|
||||
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
## RUNNING UPLANET LAT/LON TW DETECTION
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/
|
||||
# PREPARE HTTP RESPONSE (application/json)
|
||||
echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.http
|
||||
sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}.http
|
||||
|
||||
# ------------------------------------------------------------------- #
|
||||
# GET/?zone=0.001&ulat=0.02&ulon=0.01
|
||||
# ------------------------------------------------------------------- #
|
||||
|
||||
DEG="${THAT}"
|
||||
[[ -z ${DEG} ]] && DEG=1
|
||||
# DEG=$(echo "${DEG} * 10" | bc -l )
|
||||
|
||||
LAT="${THIS}"
|
||||
[[ -z $LAT ]] && LAT=0.00
|
||||
|
||||
LON="${WHAT}"
|
||||
[[ -z $LON ]] && LON=0.00
|
||||
|
||||
LAT=$(makecoord ${LAT})
|
||||
LON=$(makecoord ${LON})
|
||||
JSON="ZONE_${LAT}_${LON}_${DEG}.json"
|
||||
$(${MY_PATH}/../tools/getUMAP_ENV.sh "${LAT}" "${LON}" | tail -n 1)
|
||||
echo "UMAPG1PUB=$UMAPG1PUB UMAPIPNS=$UMAPIPNS
|
||||
SECTORG1PUB=$SECTORG1PUB SECTORIPNS=$SECTORIPNS
|
||||
REGIONG1PUB=$REGIONG1PUB REGIONIPNS=$REGIONIPNS
|
||||
LAT=$LAT LON=$LON SLAT=$SLAT SLON=$SLON RLAT=$RLAT RLON=$RLON"
|
||||
|
||||
## SECTOR LEVEL
|
||||
if [[ ${DEG} == "0.01" ]]; then
|
||||
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
SECTOR="_${SLAT}_${SLON}"
|
||||
echo "SECTOR = ${SECTOR}"
|
||||
ZONEINDEX=$SECTORIPNS
|
||||
[[ ! $ZONEINDEX ]] && ZONEINDEX="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_${SLAT}*_${SLON}*/_*_*/SECTORNS | tail -n 1)
|
||||
[[ ! $ZONEINDEX ]] && ZONEINDEX="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_${SLAT}*_${SLON}*/_*_*/SECTORNS | tail -n 1)
|
||||
ZONEG1PUB=$SECTORG1PUB
|
||||
[[ ! $ZONEG1PUB ]] && ZONEG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_${SLAT}*_${SLON}*/_*_*/SECTORG1PUB | tail -n 1)
|
||||
[[ ! $ZONEG1PUB ]] && ZONEG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_${SLAT}*_${SLON}*/_*_*/SECTORG1PUB | tail -n 1)
|
||||
LAT=${SLAT}
|
||||
LON=${SLON}
|
||||
JSON="ZONE${SECTOR}_${DEG}.json"
|
||||
|
||||
fi
|
||||
|
||||
## REGION & ABOVE LEVEL
|
||||
if [[ ${DEG} == "0.1" || ${DEG} == "1" ]]; then
|
||||
|
||||
RLAT="$(echo ${LAT} | cut -d '.' -f 1)"
|
||||
RLON="$(echo ${LON} | cut -d '.' -f 1)"
|
||||
REGION="_${RLAT}_${RLON}"
|
||||
echo "REGION = ${REGION}"
|
||||
ZONEINDEX=$REGIONIPNS
|
||||
[[ ! $ZONEINDEX ]] && ZONEINDEX="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}*_${RLON}*/_*_*/_*_*/REGIONNS | tail -n 1)
|
||||
[[ ! $ZONEINDEX ]] && ZONEINDEX="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}*_${RLON}*/_*_*/_*_*/REGIONNS | tail -n 1)
|
||||
ZONEG1PUB=$REGIONG1PUB
|
||||
[[ ! $ZONEG1PUB ]] && ZONEG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}*_${RLON}*/_*_*/_*_*/REGIONG1PUB | tail -n 1)
|
||||
[[ ! $ZONEG1PUB ]] && ZONEG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/_${RLAT}*_${RLON}*/_*_*/_*_*/REGIONG1PUB | tail -n 1)
|
||||
LAT=${RLAT}
|
||||
LON=${RLON}
|
||||
JSON="ZONE${REGION}_${DEG}.json"
|
||||
|
||||
fi
|
||||
|
||||
echo " JSON = ${JSON}"
|
||||
|
||||
if [[ ! -s ~/.zen/tmp/${JSON} ]]; then
|
||||
|
||||
## UMAP LEVEL
|
||||
if [[ ${DEG} == "0.001" ]]; then
|
||||
|
||||
swarmnum=$(ls -d ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* 2>/dev/null | wc -l )
|
||||
nodenum=$(ls -d ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* 2>/dev/null | wc -l )
|
||||
totnum=$(( swarmnum + nodenum ))
|
||||
echo " ## UMAP _${LAT}_${LON} = ${totnum} PLAYERs"
|
||||
|
||||
UMAPNS=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TODATENS | tail -n 1)
|
||||
[[ ! $UMAPNS ]] && UMAPNS=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TODATENS | tail -n 1)
|
||||
G1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/G1PUB | tail -n 1)
|
||||
[[ ! $G1PUB ]] && G1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/G1PUB | tail -n 1)
|
||||
|
||||
echo '{ "gridNumbers": [ {"lat": '${LAT}', "lon": '${LON}', "number": "(_'${LAT}'_'${LON}') = '${totnum}'", "ipns": "'${myIPFS}/ipns/${UMAPNS}/_index.html'" } ] }' \
|
||||
> ~/.zen/tmp/${MOATS}/http.grid
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/http.grid ~/.zen/tmp/${JSON}
|
||||
cat ~/.zen/tmp/${JSON} >> ~/.zen/tmp/${MOATS}.http
|
||||
|
||||
cat ~/.zen/tmp/${MOATS}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||
|
||||
rm -Rf ~/.zen/tmp/${MOATS}/
|
||||
end=`date +%s`
|
||||
echo "(UMAP)_${LAT}_${LON} $UMAPNS Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
##############################################
|
||||
## SEARCH FOR UPLANET TW NUMBERS IN THAT ZONE
|
||||
echo '{ "gridNumbers": [' >> ~/.zen/tmp/${MOATS}/http.grid
|
||||
|
||||
for i in $(seq 0 9);
|
||||
do
|
||||
|
||||
ZLAT=$(echo "$LAT + ${DEG} * $i" | bc -l)
|
||||
[[ -z ${ZLAT} ]] && ZLAT=0
|
||||
|
||||
for j in $(seq 0 9); do
|
||||
|
||||
ZLON=$(echo "$LON + ${DEG} * $j" | bc -l)
|
||||
[[ -z ${ZLON} ]] && ZLON=0
|
||||
|
||||
echo " ## SEARCH UPLANET/__/_*_*/_*.?_*.?/_${ZLAT}*_${ZLON}*"
|
||||
swarmnum=$(ls -d ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${ZLAT}*_${ZLON}*/TW/* 2>/dev/null | wc -l )
|
||||
nodenum=$(ls -d ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${ZLAT}*_${ZLON}*/TW/* 2>/dev/null | wc -l )
|
||||
totnum=$(( swarmnum + nodenum ))
|
||||
|
||||
[[ $totnum -gt 9 ]] && displaynum="X" || displaynum=$totnum
|
||||
|
||||
[[ $displaynum != "0" ]] && echo '{"lat": '${ZLAT}', "lon": '${ZLON}', "number": "'${displaynum}'", "ipns": "'${ZONEINDEX}'" }
|
||||
,' >> ~/.zen/tmp/${MOATS}/http.grid \
|
||||
&& echo "${DEG} :" '{"lat": '${ZLAT}', "lon": '${ZLON}', "number": "'${totnum}'", "ipns": "'${ZONEINDEX}'" }'
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
[[ ! $(cat ~/.zen/tmp/${MOATS}/http.grid | tail -n 1 | grep 'gridNumbers' ) ]] \
|
||||
&& sed -i '$ d' ~/.zen/tmp/${MOATS}/http.grid ## REMOVE LAST ','
|
||||
|
||||
echo ']}' >> ~/.zen/tmp/${MOATS}/http.grid
|
||||
|
||||
echo "## ADD TO CACHE ~/.zen/tmp/${JSON}"
|
||||
cp ~/.zen/tmp/${MOATS}/http.grid ~/.zen/tmp/${JSON}
|
||||
|
||||
fi
|
||||
|
||||
cat ~/.zen/tmp/${JSON} | jq -c
|
||||
|
||||
### SEND RESPONSE ON PORT
|
||||
cat ~/.zen/tmp/${JSON} >> ~/.zen/tmp/${MOATS}.http
|
||||
(
|
||||
cat ~/.zen/tmp/${MOATS}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1
|
||||
rm ~/.zen/tmp/${MOATS}/http.grid 2>/dev/null
|
||||
rm ~/.zen/tmp/${MOATS}.http && echo "BLURP ${JSON}"
|
||||
) &
|
||||
## CLEANING
|
||||
rm -Rf ~/.zen/tmp/${MOATS}/
|
||||
## TIMING
|
||||
end=`date +%s`
|
||||
echo "(ZONE) Operation time was "`expr $end - $start` seconds.
|
||||
exit 0
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
# Usage: bash addfile.sh <filename> <mime_type> <file_type>
|
||||
|
||||
filename="$1"
|
||||
mime_type="$2"
|
||||
file_type="$3"
|
||||
|
||||
echo "Processing file: $filename"
|
||||
echo "MIME type: $mime_type"
|
||||
echo "File type: $file_type"
|
||||
|
||||
# Check file type and perform corresponding treatment
|
||||
case $file_type in
|
||||
"video")
|
||||
if [[ $mime_type == *"video"* ]]; then
|
||||
# Video processing logic
|
||||
echo "Video processing..."
|
||||
# Add more processing steps as needed
|
||||
else
|
||||
echo "Invalid file type for video processing"
|
||||
fi
|
||||
;;
|
||||
"audio")
|
||||
if [[ $mime_type == *"audio"* ]]; then
|
||||
# Audio processing logic
|
||||
echo "Audio processing..."
|
||||
# Add more processing steps as needed
|
||||
else
|
||||
echo "Invalid file type for audio processing"
|
||||
fi
|
||||
;;
|
||||
"text")
|
||||
if [[ $mime_type == *"text"* ]]; then
|
||||
# Text processing logic
|
||||
echo "Text processing..."
|
||||
# Add more processing steps as needed
|
||||
else
|
||||
echo "Invalid file type for text processing"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown file type: $file_type"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "File processing complete."
|
|
@ -0,0 +1,170 @@
|
|||
#!/usr/bin/python3
|
||||
from fastapi import FastAPI, File, UploadFile, Form, HTTPException
|
||||
from fastapi.responses import HTMLResponse, JSONResponse
|
||||
import subprocess
|
||||
import os
|
||||
import magic
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# HTML form for file upload
|
||||
html_form = """
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>File Upload and Processing</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
#upload-container {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input[type="button"] {
|
||||
background-color: #4caf50;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#result-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#loading-indicator {
|
||||
display: none;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="upload-container">
|
||||
<h1>File Upload and Processing</h1>
|
||||
<form id="upload-form" enctype="multipart/form-data" method="post">
|
||||
<input type="file" id="file" accept="video/*,audio/*,text/*" required>
|
||||
<br>
|
||||
<label for="convert_to">Choose file type:</label>
|
||||
<input type="radio" id="video" name="convert_to" value="video" checked>
|
||||
<label for="video">Video</label>
|
||||
<input type="radio" id="audio" name="convert_to" value="audio">
|
||||
<label for="audio">Audio</label>
|
||||
<input type="radio" id="text" name="convert_to" value="text">
|
||||
<label for="text">Text</label>
|
||||
<br>
|
||||
<input type="button" value="Upload" onclick="uploadFile()">
|
||||
<div id="loading-indicator">Loading...</div>
|
||||
</form>
|
||||
|
||||
<div id="result-container"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
async function uploadFile() {
|
||||
const fileInput = document.getElementById('file');
|
||||
const file = fileInput.files[0];
|
||||
const fileType = document.querySelector('input[name="convert_to"]:checked').value;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('convert_to', fileType);
|
||||
|
||||
// Show loading indicator
|
||||
const loadingIndicator = document.getElementById('loading-indicator');
|
||||
loadingIndicator.style.display = 'block';
|
||||
|
||||
try {
|
||||
const response = await fetch('/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
document.getElementById('result-container').innerHTML = JSON.stringify(result, null, 2);
|
||||
} catch (error) {
|
||||
console.error('Error uploading file:', error);
|
||||
} finally {
|
||||
// Hide loading indicator after response or error
|
||||
loadingIndicator.style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
"""
|
||||
|
||||
@app.get("/")
|
||||
async def read_root():
|
||||
return HTMLResponse(content=html_form, status_code=200)
|
||||
|
||||
def get_mime_type(file: UploadFile):
|
||||
mime = magic.Magic()
|
||||
mime_type = mime.from_buffer(file.file.read(1024))
|
||||
return mime_type
|
||||
|
||||
@app.post("/upload")
|
||||
async def create_upload_file(file: UploadFile = File(...), convert_to: str = Form(...)):
|
||||
# Validate file size
|
||||
max_file_size = 100 * 1024 * 1024 # 100MB
|
||||
if file.file.__sizeof__() > max_file_size:
|
||||
raise HTTPException(status_code=400, detail="File size exceeds the limit of 100MB")
|
||||
|
||||
# Check the file type
|
||||
mime_type = get_mime_type(file)
|
||||
print(f"Detected MIME type: {mime_type}")
|
||||
|
||||
# Save the uploaded file to a temporary location
|
||||
with open(file.filename, "wb") as f:
|
||||
f.write(file.file.read())
|
||||
|
||||
# Continue with the processing logic
|
||||
# Run the post-treatment Bash script
|
||||
logs = subprocess.run(["bash", "addfile.sh", file.filename, mime_type, convert_to], capture_output=True, text=True).stdout
|
||||
|
||||
# Optionally, you can remove the temporary file
|
||||
os.remove(file.filename)
|
||||
|
||||
return JSONResponse(content={"filename": file.filename, "mime_type": mime_type, "convert_to": convert_to, "message": "File processed successfully.", "logs": logs})
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host="0.0.0.0", port=10101)
|
|
@ -1,17 +1,23 @@
|
|||
::: :::::::: ::::::::::: ::::::::: :::::::: ::::::::: :::::::: ::::::::: :::::::::::
|
||||
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
|
||||
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
|
||||
+#++:++#++: +#++:++#++ +#+ +#++:++#: +#+ +:+ +#++:++#+ +#+ +:+ +#++:++#: +#+
|
||||
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
|
||||
#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
|
||||
### ### ######## ### ### ### ######## ### ######## ### ### ###
|
||||
cat << "EOF"
|
||||
|
||||
|
||||
_____/\/\_____ ____________ ___/\/\_____ ____________ ____________ ____________ ____________ ____________ ___/\/\_____
|
||||
___/\/\/\/\___ ___/\/\/\/\_ _/\/\/\/\/\_ _/\/\__/\/\_ ___/\/\/\___ _/\/\/\/\___ ___/\/\/\___ _/\/\__/\/\_ _/\/\/\/\/\_
|
||||
_/\/\____/\/\_ _/\/\/\/\___ ___/\/\_____ _/\/\/\/\___ _/\/\__/\/\_ _/\/\__/\/\_ _/\/\__/\/\_ _/\/\/\/\___ ___/\/\_____
|
||||
_/\/\/\/\/\/\_ _______/\/\_ ___/\/\_____ _/\/\_______ _/\/\__/\/\_ _/\/\/\/\___ _/\/\__/\/\_ _/\/\_______ ___/\/\_____
|
||||
_/\/\____/\/\_ _/\/\/\/\___ ___/\/\/\___ _/\/\_______ ___/\/\/\___ _/\/\_______ ___/\/\/\___ _/\/\_______ ___/\/\/\___
|
||||
_____/\/\_____ ____________ ___/\/\_____ ____________ ____________ ____________ ____________ ____________ ___/\/\_____
|
||||
___/\/\/\/\___ ___/\/\/\/\_ _/\/\/\/\/\_ _/\/\__/\/\_ ___/\/\/\___ _/\/\/\/\___ ___/\/\/\___ _/\/\__/\/\_ _/\/\/\/\/\_
|
||||
_/\/\____/\/\_ _/\/\/\/\___ ___/\/\_____ _/\/\/\/\___ _/\/\__/\/\_ _/\/\__/\/\_ _/\/\__/\/\_ _/\/\/\/\___ ___/\/\_____
|
||||
_/\/\/\/\/\/\_ _______/\/\_ ___/\/\_____ _/\/\_______ _/\/\__/\/\_ _/\/\/\/\___ _/\/\__/\/\_ _/\/\_______ ___/\/\_____
|
||||
_/\/\____/\/\_ _/\/\/\/\___ ___/\/\/\___ _/\/\_______ ___/\/\/\___ _/\/\_______ ___/\/\/\___ _/\/\_______ ___/\/\/\___
|
||||
______________ ____________ ____________ ____________ ____________ _/\/\_______ ____________ ____________ ____________
|
||||
|
||||
_ __________ _,
|
||||
_.-(_)._ ." ". .--""--. _.-{__}-._
|
||||
.'________'. | .--------. | .' '. .:-'`____`'-:.
|
||||
[____________] /` |________| `\ / .'``'. \ /_.-"`_ _`"-._\
|
||||
/ / .\/. \ \| / / .\/. \ \ || .'/.\/.\'. | /` / .\/. \ `\
|
||||
| \__/\__/ |\_/ \__/\__/ \_/| : |_/\_| ; | | \__/\__/ |
|
||||
\ / \ / \ '.\ /.' / .-\ /-.
|
||||
/'._ -- _.'\ /'._ -- _.'\ /'. `'--'` .'\/ '._-.__--__.-_.' \
|
||||
/_ `""""` _\/_ `""""` _\ /_ `-./\.-' _\'. `""""""""` .'`\
|
||||
(__/ '| \ _)_| |_)_/ \__)| ' | |
|
||||
|_____'|_____| \__________/ | |;`_________'________`;-'
|
||||
'----------' '----------' '--------------'`--------------------`
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 2020.03.24
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
|
||||
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
|
||||
start=`date +%s`
|
||||
|
||||
YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
|
||||
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||
IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) || ( echo "noipfsid" && exit 1 )
|
||||
########################################################################
|
||||
########################################################################
|
||||
# This script could be used to manage .current Astronaut Friendships
|
||||
# But thinking about it. Is is better to keep Gchange as confidence level collector.
|
||||
########################################################################
|
||||
echo "# Script needs enhancement or better a dedicated 'AApp' acting on IPFS directly."
|
||||
########################################################################
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
# Check who is currently current connected PLAYER
|
||||
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( echo "noplayer" && exit 1 )
|
||||
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( echo "nopseudo" && exit 1 )
|
||||
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( echo "nog1pub" && exit 1 )
|
||||
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( echo "noipfsnodeid" && exit 1 )
|
||||
|
||||
# Astroport Station "Captain" connected?
|
||||
source ~/.zen/ipfs.sync; echo "CAPTAIN is $CAPTAIN $(${MY_PATH}/face.sh cool)"
|
||||
echo
|
||||
echo "$PLAYER bon parcours amical (N+2)"
|
||||
echo
|
||||
echo
|
||||
for player in $(ls ~/.zen/game/players/); do
|
||||
# $player g1pub
|
||||
g1pub=$(cat ~/.zen/game/players/$player/.g1pub) || continue
|
||||
ipfsnodeid=$(cat ~/.zen/game/players/$player/.ipfsnodeid) || continue
|
||||
|
||||
echo "Listing FRIENDS from $player"
|
||||
ls ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/
|
||||
echo
|
||||
sleep 1
|
||||
for g1 in $(ls ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/); do
|
||||
echo "$g1 est le player..."
|
||||
cat ~/.zen/game/players/$player/ipfs/.$ipfsnodeid/FRIENDS/$g1/player 2>/dev/null || echo "???"
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
# TODO USE WEB INTERFACE
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.4
|
||||
# Version: 1.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
|
@ -11,22 +11,23 @@ ME="${0##*/}"
|
|||
|
||||
echo "-----"
|
||||
echo "$ME RUNNING"
|
||||
|
||||
# ASTROBOT FIRST SPECIFIC PROCESS
|
||||
# "Copier youtube" + (voeu) => CopierYoutube (G1Voeu G1CopierYoutube) = ASTROBOT copy Ŋ1 "(G1CopierYoutube)"
|
||||
|
||||
|
||||
#######################################################################
|
||||
# ASTROBOT SUBKEY PROGRAM : [G1]CopierYoutube "tag"
|
||||
# Ce script se déclenche si le tiddler "voeu" "CopierYoutube" a été formulé dans le TW du PLAYER
|
||||
# Il active l'extraction des liens (compatibles yt-dlp) trouvés dans les tiddlers portant le tag "CopierYoutube"
|
||||
# Les vidéos (mp4) ou audio (mp3) (+tag "CopierYoutube MP3") sont inscrites dans un json puis importés dans le TW.
|
||||
#######################################################################
|
||||
INDEX="$1"
|
||||
[[ ! ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
|
||||
PLAYER="$2"
|
||||
[[ ! $PLAYER ]] && echo "ERROR - Please provide IPFS publish key" && exit 1
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide IPFS publish key" && exit 1
|
||||
|
||||
ASTONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
||||
[[ ! $ASTONAUTENS ]] && echo "ERROR - Clef IPNS $PLAYER introuvable!" && exit 1
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub)
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS="$3"
|
||||
|
@ -35,229 +36,314 @@ MOATS="$3"
|
|||
###################################################################
|
||||
## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/
|
||||
mkdir -p $HOME/.zen/game/players/$PLAYER/G1CopierYoutube/
|
||||
mkdir -p ${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/
|
||||
mkdir -p ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/
|
||||
|
||||
###################################################################
|
||||
## tag[CopierYoutube] EXTRACT ~/.zen/tmp/CopierYoutube.json FROM TW
|
||||
###################################################################
|
||||
rm -f ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json
|
||||
rm -f ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/game/players/$PLAYER/G1CopierYoutube \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1CopierYoutube \
|
||||
--render '.' 'CopierYoutube.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[CopierYoutube]]'
|
||||
|
||||
echo "DEBUG : cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json | jq -r"
|
||||
echo "DEBUG : cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json | jq -r"
|
||||
## CHEK FOR MP3 TAG
|
||||
TAGS=()
|
||||
TAGS=($(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json | jq -r .[].tags))
|
||||
echo "TAGS :${#TAGS[@]}: ${TAGS[@]}"
|
||||
isMP3=$(echo ${TAGS[@]} | grep -w "MP3")
|
||||
|
||||
BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser
|
||||
## GET USER BROWSER for YOUTUBE COOKIES
|
||||
BZER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser
|
||||
[[ $BZER ]] && BROWSER="--cookies-from-browser $BZER " || BROWSER=""
|
||||
[[ ! $isLAN ]] && BROWSER=""
|
||||
|
||||
###################################################################
|
||||
## URL EXTRACTION & yt-dlp.cache.$PLAYER upgrade
|
||||
for YURL in $(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json | jq -r '.[].text' | grep 'http'); do
|
||||
## URL EXTRACTION & yt-dlp.cache.${PLAYER} upgrade
|
||||
for YURL in $(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json | jq -r '.[].text' | grep 'http'); do
|
||||
[[ ! $(echo $YURL | grep "http" ) ]] && echo "$YURL error" && continue
|
||||
echo "G1CopierYoutube : $YURL"
|
||||
echo "Extracting video playlist into yt-dlp.cache.$PLAYER"
|
||||
echo "Extracting video playlist into yt-dlp.cache.${PLAYER}"
|
||||
|
||||
### yt-dlp.command
|
||||
CMD=$(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command 2>/dev/null | grep "$YURL" | tail -n 1)
|
||||
CMD=$(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command 2>/dev/null | grep -- "$YURL" | tail -n 1)
|
||||
if [[ ! $CMD ]]; then
|
||||
echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command
|
||||
echo "NOUVEAU CANAL $PLAYER&$YURL:$MOATS"
|
||||
echo "${PLAYER}&$YURL:$MOATS" >> ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command
|
||||
echo "NOUVEAU CANAL ${PLAYER}&$YURL:$MOATS"
|
||||
lastrun=$MOATS
|
||||
duree=604800000
|
||||
else
|
||||
lastrun=$(echo "$CMD" | rev | cut -d ':' -f 1 | rev) && echo "$CMD"
|
||||
duree=$(expr ${MOATS} - $lastrun)
|
||||
fi
|
||||
# ONE WEEK NEW SCAN
|
||||
if [[ $duree -ge 604800000 || ! -s ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER ]]; then
|
||||
yt-dlp --cookies-from-browser $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER
|
||||
sed -i "s~$lastrun~$MOATS~g" ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command # UPDATE LASTRUN
|
||||
fi
|
||||
# ONE WEEK NEW SCAN
|
||||
if [[ $duree -ge 604800000 || ! -s ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER} ]]; then
|
||||
/usr/local/bin/yt-dlp $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" 2>/dev/null >> ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER}
|
||||
sed -i "s~$lastrun~$MOATS~g" ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command # UPDATE LASTRUN
|
||||
fi
|
||||
|
||||
done # FINISH YURL loop
|
||||
|
||||
## CREATE SORT UNIQ SHUFFLED ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER (12345 ONLINE)
|
||||
cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER 2>/dev/null | sort | uniq | shuf > ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER
|
||||
## CREATE SORT UNIQ SHUFFLED ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} (12345 ONLINE)
|
||||
cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER} 2>/dev/null | sort | uniq | shuf > ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER}
|
||||
|
||||
###################################################################
|
||||
[[ ! -s ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0
|
||||
###################################################################
|
||||
boucle=0
|
||||
tot=0
|
||||
###################################################################
|
||||
# PROCESS YOUTUBEID VIDEO DOWNLOAD AND CREATE TIDDLER in TW
|
||||
###################################################################
|
||||
while read LINE;
|
||||
do
|
||||
boucle=$((boucle+1))
|
||||
echo "_____ $LINE _____ $boucle"
|
||||
YID="$(echo "$LINE" | cut -d '&' -f 1)"
|
||||
do
|
||||
boucle=$((boucle+1))
|
||||
echo "_____ $LINE _____ $boucle"
|
||||
YID="$(echo "$LINE" | rev | cut -d '=' -f 1 | rev )"
|
||||
|
||||
#~ [[ $boucle -gt 50 ]] && break ## TODO SCAN FOR ABROAD SAME COPY DONE
|
||||
### MAKE BETTER THAN RANDOM !! CONNECT TO THE WARM...
|
||||
|
||||
###################################################################
|
||||
## Search for $YID.TW.json TIDDLER in local & MySwarm cache
|
||||
echo "--- CACHE SEARCH FOR $YID ---" && TIDDLER=$(ls -t "$HOME/.zen/game/players/"*"/G1CopierYoutube/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
[[ ! $TIDDLER ]] && TIDDLER=$(ls -t "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
[[ ! $TIDDLER ]] && TIDDLER=$(ls -t "$HOME/.zen/tmp/swarm/"*"/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
[[ $TIDDLER ]] && echo "Tiddler Found in CACHE : $TIDDLER" || echo "EMPTY."
|
||||
#~ echo "--- CACHE SEARCH FOR $YID ---"
|
||||
TIDDLER=$(ls -t "${HOME}/.zen/game/players/"*"/G1CopierYoutube/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
## TODO CORRECT - CACHE CHANGED -
|
||||
[[ ! $TIDDLER ]] && TIDDLER=$(ls -t "${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
[[ ! $TIDDLER ]] && TIDDLER=$(ls -t "${HOME}/.zen/tmp/swarm/"*"/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1)
|
||||
#~ [[ $TIDDLER ]] && echo "Tiddler Found in CACHE : $TIDDLER" \
|
||||
#~ || echo "EMPTY."
|
||||
###################################################################
|
||||
|
||||
if [[ ! ${TIDDLER} ]]; then
|
||||
###################################################################
|
||||
# COPY VIDEO AND MAKE TIDDLER
|
||||
###################################################################
|
||||
if [[ ! ${TIDDLER} ]]; then
|
||||
###################################################################
|
||||
# COPY VIDEO AND MAKE TIDDLER
|
||||
###################################################################
|
||||
ZYURL=$(echo "$LINE" | cut -d '&' -f 2-)
|
||||
echo "COPIE : $ZYURL"
|
||||
|
||||
## LIMIT TO 12 MAXIMUM COPY PER DAY PER PLAYER
|
||||
[[ $boucle == 13 ]] && echo "MAXIMUM COPY REACHED FOR TODAY" && continue
|
||||
## LIMIT TO 2 MAXIMUM COPY PER DAY PER PLAYER
|
||||
[[ $tot == 3 ]] && echo "MAXIMUM COPY REACHED FOR TODAY" && break
|
||||
## TODO ACCEPT MORE WITH COINS
|
||||
|
||||
TITLE="$(yt-dlp --cookies-from-browser $BROWSER --print "%(title)s" "${ZYURL}" | detox --inline)"
|
||||
TITLE="$(/usr/local/bin/yt-dlp $BROWSER --print "%(title)s" "${ZYURL}" | detox --inline)"
|
||||
[[ ! $TITLE ]] && echo "NO TITLE" && continue
|
||||
|
||||
start=`date +%s`
|
||||
|
||||
echo ".... Downloading $TITLE.mp4"
|
||||
echo ".... Downloading $TITLE ${isMP3}"
|
||||
# https://github.com/yt-dlp/yt-dlp#format-selection-examples
|
||||
# SUBS ? --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs
|
||||
# (bv*[height<=720][vcodec~='^((he|a)vc|h26[45])']+ba)
|
||||
# TODO : DELAY COPY OPERATION... Astro can download quicker at 03:00 AM
|
||||
echo "yt-dlp -f \"(bv*[ext=mp4][height<=720]+ba/b[height<=720])\" --no-mtime --embed-thumbnail --add-metadata -o \"$HOME/.zen/tmp/yt-dlp/$TITLE.%(ext)s\" ${ZYURL}"
|
||||
echo "/usr/local/bin/yt-dlp -f \"(bv*[ext=mp4][height<=720]+ba/b[height<=720])\" --no-mtime --embed-thumbnail --add-metadata -o \"${HOME}/.zen/tmp/yt-dlp/$TITLE.%(ext)s\" ${ZYURL}"
|
||||
|
||||
#############################################################################
|
||||
## COPY FROM YOUTUBE (TODO DOUBLE COPY & MKV to MP4 OPTIMISATION)
|
||||
## EXTRA PARAM TO TRY
|
||||
# --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs
|
||||
|
||||
yt-dlp -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \
|
||||
--cookies-from-browser $BROWSER \
|
||||
--download-archive $HOME/.zen/.yt-dlp.list \
|
||||
-S res,ext:mp4:m4a --recode mp4 --no-mtime --embed-thumbnail --add-metadata \
|
||||
-o "$HOME/.zen/tmp/yt-dlp/$TITLE.%(ext)s" ${ZYURL}
|
||||
if [[ ${isMP3} == "" ]]; then
|
||||
# copying video
|
||||
/usr/local/bin/yt-dlp -q -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \
|
||||
$BROWSER \
|
||||
--download-archive ${HOME}/.zen/.yt-dlp.list \
|
||||
-S res,ext:mp4:m4a --recode mp4 --no-mtime --embed-thumbnail --add-metadata \
|
||||
-o "${HOME}/.zen/tmp/yt-dlp/$TITLE.%(ext)s" "${ZYURL}"
|
||||
ZFILE="$TITLE.mp4"
|
||||
|
||||
################################################################################
|
||||
### ADAPT TO TW RYTHM (DELAY COPY?)
|
||||
echo
|
||||
ZFILE="$TITLE.mp4"
|
||||
############################################################################
|
||||
### CHECK RESULT CONVERT MKV TO MP4
|
||||
[[ -s "${HOME}/.zen/tmp/yt-dlp/$TITLE.mkv" ]] \
|
||||
&& ffmpeg -loglevel quiet -i "${HOME}/.zen/tmp/yt-dlp/$TITLE.mkv" -c:v libx264 -c:a aac "${HOME}/.zen/tmp/yt-dlp/$TITLE.mp4" \
|
||||
&& rm "${HOME}/.zen/tmp/yt-dlp/$TITLE.mkv"
|
||||
|
||||
############################################################################
|
||||
### CHECK RESULT CONVERT MKV TO MP4
|
||||
[[ -s "$HOME/.zen/tmp/yt-dlp/$TITLE.mkv" ]] && ffmpeg -loglevel quiet -i "$HOME/.zen/tmp/yt-dlp/$TITLE.mkv" -c:v libx264 -c:a aac "$HOME/.zen/tmp/yt-dlp/$TITLE.mp4" # TRY TO CONVERT MKV TO MP4
|
||||
if [[ ! -s "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" ]]; then
|
||||
echo "No FILE -- TRYING TO RESTORE CACHE FROM TW -- ${ZFILE}"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1CopierYoutube \
|
||||
--render '.' "$YID.TW.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${ZFILE}"
|
||||
|
||||
if [[ ! -s "$HOME/.zen/tmp/yt-dlp/$ZFILE" ]]; then
|
||||
echo "No FILE -- TRYING TO RESTORE CACHE FROM TW --"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/game/players/$PLAYER/G1CopierYoutube \
|
||||
--render '.' "'$YID.TW.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "$ZFILE" \
|
||||
&& ln -s "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json"
|
||||
continue
|
||||
if [[ -s ~/.zen/game/players/${PLAYER}/G1CopierYoutube/${YID}.TW.json ]]; then
|
||||
rm "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/${ZFILE}.json" 2>/dev/null
|
||||
cd ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/
|
||||
ln -s "./${YID}.TW.json" "${ZFILE}.json"
|
||||
cd -
|
||||
else
|
||||
## REMOVE FILE FROM .yt-dlp.list - RETRY NEXT TIME
|
||||
grep -v -- "$YID" ${HOME}/.zen/.yt-dlp.list > /tmp/.yt-dlp.list
|
||||
mv /tmp/.yt-dlp.list ${HOME}/.zen/.yt-dlp.list
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
else
|
||||
# copying mp3
|
||||
echo "COPYING MP3 (!-q)"
|
||||
/usr/local/bin/yt-dlp -x --no-mtime --audio-format mp3 --embed-thumbnail --add-metadata \
|
||||
$BROWSER \
|
||||
--download-archive ${HOME}/.zen/.yt-dlp.mp3.list \
|
||||
-o "${HOME}/.zen/tmp/yt-dlp/$TITLE.%(ext)s" "${ZYURL}"
|
||||
|
||||
ZFILE="$TITLE.mp3"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
####################################################
|
||||
echo "FOUND : ~/.zen/tmp/yt-dlp/$ZFILE"
|
||||
FILE_BSIZE=$(du -b "$HOME/.zen/tmp/yt-dlp/$ZFILE" | awk '{print $1}')
|
||||
####################################################
|
||||
[[ -s ~/.zen/tmp/yt-dlp/${ZFILE} ]] \
|
||||
&& echo "FOUND : ~/.zen/tmp/yt-dlp/${ZFILE}"
|
||||
|
||||
FILE_BSIZE=$(du -b "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" | awk '{print $1}')
|
||||
[[ ! $FILE_BSIZE ]] && echo "SIZE ERROR" && continue
|
||||
|
||||
FILE_SIZE=$(echo "${FILE_BSIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } printf "%.2f %s", $1, v[s] }')
|
||||
echo "$boucle - $ZFILE - FILE SIZE = $FILE_SIZE ($FILE_BSIZE octets)"
|
||||
echo "$boucle - ${ZFILE} - FILE SIZE = $FILE_SIZE ($FILE_BSIZE octets)"
|
||||
echo
|
||||
|
||||
espeak "GOOD! Video Number $boucle = $FILE_SIZE" > /dev/null 2>&1
|
||||
### CREATE GIF ANIM : make_video_gifanim_ipfs.sh
|
||||
[[ ${isMP3} == "" ]] \
|
||||
&& $(${MY_PATH}/../tools/make_video_gifanim_ipfs.sh "${HOME}/.zen/tmp/yt-dlp" "${ZFILE}" | tail -n 1) \
|
||||
&& echo "HOP=$HOP
|
||||
ANIMH=$ANIMH
|
||||
PROBETIME=$PROBETIME
|
||||
DURATION=$DURATION
|
||||
DUREE=$DUREE
|
||||
RES=$RES
|
||||
MIME=$MIME
|
||||
VTRATIO=$VTRATIO
|
||||
file=$file"
|
||||
|
||||
|
||||
### CREATE GIF ANIM
|
||||
$(${MY_PATH}/../tools/make_video_gifanim_ipfs.sh "$HOME/.zen/tmp/yt-dlp" "$ZFILE" | tail -n 1) ## export ANIMH
|
||||
echo "/ipfs/$ANIMH"
|
||||
## Create gifanime ## TODO Search for similarities BEFORE ADD
|
||||
|
||||
|
||||
echo "Adding to IPFS"
|
||||
ILINK=$(ipfs add -q "$HOME/.zen/tmp/yt-dlp/$ZFILE" | tail -n 1)
|
||||
echo "/ipfs/$ILINK === $ZFILE"
|
||||
ILINK=$(ipfs add -q "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" | tail -n 1)
|
||||
echo "/ipfs/$ILINK === ${ZFILE}"
|
||||
|
||||
MIME=$(file --mime-type -b "$HOME/.zen/tmp/yt-dlp/$ZFILE")
|
||||
[[ $ILINK == "" ]] && echo ">>>>> BIG PROBLEM PAPA. NO IPFS " && continue
|
||||
|
||||
MIME=$(file --mime-type -b "${HOME}/.zen/tmp/yt-dlp/${ZFILE}")
|
||||
|
||||
## ADD TAGS
|
||||
SEC=$(yt-dlp --cookies-from-browser $BROWSER --print "%(duration)s" "${ZYURL}")
|
||||
CHANNEL=$(yt-dlp --cookies-from-browser $BROWSER --print "%(channel)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
PLAYLIST=$(yt-dlp --cookies-from-browser $BROWSER --print "%(playlist)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g')
|
||||
SEC=$(/usr/local/bin/yt-dlp $BROWSER --print "%(duration)s" "${ZYURL}")
|
||||
CHANNEL=$(/usr/local/bin/yt-dlp $BROWSER --print "%(channel)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
PLAYLIST=$(/usr/local/bin/yt-dlp $BROWSER --print "%(playlist)s" "${ZYURL}" | sed -r 's/\<./\U&/g' | sed 's/ //g')
|
||||
EXTRATAG="$CHANNEL $PLAYLIST"
|
||||
|
||||
if [[ ${isMP3} == "" ]]; then
|
||||
## PREPARE VIDEO HTML5 CODE
|
||||
TEXT="<video controls width=100% poster='/ipfs/"${ANIMH}"'><source src='/ipfs/"${ILINK}"' type='"${MIME}"'></video>
|
||||
<br>{{!!filesize}} - {{!!duration}} sec. - vtratio(dur) = {{!!vtratio}} ({{!!dur}})<br>
|
||||
<h1><a href='"${ZYURL}"'>"${TITLE}"</a></h1>"
|
||||
TEXT="<video controls width=100% poster='/ipfs/"${ANIMH}"'>
|
||||
<source src='/ipfs/"${ILINK}"' type='"${MIME}"'>
|
||||
Your browser does not support the video element.
|
||||
</video>
|
||||
<br>
|
||||
{{!!filesize}} - {{!!duration}} sec. - vtratio(dur) = {{!!vtratio}} ({{!!dur}})
|
||||
<br>
|
||||
<h1><a target='_blank' href='"${ZYURL}"'>Web2.0 Origin</a></h1>"
|
||||
|
||||
else
|
||||
TEXT="<audio controls>
|
||||
<source src='/ipfs/"${ILINK}"' type='"${MIME}"'>
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<br>
|
||||
{{!!filesize}} - {{!!duration}} sec. - vtratio(dur) = {{!!vtratio}} ({{!!dur}})
|
||||
<br>
|
||||
<h1><a target='_blank' href='"${ZYURL}"'>Web2.0 Origin</a></h1>"
|
||||
|
||||
fi
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
|
||||
echo "Creating Youtube \"${YID}\" tiddler : G1CopierYoutube !"
|
||||
|
||||
CTITLE=$(echo ${ZFILE} | sed 's~_~ ~g' | sed 's~\.~ ~g')
|
||||
|
||||
## WAN ADD <<hide tiddler-controls>> TO text jq 'map(.text += "<<hide tiddler-controls>>")'
|
||||
[[ ! isLAN ]] && TEXT="$TEXT <<hide tiddler-controls>>"
|
||||
echo $TEXT
|
||||
|
||||
mkdir -p ${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER} ## MISSING FOR FIRST RUN
|
||||
TIDDLER="${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/${YID}.TW.json"
|
||||
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"resolution": "'${RES}'",
|
||||
"duree": "'${DUREE}'",
|
||||
"duration": "'${DURATION}'",
|
||||
"giftime": "'${PROBETIME}'",
|
||||
"gifanime": "'/ipfs/${ANIMH}'",
|
||||
"modified": "'${MOATS}'",
|
||||
"title": "'$ZFILE'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"vtratio": "'${VTRATIO}'",
|
||||
"text": "'$TEXT'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"mime": "'${MIME}'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"filesize": "'${FILE_SIZE}'",
|
||||
"sec": "'${SEC}'",
|
||||
"dur": "'${dur}'",
|
||||
"ipfs": "'/ipfs/${ILINK}'",
|
||||
"youtubeid": "'${YID}'",
|
||||
"zurl": "'${ZYURL}'",
|
||||
"tags": "'ipfs G1CopierYoutube ${PLAYER} ${EXTRATAG} ${MIME}'"
|
||||
}
|
||||
]
|
||||
' > "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"resolution": "'${RES}'",
|
||||
"duree": "'${DUREE}'",
|
||||
"duration": "'${DURATION}'",
|
||||
"giftime": "'${PROBETIME}'",
|
||||
"gifanime": "'/ipfs/${ANIMH}'",
|
||||
"modified": "'${MOATS}'",
|
||||
"title": "'${ZFILE}'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"vtratio": "'${VTRATIO}'",
|
||||
"text": "'$TEXT'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"mime": "'${MIME}'",
|
||||
"size": "'${FILE_BSIZE}'",
|
||||
"filesize": "'${FILE_SIZE}'",
|
||||
"sec": "'${SEC}'",
|
||||
"dur": "'${dur}'",
|
||||
"ipfs": "'/ipfs/${ILINK}'",
|
||||
"youtubeid": "'${YID}'",
|
||||
"zurl": "'${ZYURL}'",
|
||||
"issuer": "'${PLAYER}'",
|
||||
"tags": "'ipfs G1CopierYoutube ${PLAYER} ${EXTRATAG} ${MIME} ${CTITLE}'"
|
||||
}
|
||||
]
|
||||
' > ${TIDDLER}
|
||||
|
||||
TIDDLER="$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json"
|
||||
tot=$((tot+1))
|
||||
|
||||
else
|
||||
###################################################################
|
||||
echo '# TIDDLER WAS IN CACHE'
|
||||
###################################################################
|
||||
## TODO : ADD EMAIL TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
|
||||
continue
|
||||
fi
|
||||
else
|
||||
###################################################################
|
||||
#~ echo "${TIDDLER} FOUND"
|
||||
###################################################################
|
||||
## TODO : ADD EMAIL TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
|
||||
continue
|
||||
fi
|
||||
|
||||
cp -f "${TIDDLER}" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/"
|
||||
cp -f "${TIDDLER}" "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/"
|
||||
|
||||
|
||||
#################################################################
|
||||
### ADDING $YID.TW.json to ASTONAUTENS INDEX.html
|
||||
### ADDING $YID.TW.json to ASTRONAUTENS INDEX.html
|
||||
#################################################################
|
||||
echo "=========================="
|
||||
echo "Adding $YID tiddler to TW /ipns/$ASTONAUTENS "
|
||||
echo "=========================="
|
||||
echo "Adding $YID tiddler to TW /ipns/$ASTRONAUTENS "
|
||||
|
||||
rm -f ~/.zen/tmp/$IPFSNODEID/newindex.html
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/newindex.html
|
||||
|
||||
echo ">>> Importing $HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json"
|
||||
echo ">>> Importing ${TIDDLER}"
|
||||
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "application/json" \
|
||||
--output ~/.zen/tmp/$IPFSNODEID --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import "${TIDDLER}" "application/json" \
|
||||
--output ~/.zen/tmp/${IPFSNODEID} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
# --deletetiddlers '[tag[CopierYoutube]]' ### REFRESH CHANNEL COPY
|
||||
if [[ -s ~/.zen/tmp/${IPFSNODEID}/newindex.html ]]; then
|
||||
|
||||
if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then
|
||||
## COPY JSON TIDDLER TO PLAYER
|
||||
cd ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/
|
||||
ln -s "./$YID.TW.json" "${ZFILE}.json"
|
||||
cd -
|
||||
|
||||
## COPY JSON TIDDLER TO PLAYER
|
||||
ln -s "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json"
|
||||
[[ $(diff ~/.zen/tmp/${IPFSNODEID}/newindex.html ${INDEX} ) ]] \
|
||||
&& mv ~/.zen/tmp/${IPFSNODEID}/newindex.html ${INDEX} \
|
||||
&& echo "===> Mise à jour ${INDEX}"
|
||||
|
||||
[[ $(diff ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}"
|
||||
else
|
||||
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/${IPFSNODEID}/newindex.html"
|
||||
echo "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
break
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/$IPFSNODEID/newindex.html"
|
||||
echo "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
fi
|
||||
|
||||
done < ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER # FINISH YID loop 1
|
||||
done < ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} # FINISH YID loop 1
|
||||
|
||||
## COPY PLAYER CACHE TO STATION SWARM CACHE
|
||||
cp -r ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/* \
|
||||
~/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.4
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
echo "-----"
|
||||
echo "$ME RUNNING"
|
||||
# Need TW index.html path + IPNS publication Key (available in IPFS keystore)
|
||||
# Search for "G1DessinDeMoa" tagged tiddlers to get URL
|
||||
|
||||
INDEX="$1"
|
||||
[[ ! $INDEX ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -f $INDEX ]] && echo "ERROR - Fichier TW absent. $INDEX" && exit 1
|
||||
|
||||
WISHKEY="$2" ## IPNS KEY NAME - G1PUB - PLAYER ...
|
||||
[[ ! $WISHKEY ]] && echo "ERROR - Please provide IPFS publish key" && exit 1
|
||||
TWNS=$(ipfs key list -l | grep -w $WISHKEY | cut -d ' ' -f1)
|
||||
[[ ! $TWNS ]] && echo "ERROR - Clef IPNS $WISHKEY introuvable!" && exit 1
|
||||
|
||||
# Extract tag=tube from TW into ~/.zen/tmp/$WISHKEY/DessinDeMoa.json
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
echo "TODO. Use 'moa' 'G1DessinDeMoa' Tiddlers to control Ŋ1 Network"
|
||||
exit 0
|
|
@ -0,0 +1,297 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.5
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
# PAD COCODING : https://pad.p2p.legal/s/G1Kodi
|
||||
# KODI SERVICE : Publish and Merge Friends Kodi Movies into RSS Stream
|
||||
########################################################################
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
echo "(✜‿‿✜) G1Kodi
|
||||
Insert G1Kodi Tiddlers from Kodi database from ~/.kodi/userdata/Database/MyVideos116.db
|
||||
should export movie to RSS (ex : http://ipfs.localhost:8080/ipfs/QmSJYf4uTj3NmqovSFZpBZuUhSS8j9FXKKnAjUMuVE896k)"
|
||||
echo "$ME RUNNING"
|
||||
|
||||
## EXTRACT MOVIES FROM KODI
|
||||
[[ ! -s ~/.kodi/userdata/Database/MyVideos116.db ]] && echo "KODI MOVIE SQLITE DB MISSING - EXIT -" && exit 1
|
||||
## CREATE 1ST ONLY TIDDLER INTO TW
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
INDEX="$1"
|
||||
[[ ! ${INDEX} ]] && INDEX="$HOME/.zen/game/players/.current/ipfs/moa/index.html"
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
ORIGININDEX=${INDEX}
|
||||
|
||||
PLAYER="$2"
|
||||
[[ ! ${PLAYER} ]] && PLAYER="$(cat ~/.zen/game/players/.current/.player 2>/dev/null)"
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide PLAYER" && exit 1
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! ${ASTRONAUTENS} ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
[[ ! $G1PUB ]] && echo "ERROR - G1PUB ${PLAYER} VIDE" && exit 1
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS="$3"
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
echo "${PLAYER} ${INDEX} ${ASTRONAUTENS} ${G1PUB} "
|
||||
#~ ###################################################################
|
||||
#~ ## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
#~ ###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/${MOATS} && echo $HOME/.zen/tmp/${MOATS}
|
||||
mkdir -p $HOME/.zen/game/players/${PLAYER}/G1Kodi/
|
||||
|
||||
echo "EXPORT Kodi Wish for ${PLAYER}"
|
||||
rm -f ~/.zen/game/players/${PLAYER}/G1Kodi/Kodi.json
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1Kodi \
|
||||
--render '.' 'Kodi.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]tag[G1Kodi]]'
|
||||
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/G1Kodi/Kodi.json ) == "[]" ]] \
|
||||
&& echo "AUCUN VOEU G1KODI - EXIT -" \
|
||||
&& rm -Rf $HOME/.zen/game/players/${PLAYER}/G1Kodi \
|
||||
&& exit 0
|
||||
|
||||
WISH=$(cat ~/.zen/game/players/${PLAYER}/G1Kodi/Kodi.json | jq -r '.[].wish')
|
||||
WISHNS=$(cat ~/.zen/game/players/${PLAYER}/G1Kodi/Kodi.json | jq -r '.[].wishns')
|
||||
echo "G1KODI: $WISH ${myIPFS}$WISHNS"
|
||||
|
||||
## Export already in TW movies
|
||||
rm -f ~/.zen/game/players/${PLAYER}/G1Kodi/TWmovies.json
|
||||
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1Kodi \
|
||||
--render '.' 'TWmovies.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Kodi]!tag[G1Voeu]]'
|
||||
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/G1Kodi/TWmovies.json) == "[]" ]] && echo "AUCUN FILM G1KODI"
|
||||
|
||||
#~ ## TW G1Kodi deletetiddlers CODE
|
||||
#~ tiddlywiki --load ${INDEX} \
|
||||
#~ --deletetiddlers '[tag[G1Kodi]!Kodi]' \
|
||||
#~ --output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "cleanindex.html" "text/plain"
|
||||
#~ [[ -s ~/.zen/tmp/${MOATS}/cleanindex.html ]] && cp -f ~/.zen/tmp/${MOATS}/cleanindex.html ~/.zen/tmp/${MOATS}/index.html
|
||||
|
||||
|
||||
echo "=========== ( ◕‿◕) EXTRACT KODI MyVideos DB (◕‿◕ ) =============="
|
||||
|
||||
## EXTRACT MOVIE FILES LIST TO CSV
|
||||
echo "\"titre\",\"desc\",\"sub\",\"source\",\"cat\",\"extrait\",\"prem\"" > ~/.zen/tmp/${MOATS}/${PLAYER}.movie.csv
|
||||
sqlite3 -csv ~/.kodi/userdata/Database/MyVideos116.db 'select c00, c01, c03, c22, c14, c19, premiered from movie' >> ~/.zen/tmp/${MOATS}/${PLAYER}.movie.csv
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${PLAYER}.movie.csv ]] && echo "EMPTY KODI MOVIE DATABASE - EXIT -" && exit 0
|
||||
#################################
|
||||
|
||||
### CONVERT TO JSON
|
||||
## Use "miller" to convert csv into json
|
||||
mlr --c2j --jlistwrap cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.csv > ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json
|
||||
|
||||
## SHUFFLE TITRE LIST
|
||||
cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq -r .[].titre | shuf > ~/.zen/tmp/${MOATS}/${PLAYER}.movie.id
|
||||
|
||||
boucle=0
|
||||
|
||||
while read TITRE; do
|
||||
|
||||
DESC=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .desc')
|
||||
SUB=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .sub')
|
||||
SOURCE=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .source')
|
||||
IPFSONE=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .ipfs_one')
|
||||
CAT=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .cat' | tail -n 1)
|
||||
YID=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .extrait' | rev | cut -d '=' -f 1 | rev)
|
||||
|
||||
PREM=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.movie.json | jq --arg v "${TITRE}" -r '.[] | select(.titre==$v) | .prem')
|
||||
MIME=$(file --mime-type -b "$SOURCE" )
|
||||
|
||||
YEAR=$(echo "${PREM}" | cut -f1 -d '-' )
|
||||
TITLE=$(echo "${TITRE}" | detox --inline ) ## TITLE SANITY
|
||||
TAGS="${YEAR} G1Kodi ${TITLE} ${PLAYER} $(echo "${CAT}" | detox --inline | sed 's~_~\ ~g')"
|
||||
|
||||
echo "${boucle} > ${TITLE}"
|
||||
echo "($MIME)" "$SOURCE"
|
||||
|
||||
## ADD MOVIE TO IPFS
|
||||
#~ <item>
|
||||
#~ <title>Delicatessen</title>
|
||||
#~ <description>La vie des étranges habitants d'un immeuble de banlieue qui se dresse dans un immense terrain vague et qui tous vont se fournir chez le boucher-charcutier, à l'enseigne « Delicatessen ».</description>
|
||||
#~ <link>http://ipfs.localhost:8080/ipfs/QmfVuhDo4kEk5eh5EULfZGxiWqrrCcHBehojgPF6kiq8r3/Delicatessen.mp4</link>
|
||||
#~ <pubDate>Sun, 6 Sep 2022 16:20:00 +0000</pubDate>
|
||||
#~ </item>
|
||||
|
||||
if [[ ! -s ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json ]]; then
|
||||
echo "CHECKING Kodi_${TITLE} IN TW"
|
||||
tiddlywiki --load ${ORIGININDEX} \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1Kodi \
|
||||
--render '.' "${TITLE}.dragdrop.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "'"Kodi_${TITLE}"'"
|
||||
fi ## CHECK PLAYER G1KODI CACHE. QUICKER.
|
||||
|
||||
if [[ $(cat ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json) == "[]" ]]; then
|
||||
|
||||
if [[ $MIME == "video/mp4" ]]; then
|
||||
echo "$MIME. GOOD. RECORDING TO TW"
|
||||
|
||||
# MAKE PAYMENT QRCODE
|
||||
# sha256 Kodi_TITLE + G1PUB encrypt = comment
|
||||
THASH=$(echo "Kodi_${TITLE}" | sha256sum | cut -d ' ' -f 1) # && echo ${THASH} > ~/.zen/tmp/${MOATS}/thash
|
||||
# WANA DO MORE SECURE ?
|
||||
## ENCRYPT THASH with G1PUB (so you are sure it is a link from your TW).
|
||||
#~ ~/.zen/Astroport.ONE/tools/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/${MOATS}/thash -o ~/.zen/tmp/${MOATS}/thash.enc
|
||||
#~ THASHSEC=$(cat ~/.zen/tmp/${MOATS}/thash.enc | base16)
|
||||
#~ Then update THASH with THASHSEC next
|
||||
## CREATE june:// QRCODE put it in IPFS
|
||||
PAYCOM="june://${G1PUB}?comment=N1Kodi:${THASH}&" ## comment=N1Kodi:TiddlerTiltleHash
|
||||
echo "${PAYCOM}"
|
||||
amzqr "${PAYCOM}" -l H -c -p ${MY_PATH}/../images/TV.png -n VOD_${TITLE}.png -d ~/.zen/tmp/${MOATS}/
|
||||
convert -gravity northwest -pointsize 20 -fill black -draw "text 30,3 \"${TITRE} (${YEAR})\"" ~/.zen/tmp/${MOATS}/VOD_${TITLE}.png ~/.zen/tmp/${MOATS}/VOD.png
|
||||
|
||||
PV=$(ipfs add -q ~/.zen/tmp/${MOATS}/VOD.png)
|
||||
echo "VOD QR = ${myIPFS}/ipfs/${PV}"
|
||||
## ADD TO IPFS
|
||||
echo "ADD ${SOURCE} TO IPFS"
|
||||
|
||||
IPFSMOVIE=$(ipfs add -q "$SOURCE")
|
||||
echo "/ipfs/${IPFSMOVIE}" > ~/.zen/tmp/${MOATS}/source
|
||||
|
||||
~/.zen/Astroport.ONE/tools/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/${MOATS}/source -o ~/.zen/tmp/${MOATS}/source.enc
|
||||
ENCODING=$(cat ~/.zen/tmp/${MOATS}/source.enc | base16)
|
||||
echo "MOVIE ADDED /ipfs/${IPFSMOVIE} :NATOOLS16: ${ENCODING}"
|
||||
|
||||
# CREATE TEXT AREA
|
||||
TEXT="<h1>{{!!titre}} ({{!!year}})</h1><h2>{{!!sub}}</h2>
|
||||
{{!!desc}}<br>
|
||||
<a target='youtube' href='https://youtu.be/"${YID}"'>Bande Annonce</a>
|
||||
<br>
|
||||
<h3>Voir ce Film:</h3>
|
||||
<h4>Installez Cesium+</h4>
|
||||
<table><tr>
|
||||
<td>
|
||||
<img width='240' src='/ipfs/QmXExw6Sh4o4rSjBQjU9PGU7BCGwb1jybrKEeaZGUNRCRE'>
|
||||
</td><td>
|
||||
<img width='240' src='/ipfs/QmP3qwEnVX9zSsyKAwuH6nhDPfrRoMbAfszrtdkLGgo7LQ'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Flashez, envoyez un don...</h4>
|
||||
<br>ce soir,<br>recevez le lien dans votre messagerie.
|
||||
</td><td>
|
||||
<img width='300' src='/ipfs/"${PV}"'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
## MAKING TIDDLER
|
||||
echo "## Creation json tiddler ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json"
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"title": "'Kodi_${TITLE}'",
|
||||
"text": "'${TEXT}'",
|
||||
"thash": "'${THASH}'",
|
||||
"year": "'${YEAR}'",
|
||||
"mime": "'${MIME}'",
|
||||
"prem": "'${PREM}'",
|
||||
"sub": "'${SUB}'",
|
||||
"desc": "'${DESC}'",
|
||||
"yid": "'${YID}'",
|
||||
"cat": "'${CAT}'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"source": "'${SOURCE}'",
|
||||
"ipfs_one": "''",
|
||||
"titre": "'${TITRE}'",
|
||||
"modified": "'${MOATS}'",
|
||||
"issuer": "'${PLAYER}'",
|
||||
"tags": "'${TAGS}'"
|
||||
}
|
||||
]
|
||||
' > ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json
|
||||
|
||||
## ADD ipfs_one to JSON file (Just to show jq in action)
|
||||
cat ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json | jq --arg v "${ENCODING}" '.[].ipfs_one = $v' \
|
||||
> ~/.zen/game/players/${PLAYER}/G1Kodi/ipfs_one.json
|
||||
|
||||
[[ -s ~/.zen/game/players/${PLAYER}/G1Kodi/ipfs_one.json ]] \
|
||||
&& cp -f ~/.zen/game/players/${PLAYER}/G1Kodi/ipfs_one.json ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json \
|
||||
&& rm ~/.zen/game/players/${PLAYER}/G1Kodi/ipfs_one.json
|
||||
|
||||
## TO ALLOW DECODING FOR MY FRIENDS
|
||||
## jq FORMULA TO ADD ipfs_FG1PUB = ACODING
|
||||
#~ cat ~/.zen/tmp/${MOATS}/atiddler.json | jq '.[] |= .+ {"_IPUB_":"_ICOD_"}' \
|
||||
#~ > ~/.zen/tmp/${MOATS}/atiddler.json.tmp \
|
||||
#~ && sed -i "s~_IPUB_~ipfs_${AG1PUB}~g" ~/.zen/tmp/${MOATS}/atiddler.json.tmp \
|
||||
#~ && sed -i "s~_ICOD_~${ACODING}~g" ~/.zen/tmp/${MOATS}/atiddler.json.tmp \
|
||||
#~ && mv ~/.zen/tmp/${MOATS}/atiddler.json.tmp ~/.zen/tmp/${MOATS}/atiddler.json
|
||||
|
||||
echo "ipfs_one : ${ENCODING}"
|
||||
|
||||
## ADD TO TW
|
||||
echo "ADD G1KODI IN TW ${PLAYER} : $myIPFS/ipns/$ASTRONAUTENS"
|
||||
rm -f ~/.zen/tmp/newindex.html
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import ~/.zen/game/players/${PLAYER}/G1Kodi/${TITLE}.dragdrop.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
## UPDATE ${INDEX}
|
||||
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
||||
|
||||
cp -f ~/.zen/tmp/newindex.html ~/.zen/tmp/${MOATS}/index.html
|
||||
|
||||
INDEX="$HOME/.zen/tmp/${MOATS}/index.html"
|
||||
echo "NEWINDEX : ${INDEX}"
|
||||
|
||||
boucle=$((boucle+1)) ## COUNT HOW MANY MOVIES GOING TO IPFS
|
||||
|
||||
else
|
||||
|
||||
echo "CANNOT UPDATE TW - FATAL ERROR -"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
echo "MOVIE IN TW ($YID)"
|
||||
echo "~~~~~~~~"
|
||||
|
||||
else
|
||||
|
||||
echo "${TITLE} MIME TYPE NOT COMPATIBLE.
|
||||
MUST BE CONVERTED TO MP4"
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "ALREADY IN TW : Kodi_${TITLE}
|
||||
https://youtu.be/${YID}"
|
||||
|
||||
fi
|
||||
|
||||
## BOUCLE BREAK - choose how many movies are added per day ? - G1STATION PARAM -
|
||||
[[ ${boucle} == 1 ]] && echo "IPFS ADD ${boucle} TODAY - BREAK -" && break
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/${PLAYER}.movie.id
|
||||
|
||||
## VERIFY, COULD BE DONE IN PLAYER REFRESH
|
||||
if [[ $(diff ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ${INDEX}) ]]; then
|
||||
|
||||
cp ${INDEX} ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html
|
||||
echo "CHANGED TW"
|
||||
|
||||
fi
|
||||
|
||||
echo "=========== ( ◕‿◕) (◕‿◕ ) =============="
|
||||
|
||||
#~ rm -Rf $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
||||
|
||||
## ./userdata/mediasources.xml
|
||||
## ./userdata/sources.xml
|
|
@ -1,223 +0,0 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.5
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
# PAD COCODING : https://pad.p2p.legal/s/G1PalPay
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
CESIUM="https://g1.data.le-sou.org"
|
||||
GCHANGE="https://data.gchange.fr"
|
||||
|
||||
echo "(✜‿‿✜) G1PalPay : Receiving & Relaying payments to emails found in comment"
|
||||
echo "$ME RUNNING"
|
||||
|
||||
########################################################################
|
||||
# PALPAY SERVICE
|
||||
########################################################################
|
||||
# CHECK TODAY INCOMING PAYMENT
|
||||
# IF COMMENT CONTAINS EMAIL ADDRESSES
|
||||
# THEN CREATE VISA+TW AND SEND PAIMENT REMOVING FIRST FROM LIST
|
||||
########################################################################
|
||||
# this couls lead in several account creation sharing % of incomes each time
|
||||
########################################################################
|
||||
|
||||
INDEX="$1"
|
||||
[[ ! ${INDEX} ]] && INDEX="$HOME/.zen/game/players/.current/ipfs/moa/index.html"
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
|
||||
PLAYER="$2"
|
||||
[[ ! ${PLAYER} ]] && PLAYER="$(cat ~/.zen/game/players/.current/.player 2>/dev/null)"
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide PLAYER" && exit 1
|
||||
|
||||
ASTONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! $ASTONAUTENS ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
[[ ! $G1PUB ]] && echo "ERROR - G1PUB ${PLAYER} VIDE" && exit 1
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS="$3"
|
||||
[[ ! $MOATS ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
###################################################################
|
||||
## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/${IPFSNODEID}/G1PalPay/${PLAYER}/
|
||||
mkdir -p $HOME/.zen/game/players/${PLAYER}/G1PalPay/
|
||||
mkdir -p $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey history -n 10 -j > $HOME/.zen/game/players/${PLAYER}/G1PalPay/$PLAYER.history.json
|
||||
|
||||
[[ ! -s $HOME/.zen/game/players/${PLAYER}/G1PalPay/$PLAYER.history.json ]] \
|
||||
&& echo "NO PAYMENT HISTORY" \
|
||||
&& exit 1
|
||||
|
||||
## DEBUG ## cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/$PLAYER.history.json | jq -r
|
||||
cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/$PLAYER.history.json | jq -rc .[] | grep '@' > ~/.zen/tmp/${MOATS}/myPalPay.json
|
||||
|
||||
## GET @ in JSON INLINE
|
||||
while read LINE; do
|
||||
|
||||
echo "MATCHING IN COMMENT"
|
||||
JSON=$LINE
|
||||
IDATE=$(echo $JSON | jq -r .date)
|
||||
IPUBKEY=$(echo $JSON | jq -r .pubkey)
|
||||
IAMOUNT=$(echo $JSON | jq -r .amount)
|
||||
IAMOUNTUD=$(echo $JSON | jq -r .amountUD)
|
||||
COMMENT=$(echo $JSON | jq -r .comment)
|
||||
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/.idate) -ge $IDATE ]] && echo "PalPay $IDATE from $IPUBKEY ALREADY TREATED - continue" && continue
|
||||
|
||||
## GET EMAILS FROM COMMENT
|
||||
ICOMMENT=($(echo "$COMMENT" | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
|
||||
## DIVIDE INCOMING AMOUNT TO SHARE
|
||||
echo "N=${#ICOMMENT[@]}"
|
||||
N=${#ICOMMENT[@]}
|
||||
SHARE=$(echo "$IAMOUNT / $N" | bc -l | cut -d '.' -f 1) ## INTEGER ROUNDED VALUE
|
||||
|
||||
echo $IDATE $IPUBKEY $IAMOUNT [$IAMOUNTUD] $ICOMMENT % $SHARE %
|
||||
|
||||
for EMAIL in "${ICOMMENT[@]}"; do
|
||||
|
||||
[[ $EMAIL == $PLAYER ]] && echo "My PalPay" && continue
|
||||
|
||||
echo "EMAIL : ${EMAIL}"
|
||||
ASTROTW="" STAMP="" ASTROG1="" ASTROIPFS="" ASTROFEED=""
|
||||
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${EMAIL}) ## export ASTROTW and more
|
||||
|
||||
if [[ ! ${ASTROTW} ]]; then
|
||||
|
||||
echo "# NEW VISA $(date)"
|
||||
SALT="" && PEPPER=""
|
||||
echo "VISA.new : \"$SALT\" \"$PEPPER\" \"${EMAIL}\" \"$PSEUDO\" \"${URL}\""
|
||||
|
||||
if [[ ! $isLAN || $USER == "zen" ]]; then
|
||||
|
||||
$(${MY_PATH}/../tools/VISA.new.sh "$SALT" "$PEPPER" "${EMAIL}" "$PSEUDO" "${URL}" | tail -n 1)
|
||||
# export ASTROTW=/ipns/$ASTRONAUTENS ASTROG1=$G1PUB ASTROMAIL=$EMAIL ASTROFEED=$FEEDNS
|
||||
|
||||
else
|
||||
|
||||
## CREATE new PLAYER IN myASTROTUBE
|
||||
echo "https://astroport.cancer.copylaradio.com/?salt=0&pepper=0&g1pub=_URL_&email=${EMAIL}"
|
||||
curl -so ~/.zen/tmp/${MOATS}/astro.port "https://astroport.cancer.copylaradio.com/?salt=0&pepper=0&g1pub=_URL_&email=${EMAIL}"
|
||||
|
||||
TELETUBE=$(cat ~/.zen/tmp/${MOATS}/astro.port | grep "(◕‿‿◕)" | cut -d ':' -f 2 | cut -d '/' -f 3)
|
||||
TELEPORT=$(cat ~/.zen/tmp/${MOATS}/astro.port | grep "(◕‿‿◕)" | cut -d ':' -f 3 | cut -d '"' -f 1)
|
||||
sleep 30
|
||||
|
||||
curl -so ~/.zen/tmp/${MOATS}/astro.rep "http://$TELETUBE:$TELEPORT"
|
||||
$(cat ~/.zen/tmp/${MOATS}/astro.rep | tail -n 1) ## SOURCE LAST LINE (SEE SALT PEPPER EMAIL API RETURN)
|
||||
|
||||
fi
|
||||
|
||||
######################################################
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${EMAIL}" "BRO. $PLAYER VOUS A OFFERT CE TW : $(myIpfsGw)/$ASTROTW" ## WELCOME NEW PLAYER
|
||||
|
||||
fi
|
||||
|
||||
## MAKE FRIENDS & SEND G1
|
||||
echo "Hello PalPay Friend $ASTROMAIL
|
||||
TW : $ASTROTW
|
||||
G1 : $ASTROG1
|
||||
ASTROIPFS : $ASTROIPFS
|
||||
RSS : $ASTROFEED"
|
||||
|
||||
[[ ! $ASTROG1 ]] \
|
||||
&& echo "MISSING ASTROG1" \
|
||||
&& continue
|
||||
|
||||
if [[ ${ASTROG1} != ${G1PUB} ]]; then
|
||||
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a ${SHARE} -p ${ASTROG1} -c "PalPay:$N:$IPUBKEY" -m > /dev/null 2>&1
|
||||
STAMP=$?
|
||||
|
||||
else
|
||||
|
||||
STAMP=0
|
||||
|
||||
fi
|
||||
|
||||
## DONE STAMP IT
|
||||
[[ $STAMP == 0 ]] && echo "$IDATE" > ~/.zen/game/players/${PLAYER}/.idate ## MEMORIZE LAST IDATE
|
||||
|
||||
done
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/myPalPay.json
|
||||
|
||||
#################################################################
|
||||
#################################################################
|
||||
### NEXT #####
|
||||
### TIDDLERS with EMAIL in TAGS treatment
|
||||
#################################################################
|
||||
## SEARCH FOR TODAY MODIFIED TIDDLERS WITH MULTIPLE EMAILS IN TAG
|
||||
#################################################################
|
||||
echo "# EXTRACT TODAY TIDDLERS"
|
||||
tiddlywiki --load $INDEX \
|
||||
--output ~/.zen/game/players/${PLAYER}/G1CopierYoutube/${G1PUB}/ \
|
||||
--render '.' "today.${PLAYER}.tiddlers.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-1]]'
|
||||
|
||||
## FILTER MY OWN EMAIL
|
||||
cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/${G1PUB}/today.${PLAYER}.tiddlers.json | sed "s~${PLAYER}~ ~g" | jq -rc '.[] | select(.tags | contains("@"))' > ~/.zen/tmp/${MOATS}/@tags.json 2>/dev/null
|
||||
[[ $? != 0 ]] && echo "NO EXTRA TIDDLERS TODAY" && exit 0
|
||||
|
||||
echo "******************TIDDLERS with EMAIL in TAGS treatment"
|
||||
#~ cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/${G1PUB}/${PLAYER}.tiddlers.json | sed "s~${PLAYER}~ ~g" | jq -rc '.[] | select(.tags | contains("@"))' > ~/.zen/tmp/${MOATS}/@tags.json
|
||||
|
||||
## EXTRACT NOT MY EMAIL
|
||||
while read LINE; do
|
||||
|
||||
echo "---------------------------------- PalPAY for Tiddler"
|
||||
TCREATED=$(echo $LINE | jq -r .created)
|
||||
TTITLE=$(echo $LINE | jq -r .title)
|
||||
TTAGS=$(echo $LINE | jq -r .tags)
|
||||
echo "$TTITLE"
|
||||
|
||||
## Count emails found
|
||||
emails=($(echo "$TTAGS" | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
nb=${#email[@]}
|
||||
|
||||
## Get first zmail
|
||||
ZMAIL="${email}"
|
||||
|
||||
MSG="+ $nb G1 TO ${email[@]}"
|
||||
echo $MSG
|
||||
|
||||
ASTROTW="" STAMP="" ASTROG1="" ASTROIPFS="" ASTROFEED=""
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${ZMAIL}) ## export ASTROTW and more
|
||||
|
||||
if [[ ${ASTROG1} && ${ASTROG1} != ${G1PUB} ]]; then
|
||||
|
||||
## SEND nb JUNE TO ALL
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a $nb -p ${ASTROG1} -c "${email[@]} $TTITLE" -m > /dev/null 2>&1 ## PalPay $nb G1
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" "OK PalPay : $MSG"
|
||||
echo "PAYMENT SENT"
|
||||
|
||||
else
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" "ERREUR PalPay : ${TTITLE} : IMPOSSIBLE DE TROUVER ${email[@]}"
|
||||
echo "NO ACCOUNT FOUND"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/@tags.json
|
||||
|
||||
echo "****************************************"
|
||||
|
||||
rm -Rf $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
|
@ -1,203 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
# Create G1VOEU TW for PLAYER
|
||||
# Mon Titre => G1MonTitre => PEPPER
|
||||
## PARAM : "TITRE DU VOEU" "PLAYER" "INDEX"
|
||||
################################################################################
|
||||
TITRE="$1"
|
||||
PLAYER="$2"
|
||||
INDEX="$3"
|
||||
|
||||
[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ $PLAYER == "" ]] && echo "Second paramètre PLAYER manquant" && exit 1
|
||||
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
|
||||
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null)
|
||||
[[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1
|
||||
|
||||
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
||||
[[ ! -s $INDEX ]] && echo "TW $PLAYER manquant" && exit 1
|
||||
|
||||
echo "Working on $INDEX"
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
||||
[[ $ASTRONAUTENS == "" ]] && echo "CLEF IPNS ASTRONAUTE MANQUANTE - EXIT -" && exit 1
|
||||
|
||||
echo "Bienvenue $PSEUDO ($PLAYER) : $G1PUB"
|
||||
echo
|
||||
|
||||
######################################################################
|
||||
|
||||
|
||||
#####################################################
|
||||
# CREATION DU TW G1VOEU
|
||||
#####################################################
|
||||
SALT=$(${MY_PATH}/../tools/diceware.sh 3 | xargs)
|
||||
echo "$SALT"
|
||||
|
||||
echo "## TITRE DE VOTRE VOEU ? CapitalGluedWords"
|
||||
[[ ! $TITRE ]] && read TITRE
|
||||
PEPPER=$(echo "$TITRE" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
echo "$PEPPER" && [[ ! $PEPPER ]] && echo "EMPTY PEPPER - ERROR" && exit 1
|
||||
|
||||
echo "## keygen CLEF DE VOEUX"
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/qrtw.dunikey "$SALT" "$PEPPER"
|
||||
WISHKEY=$(cat ~/.zen/tmp/qrtw.dunikey | grep "pub:" | cut -d ' ' -f 2)
|
||||
echo "WISHKEY (G1PUB) = $WISHKEY"
|
||||
|
||||
echo "# NOUVEAU VOEU"
|
||||
mkdir -p ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey "$SALT" "$PEPPER"
|
||||
ipfs key import $WISHKEY -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/qrtw.ipfskey
|
||||
VOEUNS=$(ipfs key list -l | grep -w "$WISHKEY" | cut -d ' ' -f 1 )
|
||||
echo "/ipns/$VOEUNS"
|
||||
|
||||
## TEST IPFS
|
||||
ipfs --timeout=30s cat /ipns/$VOEUNS > ~/.zen/tmp/$VOEUNS.json
|
||||
[[ -s ~/.zen/tmp/$VOEUNS.json ]] && echo "HEY !!! UN CHANNEL EXISTE DEJA POUR CE VOEU ! ~/.zen/tmp/$VOEUNS.json - EXIT -" && exit 1
|
||||
|
||||
echo "# UPGRADING WORLD WHISHKEY DATABASE"
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
mkdir -p ~/.zen/game/world/$WISHKEY/
|
||||
## A la fois Titre du tag et Pepper construction de clef
|
||||
echo $PEPPER > ~/.zen/game/world/$WISHKEY/.pepper
|
||||
|
||||
echo "# CREATION QR CODE"
|
||||
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png" "$LIBRA/ipns/$VOEUNS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.ASTROLINK.png" "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1ASTRO.png" "$G1PUB"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png" "$WISHKEY"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/$WISHKEY/QR.IPNS.png" "/ipns/$VOEUNS"
|
||||
|
||||
#################################
|
||||
# PREMIER TYPE ~/.zen/tmp/player.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.WISHLINK.png -resize 300 ~/.zen/tmp/QRWISHLINK.png
|
||||
convert ${MY_PATH}/../images/logoastro.png -resize 220 ~/.zen/tmp/ASTROLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +350+10 ~/.zen/tmp/ASTROLOGO.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
convert -gravity northwest -pointsize 20 -fill black -draw "text 320,250 \"$PLAYER\"" ~/.zen/tmp/one.png ~/.zen/tmp/hop.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"$PEPPER\"" ~/.zen/tmp/hop.png ~/.zen/tmp/pseudo.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"$SALT\"" ~/.zen/tmp/pseudo.png ~/.zen/tmp/salt.png
|
||||
convert -gravity northwest -pointsize 33 -fill black -draw "text 320,350 \"$PEPPER\"" ~/.zen/tmp/salt.png ~/.zen/tmp/player.png
|
||||
|
||||
#################################
|
||||
# SECOND TYPE ~/.zen/tmp/voeu.png
|
||||
convert $HOME/.zen/game/world/$WISHKEY/QR.G1WISH.png -resize 300 ~/.zen/tmp/G1WISH.png
|
||||
convert ${MY_PATH}/../images/logojeu.png -resize 260 ~/.zen/tmp/MIZLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/G1WISH.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +300+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
composite -compose Over -gravity NorthWest -geometry +320+280 ~/.zen/tmp/MIZLOGO.png ~/.zen/tmp/one.png ~/.zen/tmp/two.png
|
||||
|
||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"Ğ1 VOEU\"" ~/.zen/tmp/two.png ~/.zen/tmp/pep.png
|
||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"$PEPPER\"" ~/.zen/tmp/pep.png ~/.zen/tmp/voeu.png
|
||||
|
||||
# IMAGE DANS IPFS
|
||||
IVOEUPLAY=$(ipfs add -Hq ~/.zen/tmp/player.png | tail -n 1)
|
||||
IVOEU=$(ipfs add -Hq ~/.zen/tmp/voeu.png | tail -n 1)
|
||||
|
||||
# TEXT="<a target='_blank' href='"/ipns/${VOEUNS}"'><img src='"/ipfs/${IVOEUPLAY}"'></a><br><br><a target='_blank' href='"/ipns/${VOEUNS}"'>"${PEPPER}"</a>"
|
||||
#:[tag[G1CopierYoutube]] [tag[pdf]]
|
||||
# Contains QRCode linked to G1VoeuTW and BUTTON listing G1Voeux
|
||||
TEXT="<a target='_blank' href='#:[tag[G1"$PEPPER"]]' ><img src='"/ipfs/${IVOEUPLAY}"'></a>
|
||||
<br><a target='_blank' href='"/ipns/${VOEUNS}"'>TW G1Voeu "$PLAYER"</a><br><br>
|
||||
<\$button class='tc-tiddlylink'>
|
||||
<\$list filter='[tag[G1"${PEPPER}"]]'>
|
||||
<\$action-navigate \$to=<<currentTiddler>> \$scroll=no/>
|
||||
</\$list>
|
||||
Afficher tous vos G1"${PEPPER}"
|
||||
</\$button>"
|
||||
|
||||
# NEW IVEU TIDDLER
|
||||
echo "## Creation json tiddler : G1${PEPPER} /ipfs/${IVOEU}"
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"title": "'${PEPPER}'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"astronautens": "'/ipns/${ASTRONAUTENS}'",
|
||||
"wishns": "'/ipns/${VOEUNS}'",
|
||||
"qrcode": "'/ipfs/${IVOEUPLAY}'",
|
||||
"decode": "'/ipfs/${IVOEU}'",
|
||||
"wish": "'${WISHKEY}'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"text": "'${TEXT}'",
|
||||
"tags": "'G1Voeu G1${PEPPER} ${PLAYER}'"
|
||||
}
|
||||
]
|
||||
' > ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json
|
||||
|
||||
|
||||
|
||||
rm -f ~/.zen/tmp/newindex.html
|
||||
|
||||
echo "Nouveau Voeu $PEPPER dans MOA $PSEUDO : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||
tiddlywiki --verbose --load $INDEX \
|
||||
--deletetiddlers '[tag[voeu]]' \
|
||||
--import ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
echo "PLAYER TW Update..."
|
||||
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
||||
echo "$$$ Mise à jour $INDEX"
|
||||
cp -f ~/.zen/tmp/newindex.html $INDEX
|
||||
else
|
||||
echo "ERROR INTO ~/.zen/game/world/$WISHKEY/${PEPPER}.voeu.json"
|
||||
fi
|
||||
|
||||
# PRINTING
|
||||
LP=$(ls /dev/usb/lp* | head -n1)
|
||||
if [[ ! $LP ]]; then
|
||||
echo "NO PRINTER FOUND - Plug a Brother QL700 or Add your printer"
|
||||
else
|
||||
echo "IMPRESSION VOEU"
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/player.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/voeu.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
fi
|
||||
|
||||
# COPY QR CODE TO PLAYER ZONE
|
||||
cp ~/.zen/tmp/player.png ~/.zen/tmp/voeu.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
echo "$PEPPER" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.title
|
||||
echo "$LIBRA/ipns/$VOEUNS" > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.link
|
||||
cp ~/.zen/game/world/$WISHKEY/QR.WISHLINK.png ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/
|
||||
|
||||
# PUBLISHING
|
||||
banner="## ${PLAYER} YOUR WISH IS READY TO MAKE Ŋ1 TW FLUX for G1$PEPPER"
|
||||
echo "ipfs name publish --key=${WISHKEY} $banner"
|
||||
IPUSH=$(echo "$banner" | ipfs add -q)
|
||||
ipfs name publish --key=${WISHKEY} /ipfs/$IPUSH 2>/dev/null
|
||||
|
||||
echo $IPUSH > ~/.zen/game/players/$PLAYER/voeux/$WISHKEY/.$MOATS.chain
|
||||
|
||||
echo
|
||||
echo "Astronaute TW : $LIBRA/ipns/$ASTRONAUTENS"
|
||||
echo "Nouveau G1Voeu : $PEPPER (document de contrôle de copie Ŋ1)"
|
||||
echo "TW $PEPPER : $LIBRA/ipns/$VOEUNS"
|
||||
|
||||
echo "## TO RECEIVE G1RONDS Creating Cesium+ Profil #### timeout long ... patience ...."
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/tmp/qrtw.dunikey set --name "G1Voeu $PEPPER" --avatar "/home/$USER/.zen/Astroport.ONE/images/logojune.jpg" --site "$LIBRA/ipns/$VOEUNS" #CESIUM+
|
||||
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED !!!!"
|
||||
|
||||
echo "************************************************************"
|
||||
echo "Hop, UNE JUNE pour le Voeu $PEPPER"
|
||||
echo $MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey pay -a 1 -p $WISHKEY -c \'"$VOEUNS G1Voeu $PEPPER"\' -m
|
||||
echo "************************************************************"
|
||||
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey pay -a 1 -p $WISHKEY -c "$VOEUXNS G1Voeu $PEPPER" -m
|
||||
echo "************************************************************"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,157 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.5
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
# PAD COCODING : https://pad.p2p.legal/s/G1Kodi
|
||||
# KODI SERVICE : Publish and Merge Friends Kodi Movies into RSS Stream
|
||||
########################################################################
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
echo "$ME RUNNING"
|
||||
########################################################################
|
||||
## LOOK IN TW INDEX for THASH
|
||||
## DECODE ipfs_one
|
||||
## SEND MESSAGE TO SOURCEG1PUB
|
||||
########################################################################
|
||||
## THIS SCRIPT IS RUN WHEN A WALLET RECEIVED A TRANSACTION WITH COMMENT STARTING WITH N1Kodi:
|
||||
########################################################################
|
||||
INDEX="$1"
|
||||
[[ ! ${INDEX} ]] && INDEX="$HOME/.zen/game/players/.current/ipfs/moa/index.html"
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
|
||||
PLAYER="$2"
|
||||
[[ ! ${PLAYER} ]] && PLAYER="$(cat ~/.zen/game/players/.current/.player 2>/dev/null)"
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide PLAYER" && exit 1
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! ${ASTRONAUTENS} ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
[[ ! $G1PUB ]] && echo "ERROR - G1PUB ${PLAYER} VIDE" && exit 1
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS="$3"
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
IPUBKEY="$4"
|
||||
[[ ! ${IPUBKEY} ]] && echo "ERROR - MISSING COMMAND ISSUER !" && exit 1
|
||||
|
||||
TH="$5"
|
||||
[[ ! ${TH} ]] && echo "ERROR - MISSING COMMAND TITLE HASH ADDRESS !" && exit 1
|
||||
|
||||
echo "${PLAYER} : ${IPUBKEY} SEEKING FOR ${TH}
|
||||
${ASTRONAUTENS} ${G1PUB} "
|
||||
|
||||
#~ ###################################################################
|
||||
#~ ## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
#~ ###################################################################
|
||||
mkdir -p $HOME/.zen/tmp/${MOATS} && echo $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
## EXTRACT TIDDLER
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'TH.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[thash['${TH}']]'
|
||||
|
||||
if [[ $(cat ~/.zen/tmp/${MOATS}/TH.json) != "[]" ]]; then
|
||||
# FOUND GETTING CYPHERED IPFS LINK
|
||||
TITLE=$(cat ~/.zen/tmp/${MOATS}/TH.json | jq -r '.[].title')
|
||||
|
||||
IPFSONE=$(cat ~/.zen/tmp/${MOATS}/TH.json | jq -r '.[].ipfs_one')
|
||||
echo "${IPFSONE}" | base16 -d > ~/.zen/tmp/${MOATS}/source.one.enc
|
||||
|
||||
## DECRYPTING ipfs_one
|
||||
~/.zen/Astroport.ONE/tools/natools.py decrypt -f pubsec \
|
||||
-k ~/.zen/game/players/${PLAYER}/secret.dunikey \
|
||||
-i ~/.zen/tmp/${MOATS}/source.one.enc -o $HOME/.zen/tmp/${MOATS}/source.one
|
||||
|
||||
DECIPFS=$(cat $HOME/.zen/tmp/${MOATS}/source.one)
|
||||
echo "${TITLE} = ${DECIPFS}"
|
||||
|
||||
## TODO CREATE A TEMP IPNS KEY ?!
|
||||
|
||||
## SENDING GCHANGE & CESIUM+ MESSAGE
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myDATA} send -d "${IPUBKEY}" -t "${TITLE}" -m "N1Kodi : https://${myTUBE}${DECIPFS}"
|
||||
|
||||
$MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myCESIUM} send -d "${IPUBKEY}" -t "${TITLE}" -m "N1Kodi : https://${myTUBE}${DECIPFS}"
|
||||
|
||||
else
|
||||
|
||||
echo "NO TIDDLER WITH ${TH}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
## TODO CREATE FROM FRIEND LOCAL KODI RSS
|
||||
#~ echo '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
#~ <rss version="2.0">
|
||||
#~ <channel>
|
||||
#~ <title>RSS ASTROPORT</title>
|
||||
#~ <description>Astroport Kodi RSS feed</description>
|
||||
#~ <link>https://www.copylaradio.com</link>
|
||||
#~ <copyright>2020 Astroport.com FOSS</copyright>
|
||||
#~ <lastBuildDate>Mon, 6 Sep 2020 00:01:00 +0000</lastBuildDate>
|
||||
#~ <pubDate>Sun, 6 Sep 2020 16:20:00 +0000</pubDate>
|
||||
#~ <ttl>1800</ttl>
|
||||
#~ ' > ~/.zen/tmp/${MOATS}/movie.rss
|
||||
|
||||
#~ find ~/.zen/game/players/${PLAYER}/FRIENDS -mindepth 1 -maxdepth 1 -type d | rev | cut -f 1 -d '/' | rev > ~/.zen/tmp/${MOATS}/twfriends
|
||||
|
||||
#~ ## SCAN ALL "_APLAYER.tiddlers.json"
|
||||
#~ for FILE in $(ls ${N1PATH}/*.tiddlers.json); do
|
||||
#~ APLAYER=$(echo "$FILE" | rev | cut -d '.' -f 3- | cut -d '_' -f 1 | rev )
|
||||
#~ [[ ${APLAYER} == ${PLAYER} ]] && echo "My Movie List" && continue
|
||||
|
||||
#~ ## EXTRACT all titles to do JQ LOOP
|
||||
#~ cat ${FILE} | jq -r .[].title > ~/.zen/tmp/${MOATS}/${APLAYER}.movie.id
|
||||
|
||||
#~ while read TITLE; do
|
||||
|
||||
#~ ## GET AG1PUB FROM FRIEND TW
|
||||
#~ ## BUG !!!
|
||||
#~ TITRE=$(cat ${FILE} | jq -r .[].titre)
|
||||
#~ SUB=$(cat ${FILE} | jq -r .[].sub)
|
||||
#~ IPFSONE=$(cat ${FILE} | jq -r .[].ipfs_one)
|
||||
#~ echo "${IPFSONE}" | base16 -d > ~/.zen/tmp/${MOATS}/source.one.enc
|
||||
|
||||
#~ ~/.zen/Astroport.ONE/tools/natools.py decrypt -f pubsec \
|
||||
#~ -k ~/.zen/game/players/${PLAYER}/secret.dunikey \
|
||||
#~ -i ~/.zen/tmp/${MOATS}/source.one.enc -o $HOME/.zen/tmp/${MOATS}/source.one
|
||||
|
||||
#~ SOURCE=$(cat ${FILE} | jq -r .[].source)
|
||||
#~ IPFS_ME=$(cat ${FILE} | jq -r .[].ipfs_${player})
|
||||
|
||||
#~ echo '
|
||||
#~ <item>
|
||||
#~ <title>'${TITRE}'</title>
|
||||
#~ <description>'${SUB}'</description>
|
||||
#~ <link>http://ipfs.localhost:8080/ipfs/QmQwYpoHX6Fw26nd3KFfLj71Uv34riT4F5X2RFy2rmHekW</link>
|
||||
#~ <pubDate>Sun, 6 Sep 2022 16:20:00 +0000</pubDate>
|
||||
#~ </item>' >> ~/.zen/tmp/${MOATS}/movie.rss
|
||||
|
||||
#~ done < ~/.zen/tmp/${MOATS}/${APLAYER}.movie.id
|
||||
|
||||
|
||||
#~ done
|
||||
|
||||
#~ ## EXTRACT and DECODE ipfs_AG1PUB from FRIENDS json's
|
||||
|
||||
|
||||
#~ echo '
|
||||
#~ </channel>
|
||||
#~ </rss>
|
||||
#~ ' >> ~/.zen/tmp/${MOATS}/movie.rss
|
||||
|
||||
#~ ## UPDATE LOCAL KODI WITH
|
||||
#~ ## ./userdata/mediasources.xml
|
||||
#~ ## ./userdata/sources.xml
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## Publish All PLAYER TW,
|
||||
# Run TAG subprocess: tube, voeu
|
||||
############################################
|
||||
echo "## RUNNING PLAYER.refresh"
|
||||
|
||||
PLAYERONE="$1"
|
||||
[[ $isLAN ]] && PLAYERONE=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ ! $PLAYERONE ]] && PLAYERONE=($(ls -t ~/.zen/game/players/ | grep -Ev "localhost" 2>/dev/null))
|
||||
|
||||
## RUNING FOR ALL LOCAL PLAYERS
|
||||
for PLAYER in ${PLAYERONE[@]}; do
|
||||
[[ ! -d ~/.zen/game/players/$PLAYER ]] && echo "BAD $PLAYERONE" && continue
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
[[ ! $(echo "$PLAYER" | grep '@') ]] && continue
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
echo "##################################################################"
|
||||
echo ">>>>> PLAYER : $PLAYER >>>>>>>>>>>>> REFRESHING TW STATION"
|
||||
echo "##################################################################"
|
||||
# Get PLAYER wallet amount
|
||||
COINS=$($MY_PATH/../tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey balance)
|
||||
echo "+++ WALLET BALANCE _ $COINS (G1) _"
|
||||
#~ ## IF WALLET IS EMPTY : WHAT TODO ?
|
||||
echo "##################################################################"
|
||||
echo "##################################################################"
|
||||
echo "################### REFRESH ASTRONAUTE TW ###########################"
|
||||
echo "##################################################################"
|
||||
|
||||
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null)
|
||||
G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null)
|
||||
ASTRONS=$(cat ~/.zen/game/players/$PLAYER/.playerns 2>/dev/null)
|
||||
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && echo "WARNING No $PLAYER in keystore --" && ASTRONAUTENS=$ASTRONS
|
||||
|
||||
## VISA EMITER STATION MUST ACT ONLY
|
||||
[[ ! -f ~/.zen/game/players/$PLAYER/secret.dunikey ]] && echo "$PLAYER secret.dunikey NOT HERE CONTINUE -- " \
|
||||
&& mv ~/.zen/game/players/$PLAYER ~/.zen/game/players/.$PLAYER && continue
|
||||
|
||||
## MY PLAYER
|
||||
ipfs key export $G1PUB -o ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
[[ ! $(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) ]] && ipfs key import $PLAYER ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
rm -f ~/.zen/tmp/${MOATS}/$PLAYER.key
|
||||
|
||||
## REFRESH CACHE
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
|
||||
|
||||
echo "Getting latest online TW..."
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||
echo "/ipns/$ASTRONAUTENS ON $LIBRA"
|
||||
|
||||
ipfs --timeout 60s get -o ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html /ipns/$ASTRONAUTENS \
|
||||
|| curl -m 60 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" \
|
||||
|| cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
|
||||
|
||||
## PLAYER TW IS ONLINE ?
|
||||
if [ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ]; then
|
||||
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
echo "ERROR_PLAYERTW_OFFLINE : /ipns/$ASTRONAUTENS"
|
||||
echo "------------------------------------------------"
|
||||
echo "MANUAL PROCEDURE NEEDED"
|
||||
echo "------------------------------------------------"
|
||||
echo "$myIPFS/ipfs/"
|
||||
echo "/ipfs/"$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.* | tail -n 1)
|
||||
echo "ipfs name publish -t 24h --key=$PLAYER ..."
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
continue
|
||||
|
||||
else
|
||||
## FOUND TW
|
||||
#############################################################
|
||||
## CHECK WHO IS ACTUAL OFFICIAL GATEWAY
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json ]] && echo "${PLAYER} MadeInZion : BAD TW (☓‿‿☓) " && continue
|
||||
|
||||
player=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
||||
|
||||
[[ $player == $PLAYER ]] \
|
||||
&& echo "$PLAYER OFFICIAL TW - (⌐■_■) -" \
|
||||
|| ( echo "BAD PLAYER=$player in TW" && continue)
|
||||
fi
|
||||
#############################################################
|
||||
## GWIP == myIP or TUBE !!
|
||||
#############################################################
|
||||
|
||||
# Connect_PLAYER_To_Gchange.sh : Sync FRIENDS TW
|
||||
##############################################################
|
||||
echo "##################################################################"
|
||||
echo "## GCHANGE+ & Ŋ1 EXPLORATION: Connect_PLAYER_To_Gchange.sh"
|
||||
${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "$PLAYER"
|
||||
|
||||
# VOEUX.create.sh
|
||||
##############################################################
|
||||
## SPECIAL TAG "voeu" => Creation G1Voeu (G1Titre) makes AstroBot TW G1Processing
|
||||
##############################################################
|
||||
${MY_PATH}/VOEUX.create.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$PLAYER"
|
||||
# VOEUX.refresh.sh
|
||||
##############################################################
|
||||
## RUN ASTROBOT G1Voeux SUBPROCESS (SPECIFIC Ŋ1 COPY)
|
||||
##############################################################
|
||||
${MY_PATH}/VOEUX.refresh.sh "$PLAYER" "$MOATS" ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
|
||||
##############################################################
|
||||
|
||||
## CHECK G1PALPAY TO MAKE
|
||||
${MY_PATH}/G1PalPay.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$PLAYER"
|
||||
|
||||
##################################
|
||||
echo "# TW : GW API + LightBeam Feed + Friends"
|
||||
TUBE=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 3)
|
||||
|
||||
FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1)
|
||||
[[ ! $FEEDNS ]] && FEEDNS=$(ipfs key gen "${PLAYER}_feed")
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-name","text":"'${PLAYER}_feed'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-name.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key","text":"'${FEEDNS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-key.json
|
||||
|
||||
###########################
|
||||
# Modification Tiddlers de contrôle de GW & API
|
||||
#~ echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"'$(myPlayerApiGw)'"}]' > ~/.zen/tmp/${MOATS}/5001.json
|
||||
#~ echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"'$myIPFS'"}]' > ~/.zen/tmp/${MOATS}/8080.json
|
||||
|
||||
FRIENDSFEEDS=$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/FRIENDSFEEDS 2>/dev/null)
|
||||
echo "FRIENDS qo-op FEEDS : "${FRIENDSFEEDS}
|
||||
|
||||
## export FRIENDSFEEDS from Gchange stars
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/state/subscriptions","text":"'${FRIENDSFEEDS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/friends.json
|
||||
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import "$HOME/.zen/tmp/${MOATS}/friends.json" "application/json" \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
[[ -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/newindex.html
|
||||
###########################
|
||||
|
||||
####################
|
||||
|
||||
## ANY CHANGES ?
|
||||
##############################################################
|
||||
DIFF=$(diff ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html)
|
||||
if [[ $DIFF ]]; then
|
||||
echo "DIFFERENCE DETECTED !! "
|
||||
echo "Backup & Upgrade TW local copy..."
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||
fi
|
||||
##############################################################
|
||||
|
||||
##################################################
|
||||
##################################################
|
||||
################## UPDATING PLAYER MOA
|
||||
[[ $DIFF ]] && cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
||||
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
||||
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs name publish --allow-offline -t 24h --key=$PLAYER /ipfs/$TW
|
||||
|
||||
[[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||
|
||||
echo "================================================"
|
||||
echo "$PLAYER : $myIPFS/ipns/$ASTRONAUTENS"
|
||||
echo " = /ipfs/$TW"
|
||||
echo "================================================"
|
||||
|
||||
######################### PLAYER_feed
|
||||
IFRIENDHEAD="$(cat ~/.zen/tmp/${IPFSNODEID}/rss/${PLAYER}/IFRIENDHEAD 2>/dev/null)"
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
|
||||
echo "IFRIENDHEAD :" ${IFRIENDHEAD}
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
|
||||
|
||||
# cp -f ~/.zen/game/players/${PLAYER}/ipfs/${FPLAYER}.rss.json ~/.zen/game/players/$PLAYER/FRIENDS/${FPLAYER}.rss.json
|
||||
|
||||
[[ -d ~/.zen/game/players/$PLAYER/FRIENDS ]] \
|
||||
&& cat ${MY_PATH}/../www/iframe.html | sed "s~_ME_~/ipns/${ASTRONAUTENS}~g" | sed "s~_IFRIENDHEAD_~${IFRIENDHEAD}~g" > ~/.zen/game/players/$PLAYER/FRIENDS/index.html
|
||||
|
||||
[[ -s ~/.zen/game/players/$PLAYER/FRIENDS/index.html ]] \
|
||||
&& FRAME=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/FRIENDS/index.html | tail -n 1) \
|
||||
&& ipfs name publish --allow-offline -t 24h --key="${PLAYER}_feed" /ipfs/$FRAME
|
||||
|
||||
done
|
||||
|
||||
#################################################################
|
||||
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
||||
############################
|
||||
# Scan local cache
|
||||
if [[ -d ~/.zen/tmp/${IPFSNODEID} ]]; then
|
||||
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
|
||||
|
||||
## Merge actual online version
|
||||
ipfs get -o ~/.zen/tmp/${IPFSNODEID} /ipns/${IPFSNODEID}/
|
||||
## MAP CACHE CLEANING
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/*TW.json
|
||||
############################################
|
||||
NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
|
||||
|
||||
[[ $BSIZE != $NSIZE ]] \
|
||||
&& ROUTING=$(ipfs add -rwHq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) \
|
||||
&& echo "PUBLISH BALISE STATION /ipns/${IPFSNODEID} = $NSIZE octets" \
|
||||
&& ipfs name publish --allow-offline -t 24h /ipfs/$ROUTING
|
||||
fi
|
||||
|
||||
echo "PLAYER.refresh DONE."
|
||||
|
||||
exit 0
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.4
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
## AUTONOMOUS BOT
|
||||
# SEARCH FOR "voeu" TAG to create "g1voeu" TW
|
||||
# PLAYER G1VOEU NAME is considered as "tag" searh in Ŋ1
|
||||
# PARAM = tag / PLAYER
|
||||
# Search for "g1tag"
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
|
||||
################################################################################
|
||||
# Inspect game wishes, refresh latest IPNS version
|
||||
# SubProcess Backup and chain
|
||||
PLAYER="$1" ## IPNS KEY NAME - G1PUB - PLAYER ...
|
||||
[[ ! ${PLAYER} ]] && echo "Please provide IPFS publish key" && exit 1
|
||||
|
||||
MOATS="$2"
|
||||
|
||||
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
||||
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
|
||||
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore --" && ASTRONAUTENS=$ASTRONS
|
||||
[[ ! $ASTRONAUTENS ]] && echo "Missing ${PLAYER} IPNS KEY - CONTINUE --" && exit 1
|
||||
|
||||
INDEX="$3"
|
||||
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/${PLAYER}/ipfs/moa/index.html"
|
||||
[[ ! -s $INDEX ]] && echo "TW ${PLAYER} manquant" && exit 1
|
||||
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu
|
||||
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
###############################
|
||||
## EXTRACT G1Voeu from PLAYER TW
|
||||
echo "Exporting ${PLAYER} TW [tag[G1Voeu]]"
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]'
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json ]] && echo "AUCUN G1VOEU - EXIT -" && exit 0
|
||||
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq -r '.[].wish' > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
||||
echo "VOEUX : ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt "$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt | wc -l)
|
||||
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
## GET VoeuTitle LIST
|
||||
while read WISH
|
||||
do
|
||||
[[ ${WISH} == "" || ${WISH} == "null" ]] && continue
|
||||
echo "==============================="
|
||||
echo "G1Voeu ${WISH}"
|
||||
## Get ${WISHNAME} TW
|
||||
WISHNAME=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title')
|
||||
[[ ! ${WISHNAME} ]] && echo "WISH sans NOM - CONTINUE -" && continue
|
||||
|
||||
VOEUNS=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wishns')
|
||||
VOEUKEY=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wish')
|
||||
|
||||
## SIGNALING WISH G1PUB
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${WISH}
|
||||
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
## RUN SPECIFIC G1Voeu ASTROBOT PROGRAM (like G1CopierYoutube.sh)
|
||||
if [[ -s $MY_PATH/G1${WISHNAME}.sh ]]; then
|
||||
echo "........................ Astrobot G1${WISHNAME}.sh program found !"
|
||||
echo "________________________________ Running it *****"
|
||||
${MY_PATH}/G1${WISHNAME}.sh "$INDEX" "${PLAYER}" "$MOATS"
|
||||
echo "________________________________ Finished ******"
|
||||
else
|
||||
echo "......................... G1${WISHNAME} REGULAR Ŋ1 RSS JSON"
|
||||
fi
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
## RUN TW Ŋ1 search & copy treatment
|
||||
echo "*********************************"
|
||||
##################################
|
||||
## Search for [tag[G1${WISHNAME}]] in all Friends TW.
|
||||
## Copy tiddlers ...
|
||||
##################################
|
||||
echo "NOW SEARCH Ŋ1 FRIENDS TW's FOR tag=G1${WISHNAME}"
|
||||
echo "ls ~/.zen/game/players/${PLAYER}/FRIENDS/*/index.html"
|
||||
echo "*********************************"
|
||||
## Search in Local World (NB! G1Voeu TW copied by Connect_PLAYER_To_Gchange.sh)
|
||||
FINDEX=($( ls $HOME/.zen/game/players/${PLAYER}/FRIENDS/*/index.html))
|
||||
|
||||
for FRIENDTW in ${FINDEX[@]};
|
||||
do
|
||||
[[ ! -s $FRIENDTW ]] && echo "$FRIENDTW VIDE (AMI SANS TW)" && continue
|
||||
APLAYER=$(ls $FRIENDTW | cut -d '/' -f 7)
|
||||
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${APLAYER}.tiddlers.json
|
||||
echo "TRY EXPORT [tag[G1${WISHNAME}]] FROM $FRIENDTW"
|
||||
tiddlywiki --load $FRIENDTW \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME} --render '.' ${APLAYER}'.tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]]'
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${APLAYER}.tiddlers.json ]] && echo "NO ${WISHNAME} - CONTINUE -" && continue
|
||||
[[ $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${APLAYER}.tiddlers.json) == "[]" ]] && echo "EMPTY ${WISHNAME} - CONTINUE -" && continue
|
||||
|
||||
echo "## TIDDLERS FOUND ;) MIAM >>> (◕‿‿◕) <<<"
|
||||
echo ">>> RSS YEAH § ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${APLAYER}.tiddlers.json"
|
||||
|
||||
done
|
||||
##################################
|
||||
|
||||
echo ">>> MOA § ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json"
|
||||
tiddlywiki --load $INDEX \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME} \
|
||||
--render '.' ${PLAYER}'.tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]]'
|
||||
|
||||
### PREPARE WISHNAME index.html
|
||||
cat $MY_PATH/../templates/index_gif4.html \
|
||||
| sed -e "s~_LIBRA_~$(myIpfsGw)~g" -e "s~_G1VOEU_~${WISHNAME}~g" -e "s~_PLAYER_~${PLAYER}~g" -e "s~_VOEUNS_~${VOEUNS}~g" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/index.html
|
||||
|
||||
### ADD TO IPFS
|
||||
echo "++WISH PUBLISHING++ ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/*"
|
||||
JSONIPFS=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/* | tail -n 1) # ADDING JSONS TO IPFS
|
||||
ipfs name publish -k $VOEUKEY /ipfs/$JSONIPFS # PUBLISH $VOEUKEY
|
||||
|
||||
## MOVE INTO PLAYER AREA
|
||||
echo "Ŋ1 FLUX $(myIpfsGw)${VOEUNS}"
|
||||
echo "~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}"
|
||||
|
||||
mv -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/* ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/
|
||||
|
||||
done < ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
||||
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
############################################
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,320 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
## IT SEARCH FOR CURRENT TW ForkUPlanetZERO tag
|
||||
## IT MAKES $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key
|
||||
## IT CHECKS FOR SAME UPNAME WISH IN FRIENDS TW
|
||||
#~ echo "(✜‿‿✜) CURRENT Fork UPlanet
|
||||
#~ This program makes Player generate or join a private IPFS swarm
|
||||
#~ All friends with the same wish will share the SECRET
|
||||
#~ then any can activate a new ipfs daemon connected to that private ZONE
|
||||
## TIDDLER can contain parameters for UPlanet activation
|
||||
|
||||
echo "$ME RUNNING"
|
||||
|
||||
CURRENT=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
|
||||
########################################################################
|
||||
[[ ! ${INDEX} ]] && INDEX="$HOME/.zen/game/players/.current/ipfs/moa/index.html"
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
ORIGININDEX=${INDEX}
|
||||
|
||||
[[ ! ${PLAYER} ]] && PLAYER="$(cat ~/.zen/game/players/.current/.player 2>/dev/null)"
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide PLAYER" && exit 1
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! ${ASTRONAUTENS} ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
[[ ! $G1PUB ]] && echo "ERROR - G1PUB ${PLAYER} VIDE" && exit 1
|
||||
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
echo "${PLAYER} ${INDEX} ${ASTRONAUTENS} ${G1PUB} "
|
||||
mkdir -p $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
PLAYERPUB=$(cat $HOME/.zen/game/players/${PLAYER}/secret.dunikey | grep pub | cut -d ' ' -f 2)
|
||||
[[ "${PLAYERPUB}" == "" ]] && echo "FATAL ERROR PLAYER KEY MISSING" && exit 1
|
||||
|
||||
###################################################################
|
||||
## tag[ForkUPlanetZERO] TW EXTRACTION
|
||||
###################################################################
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'G1ForkUPlanetZERO.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[ForkUPlanetZERO]]'
|
||||
|
||||
## KEEP ONLY ONE tag[ForkUPlanetZERO] WISH !
|
||||
echo "PREPARE INLINE JSON : cat ~/.zen/tmp/${MOATS}/G1ForkUPlanetZERO.json | jq -rc .[]"
|
||||
cat ~/.zen/tmp/${MOATS}/G1ForkUPlanetZERO.json \
|
||||
| jq -rc .[] | head -n 1 > ~/.zen/tmp/${MOATS}/ONEuplanet.json
|
||||
|
||||
JSONUPLANET="${HOME}/.zen/tmp/${MOATS}/ONEuplanet.json"
|
||||
|
||||
[[ ! -s ${JSONUPLANET} ]] \
|
||||
&& echo "NO tag[ForkUPlanetZERO] for $PLAYER" && exit 0
|
||||
|
||||
UPNAME=$(cat ${JSONUPLANET} | jq -r ".title") # What name is given ?
|
||||
[[ "${UPNAME}" == "null" || "${UPNAME}" == "" ]] \
|
||||
&& echo "NO FORK UPLANET NAME .title MISSING" && exit 1
|
||||
|
||||
HASH=$(cat ${JSONUPLANET} | jq -r ".hash") ## What text hash it has ?
|
||||
SECRET=$(cat ${JSONUPLANET} | jq -r ".secret") ## What is secret ?
|
||||
|
||||
CONTRACT=$(cat ${JSONUPLANET} | jq -r ".text") ## What contract is applying ?
|
||||
[[ "${CONTRACT}" == "null" || "${CONTRACT}" == "" ]] && CONTRACT="☼☼☼☼☼ floating points ☼☼☼☼☼"
|
||||
|
||||
AHAH=$(echo $CONTRACT | sha512sum | cut -d ' ' -f 1)
|
||||
echo "%%% CONTRACT HASH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
echo "$AHAH"
|
||||
echo "$HASH"
|
||||
[[ $AHAH != $HASH ]] && echo " - WARNING - CONTRACT CHANGED - WARNING -"
|
||||
|
||||
## CHECK EXISTING ${UPNAME}.swarm.key
|
||||
[[ ! -s $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key ]] \
|
||||
&& MSG=$MSG" ${PLAYER}/.ipfs/${UPNAME}.swarm.key NOT FOUND" && ERR="NO LOCAL KEY"
|
||||
|
||||
## CREATE 32 octets swarm.key ( maximum individual Fork : octal 8^32 = decimal 7,922816251×10^28 )
|
||||
echo -e '/key/swarm/psk/1.0.0/\n/base16/' > $HOME/.zen/tmp/${MOATS}/swarm.key
|
||||
head -c 32 /dev/urandom | od -t x1 -A none - | tr -d '\n ' >> $HOME/.zen/tmp/${MOATS}/swarm.key
|
||||
echo '' >> $HOME/.zen/tmp/${MOATS}/swarm.key
|
||||
|
||||
## EXTRACT CURRENT SECRET FROM JSONUPLANET
|
||||
# which is PLAYER pub encrypted base16 of swarm.key
|
||||
###################################################
|
||||
## check if we have a player slot with cyphered key
|
||||
IN16=$(cat ${JSONUPLANET} | jq -r '."${PLAYER}"')
|
||||
## secret is only decrypted by wish source player
|
||||
[[ ${IN16} == "" || ${IN16} == "null" ]] \
|
||||
&& IN16=$(cat ${JSONUPLANET} | jq -r ".secret") && echo "get IN16 from secret field"
|
||||
|
||||
if [[ ${IN16} == "" || ${IN16} == "null" ]]; then
|
||||
|
||||
echo "NO SECRET FOUND" \
|
||||
&& echo ">> 🔑 ${UPNAME} SECRET SWARM.KEY GENERATION 🔑" \
|
||||
&& cat $HOME/.zen/tmp/${MOATS}/swarm.key \
|
||||
&& cp $HOME/.zen/tmp/${MOATS}/swarm.key $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key \
|
||||
&& echo "------- KEY LOADED -----> ${PLAYER}/.ipfs/${UPNAME}.swarm.key"
|
||||
|
||||
## THIS IS A PRIMAL TIDDLER
|
||||
|
||||
else
|
||||
echo "VERIFICATION ${IN16}"
|
||||
## DEBASE16
|
||||
echo "${IN16}" | base16 -d \
|
||||
> ~/.zen/tmp/${MOATS}/swarmkey.crypted
|
||||
|
||||
echo ">> natools.py decrypt "
|
||||
## DECODING with PLAYER secret.dunikey
|
||||
${MY_PATH}/../tools/natools.py decrypt \
|
||||
-f pubsec \
|
||||
-k $HOME/.zen/game/players/${PLAYER}/secret.dunikey \
|
||||
-i ~/.zen/tmp/${MOATS}/swarmkey.crypted \
|
||||
-o ~/.zen/tmp/${MOATS}/swarmkey.decrypted
|
||||
|
||||
echo ">> comparing decrypted key"
|
||||
## CHEK KEY WITH ACTUAL ONE
|
||||
[[ $(diff ~/.zen/tmp/${MOATS}/swarmkey.decrypted $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key) ]] \
|
||||
&& echo "- 📸 WARNING 📸 - UPDATING ${UPNAME}.swarm.key ..." && ERR="TW SWARM CHANGED"
|
||||
|
||||
## UPDATE PLAYER LOCAL SWARMKEY FROM VALUE FOUND IN HIS OWN WISH TIDDLER !
|
||||
[[ -s ~/.zen/tmp/${MOATS}/swarmkey.decrypted ]] \
|
||||
&& cp ~/.zen/tmp/${MOATS}/swarmkey.decrypted \
|
||||
$HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key \
|
||||
&& echo "PLAYER ${UPNAME}.swarm.key IS VALID" \
|
||||
|| { echo "ERROR PLAYER ${UPNAME}.swarm.key IS NOT VALID"; exit 1; }
|
||||
|
||||
fi
|
||||
|
||||
#~ (RE)CREATE SECRET
|
||||
${MY_PATH}/../tools/natools.py encrypt \
|
||||
-p ${PLAYERPUB} \
|
||||
-i $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key \
|
||||
-o $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key.enc
|
||||
ENCODING=$(cat $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key.enc | base16)
|
||||
rm $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key.enc
|
||||
echo "==> base16 ${PLAYER} encrypted swarm.key is secret"
|
||||
#~ echo "${SECRET}"
|
||||
#~ echo "${ENCODING}"
|
||||
|
||||
#################################################################
|
||||
## MAKE KEY ENCODING FOR FRIENDS
|
||||
friends=($(ls ~/.zen/game/players/${PLAYER}/FRIENDS | grep "@" 2>/dev/null))
|
||||
for f in ${friends[@]};
|
||||
do
|
||||
## Extract FRIENDG1PUB from TW (Astroport Tiddler)
|
||||
ftw=${HOME}/.zen/game/players/${PLAYER}/FRIENDS/${f}/index.html
|
||||
[[ ! -s ${ftw} ]] && echo "FRIENDS/${f} : $(cat "$HOME/.zen/game/players/${PLAYER}/FRIENDS/${f}")" && continue
|
||||
|
||||
## Check if "f=PRESIDENT" in my friend "email" TW
|
||||
tiddlywiki --load ${ftw} --output ~/.zen/tmp/${MOATS} --render '.' "${f}_.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${f}"
|
||||
PRESIDENT=$(cat ~/.zen/tmp/${MOATS}/${f}_.json | jq -r .[].president)
|
||||
[[ ${PRESIDENT} != ${f} ]] && echo "${f} Astroport is run by ${PRESIDENT}... No fork..." && continue
|
||||
|
||||
## Check if Astroport is different from my node
|
||||
tiddlywiki --load ${ftw} --output ~/.zen/tmp/${MOATS} --render '.' "${f}_Astroport.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
FRIENDG1PUB=$(cat ~/.zen/tmp/${MOATS}/${f}_Astroport.json | jq -r .[].g1pub)
|
||||
echo "___________________"
|
||||
echo "$f : $FRIENDG1PUB"
|
||||
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/${f}_Astroport.json | jq -r .[].astroport)
|
||||
[[ ${ASTROPORT} != "/ipns/${IPFSNODEID}" ]] \
|
||||
&& echo "FOREIGN ASTROPORT=${ASTROPORT}" \
|
||||
&& foreign="YES" \
|
||||
&& ASTROPORTS=("${ASTROPORTS[@]}" "${ASTROPORT}")
|
||||
|
||||
if [[ ${FRIENDG1PUB} && ${FRIENDG1PUB} != "null" ]]; then
|
||||
|
||||
#~ CHECK IF player ALREADY IN JSON
|
||||
echo "cat ${JSONUPLANET} | jq -r '.\"${f}\"'"
|
||||
FRIENDIN=$(cat ${JSONUPLANET} | jq -r '."${f}"')
|
||||
[[ "${FRIENDIN}" != "null" && "${FRIENDIN}" != "" ]] \
|
||||
&& echo "${FRIENDIN} ALREADY IN FORK ${UPNAME} TIDDLER." \
|
||||
&& continue
|
||||
|
||||
echo "#~ Create FRIENDG1PUB encrypted version of swarm.key"
|
||||
${MY_PATH}/../tools/natools.py encrypt \
|
||||
-p ${FRIENDG1PUB} \
|
||||
-i $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key \
|
||||
-o $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.${f}.swarm.key.enc
|
||||
FENCODING=$(cat $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.${f}.swarm.key.enc | base16)
|
||||
rm $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.${f}.swarm.key.enc
|
||||
|
||||
echo "## Addd email=crypt(swarmkey) field to ${JSONUPLANET} tiddler."
|
||||
cat ${JSONUPLANET} | jq '. | ."_f_" = "_FENCODING_"' > ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& sed -i 's/_f_/'"$f"'/g; s/_FENCODING_/'"$FENCODING"'/g' ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& mv ~/.zen/tmp/${MOATS}/json.up ${JSONUPLANET}
|
||||
|
||||
else
|
||||
echo "- FATAL ERROR - Friend TW ${ftw} is broken !!"
|
||||
continue
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${foreign} == "YES" ]]; then
|
||||
echo "## Check if friend have an ${UPNAME} tiddler and that secret is the same"
|
||||
## SEARCH FOR ${UPNAME} tiddler IN FRIEND TW
|
||||
tiddlywiki --load ${ftw} --output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "${f}_${UPNAME}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${UPNAME}"
|
||||
|
||||
## CONTROL SWARMKEY DECODING (must be equal)
|
||||
OUT16=$(cat ~/.zen/tmp/${MOATS}/${f}_${UPNAME}.json | jq -r '[]."'${PLAYER}'"')
|
||||
echo "${IN16}"
|
||||
echo "${OUT16}"
|
||||
|
||||
[[ ${IN16} == ${OUT16} ]] \
|
||||
&& echo "OK STATIONS +1 : TW sharing the same wish. " \
|
||||
&& OKSTATIONS=("${OKSTATIONS[@]}" "${ASTROPORT}") \
|
||||
|| echo "NO GOOD! TW not synchronized."
|
||||
|
||||
foreign=""
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
ZENSTATIONS=($(echo "${OKSTATIONS[@]}" | tr ' ' '\n' | sort -u)) ## REMOVE DUPLICATE
|
||||
echo "<<< My Friends are located in ${#ASTROPORTS[@]} ASTROPORT(s) : ${#ZENSTATIONS[@]} are OK >>>"
|
||||
|
||||
## IPFSNODEID IS FORKING TO NEW UPLANET
|
||||
if [[ ${#ZENSTATIONS[@]} -ge 3 ]]; then
|
||||
echo "UPlanet.ZERO /// ENTERING WARPING ZONE /// ${UPNAME} ACTIVATION"
|
||||
## HERE each PLAYER share the same wish
|
||||
# only secret field is "!=" in each, as it is self encoding key
|
||||
# we must find our email="The same" in each friends TW
|
||||
## CONTROL
|
||||
# round looking in friends TW... Can be done before...
|
||||
|
||||
## APPLY ?!
|
||||
##################################################
|
||||
# Let's engage Astroport.ONE code mutation...
|
||||
# tools/my.sh
|
||||
SECRETNAME=$(cat $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key | tail -n 1)
|
||||
echo "SECRETNAME=$SECRETNAME"
|
||||
|
||||
#######################################################################
|
||||
echo "# UPlanet Swarm Bootstrap Stations #
|
||||
# https://ipfs.${UPNAME} ipfs.${UPNAME}
|
||||
#################################################################
|
||||
" > ~/.zen/tmp/${MOATS}/new_straps.list
|
||||
|
||||
# Prepare "new_straps.list" from WAN only
|
||||
for station in ${ZENSTATIONS[@]}; do
|
||||
[[ ! -s ~/.zen/tmp/swarm/${station}/myIPFS.txt ]] \
|
||||
&& echo "Missing swarm/${station}/myIPFS.txt" \
|
||||
&& continue
|
||||
|
||||
bootnode=$(cat ~/.zen/tmp/swarm/${station}/myIPFS.txt)
|
||||
echo "${bootnode}"
|
||||
iptype=$(echo ${bootnode} | cut -d '/' -f 2)
|
||||
nodeip=$(echo ${bootnode} | cut -d '/' -f 3)
|
||||
isnodeipLAN=$(echo $nodeip | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
echo " ${iptype} address :: ${nodeip} (= ${isnodeipLAN})"
|
||||
[[ ${nodeip} == ${isnodeipLAN} ]] && echo "LAN NODE... no good for bootstrap" && continue
|
||||
|
||||
echo "### OK adding to new_straps.list"
|
||||
echo "${bootnode}" >> ~/.zen/tmp/${MOATS}/new_straps.list
|
||||
|
||||
done
|
||||
|
||||
## INTRODUCE NEW BOOSTRAP LIST
|
||||
cp ~/.zen/tmp/${MOATS}/new_straps.list ~/.zen/game/MY_boostrap_nodes.txt
|
||||
#######################################################################
|
||||
|
||||
# make G1PalPay refuse not from "UPlanet Master Key" primal TX
|
||||
# STABLE COIN : activate OpenCollective sync
|
||||
# and adapt 20H12.process.sh
|
||||
|
||||
## UPNAME = domain.tld
|
||||
# PACTHING Astroport.ONE code
|
||||
grep -rl --exclude-dir='.git*' 'copylaradio.com' ~/.zen | xargs sed -i "s~copylaradio.com~${UPNAME,,}~g"
|
||||
rm ~/.zen/game/myswarm_secret.dunikey
|
||||
# now we add key into ~/.ipfs/swarm.key
|
||||
#~ cp $HOME/.zen/game/players/${PLAYER}/.ipfs/${UPNAME}.swarm.key ~/.ipfs/swarm.key
|
||||
# it will make IPFSNODEID restarting in private mode
|
||||
|
||||
fi
|
||||
|
||||
## UPDATE JSONUPLANET
|
||||
cat ${JSONUPLANET} | jq '. | ."UPname" = "_UPNAME_"' > ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& sed -i 's/_UPNAME_/'"$UPNAME"'/g' ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& mv ~/.zen/tmp/${MOATS}/json.up ${JSONUPLANET}
|
||||
cat ${JSONUPLANET} | jq '. | ."hash" = "_HASH_"' > ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& sed -i 's/_HASH_/'"$AHAH"'/g' ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& mv ~/.zen/tmp/${MOATS}/json.up ${JSONUPLANET}
|
||||
cat ${JSONUPLANET} | jq '. | ."secret" = "_SECRET_"' > ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& sed -i 's/_SECRET_/'"$ENCODING"'/g' ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& mv ~/.zen/tmp/${MOATS}/json.up ${JSONUPLANET}
|
||||
|
||||
jq '.[] + {created: $MOATS, modified: $MOATS}' --arg MOATS "$MOATS" "${JSONUPLANET}" > ~/.zen/tmp/${MOATS}/json.up \
|
||||
&& mv ~/.zen/tmp/${MOATS}/json.up ${JSONUPLANET}
|
||||
|
||||
|
||||
### PUT BACK IN TW
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import ${JSONUPLANET} "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/newindex.html ]]; then
|
||||
|
||||
[[ $(diff ~/.zen/tmp/${MOATS}/newindex.html ${INDEX} ) ]] \
|
||||
&& mv ~/.zen/tmp/${MOATS}/newindex.html ${INDEX} \
|
||||
&& echo "===> Mise à jour ${INDEX}"
|
||||
|
||||
cat ${JSONUPLANET} | jq
|
||||
|
||||
else
|
||||
echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/${MOATS}/newindex.html"
|
||||
echo "XXXXXXXXXXXXXXXXXXXXXXX"
|
||||
fi
|
||||
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,18 @@
|
|||
curl -sX POST 'https://data.gchange.fr/user/profile/_search' -d '{
|
||||
"_source": [
|
||||
"title",
|
||||
"avatar._content_type",
|
||||
"time",
|
||||
"address",
|
||||
"city",
|
||||
"creationTime",
|
||||
"description",
|
||||
"_source.pubkey"
|
||||
],
|
||||
"from": 0,
|
||||
"size": 10,
|
||||
"sort": {
|
||||
"creationTime": "desc"
|
||||
}
|
||||
}' | jq
|
||||
|
|
@ -54,9 +54,9 @@ for VUID in $(cat ~/.zen/bunkerbox/crowd.json | jq -r '.posts | .[] | .video.id'
|
|||
|
||||
echo ">>>>>>>>>>>>>>>> Downloading VIDEO"
|
||||
# Choose 360p or 480p or 240p
|
||||
VSIZE=360 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
|
||||
[[ "$VIDEOSRC" == "" ]] && VSIZE=480 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
|
||||
[[ "$VIDEOSRC" == "" ]] && VSIZE=240 &&VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | cut -f 1 -d '.')
|
||||
VSIZE=360 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
|
||||
[[ "$VIDEOSRC" == "" ]] && VSIZE=480 && VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
|
||||
[[ "$VIDEOSRC" == "" ]] && VSIZE=240 &&VIDEOHEAD=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep -B1 ${VSIZE}p | head -n 1) && VIDEOSRC=$(cat ~/.zen/bunkerbox/$VUID/$VUID.m3u8 | grep ${VSIZE}p | tail -n 1 | xargs | cut -f 1 -d '.')
|
||||
VTHUMB="$(cat ~/.zen/bunkerbox/$VUID/$VUID.json | jq -r --arg VSIZE "$VSIZE" '.video.thumbnails[] | select(.height == $VSIZE) | .url')"
|
||||
|
||||
echo ">>>>>>>>>>>>>>>> Downloading Video $VSIZE Thumbnail"
|
|
@ -33,7 +33,7 @@ g1pub=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep 'pub:' | cut -d '
|
|||
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'carte.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Carte'
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'gchange.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Gchange'
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'g1visa.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'G1Visa'
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'g1visa.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'ZenCard'
|
||||
tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/gchange --render '.' 'MOA.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[moa]]'
|
||||
|
||||
GPS=$(cat ~/.zen/tmp/gchange/carte.json | jq -r .[].gps)
|
|
@ -1,17 +1,11 @@
|
|||
# CONTAINS Address of 1st Bootstrap Stations (24/24 Public IP) - DO NOT EDIT MANUALY -
|
||||
# UPlanet Swarm Bootstrap Stations # Adapt for your domain #
|
||||
# https://ipfs.copylaradio.com ipfs.copylaradio.com
|
||||
#################################################################
|
||||
# astroport.libra.copylaradio.com
|
||||
/ip4/149.102.158.67/udp/4001/quic/p2p/12D3KooWL2FcDJ41U9SyLuvDmA5qGzyoaj2RoEHiJPpCvY8jvx9u
|
||||
/ip4/149.102.158.67/tcp/4001/p2p/12D3KooWL2FcDJ41U9SyLuvDmA5qGzyoaj2RoEHiJPpCvY8jvx9u
|
||||
|
||||
# astroport.cancer.copylaradio.com
|
||||
/ip4/185.202.238.69/tcp/4001/p2p/12D3KooWDYpPdfCFf3CbKpcLNmyA2vmJs4JY55k8yje9R1MxSgdB
|
||||
|
||||
# astroport.aries.copylaradio.com
|
||||
/ip4/37.187.127.175/tcp/4001/p2p/12D3KooWSQYTxeoZZ39SNosEKxi7RUdGTtAQAqpKeZJxjzqqrZTx
|
||||
|
||||
# astroport.sonic.copylaradio.com
|
||||
/ip4/161.97.174.60/tcp/4001/p2p/12D3KooWJki74EkJ8YUhrAfr2UwtQiJKBY94PYLmVnEQe9jo3aqC
|
||||
# scorpio.copylaradio.com
|
||||
/dnsaddr/scorpio.copylaradio.com/p2p/12D3KooWS8EiLNay8qVnFaULpxW1X9sGZZz4wV8E6E3QEwCRktry
|
||||
|
||||
#################################################################
|
||||
###### WISHING TO ADD YOUR NODE TO OFFICIAL ASTROPORT BOOSTRAP LIST ?
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
## SSH PUBLIC KEYS
|
||||
## SEEDS OF THE DRAGONS WOT
|
||||
## https://pad.p2p.legal/keygen
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEtg3SlRxtzsQnsBSeU83W0tvUyBTUvOU5lhjlbZVPCZ support@qo-op.com
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILTzTegcBD3WwIyTwT3kIh6jGqyLZzEzXhcuF6IhAjlc
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHJBG6lim4ZmSmpU+GbOKJXO9arfRCP5TdKlhGa4CLJp
|
|
@ -0,0 +1,48 @@
|
|||
To use `natools` for message encryption (to destination) and signature (from sender), you would typically follow these steps:
|
||||
|
||||
### 1. Generate Key Pairs:
|
||||
- Both the sender and the recipient need to generate their key pairs (public and private keys). You can use the `natools` script to generate keys.
|
||||
|
||||
```bash
|
||||
# Sender generate keys
|
||||
python3 natools.py privkey -k ~/.zen/game/sender_secret.dunikey -f cred
|
||||
python3 natools.py pubkey -k ~/.zen/game/sender_secret.dunikey -o sender_public_key
|
||||
|
||||
# Recipient generates keys
|
||||
python3 natools.py privkey -k ~/.zen/game/myswarm_secret.dunikey -f cred
|
||||
python3 natools.py pubkey -k ~/.zen/game/myswarm_secret.dunikey -o recipient_public_key
|
||||
```
|
||||
|
||||
### 2. Encrypt the Message:
|
||||
- The sender uses the recipient's public key to encrypt the message.
|
||||
|
||||
```bash
|
||||
python3 natools.py encrypt -i plaintext.txt -k recipient_public_key -o encrypted_message.bin
|
||||
```
|
||||
|
||||
### 3. Sign the Message:
|
||||
- The sender signs the original message using their private key.
|
||||
|
||||
```bash
|
||||
python3 natools.py sign -i plaintext.txt -k sender_private_key -o signature.bin
|
||||
```
|
||||
|
||||
### 4. Verify the Signature:
|
||||
- The recipient uses the sender's public key to verify the signature.
|
||||
|
||||
```bash
|
||||
python3 natools.py verify -i plaintext.txt -p sender_public_key
|
||||
```
|
||||
|
||||
- The script will output "Signature OK!" if the verification is successful.
|
||||
|
||||
### 5. Decrypt the Message:
|
||||
- The recipient uses their private key to decrypt the message.
|
||||
|
||||
```bash
|
||||
python3 natools.py decrypt -i encrypted_message.bin -k recipient_private_key -o decrypted_message.txt
|
||||
```
|
||||
|
||||
Now you have successfully performed message encryption to the destination and signature from the sender using the `natools` script. Adjust the file paths and content as needed for your specific use case.
|
||||
|
||||
Note: Ensure that both sender and recipient securely store their private keys. Public keys can be shared openly. The encrypted message, signature, and decrypted message are intermediate files used for illustration; adjust as needed in your application.
|
|
@ -0,0 +1,14 @@
|
|||
# UPlanet OC App
|
||||
https://docs.opencollective.com/help/developers/oauth#3.-use-the-access-token-to-access-the-api
|
||||
|
||||
HOWTO GRAPHQLv2
|
||||
https://medium.com/open-collective/open-collective-graphql-api-preview-3b42ed1d55ff
|
||||
https://til.simonwillison.net/graphql/graphql-with-curl
|
||||
|
||||
https://opencollective.com/made-in-zen/members/all.json?limit=10&offset=0
|
||||
|
||||
https://opencollective.com/oauth/authorize?client_id=e95ce84b6df50f7e554f&response_type=code
|
||||
|
||||
https://ipfs.copylaradio.com/ipns/copylaradio.com/?code=16fd94e0d84ce55afaab42b2006e7cef591e6f391d764030be5351220671cfae&state=null
|
||||
|
||||
https://opencollective.com/oauth/token?grant_type=authorization_code&client_id=e95ce84b6df50f7e554f&client_secret=0eb246d4d2afe21154a83f42201b7d0ecf1e8a36&code=16fd94e0d84ce55afaab42b2006e7cef591e6f391d764030be5351220671cfae&https://opencollective.com/oauth/token?grant_type=authorization_code&client_id=e95ce84b6df50f7e554f&client_secret=0eb246d4d2afe21154a83f42201b7d0ecf1e8a36&code=16fd94e0d84ce55afaab42b2006e7cef591e6f391d764030be5351220671cfaehttps://opencollective.com/oauth/token?grant_type=authorization_code&client_id=e95ce84b6df50f7e554f&client_secret=0eb246d4d2afe21154a83f42201b7d0ecf1e8a36&code=16fd94e0d84ce55afaab42b2006e7cef591e6f391d764030be5351220671cfaehttps://opencollective.com/oauth/token?grant_type=authorization_code&client_id=e95ce84b6df50f7e554f&client_secret=0eb246d4d2afe21154a83f42201b7d0ecf1e8a36&code=16fd94e0d84ce55afaab42b2006e7cef591e6f391d764030be5351220671cfae&redirect_uri=https://ipfs.copylaradio.com/ipns/copylaradio.com
|
|
@ -0,0 +1,129 @@
|
|||
# THE ART OF BOOSTRAPING
|
||||
|
||||
"Blockchain" has special treatment during "heart beats" making evolve change of "State".
|
||||
|
||||
As we use IPFS, we can record any data structure as a "blockchain" by just copying last CID into new update.
|
||||
IPNS key publishes evolving "Solid State" (like archive.org). Any ECC key is an IPNS key.
|
||||
So Duniter/Cesium, GChange, SSH, PGP, ... can benefit a side shared storage onto IPFS.
|
||||
|
||||
Astroport.ONE is collecting is map through the bootstrap nodes in ~/.zen/Astroport.ONE/A_boostrap_nodes.txt
|
||||
A new list makes a new "Station Tribe". Some bootstrap scenario could initiate automatic key creation & cross signatures
|
||||
(ex: Create 25 PLAYERs to start a 5x5 document emitting with random cross signature)
|
||||
|
||||
THIS IS ALREADY THE CASE WITH PGP.
|
||||
Instead you can convert your SSH key and benefit from Astroport Data Layer Protocol
|
||||
```
|
||||
## SEE EXERCICE
|
||||
keygen --help
|
||||
```
|
||||
|
||||
PLAYER key & wishes can be controled through : ```~/.zen/Astroport.ONE/command.sh``` or directly through TW (Tag="voeu")
|
||||
Each wish, is a derivated key, it has an IPNS publishing and can be associated to its own ASTROBOT program to take care about Friends data collect & merge.
|
||||
|
||||
VISA.new.sh is creating TW from ```templates/twdefault.html``` and ```templates/twuplanet.html```
|
||||
This script is important as it initialize PLAYER and connect him to STATION... You can add more different templates...
|
||||
|
||||
Visit https://tiddlywiki.com to understand all the capacities this tools have inside.
|
||||
|
||||
## 20H12
|
||||
Every day (20H12.process.sh) activates automation.
|
||||
Sequence is run every night :
|
||||
1. PLAYER.refresh (distributed USERs key management)
|
||||
2. UPLANET.refresh (UPlanet key refresh only Station in Boostrap list)
|
||||
|
||||
## _12345.sh : The MAP maintainer
|
||||
|
||||
This process is run almost every hour. Stations are getting and publishing
|
||||
Each time MAP.refresh.sh is running it takes data from PLAYERs caches (~/.zen/game/players/.../) and publish it on Station IPNS key.
|
||||
|
||||
Boostrap Stations gets LANCoeurBOX through 12345 client call, asking for IPNS retrieval so SWARM data are collected.
|
||||
|
||||
## REVERSE CODE
|
||||
|
||||
You can use ~/.zen/Astroport.ONE/search command to search the code for "EXPRESSIONS"
|
||||
|
||||
For exemple, if you want to know from where VISA.new.sh is called run
|
||||
|
||||
```
|
||||
~/.zen/Astroport.ONE$ ./search VISA.new.sh
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Searching for VISA.new.sh recursively. Please Wait...
|
||||
------------------------------------------------------------------------------
|
||||
./command.sh: ${MY_PATH}/RUNTIME/VISA.new.sh
|
||||
./command.sh: ${MY_PATH}/RUNTIME/VISA.new.sh "$SALT" "$PEPPER" "$EMAIL"
|
||||
./API/SALT.sh: echo "# ASTRONAUT NEW VISA Create VISA.new.sh in background (~/.zen/tmp/email.${EMAIL}.${MOATS}.txt)"
|
||||
./API/SALT.sh: ${MY_PATH}/../RUNTIME/VISA.new.sh "$SALT" "$PEPPER" "${EMAIL}" "$PSEUDO" "${WHAT}" >> ~/.zen/tmp/email.${EMAIL}.${MOATS}.txt
|
||||
./TODO.list:./RUNTIME/VISA.new.sh:######### TODO Ajouter d'autres clefs IPNS, GPG ?
|
||||
./TODO.list:./RUNTIME/VISA.new.sh:WID="https://ipfs.$CLYUSER$YOMAIN.$(myHostName)/api" ## Next Generation API # TODO PLAYER IPFS Docker entrance
|
||||
./TODO.list:./RUNTIME/VISA.new.sh: ############ TODO améliorer templates, sed, ajouter index.html, etc...
|
||||
./TODO.list:./RUNTIME/VISA.new.sh: ## TODO : FOR STRONGER SECURITY REMOVE THIS LINE
|
||||
./TODO.list:./RUNTIME/VISA.new.sh:# !! TODO !! # DEMO MODE. REMOVE FOR PRODUCTION - RECALCULATE AND RENEW AFTER EACH NEW KEY DELEGATION
|
||||
./TODO.list:./RUNTIME/VISA.new.sh:# TODO : Allow Astronaut PASS change ;)
|
||||
------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
## EXERCICE
|
||||
|
||||
“keygen” peut fabriquer la clef duniter et ipfs à partir du keygen ssh (avec clef à courbe elliptique: ECC) et les convertir en clef duniter (secret.dunikey) et ipfs (IPNS)
|
||||
|
||||
```
|
||||
ssh-keygen -t ed25519 -C "userA"
|
||||
keygen -i ~/.ssh/id_ed25519 -t duniter -o ~/.zen/Asecret.dunikey
|
||||
keygen -i ~/.ssh/id_ed25519 -t ipfs -o ~/.zen/Asecret.ipns
|
||||
```
|
||||
On va utiliser “natools” pour faire voyager les données en sécurité dans IPFS :wink:
|
||||
```
|
||||
natools.py encrypt -p $UserBPubKey -i ~/.zen/file.clear -o ~/.zen/file.toB.enc
|
||||
```
|
||||
“jaklis” va servir distribuer la toile de confiance.
|
||||
On envoi entre 1 et 100 G1 aux UserXPubKey des clefs SSH avec lesquelles ont veut signifier un niveau de confiance.
|
||||
|
||||
UserB devra faire de même avec le même montant (ou pas, on verra plus tard ce cas…)
|
||||
```
|
||||
MACHINE A
|
||||
jaklis.py -k ~/.zen/secretA.dunikey pay -a 100 -p ${UserBPubKey} -c "ASTRO#SSH" -m
|
||||
|
||||
MACHINE B
|
||||
jaklis.py -k ~/.zen/secretB.dunikey pay -a 100 -p ${UserAPubKey} -c "ASTRO#SSH" -m
|
||||
```
|
||||
Maintenant.
|
||||
Il reste à maintenir à jour et appliquer la ToileDeConfiance ASTRO#SSH
|
||||
|
||||
Pour cela, jaklis va extraire l’historique des transactions reçues qui portent le tag ASTRO#SSH
|
||||
```
|
||||
jaklis.py history -p UserAPubKey
|
||||
|
||||
+---------------------------------------------------------------------------------------------------------------------------------------
|
||||
| Date | De / À | Ḡ1 | DU/ḡ1 | Commentaire |
|
||||
|---------------------------------------------------------------------------------------------------------------------------------------
|
||||
| 04/04/2023 à 20:01 | HV7o…jG61:Bu6 | 100.00 | ~~~ | ASTRO#SSH
|
||||
|---------------------------------------------------------------------------------------------------------------------------------------
|
||||
| 04/04/2023 à 20:01 | 54yA…UvJm:3px | 70.00 | ~~~ | ASTRO#SSH
|
||||
```
|
||||
Extraire et vérifier qu’au moins une TX entrante et sortante existent (leur somme fait 0)… (“jq”)
|
||||
|
||||
Puis pour établir le droit de se connecter en SSH par exemple, UserA et UserB peuvent inscrire leur clef publique SSH dans ~/.ssh/authorized_keys et ~/.ssh/known_hosts.
|
||||
|
||||
Pour agrémenter cette phase on peut utiliser IPFS (et natools)
|
||||
|
||||
```
|
||||
# Récup les paquets pour A depuis les machines SSH comptabilisé à 0
|
||||
ipfs cat /ipns/IPNSUserB/file.toA.enc
|
||||
ipfs cat /ipns/IPNSUserC/file.toA.enc
|
||||
```
|
||||
|
||||
Voila le principe pour utiliser la G1 et établir une nouvelle “toile de confiance”, et faire passer des fichiers ou des messages entre les clefs. On étendre ce principe à d’autres “toiles de confiance” en définissant une nomenclature pour les ASTRO#TAG…
|
||||
|
||||
Qui est intéressé par ce programme (de distribution de clef SSH ou autre)?
|
||||
Voila ma clef
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEtg3SlRxtzsQnsBSeU83W0tvUyBTUvOU5lhjlbZVPCZ support@qo-op.com
|
||||
|
||||
* “keygen” https://git.p2p.legal/STI/Astroport.ONE/src/branch/master/tools/keygen
|
||||
* “natools” https://git.p2p.legal/STI/Astroport.ONE/src/branch/master/tools/natools.py
|
||||
* “jaklis” https://git.p2p.legal/axiom-team/jaklis
|
||||
* “ipfs” https://git.p2p.legal/STI/Astroport.ONE/src/branch/master/install.kubo_v0.20.0_linux.sh
|
||||
|
||||
## ASTROPORT CREW GILET https://astroport.myspreadshop.fr/create?product=a68ad31e-d554-4c75-821d-97b00d6ad13f&view=2
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
A Ynov depuis la B1, je code en principalement Python
|
||||
j'ai des compétences en Docker, git, en gestion de bdd et traitement des donné
|
||||
|
||||
J'aime faire du piano
|
||||
|
After Width: | Height: | Size: 83 KiB |
14
README.TW.md
|
@ -1,5 +1,19 @@
|
|||
# TW : TiddlyWiki
|
||||
|
||||
Clarifions quelques points concernant TiddlyWiki :
|
||||
|
||||
* Les Tiddlers peuvent contenir n'importe quelle donnée (notes, tâches, numéros de téléphone, photos, vidéos musicales, recettes, produits, membres de la famille, ...).
|
||||
* Les dossiers peuvent avoir des étiquettes
|
||||
* Les tags peuvent être utilisés pour "étiqueter" les tiddlers afin de les catégoriser (tout comme les hashtags).
|
||||
* Les étiquettes peuvent être utilisées pour créer des hiérarchies, des arbres (table des matières) en ajoutant l'étiquette parent à l'étiquette actuelle.
|
||||
* Les tiddlers peuvent avoir des champs
|
||||
* Les champs peuvent contenir des données arbitraires (date, valeur numérique, texte, voire une liste d'autres tiddlers) qui caractérisent le tiddler.
|
||||
* Les tags sont stockés dans le champ tags du tiddler.
|
||||
* Comme les balises ne sont pas différentes des autres champs, n'importe quel champ peut être utilisé comme balises.
|
||||
* Les liens dans le texte forment également un arbre
|
||||
|
||||
# Ŋ1 PROTOCOL
|
||||
|
||||
L'utilisation du cryptosystème signifie que tout hôte possédant une clé privée peut modifier "quelque chose", la clé publique étant l'adresse de cette "chose". Quand on se concentre sur le hachage des données comme le fait IPFS, on peut stocker n'importe quoi partout.
|
||||
|
||||
Astroport.ONE attache une clé (2 pass phrase NaCl generattion) et un email à un modèle TW. Chaque ordinateur sert l'API sur le port 1234. Il peut héberger plusieurs clés PLAYER et gérer leurs TW.
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# Preamble
|
||||
Are you ready to be part of an exciting technological adventure? Do you want to contribute to an innovative project that aims to protect freedom of expression and promote uncensored information sharing? If so, Astroport is the perfect fit for you!
|
||||
|
||||
Astroport is much more than just software; it's a groundbreaking platform that leverages peer-to-peer (P2P) and IPFS technology to enable users to share information, particularly videos, securely and without fear of censorship. We are committed to defending freedom of expression and combating potential restrictions imposed by fact-checking laws advanced by the European Union.
|
||||
|
||||
But Astroport doesn't stop there. We go even further by creating a network that identifies resources around you, whether it's food, friends, services, or goods. Imagine being able to easily find what you need, locally and in a decentralized manner. With Astroport, you'll never be alone when it comes to meeting your needs.
|
||||
|
||||
Moreover, we offer a revolutionary tool called the "build guide," inspired by Minecraft but for real life. You'll be able to follow detailed tutorials to build or produce anything you desire. And to facilitate your projects, we've integrated the marketplace of the Ğ1 libre currency (gchange.fr), allowing you to order the necessary basic materials for your creations.
|
||||
|
||||
To make all this possible, we need talented and passionate developers like you! Join our team and contribute to the creation of a revolutionary platform that unleashes the power of knowledge and fosters unhindered collaboration.
|
||||
|
||||
As a developer at Astroport, you'll have the opportunity to work with cutting-edge technologies such as P2P, IPFS, and the Ğ1 libre currency. You'll push the boundaries of innovation and contribute to a project that will change the way we share information and interact with our environment.
|
||||
|
||||
Join us now and be part of a passionate team working to make the world better, freer, and more connected. Together, we will build a future where censorship has no place and the sharing of knowledge becomes a reality for all.
|
||||
|
||||
Join Astroport and make a difference today!
|
||||
|
||||
## https://astroport.com
|
||||
|
||||
With this technology, we each become host and provider, monetary and media sovereign.
|
||||
With this technology, we establish the "Crypto Department 96" whose map connects territories beyond borders and countries.
|
||||
|
||||
Astroport ONE is the embassy of a world made of interconnected algorithmic webs of trust.
|
||||
|
||||
# Astroport.ONE
|
||||
|
||||
It is a life-size board game that consists in listing, inventing, teaching, and disseminating the best ways to inhabit the planet Earth.
|
||||
This program introduces multimedia data (web page, audio, video) as data chains (blockchain) registered in the IPFS network
|
||||
network that players exchange through TW and Oasis.
|
||||
|
||||
## Fred Story
|
||||
|
||||
In 2018, when most of my job oportunies were about Blockchain and IoT aiming to monitor anything... I understood that we should go with great advice in this new age. So.
|
||||
I decided to refuse to have a profession to get € to live, and thanks to the RSA, transformed my apartment in Toulouse into a "G1FabLab" to realize several prototypes and experiments around the use and practice of G1.
|
||||
|
||||
Several prototypes developed on small computers (RaspberryPi ZeroW, 3B and 4B) appeared.
|
||||
|
||||
We used the G1BILLET to discover that it is only a "bearer voucher written on paper" which, contrary to the habit to which the bank accustomed us, must be destroyed when it returns to its issuer.
|
||||
|
||||
When I launched the G1SMS service (to make payments between cell phone numbers), all this was working on a Raspberry Pi (without UPS) and a phone in my apartment located in Toulouse.
|
||||
|
||||
I became aware that I was becoming a "trusted third party" who had to guarantee the functioning of the service 24h/24. Becoming the manager of everyone's "login" and "keys", to make them "operate" through a software on a blockchain-type database confers a great responsibility!
|
||||
|
||||
The design of the software and the federative architecture that I had just experimented with used a wallet account to create the operator of the service, who then controlled the keys of other wallets and could take a share of each transaction that could be paid for each "branch".
|
||||
|
||||
And it is in front of this company that I wished to stop the G1SMS service.
|
||||
|
||||
Indeed, cryptography is an art that expressed in the cyberspace provides powers, the one to send "registered mails unreadable except by the public key that has been used as address", the one where having a private key offers a "safe" for each one. A new "cryptopunk" world is revealed... A place where a crazy race takes place between those who imagine the best encryption (to maintain their secret activity? or their private life?) and those who wish to break this encryption (for? many reasons surely?).
|
||||
|
||||
Finally, behind the advantageous action of making all our usernames and passwords disappear, another game is actually hidden. The one that links our accounts. Our Avatar and the UNiverse where it is delivered is composed of chains and keys... Of contracts?!
|
||||
|
||||
With G1SMS, and the exploration of the G1, I had put my finger on the role of the Trusted Third Party, who puts himself forward and offers his services. And this was the job of the Banker, the Insurer too... And finally that of the State since it imposes the currency of the game to the players and issues your identity card.
|
||||
|
||||
These structures were not invented by us. They are constantly discussed, remodeled, imposing laws to make up for a lack of rules that cannot be respected by all. This is a difficult challenge, especially when one can have multiple identities.
|
||||
|
||||
For practical reasons, we will delegate our trust. And from now on, in these times, our encryption keys. Certified by the issuer of the tokens of the game that became software. The set of keys that will make our future software work, depends on what we do with them. The entire Internet is being redesigned.
|
||||
|
||||
So with some friends at RSA, we have undertaken this journey into the future of JUNE, an imagined country. A Game capable of organizing a commune. 100% FREE. The one where our keys belong to us!
|
||||
|
||||
Stopped by the authorities. We were able to build in the forest, as an extension to the models of self-built autonomous habitats explored by the "MadeInZion" foundation, the prototype of a decentralized Internet "SolarPunk" that can work OnLine and OffLine.
|
||||
|
||||
|
||||
Personally this exploration will have allowed me to understand and to deconstruct the contracts linking "Fred" and/or "Frédéric RENAULT" to the board game. To discover the Administrative Inquisition, the harassments undergone by "Frédéric RENAULT", until inflicting to this "player" one of the "legal entities" of the chain of parental authority that I had just broken, the prohibition to meet neither Emma, nor Tim if they were called "RENAULT--PREVOST". What he testified he did not wish to wear during our meetings. It was enough to vaporize the injunctions towards my person.
|
||||
|
||||
A sacred adventure! Where my national identity card and my key member of the June face each other. Where the CAF claims the reimbursement of the RSA. Where my bank account is blocked next month... I know I am curious. Curious to understand the world I live in.
|
||||
|
||||
At this point, I might as well continue.
|
||||
|
||||
By pooling our computers with the right free software, We can become together a datacenter without any address, that stores and shares our data "with each other".
|
||||
|
||||
🥥 A Free Internet. Why? How? With whom?
|
||||
|
||||
The keys of modern encryption (remember ed25519) lead to the same place, a decimal sequence located in the decimals of "π". It is in this great infinite spiral that our data are installed. And it is in this circle that our keys define sequences that serve as keys (that we link to other keys)
|
||||
|
||||
With @aya the creator of Olympe Network, we are aware of this mutation. We have invested in IPFS, the global disk where everything we write on it is readable by everyone, provided that he has the keys to dispose of it.
|
||||
|
||||
From this association has just been born "THE ♥BOX", a software and network service that allows you to save your favorite "Youtube" channel or playlist. All these data are saved in "The Claude", a hybrid software using our keys so we can host and own the data we publish.
|
||||
|
||||
To try online with an email and a link to keep...
|
||||
```
|
||||
# Manipulate TW with tiddlywiki
|
||||
~/.zen/game/players/*/ipfs/moa/index.html
|
||||
# Makes your G1Wishes collide : merge and fork. G1Voeu derivated keys system)
|
||||
~/.zen/game/world/*/.pepper
|
||||
```
|
||||
https://astroport.copylaradio.com
|
517
README.md
|
@ -1,109 +1,299 @@
|
|||
# Préambule
|
||||
Quand pourrons nous sortir de ce Méchant Cloud qui nous profile, nous scrute, nous analyse... Pour au final nous faire consommer.
|
||||
Je n'ai pas suivi la formation d’ingénieur réseau pour fabriquer ça!
|
||||
Alors j'ai fait autre chose.
|
||||
# Introduction
|
||||
|
||||
Astroport est contruit sur IPFS pour former nos Cloud personnels échangés entre amis d'amis à l’abri des algorithmes de l'IA et du datamining sauvage qui règne ici bas.
|
||||
L'avantage de ce système, une consommation énergétique divisé par 100, une répartition des données qui permet de fonctionner déconnecté, un système d'information pair à pair inaltérable, inviolable.
|
||||
S'il vous plaît arrêtons cet Internet Supermarché de nous même...
|
||||
C'est une bibliothèque du savoir à la base.
|
||||
[Astroport DEV Journal](https://pad.p2p.legal/s/AstroportDEVJournal#)
|
||||
|
||||
**Embark on a Cosmic Journey with AstroID & ZenCard System and Astroport.ONE**
|
||||
|
||||
Are you weary of the constraints of traditional payment systems and concerned about the reliability
|
||||
of your distributed storage solutions? Look no further! Our revolutionary ZenCard QRCode based Payment System
|
||||
and Astroport.ONE v1.0 seamlessly blend cutting-edge blockchain technology with interplanetary storage,
|
||||
offering you a commission-free and secure solution.
|
||||
|
||||
**Astroport.ONE v1.0: Decentralized Storage Beyond Borders**
|
||||
|
||||
Astroport.ONE isn't just a distributed storage software; it's a reimagining of data management.
|
||||
Utilizing IPFS and introducing a master boot record (MBR) and allocation table to Tiddlywiki data,
|
||||
Astroport.ONE organizes information with unprecedented precision. In the UPlanet format system,
|
||||
the planet is sliced into 0.01° segments, ensuring locally registered Tiddlers with unique signatures.
|
||||
|
||||
As a network engineer and system administrator committed to the Common Good, join us in constructing
|
||||
Astroport.ONE and shaping the future of secure and reliable distributed storage.
|
||||
|
||||
**Station Extra-Terrestre Astroport.ONE: Where Innovation Meets Tranquility**
|
||||
|
||||
In the midst of this technological revolution, discover the Station Extra-Terrestre Astroport.ONE.
|
||||
A haven for volunteers striving to live in peace and harmony within a spaceship turned garden,
|
||||
it unveils a new "Jeu de Société" developed by and for the Astronauts of MadeInZion.
|
||||
|
||||
Embark on an exploration of "Voeux," wishes funded collaboratively through donations in the Libre currency G1.
|
||||
These wishes encapsulate ideas, plans, explanations, and even mistakes, marking the journey toward their realization.
|
||||
|
||||
In this digital game manifesting in real life, your digital identity is in your hands, and a new Internet unfolds,
|
||||
built according to our "Toiles de confiance" (Webs of Trust)!
|
||||
|
||||
Join us in this cosmic journey where peace, harmony, and the spirit of exploration reign supreme.
|
||||
Send your love to the Extraordinary Earthlings at https://qo-op.com.
|
||||
|
||||
Welcome to a universe where wishes become reality, and the possibilities are boundless.
|
||||
|
||||
[BASH ENGINE FOR A CRYPTO PLAYGROUND](https://pad.p2p.legal/p/G1Fablab#)
|
||||
|
||||
## https://astroport.com
|
||||
|
||||
Avec cette technologie, nous devenons chacun hébergeur et fournisseur d'accès, souverain monétaire et médiatique.
|
||||
Avec cette technologie, nous établissons une "Crypto Nation" dont la carte relie les territoires au delà des frontières et des pays.
|
||||
With this technology, we each become host and access provider and media sovereign.
|
||||
|
||||
Astroport ONE est l'ambassade d'un monde fait de toiles confiances interconnectées.
|
||||
**Astroport ONE propels a digital world of interconnected trust webs**.
|
||||
|
||||
# Astroport.ONE
|
||||
Each "Astroport.ONE" station is a digital embassy that communicates and synchronizes with its peers.
|
||||
Users can "move their account". The last one used during the day becomes the "official station".
|
||||
|
||||
Il s'agit d'un Jeu de société grandeur nature qui consiste à répertorier, inventer, enseigner, diffuser les meilleures façons d'habiter la planète Terre.
|
||||
Ce programme introduit des données multimédia (page web, audio, vidéo) en tant que chaines de données (blockchain) inscrites dans le réseau IPFS
|
||||
que les joueurs échangent au travers des TW et Oasis.
|
||||
The architecture attached to each public key is deployed in the form of "flower petals" according to the circles of trust Ŋ1 and Ŋ2 and the data flows produced by the derived keys.
|
||||
|
||||
![N.ONE.2](https://www.copylaradio.com/web/image/6038/ASTROPORT_multiWoTNet.png)
|
||||
|
||||
ASTROBOT "Intelligent contract in BASH"
|
||||
Programs are triggered by "G1Tag" (derived keys) ensures extraction of "G1WordClefs" from "surrounding" Tiddlers.
|
||||
|
||||
To trigger the execution of a "personal intelligent contract", simply create a "wish" (Tag=voeu)
|
||||
At this point, if it exists "ASTROBOT/G1Tag.sh" program will publish the data relating to the Tag concerned on a new "personal IPNS derived key", if not a default "json from all with same wish" is created (see RUNTIME/VOEUX.refresh.sh)
|
||||
|
||||
# INSTALLATION (Linux Mint / Ubuntu / DEBIAN)
|
||||
|
||||
Tested on "Linux Mint" (Debian like distro compatible), the **hacker way for using & buidling new blockchain services** ...
|
||||
|
||||
INSTALL COMMAND
|
||||
|
||||
```
|
||||
# GIT.P2P.LEGAL
|
||||
|
||||
bash <(wget -qO- https://git.p2p.legal/qo-op/Astroport.ONE/raw/branch/master/install.sh)
|
||||
|
||||
# GITHHUB
|
||||
bash <(wget -qO- https://raw.githubusercontent.com/papiche/Astroport.ONE/master/install.sh)
|
||||
|
||||
```
|
||||
|
||||
> TODO: MORE MODULAR INSTALL.
|
||||
> CREATE adventure explaining it
|
||||
|
||||
## DRAGONS WOT
|
||||
|
||||
Once you install Astroport.ONE...
|
||||
|
||||
If all has gone well, you should find these processes running...
|
||||
|
||||
```
|
||||
/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub
|
||||
/bin/bash /home/fred/.zen/G1BILLET/G1BILLETS.sh daemon
|
||||
\_ /bin/bash /home/fred/.zen/G1BILLET/G1BILLETS.sh daemon
|
||||
\_ nc -l -p 33101 -q 1
|
||||
/bin/bash /home/fred/.zen/Astroport.ONE/12345.sh
|
||||
\_ /bin/bash /home/fred/.zen/Astroport.ONE/12345.sh
|
||||
\_ nc -l -p 1234 -q 1
|
||||
/bin/bash /home/fred/.zen/Astroport.ONE/_12345.sh
|
||||
\_ nc -l -p 12345 -q 1
|
||||
|
||||
```
|
||||
|
||||
# LANCEMENT
|
||||
> Become Official REGIONAL Station
|
||||
> - follow "PGP/SSH/IPFSNODEID" linking procedure -
|
||||
> https://pad.p2p.legal/keygen
|
||||
|
||||
## MODE AVENTURE : Activez une Ambassade "Astroport" !
|
||||
|
||||
```
|
||||
~/.zen/Astroport.ONE/adventure/adventure.sh
|
||||
```
|
||||
# DESKTOP
|
||||
|
||||
Trouvez le moyen d'accéder à une "Station Astroport" installée en forêt...
|
||||
After installation, you should have 3 new shortcuts on your desktop
|
||||
|
||||
NB: Une Station branchée sur un panneau solaire et une batterie adéquate, peut fonctionner OnGrid et OffGrid
|
||||
* Astroport", which opens your station portal: http://astroport.localhost:1234
|
||||
* REC" allows you to save your files on IPFS and publish their Capusle in your TW.
|
||||
* G1BILLET" lets you create ZenCards and other useful QRCodes
|
||||
|
||||
## ./start.sh
|
||||
NB : If you use "Nemo" as file manager. You can "ipfs add" any file (with no space in file name) by right click it.
|
||||
|
||||
Gestion des VISA PLAYER (et gestion des VOEUX) en mode CLI
|
||||
> TODO : detect OS and FILE MANAGER to adapt desktop linking and right clic action
|
||||
|
||||
## How to manage your "Astroport"!
|
||||
|
||||
You need to create a "PLAYER".
|
||||
It is defined by email, salt, pepper, lat, lon and PASS
|
||||
|
||||
```
|
||||
~/.zen/Astroport.ONE/command.sh
|
||||
```
|
||||
Browse available functions
|
||||
|
||||
# Activer "myos" MODE OLYMPE (Docker)
|
||||
A Station can host multiple "PLAYERs and TiddlyWikis".
|
||||
|
||||
```
|
||||
sudo apt install git make docker.io
|
||||
sudo adduser $USER docker
|
||||
---
|
||||
|
||||
## REBOOT
|
||||
|
||||
cd ~/.zen/Astroport.ONE
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
USER devient un PLAYER, avec son propre démon IPFS, installé dans un Docker.
|
||||
Chaque STATION (nœud Astroport) accessible en WAN peut héberger un à plusieurs autres "JOUEURS".
|
||||
|
||||
IPFS relie les clefs et les données.
|
||||
Nous mettons un TW dans une clef.
|
||||
|
||||
|
||||
# API : "Sauve qui Peut"
|
||||
# "BASH API" : "♥BOX"
|
||||
## http://astroport.localhost:1234
|
||||
|
||||
Une fois votre Station Astroport démarrée (```~/.start.sh```):
|
||||
* le port 1234 publie API
|
||||
* le port 12345 publie MAP(*)
|
||||
Once your Astroport Station is started:
|
||||
* port 1234 publishes API (REPONSE PORT TCP 45780 45781 ( up to ... 45790 )
|
||||
* port 12345 publishes MAP(*) (ESSAIM MAP - BOOSTRAP / STATIONS)
|
||||
* port 33101 publishes G1BILLETS (REPLY TCP PORT 33102)
|
||||
* port 8080, 4001 and 5001 are IPFS gateway ports.
|
||||
|
||||
List of ports to activate.
|
||||
|
||||
### PRIVATE ZONE (fonctionne sur toutes les Stations. Mode coucou)
|
||||
![](https://ipfs.asycn.io/ipfs/QmWzwL9fZKDGuqsvDjkA8v9sAcU4zQ4BvjKDRwnZQBT97y)
|
||||
|
||||
To add your Station to our swarm, enter the IP of your BOX in the file ``~/.zen/♥Box ````.
|
||||
|
||||
exemple
|
||||
```
|
||||
frd@scorpio:~ $ cat ~/.zen/♥Box
|
||||
86.210.184.173
|
||||
|
||||
```
|
||||
|
||||
⚠ API ASTROPORT = NETCAT SYSTEM ⚠
|
||||
|
||||
**Astroport doesn't need a web server to work**. We use the simplest network tool, **netcat**.
|
||||
Operation gives access to an "API BASH" (classified by the same name as the first GET parameter received in the API directory).
|
||||
|
||||
Requests are made in HTTP GET on port 1234, with the response PORT in the loaded page.
|
||||
Perform a regexp on "url=ADRESSE:PORT" or (♥‿‿♥) to find out which.
|
||||
|
||||
Here are some examples of how to do it.
|
||||
|
||||
## ANSWER PORT RECOVERY API : (♥‿‿♥)
|
||||
### CLI (BASH)
|
||||
```
|
||||
# OPEN ASTROPORT HOME PAGE
|
||||
curl -so ~/.zen/tmp/${MOATS}/astro.port "http://astroport.localhost:1234/?salt=0&pepper=0&g1pub=_URL_&email=${EMAIL}"
|
||||
|
||||
# GREP NEXT PORT IN PAGE CODE
|
||||
TELETUBE=$(cat ~/.zen/tmp/${MOATS}/astro.port | grep "(♥‿‿♥)" | cut -d ':' -f 2 | cut -d '/' -f 3)
|
||||
TELEPORT=$(cat ~/.zen/tmp/${MOATS}/astro.port | grep "(♥‿‿♥)" | cut -d ':' -f 3 | cut -d '"' -f 1)
|
||||
|
||||
sleep 30
|
||||
|
||||
# ACCESS TO FINAL RESULT
|
||||
curl -so ~/.zen/tmp/${MOATS}/astro.rep "http://$TELETUBE:$TELEPORT"
|
||||
```
|
||||
### JS
|
||||
|
||||
Exemple :
|
||||
```
|
||||
var myURL = 'http://astroport.localhost:1234/?' + query;
|
||||
async function fetchAstroport(myURL) {
|
||||
try {
|
||||
|
||||
let one = await fetch(myURL); // Gets a promise
|
||||
var doc = await one.text();
|
||||
var regex = /url='([^']+)/i; // Get response PORT
|
||||
var redirectURL = doc.match(regex)[1]
|
||||
|
||||
console.log(redirectURL)
|
||||
|
||||
setTimeout(function() {
|
||||
// let two = await fetch(redirectURL);
|
||||
// document.mydiv.innerHTML = await two.text(); // Replaces body with response
|
||||
window.open( redirectURL, "AstroTab");
|
||||
}, 5000);
|
||||
|
||||
} catch (err) {
|
||||
console.log('Fetch error:' + err); // Error handling
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
USE "[astro.js](templates/ZenStation/G1PalPay_fichiers/astro.js)"
|
||||
```
|
||||
<script src="https://ipfs.asycn.io/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
|
||||
```
|
||||
|
||||
## ➤ SALT API
|
||||
### ```/?salt=${SALT}&pepper=${PEPPER}&${APPNAME}=${WHAT}&${OBJ}=${VAL}...```
|
||||
|
||||
* Créer son TW <3BOX
|
||||
### Créer (ou téléporter) un PLAYER TW : OFFICIAL <3BOX :
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&g1pub=${URLENCODEDURL}&email=${PLAYER}
|
||||
```
|
||||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&g1pub=${URLENCODEDURL}&email=${PLAYER}```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `g1pub` | `string` | **Required**. Your prefered _URL_ to copy video from |
|
||||
| `email` | `email` | **Required**. Your email token |
|
||||
|
||||
* Lire sa Messagerie Gchange
|
||||
### LOGOUT PLAYER (remove IPNS keys from Station)
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&logout=${PLAYER}
|
||||
```
|
||||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&messaging=on```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `logout` | `string` | **Required**. Your email token |
|
||||
|
||||
* Convertir vers adresse IPNS
|
||||
### LOGIN PLAYER (Activate IPNS keys on Station)
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&login=${PLAYER}
|
||||
```
|
||||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&getipns=on```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `login` | `string` | **Required**. Your email token |
|
||||
|
||||
* AppName=testcraft : Enregistrer JSON
|
||||
### Définir le niveau ★ accordé à un "g1friend"
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&friend=${G1PUB}&stars=${1:5}
|
||||
```
|
||||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&testcraft=json&nodeid=_&dataid=$QRHASH```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `friend` | `string` | **Required**. G1PUB token of friend |
|
||||
| `stars` | `number` | **Required**. Number between 1 to 5 |
|
||||
|
||||
|
||||
Redirections
|
||||
### Lire Messagerie de la base "GChange"
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&messaging=on
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `messaging` | `string` | **Required**. (on=json) output type |
|
||||
|
||||
### Conversion vers adresse IPNS
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&getipns=on
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `getipns` | `string` | **Required** on |
|
||||
|
||||
### AppName=testcraft : Enregistrer JSON
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&testcraft=json&nodeid=_&dataid=$QRHASH
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `testcraft` | `string` | **Required** AppNAME subcommand |
|
||||
| `${OBJ}` | `${VAL}` | depends on App |
|
||||
|
||||
This IPFS object transfer needs that the client is using well configured WebRTC/IPFS relays
|
||||
Look for example in ```www/upload_to_astroport.html```
|
||||
|
||||
```
|
||||
'/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
|
||||
'/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star'
|
||||
```
|
||||
|
||||
### Redirections
|
||||
* vers Gchange
|
||||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&g1pub=on```
|
||||
|
@ -112,24 +302,196 @@ Redirections
|
|||
|
||||
```/?salt=${SALT}&pepper=${PEPPER}&g1pub=astro```
|
||||
|
||||
### PLAYER (fonctionne uniquement sur la Station qui héberge votre PLAYER)
|
||||
### Déclencher un Payement de Ğ1 à une G1PUB
|
||||
```http
|
||||
GET /?salt=${SALT}&pepper=${PEPPER}&pay=1&g1pub=DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech
|
||||
```
|
||||
|
||||
* Déclencher un Payement de 99 Ğ1 à Fred
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `salt` | `string` | **Required**. Your passphrase one token |
|
||||
| `pepper` | `string` | **Required**. Your passphrase two token |
|
||||
| `pay` | `integer` | **Required** G1 AMOUNT |
|
||||
| `g1pub` | `G1PUB` | **Required** destination "wallet key" |
|
||||
|
||||
```/?player=${PLAYER}&pay=99&g1pub=DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech```
|
||||
## ➤ PLAYER (works only on LAN Station)
|
||||
### ```/?player=${PLAYER}&${APPNAME}=${WHAT}&${OBJ}=${VAL}...```
|
||||
|
||||
* Exporter Tiddlers.json depuis son TW selon valeur des "tags" ( ici TAG=G1CopierYoutube)
|
||||
### Exporter Tiddlers.json depuis son TW selon valeur des "tags" ( ici TAG=G1CopierYoutube)
|
||||
```http
|
||||
GET /?player=${PLAYER}&moa=json&tag=G1CopierYoutube
|
||||
```
|
||||
|
||||
```/?player=${PLAYER}&moa=json&tag=G1CopierYoutube```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `player` | `string` | **Required**. Your EMAIL token |
|
||||
| `moa` | `string` | **Required** APP = output format |
|
||||
| `tag` | `${VAL}` | TW filtering default G1CopierYoutube |
|
||||
|
||||
> CAN BE EXTENDED
|
||||
|
||||
## ➤ AMZQR : Create a QRCode with "amzqr"
|
||||
```http
|
||||
GET /?amzqr=${URLENCODEDSTRING}&logo=${IMAGE}
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `amzqr` | `string` | **Required** the qrcode string |
|
||||
| `logo` | `string` | **Required** ./images/${IMAGE}.png |
|
||||
|
||||
check available "logo.png" in [./images](./images)
|
||||
|
||||
## ➤ UPLANET : Create Umap, AstroID & ZenCard for PLAYER (email)
|
||||
```http
|
||||
GET /?uplanet=${PLAYER}&zlat=${LAT}&zlon=${LON}&g1pub=${PASS}
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `uplanet` | `email` | **Required** Your EMAIL token |
|
||||
| `zlat` | `decimal` | **Required** LATITUDE with 2 decimals digits |
|
||||
| `zlon` | `decimal` | **Required** LONGITUDE with 2 decimals digits |
|
||||
| `g1pub` | `string` | **Facultative** choose Umap AstroID PASS |
|
||||
|
||||
Create à Umap key (LAT/LON), then a PLAYER TW with GPS as Umap IPNS reference
|
||||
This API is used by OSM2IPFS code.
|
||||
|
||||
* [UPlanet Entrance](https://qo-op.com)
|
||||
|
||||
### ➤ QRCODE (API SandBox)
|
||||
```http
|
||||
GET /?qrcode=${G1PUB} | ${ASTRONAUTENS} | ${PGP_ASTROID_STRING}
|
||||
```
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :-------------------------------- |
|
||||
| `qrcode` | `string` | **Required**. Your G1PUB or ASTRONAUTENS or PGP_ASTROID token |
|
||||
|
||||
> Look for details & extend as you like in [~/.zen/Astroport.ONE/API/QRCODE.sh](API/QRCODE.sh)
|
||||
|
||||
## The Art of key derivation, chaining & use
|
||||
|
||||
In order to make (a little) clear how we use cryptography,
|
||||
|
||||
We choose to use "NaCl" (secret1 / secret) 2 key generation, so it is easy to understand Web3 mechanism.
|
||||
|
||||
**(SECRET1/SECRET2) mixing**
|
||||
|
||||
* If PLAYER key is (SECRET1 / SECRET2) and G1PUB and EMAIL + TW
|
||||
* feed key (SECRET1 / SECRET2 G1PUB)
|
||||
* wishes keys are (SECRET2 / WishName EMAIL)
|
||||
* sub-wishes are (EMAIL / G1WishName G1PUB)
|
||||
* wish-billets are (EMAIL_dice_words / G1WishName G1PUB)
|
||||
|
||||
This way PLAYER TW capable of retrieving and never loose its data.
|
||||
It is writen into IPFS... So recreate the key anywhere makes you get your data from friends you shared it with.
|
||||
|
||||
**Cross (G1PUB) keys**
|
||||
|
||||
Between PlayerA (AG1PUB) & PlayerB (BG1PUB) obvious communication channel keys are existing :
|
||||
|
||||
(AG1PUB / AG1PUB) - A knock on the door
|
||||
(AG1PUB / BG1PUB) - From A to B channel
|
||||
(BG1PUB / AG1PUB) - From B to A channel
|
||||
(BG1PUB / BG1PUB) - B knock on the door
|
||||
|
||||
We can use this to implement protocols, for exemple :
|
||||
To ollow PlayerA / PlayerB to become friends
|
||||
|
||||
A write a KNOCK.AG1PUB file + signature using (BG1PUB / BG1PUB) keygen IPNS key,
|
||||
Then B reply with the same KNOCK at (AG1PUB / AG1PUB) address
|
||||
|
||||
A/B - B/A keys can be used as bidirectionnal encrypted data channels.
|
||||
|
||||
In a well formed IPFS swarm, we could even send video... Check code in ```/tools/streaming/```
|
||||
|
||||
|
||||
### PUBLIC (fonctionne par tout, pour tous)
|
||||
### ```/?qrcode=$G1PUB/$IPNS/$...```
|
||||
**(LON / LAT) keys**
|
||||
|
||||
NaCl keys can be initiated with GPS Geoloc and receive shared informations.
|
||||
Using the same A/B swapping method, any A place have also a communication channel with B place ;)
|
||||
|
||||
**(COUNTRY / ZIP) keys**
|
||||
|
||||
For a town key, we could use country code + ZIP code, ... etc
|
||||
Many public application can be easily addressed like that
|
||||
|
||||
As these keys are discoverable, the channel can be hijacked by anyone.
|
||||
So ASTROBOT while applying ScuttleButt replications will ".chain.ts" data and check for protocol respect.
|
||||
|
||||
Data can't be lost, but protocol chain can be break !
|
||||
In case of some annoyance, we can monitor IPFS protocol to identify which IPFSNODEID key is acting badly and apply reaction based on DEFCON level (look into astrXbian code)
|
||||
|
||||
### MAILJET & GPS
|
||||
|
||||
In order for "Boostrap Station" to send emails to PLAYERs, we use [mailjet service](https://mailjet.com/).
|
||||
|
||||
```
|
||||
## CREDENTIALS FILE
|
||||
~/.zen/MJ_APIKEY
|
||||
# IS USED BY
|
||||
~/.zen/Astroport.ONE/tools/mailjet.sh
|
||||
```
|
||||
|
||||
Boostrap location is specified in ~/.zen/GPS
|
||||
|
||||
```
|
||||
cat ~/.zen/GPS
|
||||
48.87039, 2.31673
|
||||
|
||||
```
|
||||
|
||||
### LOW RESSOURCE STATION CAN ACTIVATE LOW MODE (disable ipfs daemon)
|
||||
```
|
||||
~/.zen/Astroport.ONE/tools/cron_VRFY.sh LOW
|
||||
|
||||
sudo systemctl restart astroport.service
|
||||
sudo systemctl restart g1billet.service
|
||||
|
||||
```
|
||||
|
||||
### STATION : Show Station PLAYER's G1 investments levels
|
||||
```http
|
||||
GET /?qrcode=station
|
||||
```
|
||||
|
||||
### STATION MAP & PLAYER DATA PROPAGATION
|
||||
|
||||
Chaque Station collecte et publie sur sa clef "self" (/ipns/$IPFSNODEID) les liens vers le cache de l'ensemble de l'essaim
|
||||
http://localhost:12345 renvoi un json
|
||||
|
||||
```
|
||||
{
|
||||
"created" : "202304111854481040",
|
||||
"hostname" : "kitty.localhost",
|
||||
"myIP" : "192.168.1.14",
|
||||
"ipfsnodeid" : "12D3KooWK1ACupF7RD3MNvkBFU9Z6fX11pKRAR99WDzEUiYp5t8j",
|
||||
"astroport" : "http://192.168.1.14:1234",
|
||||
"g1station" : "http://ipfs.localhost:8080/ipns/12D3KooWK1ACupF7RD3MNvkBFU9Z6fX11pKRAR99WDzEUiYp5t8j",
|
||||
"g1swarm" : "http://ipfs.localhost:8080/ipns/k51qzi5uqu5djv0qz9wkl8i94opzm62csh56mnp9zove8i543e4vv4cy9gvr1o"
|
||||
}
|
||||
|
||||
```
|
||||
| Parameter | Description |
|
||||
| :-------- | :------- |
|
||||
| created | date de creation du document |
|
||||
| hostname | nom de la station |
|
||||
| myIP | adresse IP de la station |
|
||||
| ipfsnodeid | Clef publique, balise de la station |
|
||||
| astroport | Lien vers l'API de la station |
|
||||
| g1station | Lien vers la carte PLAYER de la Station |
|
||||
| g1swarm | Lien vers la carte des cartes des Stations de l'essaim |
|
||||
|
||||
Afin de propager la carte chaque station lors de son raffraichissement de cache
|
||||
envoi aux Boostrap une requête pour upload (```/ipns/${IPFSNODEID}```)
|
||||
```
|
||||
STATION MAP UPSYNC : http://$nodeip:12345/?${GNODEID}=${IPFSNODEID}
|
||||
```
|
||||
|
||||
|
||||
# 20H12
|
||||
|
||||
Chaque jour, les ASTROBOTs captent les :star: de leurs PLAYERs puis exécutent le protocole de synchronisation Ŋ1
|
||||
Chaque jour, les ASTROBOTs captent les :star: (tiddler 'email') de leurs PLAYERs puis exécutent le protocole de synchronisation Ŋ1
|
||||
|
||||
[20H12.sh](/qo-op/Astroport.ONE/src/branch/master/20h12.sh)
|
||||
|
||||
|
@ -137,13 +499,15 @@ Ils analysent les données et extraient des flux json selon les G1Voeu présent
|
|||
|
||||
Le niveau informationnel de confiance exploré permet de proposer des alertes issues du niveau Ŋ2.
|
||||
|
||||
## FLUX TW :
|
||||
## EXEMPLE DE FLUX TW :
|
||||
|
||||
[![TW FEEDS](https://ipfs.copylaradio.com/ipfs/Qma9zvrYHGcUPisLKBcG9U9sktThX5VfVci8jfM8D9RspT)](https://pad.p2p.legal/s/G1TWFeed#)
|
||||
|
||||
|
||||
# IPFS : UN STOCKAGE INALTERABLE ET INTELLIGENT
|
||||
|
||||
[![](https://ipfs.asycn.io/ipfs/QmafsWdAeB5W9HcNPQWK2yjTgcW8eTxHoSD7bzE55mtrdP)
|
||||
|
||||
### "The Barefoot Architect" de Johan Van Lengen.
|
||||
|
||||
Lignes de commandes
|
||||
|
@ -154,7 +518,7 @@ ipfs cat QmbfVUAyX6hsxTMAZY7MhvUmB3AkfLS7KqWihjGfu327yG > /tmp/vdoc.pub_the-bare
|
|||
```
|
||||
Après un passage par [ajouter_media.sh](/qo-op/Astroport.ONE/src/branch/master/ajouter_media.sh)
|
||||
|
||||
Vos données son stockées [dans des Tiddlers](https://ipfs.copylaradio.com/ipns/k51qzi5uqu5dioeckikst5f8jw1tbljom6acjbw9zerl3671921krs4nm1531r#:[tag[G1Films]])
|
||||
Les données sont stockées [dans des Tiddlers](https://ipfs.copylaradio.com/ipns/k51qzi5uqu5dgobi9ozzzvdftqfd3hd7a1488nzymky1edz8j779jov7sbemc0#Foret_Enchantee-PROJET_ASTROPORT)
|
||||
|
||||
### Foret Enchantée - PROJET ASTROPORT.pdf
|
||||
|
||||
|
@ -172,3 +536,16 @@ https://ipfs.copylaradio.com/ipfs/QmUtGpGeMZvwp47ftqebVmoFWCmvroy5wEtWsKvWvDWJpR
|
|||
## Stargazers over time
|
||||
|
||||
[![Stargazers over time](https://starchart.cc/papiche/Astroport.ONE.svg)](https://starchart.cc/papiche/Astroport.ONE)
|
||||
|
||||
## CREDITS
|
||||
|
||||
This "digital art" structure is a selection of some of the most valuable Free & OpenSource Software I ever had in my hand.
|
||||
Credits is going to all the kindness and care provided to make valuable and secure software available for all
|
||||
|
||||
Do you know [G1](https://monnaie-libre.fr) ? The best crypto coin you could ever dream about...
|
||||
|
||||
Thanks for contributions on [Swarm BUDGET](https://opencollective.com/monnaie-libre#category-BUDGET)
|
||||
|
||||
|
||||
## IPFS Ecosystem Directory Submission Form
|
||||
https://airtable.com/appLWiIrg9SQaEtEq/shrjwvk9pAeAk0Ci7
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
# Activate SUPPORT MODE: open ssh over IPFS
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
########################################################################
|
||||
YOU=$(myIpfsApi) || er+=" ipfs daemon not running"
|
||||
[[ "$YOU" == "" || "${IPFSNODEID}" == "" ]] && echo "ERROR : $er " && exit 1
|
||||
########################################################################
|
||||
## THIS SCRIPT COPY BOOSTRAP PUBKEY
|
||||
### AND OPEN IPFS P2P SSH FORWARD ON CHANNEL
|
||||
# Make Station publish SSH port on "/x/ssh-$(IPFSNODEID)"
|
||||
########################################################################
|
||||
## use STOP or OFF to finish forwarding
|
||||
|
||||
PARAM="$1"
|
||||
if [[ "${PARAM,,}" == "off" || "${PARAM,,}" == "stop" ]]; then
|
||||
ipfs p2p close --all
|
||||
rm ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh 2>/dev/null
|
||||
rm ~/.zen/tmp/${IPFSNODEID}/y_ssh.pub 2>/dev/null
|
||||
echo "STOP" && exit 0
|
||||
fi
|
||||
|
||||
############################################
|
||||
## DISTRIBUTE DRAGON SSH WOT SEED
|
||||
# A_boostrap_ssh.txt
|
||||
############################################
|
||||
while IFS= read -r line
|
||||
do
|
||||
LINE=$(echo "$line" | grep "ssh-ed25519" | grep -Ev "#") # Remove # & not ssh-ed25519
|
||||
[[ ! ${LINE} ]] && continue
|
||||
if [[ ! $(cat ~/.ssh/authorized_keys | grep "${LINE}") ]]
|
||||
then
|
||||
echo "# ADDING ${LINE} to ~/.ssh/authorized_keys"
|
||||
mkdir -p ~/.ssh && echo "${LINE}" >> ~/.ssh/authorized_keys
|
||||
else
|
||||
echo "TRUSTING ${LINE}"
|
||||
fi
|
||||
done < ${MY_PATH}/../A_boostrap_ssh.txt
|
||||
|
||||
############################################
|
||||
## PUBLISH SSH PUBKEY OVER IPFS
|
||||
## KITTY ssh-keygen style
|
||||
[[ -s ~/.ssh/id_ed25519.pub ]] && cp ~/.ssh/id_ed25519.pub ~/.zen/tmp/${IPFSNODEID}/y_ssh.pub
|
||||
## DRAGONz PGP/SSH style (https://pad.p2p.legal/keygen)
|
||||
gpg --export-ssh-key $(cat ~/.zen/game/players/.current/.player) 2>/dev/null > ~/.zen/tmp/${IPFSNODEID}/z_ssh.pub
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/z_ssh.pub ]] && rm ~/.zen/tmp/${IPFSNODEID}/z_ssh.pub # remove empty file
|
||||
|
||||
############################################
|
||||
### FORWARD SSH PORT over /x/ssh-${IPFSNODEID}
|
||||
############################################
|
||||
echo "Lanching /x/ssh-${IPFSNODEID}"
|
||||
|
||||
[[ ! $(ipfs p2p ls | grep "/x/ssh-${IPFSNODEID}") ]] \
|
||||
&& ipfs p2p listen /x/ssh-${IPFSNODEID} /ip4/127.0.0.1/tcp/22
|
||||
|
||||
ipfs p2p ls
|
||||
|
||||
echo
|
||||
############################################
|
||||
## PREPARE x_ssh.sh
|
||||
## REMOTE ACCESS COMMAND FROM DRAGONS
|
||||
############################################
|
||||
PORT=22000
|
||||
PORT=$((PORT+${RANDOM:0:3}))
|
||||
|
||||
#######################################################################
|
||||
## Adapt $USER for the UPlanet /home/$USER Private Swarm specific one
|
||||
#######################################################################
|
||||
|
||||
echo '#!/bin/bash
|
||||
if [[ ! $(ipfs p2p ls | grep x/ssh-'${IPFSNODEID}') ]]; then
|
||||
ipfs --timeout=10s ping -n 4 /p2p/'${IPFSNODEID}'
|
||||
[[ $? == 0 ]] \
|
||||
&& ipfs p2p forward /x/ssh-'${IPFSNODEID}' /ip4/127.0.0.1/tcp/'${PORT}' /p2p/'${IPFSNODEID}' \
|
||||
&& ssh \$USER@127.0.0.1 -p '${PORT}' \
|
||||
|| echo "CONTACT IPFSNODEID FAILED - ERROR -"
|
||||
fi
|
||||
' > ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh
|
||||
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh
|
||||
|
||||
echo "
|
||||
|
||||
/| /\\
|
||||
/^^^/ |^\Z / |
|
||||
| \Z / |
|
||||
/ @ \Z / / \_______
|
||||
( \ _ / \Z / / /
|
||||
( ---- /G |\ |Z / / /
|
||||
( / ---- \ /---'/\ |Z / / /
|
||||
\/--' /--/ /Z / /
|
||||
| /--/ |Z / / \_______
|
||||
/ /--/ |Z \ / /
|
||||
--/ /--/ \Z | / /
|
||||
/ /--/ \Z / /
|
||||
|--| \Z/ /
|
||||
|---| / /----'
|
||||
\---| /^^^^^^^^^^^^\Z
|
||||
\-/ \Z
|
||||
/ / | \Z
|
||||
\---' |\________| |_______ |Z
|
||||
\--' /\/ \|_|_|_|| |_|_|_|_|\_ |Z
|
||||
'------' / / / |_ /Z
|
||||
\---' | / `````` /Z
|
||||
\--' /\/ \ _____________/Z
|
||||
'------' \
|
||||
|
||||
"
|
||||
############################################
|
||||
echo "CONNECT WITH THIS COMMAND"
|
||||
echo "ipfs cat /ipns/${IPFSNODEID}/x_ssh.sh | bash"
|
||||
############################################
|
||||
|
||||
## PROMETHEUS NODE
|
||||
if [[ -s ~/.zen/prometheus/prometheus ]]; then
|
||||
|
||||
echo "UPDATING ~/.zen/prometheus/prometheus.yml"
|
||||
## ADD ALL SWARM NODES TO MONITORING LIST for prometheus (GRAFANA) node
|
||||
|
||||
ncrunning=$(ps axf --sort=+utime | grep -w 'prometheus' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ $ncrunning ]] \
|
||||
&& echo "RESTARTING" && kill -HUP $ncrunning \
|
||||
|| { cd ~/.zen/prometheus/; ./prometheus & }
|
||||
|
||||
fi
|
||||
|
||||
## LAUNCHING node_exporter
|
||||
ncrunning=$(ps axf --sort=+utime | grep -w 'node_exporter' | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1)
|
||||
[[ $ncrunning ]] \
|
||||
&& echo "RESTARTING" && kill -HUP $ncrunning \
|
||||
|| { /usr/local/bin/node_exporter & }
|
||||
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,373 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 1.0
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
# PAD COCODING : https://pad.p2p.legal/s/G1PalPay
|
||||
# This script monitors G1 Blockchain
|
||||
########################################################################
|
||||
# TODO : CHECK RX coming from UPlanet Wallet
|
||||
## meaning an initial 3.1G1 from a ZenStation admin wallet
|
||||
## if not relay payment to ZenStation admin
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
CESIUM=${myCESIUM}
|
||||
GCHANGE=${myGCHANGE}
|
||||
|
||||
echo "$ME RUNNING (•‿‿•)"
|
||||
|
||||
########################################################################
|
||||
# PALPAY SERVICE : MONITOR INCOMING TX & NEW TIDDLERS
|
||||
########################################################################
|
||||
########################################################################
|
||||
INDEX="$1" ## TW file
|
||||
[[ ! ${INDEX} ]] && INDEX="$HOME/.zen/game/players/.current/ipfs/moa/index.html"
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Please provide path to source TW index.html" && exit 1
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1
|
||||
|
||||
PLAYER="$2" ## PLAYER
|
||||
[[ ! ${PLAYER} ]] && PLAYER="$(cat ~/.zen/game/players/.current/.player 2>/dev/null)"
|
||||
[[ ! ${PLAYER} ]] && echo "ERROR - Please provide PLAYER" && exit 1
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1) ## TW /ipns/
|
||||
[[ ! ${ASTRONAUTENS} ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1
|
||||
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub) ## PLAYER WALLET
|
||||
[[ ! $G1PUB ]] && echo "ERROR - G1PUB ${PLAYER} VIDE" && exit 1
|
||||
|
||||
# Extract tag=tube from TW
|
||||
MOATS="$3"
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
###################################################################
|
||||
## CREATE APP NODE PLAYER PUBLICATION DIRECTORY
|
||||
###################################################################
|
||||
mkdir -p $HOME/.zen/game/players/${PLAYER}/G1PalPay/
|
||||
mkdir -p $HOME/.zen/tmp/${MOATS}
|
||||
echo "=====(•‿‿•)====== ( ◕‿◕) (◕‿◕ ) =======(•‿‿•)======= ${PLAYER}
|
||||
${INDEX}"
|
||||
echo "(✜‿‿✜) G1PalPay : CHECK LAST 30 TX comment"
|
||||
|
||||
# CHECK LAST 30 INCOMING PAYMENTS
|
||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 12 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey history -n 30 -j \
|
||||
> $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json
|
||||
|
||||
[[ ! -s $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json ]] \
|
||||
&& echo "NO PAYMENT HISTORY.........................."
|
||||
##############################
|
||||
|
||||
## CONTROL WALLET
|
||||
########################################################################################
|
||||
if [[ ${UPLANETNAME} != "" ]]; then
|
||||
echo "UPLANET ORIGIN CONTROL"
|
||||
while read LINE; do
|
||||
|
||||
echo "${LINE}"
|
||||
JSON=${LINE}
|
||||
TXIDATE=$(echo $JSON | jq -r .date)
|
||||
TXIPUBKEY=$(echo $JSON | jq -r .pubkey)
|
||||
TXIAMOUNT=$(echo $JSON | jq -r .amount)
|
||||
COMMENT=$(echo $JSON | jq -r .comment)
|
||||
|
||||
lastTXdate=$(cat ~/.zen/game/players/${PLAYER}/.uplanet.check)
|
||||
[[ -z lastTXdate ]] && lastTXdate=0
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/.uplanet.check) -ge $TXIDATE ]] \
|
||||
&& continue
|
||||
|
||||
[[ $(echo "$TXIAMOUNT < 0" | bc) -eq 1 ]] \
|
||||
&& echo "$TXIDATE" > ~/.zen/game/players/${PLAYER}/.uplanet.check \
|
||||
&& continue
|
||||
|
||||
echo "# CHECK FOR PRIMAL REGULAR TX in INCOMING PAYMENTS"
|
||||
# silkaj money history DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech | tail -n 3 | head -n 1
|
||||
# │ 2017-11-25 │ 5nk2qdh1…:GWD │ 200 │ 18.332 │ │
|
||||
line=$(silkaj money history $TXIPUBKEY | tail -n 3 | head -n 1)
|
||||
pub8=$(echo $line | awk -F'│' '{gsub(/[[:space:]]*/, "", $3); split($3, a, ":"); print substr(a[1], 1, 8)}')
|
||||
# pub8=$(echo $line | cut -d '│' -f 3 | cut -c 1-8)
|
||||
# PUB8= UPLANET WALLET
|
||||
|
||||
done < $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json
|
||||
fi
|
||||
|
||||
|
||||
|
||||
##########################################################
|
||||
############# CHECK FOR N1COMMANDs IN PAYMENT COMMENT
|
||||
#################################################################
|
||||
# LOG / cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json | jq -rc .[]
|
||||
## TREAT ANY COMMENT STARTING WITH N1: exemple : N1Kodi.sh
|
||||
## EXTRACT /ASTROBOT/N1ProgramNames
|
||||
ls ${MY_PATH}/../ASTROBOT/ | grep "N1" | cut -d "." -f 1 > ~/.zen/tmp/${MOATS}/N1PROG
|
||||
while read prog; do
|
||||
echo "# SCAN FOR N1 COMMAND : $prog"
|
||||
cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json | jq -rc .[] | grep "$prog" >> ~/.zen/tmp/${MOATS}/myN1.json
|
||||
done < ~/.zen/tmp/${MOATS}/N1PROG
|
||||
|
||||
# got N1 incoming TX
|
||||
while read NLINE; do
|
||||
## COMMENT FORMAT = N1$CMD:$TH:$TRAIL
|
||||
TXIDATE=$(echo ${NLINE} | jq -r .date)
|
||||
TXIPUBKEY=$(echo ${NLINE} | jq -r .pubkey)
|
||||
|
||||
COMMENT=$(echo ${NLINE} | jq -r .comment)
|
||||
CMD=$(echo ${COMMENT} | cut -d ':' -f 1 | cut -c -12 ) # Maximum 12 characters CMD
|
||||
|
||||
# Verify last recorded acting date (avoid running twice)
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/.ndate) -ge $TXIDATE ]] \
|
||||
&& echo "$CMD $TXIDATE from $TXIPUBKEY ALREADY TREATED - continue" \
|
||||
&& continue
|
||||
|
||||
TH=$(echo ${COMMENT} | cut -d ':' -f 2)
|
||||
TRAIL=$(echo ${COMMENT} | cut -d ':' -f 3-)
|
||||
|
||||
if [[ -s ${MY_PATH}/../ASTROBOT/${CMD}.sh ]]; then
|
||||
|
||||
echo "RECEIVED CMD=${CMD} from ${TXIPUBKEY}"
|
||||
${MY_PATH}/../ASTROBOT/${CMD}.sh ${INDEX} ${PLAYER} ${MOATS} ${TXIPUBKEY} ${TH} ${TRAIL}
|
||||
## WELL DONE .
|
||||
[[ $? == 0 ]] && echo "${CMD} DONE" && echo "$TXIDATE" > ~/.zen/game/players/${PLAYER}/.ndate ## MEMORIZE LAST TXIDATE
|
||||
|
||||
else
|
||||
|
||||
echo "NOT A N1 COMMAND ${COMMENT}"
|
||||
|
||||
fi
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/myN1.json
|
||||
|
||||
########################################################################################
|
||||
echo "# CHECK FOR EMAILs IN PAYMENT COMMENT"
|
||||
## DEBUG ## cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json | jq -r
|
||||
#################################################################
|
||||
cat $HOME/.zen/game/players/${PLAYER}/G1PalPay/${PLAYER}.duniter.history.json | jq -rc .[] | grep '@' \
|
||||
> ~/.zen/tmp/${MOATS}/myPalPay.json
|
||||
|
||||
# IF COMMENT CONTAINS EMAIL ADDRESSES
|
||||
# SPREAD & TRANSFER AMOUNT TO NEXT (REMOVING IT FROM LIST)...
|
||||
## Other G1PalPay will continue the transmission...
|
||||
########################################################################
|
||||
## GET @ in JSON INLINE
|
||||
while read LINE; do
|
||||
|
||||
echo "${LINE}"
|
||||
JSON=${LINE}
|
||||
TXIDATE=$(echo $JSON | jq -r .date)
|
||||
TXIPUBKEY=$(echo $JSON | jq -r .pubkey)
|
||||
TXIAMOUNT=$(echo $JSON | jq -r .amount)
|
||||
TXIAMOUNTUD=$(echo $JSON | jq -r .amountUD)
|
||||
COMMENT=$(echo $JSON | jq -r .comment)
|
||||
|
||||
lastTXdate=$(cat ~/.zen/game/players/${PLAYER}/.atdate)
|
||||
[[ -z lastTXdate ]] && lastTXdate=0
|
||||
[[ $(cat ~/.zen/game/players/${PLAYER}/.atdate) -ge $TXIDATE ]] \
|
||||
&& echo "PalPay $TXIDATE from $TXIPUBKEY ALREADY TREATED - continue" \
|
||||
&& continue
|
||||
|
||||
## GET EMAILS FROM COMMENT
|
||||
TXIMAILS=($(echo "$COMMENT" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
|
||||
[[ $(echo "$TXIAMOUNT < 0" | bc) -eq 1 ]] \
|
||||
&& echo "TX-OUT :: ${LINE}" \
|
||||
&& echo "$TXIDATE" > ~/.zen/game/players/${PLAYER}/.atdate \
|
||||
&& continue
|
||||
|
||||
## DIVIDE INCOMING AMOUNT TO SHARE
|
||||
echo "N=${#TXIMAILS[@]}"
|
||||
N=${#TXIMAILS[@]}
|
||||
|
||||
SHAREE=$(echo "scale=2; $TXIAMOUNT / $N" | bc)
|
||||
SHARE=$(makecoord ${SHAREE})
|
||||
## SHARE is received AMOUT divided by numbers of EMAILS in comment
|
||||
echo "% ${#TXIMAILS[@]} % $SHARE % $TXIDATE $TXIPUBKEY $TXIAMOUNT [$TXIAMOUNTUD] $TXIMAILS"
|
||||
|
||||
# let's loop over TXIMAILS
|
||||
for EMAIL in "${TXIMAILS[@]}"; do
|
||||
|
||||
[[ ${EMAIL} == $PLAYER ]] \
|
||||
&& echo "ME MYSELF" \
|
||||
&& echo "$TXIDATE" > ~/.zen/game/players/${PLAYER}/.atdate \
|
||||
&& continue
|
||||
|
||||
echo "EMAIL : ${EMAIL}"
|
||||
|
||||
ASTROTW="" STAMP="" ASTROG1="" ASTROIPFS="" ASTROFEED="" # RESET VAR
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${EMAIL}) ## export ASTROTW and more
|
||||
[[ ${ASTROTW} == "" ]] && ASTROTW=${ASTRONAUTENS}
|
||||
echo "export ASTROPORT=${ASTROPORT} ASTROTW=${ASTROTW} ASTROG1=${ASTROG1} ASTROMAIL=${EMAIL} ASTROFEED=${FEEDNS}"
|
||||
|
||||
if [[ ! ${ASTROTW} ]]; then
|
||||
|
||||
echo "# PLAYER ${EMAIL} INCONNU $(date)"
|
||||
continue
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! ${ASTROG1} ]]; then
|
||||
echo "<html><head><meta charset='UTF-8'>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head><body>" > ~/.zen/tmp/palpay.bro
|
||||
|
||||
echo "<h1>BRO.<h1>
|
||||
$PLAYER wants to send you ${SHARE} G1...<br>
|
||||
<br>(♥‿‿♥)... on <a href='https://qo-op.com'>UPlanet</a>
|
||||
</body></html>" >> ~/.zen/tmp/palpay.bro
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${EMAIL}" ~/.zen/tmp/palpay.bro "BRO. $PLAYER INVITATION"
|
||||
continue
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
|
||||
## SEND G1
|
||||
echo "PalPay____________
|
||||
SEND ${SHARE} G1 to $ASTROMAIL
|
||||
TW : $ASTROTW
|
||||
G1 : ${ASTROG1}"
|
||||
|
||||
echo PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${SHARE}" "${ASTROG1}" "UPLANET:PALPAY"
|
||||
${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${SHARE}" "${ASTROG1}" "UPLANET:PALPAY"
|
||||
STAMP=$?
|
||||
## DONE STAMP IT
|
||||
[[ $STAMP == 0 ]] \
|
||||
&& echo "REDISTRIBUTION DONE" \
|
||||
&& echo "$TXIDATE" > ~/.zen/game/players/${PLAYER}/.atdate
|
||||
|
||||
done
|
||||
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/myPalPay.json
|
||||
|
||||
echo "====(•‿‿•)======= %%%%% (°▃▃°) %%%%%%% ======(•‿‿•)========"
|
||||
|
||||
########################################################################################
|
||||
## SEARCH FOR TODAY MODIFIED TIDDLERS WITH MULTIPLE EMAILS IN TAG
|
||||
# This can could happen in case Tiddler is copied OR PLAYER manualy adds an email tag to Tiddler to share with someone...
|
||||
#################################################################
|
||||
echo "# EXTRACT [days[-1]] DAYS TIDDLERS"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "today.${PLAYER}.tiddlers.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days[-1]]'
|
||||
|
||||
# cat ~/.zen/tmp/${MOATS}/today.${PLAYER}.tiddlers.json | jq -rc # LOG
|
||||
|
||||
## FILTER MY OWN EMAIL
|
||||
cat ~/.zen/tmp/${MOATS}/today.${PLAYER}.tiddlers.json \
|
||||
| sed "s~${PLAYER}~ ~g" | jq -rc '.[] | select(.tags | contains("@"))' \
|
||||
> ~/.zen/tmp/${MOATS}/@tags.json 2>/dev/null ## Get tiddlers with not my email in it
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/@tags.json ]] \
|
||||
&& echo "NO EXTRA @tags.json TIDDLERS TODAY"
|
||||
|
||||
# LOG
|
||||
cat ~/.zen/tmp/${MOATS}/@tags.json
|
||||
echo "******************TIDDLERS with new EMAIL in TAGS treatment"
|
||||
|
||||
################################
|
||||
## detect NOT MY EMAIL in TODAY TIDDLERS
|
||||
################################
|
||||
while read LINE; do
|
||||
|
||||
echo "---------------------------------- Sava PalPé mec"
|
||||
echo "${LINE}"
|
||||
echo "---------------------------------- PalPAY for Tiddler"
|
||||
TCREATED=$(echo ${LINE} | jq -r .created)
|
||||
TTITLE=$(echo ${LINE} | jq -r .title)
|
||||
TTEXT=$(echo ${LINE} | jq -r '.text | match("/ipfs/[^\"\\s]+") | .string | first')
|
||||
TTAGS=$(echo ${LINE} | jq -r .tags)
|
||||
|
||||
## Extract "/ipfs/CID" from Tiddler - to pin TOPIN -
|
||||
TOPIN=$(echo ${LINE} | jq -r .ipfs) ## Tiddler produced by "Astroport Desktop"
|
||||
[[ ! $(echo ${TOPIN} | grep '/ipfs') ]] && TOPIN=$(echo ${LINE} | jq -r ._canonical_uri) ## Tiddler is exported to IPFS
|
||||
[[ ! $(echo ${TOPIN} | grep '/ipfs') ]] && TOPIN=$(echo ${LINE} | jq -r '.text | match("/ipfs/[^\"\\s]+") | .string | first') ## Ket first /ipfs/ link from text field
|
||||
[[ ! $(echo ${TOPIN} | grep '/ipfs') ]] && echo "NOT COMPATIBLE ${TOPIN}" && TOPIN=""
|
||||
|
||||
echo "$TTITLE"
|
||||
|
||||
## Count extra emails found
|
||||
emails=($(echo "$TTAGS" | sed "s~${PLAYER}~ ~g" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
nb=${#emails[@]}
|
||||
#~ zen=$(echo "scale=2; $nb / 10" | bc) ## / divide by 10 = 1 ZEN each
|
||||
|
||||
## Get first zmail
|
||||
ZMAIL="${emails}"
|
||||
|
||||
MSG="SEND + $nb JUNE TO BROs : ${emails[@]}"
|
||||
echo $MSG
|
||||
|
||||
ASTROTW="" STAMP="" ASTROG1="" ASTROIPFS="" ASTROFEED=""
|
||||
#### SEARCH FOR PALPAY ACOUNTS : USING PALPAY RELAY - COULD BE DONE BY A LOOP ?? §§§
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${ZMAIL}) ## export ASTROTW and more
|
||||
echo "export ASTROPORT=${ASTROPORT} ASTROTW=${ASTROTW} ASTROG1=${ASTROG1} ASTROMAIL=${EMAIL} ASTROFEED=${FEEDNS}"
|
||||
[[ ${ASTROTW} == "" ]] && ASTROTW=${ASTRONAUTENS}
|
||||
|
||||
echo "TOPIN=${TOPIN}"
|
||||
if [[ ${TOPIN} && ${ASTROG1} && ${ASTROG1} != ${G1PUB} ]]; then
|
||||
|
||||
##############################
|
||||
### GET PAID & GET PINNED !!
|
||||
##############################
|
||||
${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${nb}" "${ASTROG1}" "${emails[@]} /ipfs/${TOPIN}"
|
||||
|
||||
echo "<html><head><meta charset='UTF-8'>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head><body><h1>BRO ${PLAYER}</h1> : $MSG" > ~/.zen/tmp/${MOATS}/g1message
|
||||
## PINNING IPFS MEDIA - PROOF OF COPY SYSTEM -
|
||||
[[ ! -z $TOPIN ]] \
|
||||
&& ipfs pin add $TOPIN \
|
||||
&& echo "<br> <a href='${myIPFSGW}'/ipns/${ASTROTW}#${TTITLE}>${TTITLE}</a>
|
||||
<br>( ${emails[@]} )<br>
|
||||
<h2>PIN: <a href='${myIPFSGW}'$TOPIN>$TOPIN</a></h2>(☼‿‿☼)" >> ~/.zen/tmp/${MOATS}/g1message
|
||||
## lazy mode... NOT FINISHING HTML TAGGING... browser shoud display html page ;)
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/${MOATS}/g1message "BRO. ${ZMAIL} TW5 PIN"
|
||||
|
||||
else
|
||||
## ${ZMAIL} NOT A PLAYER YET
|
||||
## SEND MESSAGE TO INFORM ${ZMAIL} OF THIS EXISTING TIDDLER
|
||||
echo "<html><head><meta charset='UTF-8'>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head><body>
|
||||
<h1>BRO. </h1>
|
||||
<br> <a href='${myIPFSGW}'/ipns/${ASTROTW}#${TTITLE}>${TTITLE}</a>
|
||||
<br>( ${emails[@]} )<br>
|
||||
<br><b>${TTITLE}</b><br>(✜‿‿✜)
|
||||
... Join <a href='https://qo-op.com'>UPlanet</a>
|
||||
</body></html>" > ~/.zen/tmp/palpay.bro
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${ZMAIL}" ~/.zen/tmp/palpay.bro "BRO. ${PLAYER} TW5 link"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/@tags.json
|
||||
|
||||
echo "=====(•‿‿•)====== ( ◕‿◕) (◕‿◕ ) =======(•‿‿•)======="
|
||||
|
||||
# rm -Rf $HOME/.zen/tmp/${MOATS}
|
||||
ls $HOME/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,264 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"${MY_PATH}\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
################################################################################
|
||||
# Create G1VOEU TW for PLAYER
|
||||
# Mon Titre => G1MonTitre
|
||||
## PARAM : "TITRE DU VOEU" "PLAYER" "INDEX"
|
||||
################################################################################
|
||||
TITRE="$1"
|
||||
PLAYER="$2"
|
||||
INDEX="$3"
|
||||
|
||||
[[ ${PLAYER} == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ ${PLAYER} == "" ]] && echo "Second paramètre PLAYER manquant" && exit 1
|
||||
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
|
||||
[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
||||
[[ $G1PUB == "" ]] && echo "Troisième paramètre G1PUB manquant" && exit 1
|
||||
|
||||
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/${PLAYER}/ipfs/moa/index.html"
|
||||
echo $INDEX
|
||||
[[ ! -s $INDEX ]] && echo "TW ${PLAYER} manquant" && exit 1
|
||||
|
||||
echo "Working on $INDEX"
|
||||
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
|
||||
[[ $ASTRONAUTENS == "" ]] && echo "CLEF IPNS ASTRONAUTE MANQUANTE - EXIT -" && exit 1
|
||||
|
||||
echo "Bienvenue $PSEUDO (${PLAYER}) : $G1PUB"
|
||||
echo
|
||||
|
||||
######################################################################
|
||||
MOATS="$4"
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
|
||||
#####################################################
|
||||
# CREATION DE LA CLEF DERIVEE "G1VOEU"
|
||||
#####################################################
|
||||
source ~/.zen/game/players/${PLAYER}/secret.june ## LE PEPPER DU PLAYER DEVIENT LE SECRET1 DU G1VOEU
|
||||
[[ ${PEPPER} ]] && echo "Using PLAYER PEPPER AS WISH SALT" && SECRET1="${PEPPER}" ##
|
||||
[[ ! ${SECRET1} ]] && SECRET1=$(${MY_PATH}/../tools/diceware.sh 12 | xargs)
|
||||
|
||||
#~ echo "${SECRET1}"
|
||||
|
||||
echo "## TITRE DU G1VOEU ? CapitalGluedWords please"
|
||||
[[ ! ${TITRE} ]] && read TITRE
|
||||
VoeuName=$(echo "${TITRE}" | sed -r 's/\<./\U&/g' | sed 's/ //g') # VoeuName EST LE TITRE DU VOEU : CapitalGluedWords + EMAIL
|
||||
|
||||
SECRET2="${VoeuName} ${PLAYER} ${SALT}" ## SECRET2 est "TitreDuVoeu PLAYER SALT"
|
||||
|
||||
echo "${SECRET2}" && [[ ! ${SECRET2} ]] && echo "EMPTY SECRET2 - ERROR" && exit 1
|
||||
|
||||
echo "## keygen PLAYER DERIVATE WISH KEY"
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/wish.dunikey "${SECRET1}${UPLANETNAME}" "${SECRET2}${UPLANETNAME}"
|
||||
WISHG1PUB=$(cat ~/.zen/tmp/${MOATS}/wish.dunikey | grep "pub:" | cut -d ' ' -f 2)
|
||||
echo "WISHG1PUB (G1PUB) = ${WISHG1PUB}"
|
||||
[[ ${WISHG1PUB} == "" ]] && echo "EMPTY WISHG1PUB G1PUB - ERROR" && exit 1
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/
|
||||
mv ~/.zen/tmp/${MOATS}/wish.dunikey ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/wish.dunikey
|
||||
|
||||
echo "# NOUVEAU VOEU"
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/qrtw.ipfskey "${SECRET1}${UPLANETNAME}" "${SECRET2}${UPLANETNAME}"
|
||||
ipfs key import ${WISHG1PUB} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/qrtw.ipfskey
|
||||
VOEUNS=$(ipfs key list -l | grep -w "${WISHG1PUB}" | cut -d ' ' -f 1 )
|
||||
echo "/ipns/${VOEUNS}"
|
||||
|
||||
## NATOOLS ENCRYPT
|
||||
echo "# NATOOLS ENCODING qrtw.ipfskey "
|
||||
${MY_PATH}/../tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/qrtw.ipfskey -o $HOME/.zen/tmp/${MOATS}/qrtw.ipfskey.$G1PUB.enc
|
||||
ENCODING=$(cat $HOME/.zen/tmp/${MOATS}/qrtw.ipfskey.$G1PUB.enc | base16)
|
||||
#~ echo $ENCODING
|
||||
|
||||
## TEST IPFS
|
||||
#~ ipfs --timeout=30s cat --progress=false /ipns/${VOEUNS} > ~/.zen/tmp/${VOEUNS}.json
|
||||
#~ [[ -s ~/.zen/tmp/${VOEUNS}.json ]] \
|
||||
#~ && echo "HEY !!! UN CHANNEL EXISTE DEJA POUR CE VOEU ! ~/.zen/tmp/${VOEUNS}.json - EXIT -" \
|
||||
#~ && exit 1
|
||||
|
||||
echo "# UPGRADING WORLD WHISHKEY DATABASE"
|
||||
|
||||
mkdir -p ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/
|
||||
## A la fois Titre du tag et Pepper construction de clef
|
||||
echo ${VoeuName} > ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/.pepper
|
||||
echo ${WISHG1PUB} > ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/.wish
|
||||
|
||||
echo "# CREATION QR CODE"
|
||||
|
||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2)
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.WISHLINK.png" "$LIBRA/ipns/${VOEUNS}"
|
||||
|
||||
#################################################################
|
||||
## MAKING SPECIAL amrzqr => G1Milgram TICKET
|
||||
## LE QRCODE CORRESPOND A LA CLEF DERIVE "${PLAYER} :: G1${VoeuName} ${PLAYERG1PUB}" avec PASS=YYYYMM
|
||||
IMAGIC=$(${MY_PATH}/../tools/VOEUX.print.sh "${PLAYER}" "${VoeuName}" "${MOATS}" "${G1PUB}" | tail -n 1)
|
||||
cp ~/.zen/tmp/${MOATS}/START.png ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/
|
||||
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.ASTROLINK.png" "$LIBRA/ipns/$ASTRONAUTENS"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.G1ASTRO.png" "${G1PUB}"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.G1WISH.png" "${WISHG1PUB}:ZEN"
|
||||
qrencode -s 12 -o "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.IPNS.png" "/ipns/${VOEUNS}"
|
||||
|
||||
#################################
|
||||
# PREMIER TYPE ~/.zen/tmp/player.png
|
||||
convert $HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.WISHLINK.png -resize 300 ~/.zen/tmp/QRWISHLINK.png
|
||||
convert ${MY_PATH}/../images/logoastro.png -resize 220 ~/.zen/tmp/ASTROLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +350+10 ~/.zen/tmp/ASTROLOGO.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
convert -gravity northwest -pointsize 20 -fill black -draw "text 320,250 \"${PLAYER}\"" ~/.zen/tmp/one.png ~/.zen/tmp/hop.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 20,320 \"${VoeuName}\"" ~/.zen/tmp/hop.png ~/.zen/tmp/pseudo.png
|
||||
convert -gravity northwest -pointsize 30 -fill black -draw "text 320,300 \"*****\"" ~/.zen/tmp/pseudo.png ~/.zen/tmp/salt.png
|
||||
convert -gravity northwest -pointsize 33 -fill black -draw "text 320,350 \"${VoeuName}\"" ~/.zen/tmp/salt.png ~/.zen/tmp/player.png
|
||||
|
||||
#################################
|
||||
# SECOND TYPE ~/.zen/tmp/voeu.png
|
||||
convert $HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/QR.G1WISH.png -resize 300 ~/.zen/tmp/G1WISH.png
|
||||
convert ${MY_PATH}/../images/logojeu.png -resize 260 ~/.zen/tmp/MIZLOGO.png
|
||||
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/G1WISH.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/astroport.png
|
||||
composite -compose Over -gravity NorthWest -geometry +300+0 ~/.zen/tmp/QRWISHLINK.png ~/.zen/tmp/astroport.png ~/.zen/tmp/one.png
|
||||
composite -compose Over -gravity NorthWest -geometry +320+280 ~/.zen/tmp/MIZLOGO.png ~/.zen/tmp/one.png ~/.zen/tmp/two.png
|
||||
|
||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 32,350 \"Ğ1 VOEU\"" ~/.zen/tmp/two.png ~/.zen/tmp/pep.png
|
||||
convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"${VoeuName}\"" ~/.zen/tmp/pep.png ~/.zen/tmp/voeu.png
|
||||
|
||||
# IMAGE DANS IPFS
|
||||
IVOEUPLAY=$(ipfs add -Hq ~/.zen/tmp/player.png | tail -n 1)
|
||||
IVOEU=$(ipfs add -Hq ~/.zen/tmp/voeu.png | tail -n 1)
|
||||
|
||||
### G1VOEU LIGHTBEAM :: ${PLAYER}_${VoeuName} :: /ipns/${VOEUNS}
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-name","text":"'${PLAYER}_${VoeuName}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-name.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key-'${VoeuName}'","text":"'${VOEUNS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-key.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/g1/lightbeam-key-'${VoeuName}'","text":"'${WISHG1PUB}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-g1.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/g1/lightbeam-natools-'${VoeuName}'","text":"'${ENCODING}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-natools.json
|
||||
|
||||
# TEXT="<a target='_blank' href='"/ipns/${VOEUNS}"'><img src='"/ipfs/${IVOEUPLAY}"'></a><br><br><a target='_blank' href='"/ipns/${VOEUNS}"'>"${VoeuName}"</a>"
|
||||
#:[tag[G1CopierYoutube]] [tag[pdf]]
|
||||
# Contains QRCode linked to G1VoeuTW and BUTTON listing G1Voeux
|
||||
# <img width='600' src='"/ipfs/${IMAGIC}"'><br>
|
||||
TEXT="<a target='_blank' href='#:[tag[G1"${VoeuName}"]]' ><img src='"/ipfs/${IVOEUPLAY}"'></a><br>\n
|
||||
<a target='_blank' href='"/ipns/${VOEUNS}"'>TW G1Voeu "${PLAYER}"</a><br><br>\n\n
|
||||
<\$button class='tc-tiddlylink'>\n
|
||||
<\$list filter='[tag[G1"${VoeuName}"]]'>\n
|
||||
<\$action-navigate \$to=<<currentTiddler>> \$scroll=no/>\n
|
||||
</\$list>\n
|
||||
ALL G1"${VoeuName}"\n
|
||||
</\$button>"
|
||||
|
||||
# NEW IVEU TIDDLER
|
||||
echo "## Creation json tiddler : G1${VoeuName} /ipfs/${IVOEU}"
|
||||
echo '[
|
||||
{
|
||||
"created": "'${MOATS}'",
|
||||
"title": "'${VoeuName}'",
|
||||
"type": "'text/vnd.tiddlywiki'",
|
||||
"astronautens": "'/ipns/${ASTRONAUTENS}'",
|
||||
"wishns": "'/ipns/${VOEUNS}'",
|
||||
"qrcode": "'/ipfs/${IVOEUPLAY}'",
|
||||
"decode": "'/ipfs/${IVOEU}'",
|
||||
"wish": "'${WISHG1PUB}'",
|
||||
"g1pub": "'${G1PUB}'",
|
||||
"text": "'${TEXT}'",
|
||||
"tags": "'G1Voeu G1${VoeuName} ${PLAYER}'",
|
||||
"asksalt": "'${HPass}'",
|
||||
"junesec" : "'${ENCODING}'"
|
||||
}
|
||||
]
|
||||
' > ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/${VoeuName}.voeu.json
|
||||
|
||||
|
||||
|
||||
rm -f ~/.zen/tmp/newindex.html
|
||||
|
||||
echo "Nouveau Voeu ${VoeuName} dans MOA $PSEUDO : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||
tiddlywiki --load $INDEX \
|
||||
--deletetiddlers '[tag[voeu]]' \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-g1.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-natools.json "application/json" \
|
||||
--import ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/${VoeuName}.voeu.json "application/json" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
echo "PLAYER TW Update..."
|
||||
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
||||
echo "___ Mise à jour $INDEX"
|
||||
cp -f ~/.zen/tmp/newindex.html $INDEX
|
||||
else
|
||||
echo "ERROR INTO ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/${VoeuName}.voeu.json"
|
||||
fi
|
||||
|
||||
# PRINTING
|
||||
LP=$(ls /dev/usb/lp* | head -n1)
|
||||
if [[ ! $LP ]]; then
|
||||
echo "NO PRINTER FOUND - Plug a Brother QL700 or Add your printer"
|
||||
else
|
||||
echo "IMPRESSION VOEU"
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/result.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/player.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
brother_ql_create --model QL-700 --label-size 62 ~/.zen/tmp/voeu.png > ~/.zen/tmp/toprint.bin 2>/dev/null
|
||||
sudo brother_ql_print ~/.zen/tmp/toprint.bin $LP
|
||||
fi
|
||||
|
||||
# COPY QR CODE TO PLAYER ZONE
|
||||
cp ~/.zen/tmp/player.png ~/.zen/tmp/voeu.png ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/
|
||||
echo "${SECRET1}" > ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/.salt
|
||||
echo "${VoeuName}" > ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/.title
|
||||
|
||||
echo "$LIBRA/ipns/${VOEUNS}" > ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/.link
|
||||
cp ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/.link ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/
|
||||
cp ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/*.png ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/
|
||||
|
||||
# PUBLISHING
|
||||
echo "ipfs name publish --key=${WISHG1PUB}"
|
||||
banner="## ${PLAYER} G1WISH READY :: G1${VoeuName}
|
||||
<img src=/ipfs/$IMAGIC>
|
||||
G1Voeu Astronaute (TW) : $LIBRA/ipns/$ASTRONAUTENS
|
||||
${VoeuName} FLUX Ŋ1
|
||||
G1${VoeuName} : $LIBRA/ipns/${VOEUNS}
|
||||
WISH G1PUB : ${WISHG1PUB}"
|
||||
|
||||
IPUSH=$(echo "$banner" | ipfs add -q | tail -n 1)
|
||||
ipfs name publish --key=${WISHG1PUB} /ipfs/$IPUSH 2>/dev/null
|
||||
|
||||
echo $IPUSH > ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/.chain.${MOATS}
|
||||
|
||||
echo $banner > ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/banner
|
||||
cat ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/banner
|
||||
|
||||
#~ echo "## TO RECEIVE G1RONDS Creating Cesium+ Profil #### timeout long ... patience ...."
|
||||
#~ ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB}/wish.dunikey set --name "G1Voeu ${VoeuName}" --avatar "$HOME/.zen/game/world/${VoeuName}/${WISHG1PUB}/result_qrcode.png" --site "$LIBRA/ipns/${VOEUNS}" #CESIUM+
|
||||
#~ [[ ! $? == 0 ]] && echo "G1VOEU CESIUM WALLET PROFILE CREATION FAILED !!!!"
|
||||
|
||||
echo "************************************************************"
|
||||
#~ echo "COULD LIMIT ON JUNE pour le Voeu ${VoeuName}"
|
||||
#~ echo ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a 1 -p ${WISHG1PUB} -c \'"${VOEUNS} G1Voeu ${VoeuName}"\' -m
|
||||
#~ echo "************************************************************"
|
||||
#~ echo "************************************************************"
|
||||
|
||||
#~ ${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey pay -a 1 -p ${WISHG1PUB} -c "$VOEUXNS G1Voeu ${VoeuName}" -m
|
||||
#~ [[ ! $? == 0 ]] \
|
||||
#~ && echo "SOOOOOOOOOOOORRRRRRRY GUY. YOU CANNOT PAY A G1 A NEW WISH - THIS IS FREE TO CHANGE -"
|
||||
#~ && rm -Rf ~/.zen/game/players/${PLAYER}/voeux/${VoeuName}/${WISHG1PUB} \
|
||||
#~ && rm -Rf ~/.zen/game/world/${VoeuName}/${WISHG1PUB}/ \
|
||||
#~ && ipfs key rm ${WISHG1PUB} \
|
||||
#~ && tiddlywiki --load ${INDEX} \
|
||||
#~ --deletetiddlers '${VoeuName}' \
|
||||
#~ --output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain" \
|
||||
#~ && cp -f ~/.zen/tmp/newindex.html $INDEX \
|
||||
#~ && echo "G1${VoeuName} FLUX REMOVED"
|
||||
|
||||
echo "************************************************************"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,103 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
## EXPLORE SWARM MAPNS
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
## LOG into ~/.zen/tmp/_12345.log
|
||||
exec 2>&1 >> ~/.zen/tmp/_12345.log
|
||||
|
||||
echo "=========================="
|
||||
echo "(◕‿◕ ) ${ME} (◕‿◕ ) "
|
||||
#~ ## CHECK IF ALREADY MErunning
|
||||
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
|
||||
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
|
||||
|
||||
echo "(◕‿◕ ) ${ME} starting UPlanet Key Scan _______________________________"
|
||||
|
||||
## LOCAL
|
||||
LWKEYS=($(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#LWKEYS[@]} " local UMAPS"
|
||||
LSKEYS=($(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/SECTORS/_*_*/_*.?_*.?/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#LSKEYS[@]} " local SECTORS"
|
||||
LRKEYS=($(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/REGIONS/_*_*/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#LRKEYS[@]} " local REGIONS"
|
||||
|
||||
## SWARM
|
||||
WKEYS=($(cat ~/.zen/tmp/swarm/12D*/UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#WKEYS[@]} " swarm UMAPS"
|
||||
SKEYS=($(cat ~/.zen/tmp/swarm/12D*/UPLANET/SECTORS/_*_*/_*.?_*.?/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#SKEYS[@]} " swarm SECTORS"
|
||||
RKEYS=($(cat ~/.zen/tmp/swarm/12D*/UPLANET/REGIONS/_*_*/_index.html 2>/dev/null | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf ))
|
||||
echo ${#RKEYS[@]} " swarm REGIONS"
|
||||
|
||||
## COMBINE & SHUFFLE KEYS
|
||||
combined=("${LWKEYS[@]}" "${LSKEYS[@]}" "${LRKEYS[@]}" "${WKEYS[@]}" "${SKEYS[@]}" "${RKEYS[@]}")
|
||||
UKEYS=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u | shuf ))
|
||||
echo "SYNC ${#UKEYS[@]} GEOKEYS..."
|
||||
|
||||
## STORAGE FOR IPFS GET UplanetKeyS
|
||||
mkdir -p ~/.zen/tmp/flashmem
|
||||
|
||||
## Refresh flashmem/UplanetKey every 3 hours => DATA SHAKER
|
||||
find ~/.zen/tmp/flashmem -mmin +180 -exec rm -rf {} +
|
||||
|
||||
floop=0
|
||||
medo=0
|
||||
for key in ${UKEYS[@]}; do
|
||||
|
||||
[[ -d ~/.zen/tmp/flashmem/$key ]] \
|
||||
&& echo "$key already copied" && medo=$((medo +1)) && continue
|
||||
|
||||
echo "SYNC $key"
|
||||
|
||||
floop=$((floop +1))
|
||||
mkdir -p ~/.zen/tmp/flashmem/$key
|
||||
|
||||
echo "ipfs --timeout 180s get -o ~/.zen/tmp/flashmem/$key /ipns/$key"
|
||||
ipfs --timeout 180s get --progress=false -o ~/.zen/tmp/flashmem/$key /ipns/$key
|
||||
[[ $? == 0 ]] \
|
||||
&& medo=$((medo +1)) && floop=$((floop -1)) \
|
||||
|| rm -Rf ~/.zen/tmp/flashmem/$key # GOT IT or NOT ?
|
||||
|
||||
[ $floop -gt 33 ] && break
|
||||
|
||||
done
|
||||
echo "=========================="
|
||||
echo "(◕‿◕ ) ${ME} :: $medo SUCCESS missing $floop KEYS from ${#UKEYS[@]} GEOKEYS"
|
||||
echo "=========================="
|
||||
|
||||
## Search for TW /ipfs/ and refresh
|
||||
TWS=($(cat ~/.zen/tmp/flashmem/*/TWz/*/_index.html | grep -o "url='/[^']*'"| sed "s/url='\(.*\)'/\1/" | awk -F"/" '{print $3}' | shuf))
|
||||
echo "SYNC ${#TWS[@]} TWs..."
|
||||
floop=0
|
||||
medo=0
|
||||
for tw in ${TWS[@]}; do
|
||||
|
||||
[[ -d ~/.zen/tmp/flashmem/tw/$tw ]] \
|
||||
&& echo "$key already copied" && medo=$((medo +1)) && continue
|
||||
|
||||
echo "SYNC $key"
|
||||
|
||||
floop=$((floop +1))
|
||||
mkdir -p ~/.zen/tmp/flashmem/tw/$tw
|
||||
|
||||
ipfs --timeout 180s get --progress=false -o ~/.zen/tmp/flashmem/tw/$tw/index.html /ipns/$tw
|
||||
[[ $? == 0 ]] \
|
||||
&& medo=$((medo +1)) && floop=$((floop -1)) \
|
||||
|| rm -Rf ~/.zen/tmp/flashmem/tw/$tw
|
||||
|
||||
[ $floop -gt 33 ] && break
|
||||
|
||||
done
|
||||
|
||||
echo "=========================="
|
||||
echo "(✜‿‿✜) ${ME} :: $medo SUCCESS missing $floop KEYS from ${#TWS[@]} TWS"
|
||||
echo "=========================="
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## MAP REFRESH
|
||||
# LOAD EXTRA DATA TO CACHE ~/.zen/tmp/${IPFSNODEID}/
|
||||
# PUBLISH STATION BALISE
|
||||
############################################
|
||||
echo "## RUNNING NODE.refresh"
|
||||
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
#################################################################
|
||||
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
||||
############################
|
||||
|
||||
# UDATE STATION BALISE
|
||||
if [[ -d ~/.zen/tmp/${IPFSNODEID} ]]; then
|
||||
|
||||
# ONLY FRESH DATA HERE
|
||||
BSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
|
||||
## Getting actual online version
|
||||
#~ ipfs get -o ~/.zen/tmp/${IPFSNODEID} /ipns/${IPFSNODEID}/
|
||||
|
||||
## COPY STATION yt-dlp.list
|
||||
cp $HOME/.zen/.yt-dlp.list ~/.zen/tmp/${IPFSNODEID}/yt-dlp.list
|
||||
cp $HOME/.zen/.yt-dlp.mp3.list ~/.zen/tmp/${IPFSNODEID}/yt-dlp.mp3.list
|
||||
|
||||
## COPY COINS VALUE OF THE DAY
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID}/COINS/
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/COINS/
|
||||
cp -f ~/.zen/tmp/coucou/*.COINS ~/.zen/tmp/${IPFSNODEID}/COINS/
|
||||
|
||||
## COPY 20h12.log
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/20h12.log ## TODO REMOVE
|
||||
cp -f /tmp/20h12.log ~/.zen/tmp/${IPFSNODEID}/20h12.txt
|
||||
|
||||
## COPY FRIENDS
|
||||
PLAYERONE=($(ls -t ~/.zen/game/players/ | grep "@" 2>/dev/null))
|
||||
echo "FOUND : ${PLAYERONE[@]}"
|
||||
## RUNING FOR ALL LOCAL PLAYERS
|
||||
for PLAYER in ${PLAYERONE[@]}; do
|
||||
echo "${PLAYER} GCHANGE FRIENDS"
|
||||
[[ -d ~/.zen/tmp/${IPFSNODEID}/${PLAYER} && ${PLAYER} != "" ]] \
|
||||
&& rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/
|
||||
done
|
||||
## STOP GCHANGE SWARM SHARING --- too big data --- deprecated
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID}/GCHANGE ## UGGLY PATCH
|
||||
|
||||
## INFORM GPS LOCATION
|
||||
[[ -s ~/.zen/game/players/.current/GPS.json ]] \
|
||||
&& cp ~/.zen/game/players/.current/GPS.json ~/.zen/tmp/${IPFSNODEID}/ \
|
||||
&& LAT=$(cat ~/.zen/tmp/${IPFSNODEID}/GPS.json | jq -r .[].lat) \
|
||||
&& LON=$(cat ~/.zen/tmp/${IPFSNODEID}/GPS.json | jq -r .[].lon) \
|
||||
&& echo "LAT=${LAT}; LON=${LON}" > ~/.zen/GPS
|
||||
|
||||
## REFRESH TIMESTAMPING
|
||||
echo "${MOATS}" > ~/.zen/tmp/${IPFSNODEID}/_MySwarm.moats
|
||||
echo "$(date -u)" > ~/.zen/tmp/${IPFSNODEID}/_MySwarm.staom
|
||||
|
||||
echo "############################################ MY MAP "
|
||||
ls ~/.zen/tmp/${IPFSNODEID}/
|
||||
echo "############################################"
|
||||
NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | xargs | cut -f 1)
|
||||
ROUTING=$(ipfs add -rwHq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 )
|
||||
ipfs name publish /ipfs/${ROUTING}
|
||||
echo ">> $NSIZE Bytes STATION BALISE > ${myIPFS}/ipns/${IPFSNODEID}"
|
||||
|
||||
fi
|
||||
|
||||
echo "## CLEANING SWARM 3 DAYS OLD"
|
||||
find ~/.zen/tmp/swarm/ -mtime +3 -type d -exec rm -Rf '{}' \;
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,687 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## Publish All PLAYER TW,
|
||||
# Run TAG subprocess: tube, voeu
|
||||
############################################
|
||||
echo "## RUNNING PLAYER.refresh
|
||||
|
||||
_..._
|
||||
.' '. _
|
||||
/ .-°°-\ _/ \\
|
||||
.-| /:. | | |
|
||||
| \ |:. /.-'-./
|
||||
| .-'-;:__.' =/
|
||||
.'= A=|STRO _.='
|
||||
/ _. | ;
|
||||
;-.-'| \ |
|
||||
/ | \ _\ _\\
|
||||
"
|
||||
|
||||
PLAYERONE="$1"
|
||||
# [[ $isLAN ]] && PLAYERONE=$(cat ~/.zen/game/players/.current/.player 2>/dev/null)
|
||||
[[ ! ${PLAYERONE} ]] && PLAYERONE=($(ls -t ~/.zen/game/players/ | grep "@" 2>/dev/null))
|
||||
|
||||
echo "FOUND ${#PLAYERONE[@]} ASTRONAUTS : ${PLAYERONE[@]}"
|
||||
CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev)
|
||||
|
||||
echo "RENEWING LOCAL UPLANET REPOSITORY (ADMIN=${CURRENT})
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??"
|
||||
|
||||
|
||||
## RUNING FOR ALL LOCAL PLAYERS
|
||||
for PLAYER in ${PLAYERONE[@]}; do
|
||||
[[ ! -d ~/.zen/game/players/${PLAYER:-undefined} ]] && echo "BAD ${PLAYERONE}" && continue
|
||||
[[ ! $(echo "${PLAYER}" | grep '@') ]] && continue
|
||||
|
||||
start=`date +%s`
|
||||
# CLEAN LOST ACCOUNT
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/secret.dunikey ]] \
|
||||
&& rm -Rf ~/.zen/game/players/${PLAYER} \
|
||||
&& echo "WARNING - ERASE ${PLAYER} - BADLY PLUGGED" \
|
||||
&& continue
|
||||
|
||||
YOUSER=$($MY_PATH/../tools/clyuseryomail.sh "${PLAYER}")
|
||||
|
||||
### UPGRADE PLAYER for myos IPFS API ### DOUBLON WITH VISA.new (TO REMOVE)
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/.ipfs # Prepare PLAYER datastructure
|
||||
echo "/ip4/127.0.0.1/tcp/5001" > ~/.zen/game/players/${PLAYER}/.ipfs/api
|
||||
######## WORK IN PROGRESS #### myos integration
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
echo "##### ${YOUSER} ################################ ~/.zen/tmp/${MOATS}"
|
||||
echo "##################################################################"
|
||||
echo ">>>>> PLAYER : ${PLAYER} >>>>>>>>>>>>> REFRESHING TW "
|
||||
echo "################################################ $(date)"
|
||||
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
||||
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
|
||||
# Get PLAYER wallet amount
|
||||
$MY_PATH/../tools/COINScheck.sh ${G1PUB} > ~/.zen/tmp/${MOATS}/${PLAYER}.COINScheck
|
||||
cat ~/.zen/tmp/${MOATS}/${PLAYER}.COINScheck ###DEBUG MODE
|
||||
COINS=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.COINScheck | tail -n 1)
|
||||
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
echo "+++ WALLET BALANCE _ $COINS (G1) _ / $ZEN ZEN /"
|
||||
|
||||
#~ ## ZENCARD ARE ACTIVATED WITH 1 G1 + 10 ZEN (= 10 €/OC) ?
|
||||
echo "## >>>>>>>>>>>>>>>> REFRESH ASTRONAUTE TW"
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${G1PUB} | cut -d ' ' -f1)
|
||||
|
||||
############### CANNOT FIND PLAYER KEY ###########
|
||||
if [[ ! ${ASTRONAUTENS} ]]; then
|
||||
|
||||
echo "${PLAYER} TW IS DISCONNECTED... RECREATING IPNS KEYS"
|
||||
## TODO : EXTRACT & DECRYPT secret.june FROM TW
|
||||
ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player
|
||||
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player
|
||||
|
||||
source ~/.zen/game/players/${PLAYER}/secret.june
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/feed.ipfskey "$SALT" "$G1PUB"
|
||||
FEEDNS=$(ipfs key import "${PLAYER}_feed" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/feed.ipfskey)
|
||||
|
||||
## IF ASTRONS="" KEY WILL BE DELETED AFTER REFRESH
|
||||
ASTRONAUTENS=$ASTRONS && ASTRONS=""
|
||||
|
||||
fi
|
||||
|
||||
[[ ! ${ASTRONAUTENS} ]] && echo "ERROR BAD ${PLAYER} - CONTINUE" && continue
|
||||
|
||||
echo ">>> $myIPFS/ipns/${ASTRONAUTENS}"
|
||||
|
||||
## ACTIVATE PLAYER TW IN STATION CACHE
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/
|
||||
|
||||
################### GET LATEST TW
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html
|
||||
echo "GETTING TW..."
|
||||
####################################################################################################
|
||||
ipfs --timeout 480s get --progress=false -o ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html /ipns/${ASTRONAUTENS}
|
||||
####################################################################################################
|
||||
## PLAYER TW IS ONLINE ?
|
||||
if [ ! -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html ]; then
|
||||
|
||||
NOWCHAIN=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain)
|
||||
LASTCHAIN=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.* | tail -n 1)
|
||||
try=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.try 2>/dev/null) || try=3
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
echo "$myIPFS/ipns/${ASTRONAUTENS}'>TW REFRESH FAILED"
|
||||
echo ">> %%% WARNING TRY LEFT : $try %%%"
|
||||
echo "------------------------------------------------"
|
||||
echo " * <a href='${myIPFS}/ipfs/${LASTCHAIN}'>LAST</a>"
|
||||
echo " * <a href='${myIPFS}/ipfs/${NOWCHAIN}'>NOW</a>"
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
## SEND AN EMAIL ALERT TO PLAYER
|
||||
echo "<html><head><meta charset='UTF-8'>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head><body><a href='$myIPFS/ipns/${ASTRONAUTENS}'>TW LOADING TIMEOUT</a>" > ~/.zen/tmp/result
|
||||
echo "<br>------------------------------------------------" >> ~/.zen/tmp/result
|
||||
echo "<br>" >> ~/.zen/tmp/result
|
||||
echo "<br><a href='${myIPFS}/ipfs/${LASTCHAIN}'>[yesterday]</a>: /ipfs/${LASTCHAIN}" >> ~/.zen/tmp/result
|
||||
echo "<br><a href='${myIPFS}/ipfs/${NOWCHAIN}'>[today]</a>: /ipfs/${NOWCHAIN}" >> ~/.zen/tmp/result
|
||||
echo "<br>" >> ~/.zen/tmp/result
|
||||
echo "<br> %%% WARNING %%% $try TRY LEFT %%%" >> ~/.zen/tmp/result
|
||||
echo "<br>------------------------------------------------" >> ~/.zen/tmp/result
|
||||
echo "<br>ipfs name publish --key=${PLAYER} /ipfs/${NOWCHAIN}" >> ~/.zen/tmp/result
|
||||
echo "</body></html>" >> ~/.zen/tmp/result
|
||||
|
||||
|
||||
[[ $try == 0 && "${CURRENT}" != "${PLAYER}" ]] \
|
||||
&& echo "PLAYER ${PLAYER} UNPLUG" \
|
||||
&& ${MY_PATH}/PLAYER.unplug.sh ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ${PLAYER} "ALL" \
|
||||
&& continue
|
||||
|
||||
try=$((try-1))
|
||||
echo "$try" > ~/.zen/game/players/${PLAYER}/ipfs/moa/.try
|
||||
|
||||
$MY_PATH/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/result "TW LOADING TIMEOUT"
|
||||
|
||||
continue
|
||||
|
||||
fi
|
||||
|
||||
#############################################################
|
||||
## FOUND TW
|
||||
err=""
|
||||
#############################################################
|
||||
## CHECK "GPS" Tiddler
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS' ## GPS Tiddler
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/GPS.json || $(cat ~/.zen/tmp/${MOATS}/GPS.json) == "[]" ]] \
|
||||
&& msg="${PLAYER} GPS : BAD TW (☓‿‿☓) " && err="(☓‿‿☓)"
|
||||
|
||||
#############################################################
|
||||
## CHECK MadeInZion
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion' ## MadeInZion Tiddler
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json || $(cat ~/.zen/tmp/${MOATS}/MadeInZion.json) == "[]" ]] \
|
||||
&& msg="${PLAYER} MadeInZion : BAD TW (☓‿‿☓) " && err="(☓‿‿☓)" && player="" \
|
||||
|| player=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
||||
|
||||
lang=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json 2>/dev/null | jq -r .[].dao)
|
||||
[[ ${lang} == "null" ]] && lang="fr"
|
||||
#############################################################
|
||||
## CHECK "AstroID" Tiddler
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'AstroID.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID' ## AstroID Tiddler
|
||||
[[ $(cat ~/.zen/tmp/${MOATS}/AstroID.json 2>/dev/null) == "[]" ]] && rm ~/.zen/tmp/${MOATS}/AstroID.json
|
||||
########################################## used by Astroport :: Lasertag :: TW plugin ##
|
||||
## CHECK "$:/config/NewTiddler/Tags"
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'TWsign.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '$:/config/NewTiddler/Tags' ## $:/config/NewTiddler/Tags Tiddler
|
||||
signature=$(cat ~/.zen/tmp/${MOATS}/TWsign.json | jq -r .[].text)
|
||||
echo "${player} SIGNATURE = $signature"
|
||||
|
||||
#############################################################
|
||||
## CHECK "Astroport" TIDDLER
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport' ## Astroport Tiddler
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/Astroport.json || $(cat ~/.zen/tmp/${MOATS}/Astroport.json) == "[]" ]] \
|
||||
&& msg="${PLAYER} Astroport : BAD TW (☓‿‿☓) " && err="(☓‿‿☓)"
|
||||
|
||||
############################################################ BAD TW SIGNATURE
|
||||
[[ ( ${player} != ${PLAYER} || ${PLAYER} != ${signature} || "${err}" == "(☓‿‿☓)" ) && ${PLAYER} != ${CURRENT} ]] \
|
||||
&& echo "> (☓‿‿☓) BAD PLAYER=$player in TW (☓‿‿☓) $msg" \
|
||||
&& ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ALL" \
|
||||
&& continue \
|
||||
|| echo "${PLAYER} OFFICIAL TW - (⌐■_■) -"
|
||||
|
||||
BIRTHDATE=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].birthdate)
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport) ## ZenStation IPNS address
|
||||
CURCHAIN=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].chain | rev | cut -f 1 -d '/' | rev) # Remove "/ipfs/" part
|
||||
[[ ${CURCHAIN} == "" || ${CURCHAIN} == "null" ]] \
|
||||
&& CURCHAIN="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # AVOID EMPTY
|
||||
|
||||
SBIRTH=$(${MY_PATH}/../tools/MOATS2seconds.sh ${BIRTHDATE})
|
||||
SNOW=$(${MY_PATH}/../tools/MOATS2seconds.sh ${MOATS})
|
||||
DIFF_SECONDS=$(( SNOW - SBIRTH ))
|
||||
days=$((DIFF_SECONDS / 60 / 60 / 24))
|
||||
|
||||
################################################## ANOTHER ASTROPORT !!
|
||||
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
|
||||
########### ASTROPORT is not IPFSNODEID => EJECT TW
|
||||
if [[ ${IPNSTAIL} != ${IPFSNODEID} || ${IPNSTAIL} == "_ASTROPORT_" ]]; then
|
||||
echo "> PLAYER MOVED TO ${IPNSTAIL} : UNPLUG "
|
||||
${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ONE" "Now TW is plugged to ${ASTROPORT}"
|
||||
echo ">>>> CIAO ${PLAYER}"
|
||||
continue
|
||||
fi
|
||||
|
||||
################ VERIFICATIONS DONE ######################
|
||||
echo "ASTROPORT ZenStation : ${ASTROPORT}"
|
||||
echo "CURCHAIN=${CURCHAIN}"
|
||||
echo "================================== TW $days days old"
|
||||
|
||||
############################################## +2 DAYS & AstroID = UNPLUG !!
|
||||
## REMOVE TW OLDER THAN 2 DAYS WITH AstroID
|
||||
[[ -s ~/.zen/tmp/${MOATS}/AstroID.json && $days -gt 2 && "${CURRENT}" != "${PLAYER}" ]] \
|
||||
&& ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ALL" "TW EJECTION. Found an AstroID in your TW." \
|
||||
&& echo "(#__#) AstroID +2 DAYS = SECURITY ERROR (#__#)" && continue
|
||||
####################################################################### RTFM DUMB FIREWALL
|
||||
############################################################################################
|
||||
|
||||
######################################
|
||||
#### UPLANET GEO COORD EXTRACTION
|
||||
## GET "GPS" TIDDLER - 0.00 0.00 (if empty: null)
|
||||
ZLAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
|
||||
[[ $ZLAT == "null" || $ZLAT == "" ]] && ZLAT="0.00"
|
||||
ZLON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
|
||||
[[ $ZLON == "null" || $ZLON == "" ]] && ZLON="0.00"
|
||||
|
||||
LAT=$(makecoord ${ZLAT})
|
||||
LON=$(makecoord ${ZLON})
|
||||
|
||||
### GET UMAP ENV
|
||||
$(${MY_PATH}/../tools/getUMAP_ENV.sh "${LAT}" "${LON}" | tail -n 1)
|
||||
echo "UMAPG1PUB=$UMAPG1PUB UMAPIPNS=$UMAPIPNS SECTORG1PUB=$SECTORG1PUB SECTORIPNS=$SECTORIPNS REGIONG1PUB=$REGIONG1PUB REGIONIPNS=$REGIONIPNS LAT=$LAT LON=$LON SLAT=$SLAT SLON=$SLON RLAT=$RLAT RLON=$RLON"
|
||||
|
||||
UMAPNS=$(echo $UMAPIPNS | cut -d '/' -f 3)
|
||||
#############################################
|
||||
# MAKE "GPS" TIDDLER
|
||||
cat ${MY_PATH}/../templates/data/GPS.json \
|
||||
| sed -e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
-e "s~_LAT_~${LAT}~g" \
|
||||
-e "s~_LON_~${LON}~g" \
|
||||
-e "s~_UMAPNS_~${UMAPNS}~g" \
|
||||
-e "s~_SECTORTW_~${SECTORIPNS}/TW~g" \
|
||||
> ~/.zen/tmp/${MOATS}/GPS.json
|
||||
|
||||
## UPDATE PLAYER CACHE
|
||||
echo "_${LAT}_${LON}" > ~/.zen/game/players/${PLAYER}/.umap
|
||||
cp ~/.zen/tmp/${MOATS}/GPS.json ~/.zen/game/players/${PLAYER}/
|
||||
|
||||
################# PERSONAL VDO.NINJA PHONEBOOTH
|
||||
if [[ "${days}" == "3" ]]; then
|
||||
YOUSER=$($MY_PATH/../tools/clyuseryomail.sh "${PLAYER}")
|
||||
_USER=$(echo $YOUSER | sed "s~\.~_~g")
|
||||
# MAKE "VISIO" TIDDLER
|
||||
cat ${MY_PATH}/../templates/data/VISIO.json \
|
||||
| sed -e "s~_IPFSNINJA_~${VDONINJA}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
-e "s~_PHONEBOOTH_~${_USER}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/VISIO.json
|
||||
|
||||
else
|
||||
echo "[]" > ~/.zen/tmp/${MOATS}/VISIO.json
|
||||
fi
|
||||
|
||||
|
||||
#####################################################################
|
||||
# MAKE "CESIUM" TIDDLER
|
||||
if [[ "${days}" == "4" ]]; then
|
||||
echo "Create CESIUM Tiddler"
|
||||
cat ${MY_PATH}/../templates/data/CESIUM.json \
|
||||
| sed -e "s~_G1PUB_~${G1PUB}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_CESIUMIPFS_~${CESIUMIPFS}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/CESIUM.json
|
||||
|
||||
else
|
||||
echo "[]" > ~/.zen/tmp/${MOATS}/CESIUM.json
|
||||
fi
|
||||
#####################################################################
|
||||
########## $:/moa picture ## CREATE EMAIL from email tiddler ########
|
||||
## GET $:/moa Tiddlers ####################################### START
|
||||
echo "GET $:/moa Tiddlers"
|
||||
###################################################### [tag[$:/moa]] used for "DID" declaration
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'FRIENDS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[$:/moa]]' ## $:/moa EMAIL Tiddlers
|
||||
#####################################################################
|
||||
fplayers=($(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq -rc .[].title))
|
||||
echo "${fplayers[@]}"
|
||||
UPLAYERSTIDS=()
|
||||
for fp in ${fplayers[@]}; do
|
||||
|
||||
[[ ! "${fp}" =~ ^[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$ ]] && echo "BAD ${fp} FORMAT" && continue
|
||||
[[ "${fp}" == "${PLAYER}" ]] && echo "IT'S ME - CONTINUE" && continue
|
||||
|
||||
FPLAYER=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .player')
|
||||
[[ $FPLAYER == 'null' || $FPLAYER == '' ]] \
|
||||
&& echo "FPLAYER null - NOGOOD${fp} -" \
|
||||
&& continue
|
||||
# AUTO CORRECT : sed -i "s~${fp}~NOGOOD${fp}~g" ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
|
||||
FTW=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .tw')
|
||||
[[ ${FTW} == "/ipns/" || ${FTW} == "null" || ${FTW} == "" ]] && echo "WEIRD FTW ${FTW} - CONTINUE" && continue
|
||||
|
||||
FG1PUB=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .g1pub')
|
||||
[[ $FG1PUB == 'null' || $FG1PUB == '' ]] && echo "FG1PUB null - CONTINUE" && continue
|
||||
|
||||
IHASH=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .text' | sha256sum | cut -d ' ' -f 1)
|
||||
|
||||
echo ":: coucou :: $FPLAYER :: (ᵔ◡◡ᵔ) ::"
|
||||
echo "TW: $FTW"
|
||||
echo "G1: $FG1PUB"
|
||||
echo "IHASH: $IHASH"
|
||||
UPLAYERSTIDS=("${UPLAYERSTIDS[@]}" "[[${FPLAYER^^}|${FPLAYER^^}]]")
|
||||
|
||||
## GET ORIGINH FROM LAST KNOWN TW STATE
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}
|
||||
|
||||
## CHECK ALREADY IN ${FPLAYER^^} IHASH
|
||||
rm -f ~/.zen/tmp/${MOATS}/finside.json
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'finside.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${FPLAYER^^}" ## ${FPLAYER^^} autoload Tiddlers
|
||||
|
||||
INSIDEH=$(cat ~/.zen/tmp/${MOATS}/finside.json | jq -rc '.[].ihash')
|
||||
echo "INSIDEH: $INSIDEH"
|
||||
|
||||
if [[ -s ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html ]]; then
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "${FPLAYER}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${FPLAYER}" ## GET ORIGIN
|
||||
|
||||
ORIGINH=$(cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq -r '.[].text' | sha256sum | cut -d ' ' -f 1)
|
||||
## CAN USE IPFSH=$(cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq -r '.[].text' | ipfs add -q)
|
||||
## TODO MICROLEDGER TIDDLER...
|
||||
# we are monitoring email tiddler image change (the G1BILLET background can be made of).
|
||||
echo "ORIGINH: $ORIGINH"
|
||||
else
|
||||
ORIGINH="$INSIDEH"
|
||||
fi
|
||||
|
||||
( ## REFRESH LOCAL PLAYER CACHE with FRIEND ACTUAL TW (&) will be used TOMORROW
|
||||
ipfs --timeout 480s cat --progress="false" ${FTW} > ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html
|
||||
) &
|
||||
|
||||
## UPDATE IF IHASH CHANGED -> New drawing => Friend get informed
|
||||
if [[ -z $INSIDEH || $INSIDEH != $IHASH || $ORIGINH != $INSIDEH ]]; then
|
||||
cat ${MY_PATH}/../templates/data/_UPPERFPLAYER_.json \
|
||||
| sed -e "s~_UPPERFPLAYER_~${FPLAYER^^}~g" \
|
||||
-e "s~_FPLAYER_~${FPLAYER}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_IHASH_~${IHASH}~g" \
|
||||
-e "s~_FRIENDTW_~${FTW}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/${FPLAYER^^}.json
|
||||
|
||||
echo "Insert New ${FPLAYER^^}.json"
|
||||
#~ cat ~/.zen/tmp/${MOATS}/${FPLAYER^^}.json | jq
|
||||
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--import ${HOME}/.zen/tmp/${MOATS}/${FPLAYER^^}.json 'application/json' \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER} \
|
||||
--render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
[[ -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html \
|
||||
|| echo "ERROR - CANNOT IMPORT ${FPLAYER^^}.json - ERROR"
|
||||
|
||||
if [[ $ORIGINH != $INSIDEH && $ORIGINH != "" ]]; then
|
||||
echo "ORIGINH Update"
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--import ${HOME}/.zen/tmp/${MOATS}/${FPLAYER}.json 'application/json' \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER} \
|
||||
--render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
[[ -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html \
|
||||
|| echo "ERROR - CANNOT IMPORT ${FPLAYER}.json - ERROR"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
## GET $:/moa Tiddlers ####################################### END
|
||||
|
||||
################## PREPARE LIST TO INSERT IN SECTORTW_NEWS TID
|
||||
echo "${UPLAYERSTIDS[@]}"
|
||||
UPLAYERSTIDS_STR=""
|
||||
for item in "${UPLAYERSTIDS[@]}"; do
|
||||
UPLAYERSTIDS_STR+="\n* $item"
|
||||
done
|
||||
# Trim leading space
|
||||
UPLAYERSTIDS_STR="${UPLAYERSTIDS_STR# }"
|
||||
######################################
|
||||
# (RE)MAKE "SECTORTW_NEWS" TIDDLER
|
||||
cat ${MY_PATH}/../templates/data/SECTORTW_NEWS.json \
|
||||
| sed -e "s~_SECTOR_~${SECTOR}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_UPLANET_~https://qo-op.com~g" \
|
||||
-e "s~_UPLAYERSTIDS_~${UPLAYERSTIDS_STR}~g" \
|
||||
-e "s~_SECTORTW_~${SECTORIPNS}/TW~g" \
|
||||
> ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json
|
||||
|
||||
echo "SECTORTW_NEWS $SECTOR SECTORTW=${SECTORIPNS}/TW :: ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json"
|
||||
${MY_PATH}/TW/import_tiddler.sh \
|
||||
~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json
|
||||
|
||||
#############################################################
|
||||
# Connect_PLAYER_To_Gchange.sh : Sync FRIENDS TW - TODO : REWRITE
|
||||
######################################### BETTER USE json FILE IN /ipns/$IPFSNODEID/COINS
|
||||
#~ echo "##################################################################"
|
||||
|
||||
[[ -s ~/.zen/tmp/coucou/${G1PUB}.gchange.json ]] \
|
||||
&& echo "## Connect_PLAYER_To_Gchange.sh (★★★★★)" \
|
||||
&& ${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "${PLAYER}" \
|
||||
|| echo "NO Gchange account found"
|
||||
|
||||
##############################################################
|
||||
# G1PalPay - 2 G1 mini -> Check for G1 TX incoming comments #
|
||||
##############################################################
|
||||
if [[ $(echo "$COINS >= 2" | bc -l) -eq 1 ]]; then
|
||||
##############################################################
|
||||
# G1PalPay.sh #
|
||||
##############################################################
|
||||
echo "## RUNNING G1PalPay Wallet Monitoring "
|
||||
${MY_PATH}/G1PalPay.sh ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html "${PLAYER}"
|
||||
|
||||
##############################################################
|
||||
# VOEUX.create.sh #
|
||||
##############################################################
|
||||
${MY_PATH}/VOEUX.create.sh ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html "${PLAYER}" "${G1PUB}"
|
||||
|
||||
##############################################################
|
||||
# VOEUX.refresh.sh #
|
||||
##############################################################
|
||||
${MY_PATH}/VOEUX.refresh.sh "${PLAYER}" "${MOATS}" ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html
|
||||
|
||||
else
|
||||
echo "> ZenCard not activated ($ZEN ZEN)"
|
||||
fi
|
||||
|
||||
##################################
|
||||
## PATCH : RESTORE PLAYER GPS.json (protect cache erased by WISH treatment)
|
||||
cp -f ~/.zen/game/players/${PLAYER}/GPS.json ~/.zen/tmp/${MOATS}/
|
||||
## WRITE TIDDLERS IN TW SECTORTW_NEWS.json
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--import ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/GPS.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/VISIO.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/CESIUM.json "application/json" \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
|
||||
## CHECK IT IS OK
|
||||
[[ -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html \
|
||||
&& echo "TW UPlanet tiddlers updated" \
|
||||
|| echo "ERROR - CANNOT CREATE TW NEWINDEX - ERROR"
|
||||
###########################
|
||||
|
||||
########################
|
||||
## SEND TODAY ZINE
|
||||
#### UPlanetZINE/day${days}/index.${lang}.html
|
||||
TODAYZINE="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.${lang}.html"
|
||||
[[ ! -s ${TODAYZINE} ]] && TODAYZINE="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.html"
|
||||
[[ -s ${TODAYZINE} && ${days} -gt 0 ]] \
|
||||
&& echo "SENDING TODAYZINE DAY ${days} + mailjet TW import " \
|
||||
&& ${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ${TODAYZINE} "ZINE #${days}" "${HOME}/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html" \
|
||||
|| echo "NO ZINE FOR DAY ${days}"
|
||||
|
||||
|
||||
####################
|
||||
## TW NEWINDEX .... #####
|
||||
##############################################################
|
||||
echo "LOCAL BACKUP + MICROLEDGER TW"
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
[[ -s ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain ]] \
|
||||
&& ZCHAIN=$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain) \
|
||||
&& echo "# CHAIN : ${CURCHAIN} -> ${ZCHAIN}" \
|
||||
&& [[ ${CURCHAIN} != "" && ${ZCHAIN} != "" ]] \
|
||||
&& sed -i "s~${CURCHAIN}~${ZCHAIN}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
##################################################
|
||||
######## UPDATING ${PLAYER}/ipfs/moa/.chain
|
||||
cp ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain \
|
||||
~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats)
|
||||
|
||||
## CLEAN .chain CACHE
|
||||
find ~/.zen/game/players/${PLAYER}/ipfs/moa/ -mtime +30 -type f -exec rm -f '{}' \;
|
||||
|
||||
##########################################
|
||||
## TW IPFS ADD & PUBLISH
|
||||
##########################################
|
||||
TW=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html | tail -n 1)
|
||||
ipfs --timeout 720s name publish --key=${PLAYER} /ipfs/${TW}
|
||||
|
||||
## LOCAL PLAYER CACHING
|
||||
echo ${TW} > ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain
|
||||
echo ${MOATS} > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats
|
||||
|
||||
echo "================================================"
|
||||
echo " NEW TW ${PLAYER} : = ${myIPFS}/ipfs/${TW}"
|
||||
echo " $myIPFSGW/ipns/${ASTRONAUTENS}"
|
||||
echo "================================================"
|
||||
ipfs pin rm ${CURCHAIN}
|
||||
|
||||
######################### REPLACE TW with REDIRECT to latest IPFS or IPNS (reduce 12345 cache size)
|
||||
[[ ! -z ${TW} ]] && TWLNK="/ipfs/${TW}" || TWLNK="/ipns/${ASTRONAUTENS}"
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='${TWLNK}'\" />${PLAYER}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html
|
||||
|
||||
#########################################################
|
||||
##### TW JSON RSS EXPORT
|
||||
###################
|
||||
# REFRESH PLAYER_feed KEY
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ ) RSS"
|
||||
|
||||
#########################################################################################
|
||||
## CREATING 30 DAYS JSON RSS STREAM
|
||||
# [days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]]
|
||||
#########################################################################################
|
||||
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
--output ~/.zen/game/players/${PLAYER}/ipfs \
|
||||
--render '.' "${PLAYER}.rss.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]]'
|
||||
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json ]] \
|
||||
&& echo "NO ${PLAYER} RSS - BAD "
|
||||
|
||||
echo "~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json"
|
||||
|
||||
########################################################
|
||||
#### PLAYER ACCOUNT HAVE NEW TIDDLER or NOT #########
|
||||
if [[ $(cat ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json) == "[]" && "${CURRENT}" != "${PLAYER}" ]]; then
|
||||
echo "ALERT -- RSS IS EMPTY -- COINS=$COINS / ZEN=$ZEN -- $days DAYS"
|
||||
## DEAD PLAYER ??
|
||||
if [[ ${days} -eq 27 ]]; then
|
||||
echo "<html><head><meta charset='UTF-8'>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head><body><h1>🔋WARNING</h1>" > ~/.zen/tmp/alert
|
||||
echo "<br><h3><a href=$(myIpfsGw)/ipfs/${CURCHAIN}> ${PLAYER} TW 🔌📺 </a></h3> 🌥 $ZEN ZEN 🌥 </body></html>" >> ~/.zen/tmp/alert
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/alert "TW ZEN ALERT"
|
||||
echo "<<<< PLAYER TW WARNING <<<< ${DIFF_SECONDS} > ${days} days"
|
||||
fi
|
||||
if [[ ${days} -gt 29 ]]; then
|
||||
#################################### UNPLUG ACCOUNT
|
||||
echo ">>>> PLAYER TW UNPLUG >>>>> ${days} days => BYE BYE ${PLAYER} ZEN=$ZEN"
|
||||
${MY_PATH}/PLAYER.unplug.sh ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ${PLAYER} "ALL"
|
||||
continue
|
||||
fi
|
||||
|
||||
## PAY 1 ZEN TO UMAPG1PUB
|
||||
[[ "${UMAPG1PUB}" != "" ]] \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "0.1" "${UMAPG1PUB}" "UPLANET:TW:${YOUSER}:/ipfs/${TW}"
|
||||
|
||||
else
|
||||
|
||||
### PLAYER ALIVE PUBLISH RSS &
|
||||
FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1)
|
||||
[[ ${FEEDNS} ]] \
|
||||
&& IRSS=$(ipfs add --pin=false -q ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json | tail -n 1) \
|
||||
&& echo "Publishing ${PLAYER}_feed: /ipns/${FEEDNS} => /ipfs/${IRSS}" \
|
||||
&& ipfs --timeout 300s name publish --key="${PLAYER}_feed" /ipfs/${IRSS} \
|
||||
|| echo ">>>>> WARNING ${PLAYER}_feed IPNS KEY PUBLISHING CUT - WARNING"
|
||||
|
||||
fi
|
||||
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${IRSS}'\" />${PLAYER}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}.feed.html
|
||||
|
||||
#########################################################
|
||||
## TODO CREATING 30 DAYS XML RSS STREAM ???
|
||||
## https://talk.tiddlywiki.org/t/has-anyone-generated-an-rss-feed-from-tiddlywiki/966/26
|
||||
# tiddlywiki.js --load my-wiki.html --render "[[$:/plugins/sq/feeds/templates/rss]]" "feed.xml" "text/plain" "$:/core/templates/wikified-tiddler"
|
||||
### $:/plugins/sycom/atom-feed/atom.xml
|
||||
#~ tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
#~ --output ~/.zen/game/players/${PLAYER}/ipfs --render '.' "${PLAYER}.rss.xml" 'text/plain' "$:/core/templates/wikified-tiddler" 'exportFilter' '[days:created[-30]!is[system]!tag[G1Voeu]]'
|
||||
|
||||
|
||||
#################################################
|
||||
################### COPY DATA TO UP LEVEL GRIDS
|
||||
#################################################
|
||||
## SECTOR BANK COORD
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
## REGION
|
||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||
|
||||
echo "(⌐■_■) /UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}"
|
||||
## IPFSNODEID 12345 CACHE UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/RSS/
|
||||
|
||||
cp ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/RSS/
|
||||
#### CREATE ALL JSON COMPILATION
|
||||
${MY_PATH}/../tools/json_dir.all.sh \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/RSS/
|
||||
|
||||
## IPFS PLAYER TW #
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/TW/${PLAYER}
|
||||
# /ipfs/${TW} = /TW/${PLAYER}/index.html
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${TW}'\" />${TODATE}:${PLAYER}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/TW/${PLAYER}/index.html
|
||||
# /ipns/${ASTRONAUTENS} = /TW/${PLAYER}/_index.html
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${ASTRONAUTENS}'\" />${PLAYER}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/TW/${PLAYER}/_index.html
|
||||
## IPNS UMAP _index.html ##
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${UMAPNS}'\" />${TODATE}:_${LAT}_${LON}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_index.html
|
||||
|
||||
ls -al ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON} 2>/dev/null
|
||||
echo "(☉_☉ ) (☉_☉ ) (☉_☉ )"
|
||||
|
||||
#####################################################################
|
||||
## DAY=7 : SEND ${G1LEVEL1} G1 to PLAYER
|
||||
[[ ${days} -eq 7 && "${CURRENT}" != "${PLAYER}" && "${CURRENT}" != "" ]] \
|
||||
&& echo "7 DAY. PLAYER STEP ONE SUCCEED." \
|
||||
&& MIUSER=$(${MY_PATH}/../tools/clyuseryomail.sh "${CURRENT}") \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/.current/secret.dunikey" "${G1LEVEL1}" "${G1PUB}" "UPLANET:WELCOME:${MIUSER}:${YOUSER}" \
|
||||
&& echo "UPLANET:WELCOME:${MIUSER}:${YOUSER}" && echo "(⌐■_■) ~~~ OFFICIAL ~~ _${LAT}_${LON} ~~~ $ASTRONAUTENS"
|
||||
|
||||
#####################################################################
|
||||
############ CURRENT #################### _ForkUPlanetZERO ?
|
||||
if [[ $(echo "$COINS > 100" | bc -l) -eq 1 ]]; then
|
||||
[[ ${CURRENT} == ${PLAYER} ]] && ${MY_PATH}/../ASTROBOT/_ForkUPlanetZERO.sh
|
||||
fi
|
||||
#################################### NEED > 100 G1 ##################
|
||||
#####################################################################
|
||||
#####################################################################
|
||||
|
||||
## MAINTAIN R/RW TW STATE
|
||||
[[ ${ASTRONS} == "" ]] \
|
||||
&& echo "${PLAYER} DISCONNECT" \
|
||||
&& ipfs key rm ${PLAYER} \
|
||||
&& ipfs key rm ${PLAYER}_feed \
|
||||
&& ipfs key rm ${G1PUB}
|
||||
|
||||
## CLEANING CACHE
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
echo
|
||||
|
||||
end=`date +%s`
|
||||
dur=`expr $end - $start`
|
||||
echo "${PLAYER} refreshing took $dur seconds (${MOATS})"
|
||||
|
||||
done
|
||||
echo "============================================ PLAYER.refresh DONE."
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,89 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## UNPLUG A PLAYER FROM ASTROPORT STATION
|
||||
############################################
|
||||
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
||||
|
||||
INDEX="$1"
|
||||
[[ ! -s ${INDEX} ]] && echo "INDEX ${INDEX} NOT FOUND - EXIT -" && exit 1
|
||||
|
||||
PLAYER="$2"
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/secret.dunikey ]] && echo "PLAYER ${PLAYER} NOT FOUND - EXIT -" && exit 1
|
||||
|
||||
ONE="$3"
|
||||
|
||||
## EXPLAIN WHY !
|
||||
SHOUT="$4"
|
||||
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
|
||||
## PLAYER UMAP ?
|
||||
## GET "GPS" TIDDLER
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS' ## GPS Tiddler
|
||||
TWMAPNS=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].umap)
|
||||
LAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
|
||||
[[ $LAT == "null" || $LAT == "" ]] && LAT="0.00"
|
||||
LON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
|
||||
[[ $LON == "null" || $LON == "" ]] && LON="0.00"
|
||||
echo "LAT=${LAT}; LON=${LON}; UMAPNS=${TWMAPNS}"
|
||||
rm ~/.zen/tmp/${MOATS}/GPS.json
|
||||
|
||||
########## SEND COINS TO SECTORG1PUB - ẐEN VIRTUAL BANK - EVERY 800 METERS - ;)
|
||||
LAT=$(makecoord $LAT)
|
||||
LON=$(makecoord $LON)
|
||||
##############################################################
|
||||
## POPULATE UMAP IPNS & G1PUB
|
||||
$($MY_PATH/../tools/getUMAP_ENV.sh ${LAT} ${LON} | tail -n 1)
|
||||
|
||||
## GET COINS
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${SECTORG1PUB} | tail -n 1)
|
||||
echo "SECTOR WALLET = ${COINS} G1 : ${SECTORG1PUB}"
|
||||
|
||||
## UNPLUG => SEND 10 ZEN to SECTORG1PUB
|
||||
## ALL => SEND ALL to $WORLDG1PUB
|
||||
|
||||
ALL="ALL"
|
||||
[[ $ONE == "ONE" ]] && ALL=1
|
||||
[[ $ALL == "ALL" ]] && SECTORG1PUB=${WORLDG1PUB} && echo "DEST = WORLDG1PUB: ${WORLDG1PUB}"
|
||||
|
||||
YOUSER=$(${MY_PATH}/../tools/clyuseryomail.sh ${PLAYER})
|
||||
[[ ! -z ${SECTORG1PUB} ]] \
|
||||
&& echo "> PAY4SURE ZEN:${ALL} WALLET MOVE" \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${ALL}" "${SECTORG1PUB}" "UPLANET:UNPLUG:${YOUSER}:${ALL}"
|
||||
|
||||
## REMOVING PLAYER from ASTROPORT
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub)
|
||||
ipfs key rm "${PLAYER}" "${PLAYER}_feed" "${G1PUB}"
|
||||
for vk in $(ls -d ~/.zen/game/players/${PLAYER}/voeux/*/* 2>/dev/null | rev | cut -d / -f 1 | rev); do
|
||||
echo "removing wish ${vk}"
|
||||
[[ ${vk} != "" ]] && ipfs key rm ${vk}
|
||||
done
|
||||
|
||||
## SEND PLAYER LAST KNOW TW
|
||||
TW=$(ipfs add -Hq ${INDEX} | tail -n 1)
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" "<html><body><h1>Ciao ${PLAYER},</h1> Your TW is unplugged from Astroport : <a href='/ipfs/${TW}'>TW (${TW})</a>.<br>$(cat ~/.zen/game/players/${PLAYER}/secret.june)<br><h3>May the force be with you.</h3></body></html>" "BYE BYE MESSAGE $SHOUT"
|
||||
|
||||
echo "PLAYER IPNS KEYS UNPLUGED"
|
||||
echo "#######################"
|
||||
echo "CLEANING ~/.zen/game/players/${PLAYER}"
|
||||
rm -Rf ~/.zen/game/players/${PLAYER-empty}
|
||||
|
||||
echo "CLEANING NODE CACHE ~/.zen/tmp/${IPFSNODEID-empty}/*/${PLAYER-empty}*"
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID-empty}/*/${PLAYER-empty}*
|
||||
|
||||
echo "CLEANING SESSION CACHE"
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,179 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## REGION REFRESH
|
||||
# UMAP > SECTOR > REGION
|
||||
## Get from 100 sectors tiddlers with more than 2 signatures
|
||||
############################################
|
||||
echo
|
||||
echo
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
echo "# # # # RUNNING REGION.refresh"
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir ~/.zen/tmp/${MOATS}
|
||||
|
||||
## UMAPS list made BY UPLANET.refresh.sh
|
||||
for i in $*; do
|
||||
UMAPS=("$i" ${UMAPS[@]})
|
||||
done
|
||||
|
||||
## NO $i PARAMETERS - GET ALL UMAPS
|
||||
if [[ ${#UMAPS[@]} == 0 ]]; then
|
||||
MEMAPS=($(ls -td ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
||||
UMAPS=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
fi
|
||||
|
||||
######## DETERMINE REGIONS FOR ALL UMAPS ################
|
||||
for UMAP in ${UMAPS[@]}; do
|
||||
|
||||
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
||||
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
||||
|
||||
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
|
||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||
|
||||
MYREGIONS=("_${RLAT}_${RLON}" ${MYREGIONS[@]})
|
||||
|
||||
done
|
||||
|
||||
## GET UNIQ REGIONS LIST
|
||||
REGIONS=($(echo "${MYREGIONS[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
[[ ${REGIONS[@]} == "" ]] && echo "> NO REGION FOUND" && exit 0
|
||||
|
||||
echo "ACTIVATED REGIONS : ${REGIONS[@]}"
|
||||
|
||||
for REGION in ${REGIONS[@]}; do
|
||||
echo "-------------------------------------------------------------------"
|
||||
echo "_____REGION ${REGION} $(date)"
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${REGION}
|
||||
RLAT=$(echo ${REGION} | cut -d '_' -f 2)
|
||||
RLON=$(echo ${REGION} | cut -d '_' -f 3)
|
||||
|
||||
################################## TODO : make sharing key protocol evolve
|
||||
## FOR NOW ONLY 1ST BOOSTRAP PUBLISH REGION KEYS
|
||||
# with bigger planetary swam will be closest "IA Station", or it could be choosen according to ZEN value...
|
||||
STRAPS=($(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | rev | cut -d '/' -f 1 | rev | grep -v '^[[:space:]]*$')) ## ${STRAPS[@]}
|
||||
ACTINGNODE=${STRAPS[0]} ## FIST NODE IN STRAPS
|
||||
if [[ "${ACTINGNODE}" != "${IPFSNODEID}" ]]; then
|
||||
echo ">> ACTINGNODE=${ACTINGNODE} is not ME - CONTINUE -"
|
||||
continue
|
||||
fi
|
||||
##############################################################
|
||||
REGIONG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${REGION}" "${UPLANETNAME}${REGION}")
|
||||
[[ ! ${REGIONG1PUB} ]] && echo "ERROR generating REGION WALLET" && exit 1
|
||||
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${REGIONG1PUB} | tail -n 1)
|
||||
echo "REGION : ${REGION} (${COINS} G1) WALLET : ${REGIONG1PUB}"
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/REGION.priv "${UPLANETNAME}${REGION}" "${UPLANETNAME}${REGION}"
|
||||
ipfs key rm ${REGIONG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
REGIONNS=$(ipfs key import ${REGIONG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/REGION.priv)
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/REGION.priv "${YESTERDATE}${UPLANETNAME}${REGION}" "${YESTERDATE}${UPLANETNAME}${REGION}"
|
||||
ipfs key rm ${YESTERDATE}${REGIONG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
YESTERDATEREGIONNS=$(ipfs key import ${YESTERDATE}${REGIONG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/REGION.priv)
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/REGION.priv "${TODATE}${UPLANETNAME}${REGION}" "${TODATE}${UPLANETNAME}${REGION}"
|
||||
ipfs key rm ${TODATE}${REGIONG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
TODATEREGIONNS=$(ipfs key import ${TODATE}${REGIONG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/REGION.priv)
|
||||
##############################################################
|
||||
## GET from IPNS
|
||||
ipfs --timeout 240s get --progress=false -o ~/.zen/tmp/${MOATS}/${REGION}/ /ipns/${YESTERDATEREGIONNS}/
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
## SHOULD NEED 12 SIGNATURES
|
||||
## FULL REFRESH DEMO... ZEN CHAINING COMING LATER
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${REGION}/RSS
|
||||
rm -f ~/.zen/tmp/${MOATS}/${REGION}/RSS/_${RLAT}_${RLON}.week.rss.json
|
||||
rm -f ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL
|
||||
|
||||
## START WITH LOCAL SECTORS RSS WEEK
|
||||
RSSNODE=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/SECTORS/_${RLAT}*_${RLON}*/_${RLAT}*_${RLON}*/_${RLAT}*_${RLON}*.week.rss.json 2>/dev/null))
|
||||
for RSS in ${RSSNODE[@]}; do
|
||||
[[ $(cat ${RSS}) != "[]" ]] \
|
||||
&& cp ${RSS} ~/.zen/tmp/${MOATS}/${REGION}/RSS/ \
|
||||
&& ${MY_PATH}/../tools/RSS2WEEKnewsfile.sh ${RSS} >> ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL
|
||||
done
|
||||
NL=${#RSSNODE[@]}
|
||||
|
||||
echo "
|
||||
---
|
||||
" >> ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL
|
||||
|
||||
## ADD SWARM SECTORS RSS WEEK
|
||||
RSSWARM=($(ls ~/.zen/tmp/swarm/*/UPLANET/SECTORS/_${RLAT}*_${RLON}*/_${RLAT}*_${RLON}*/_${RLAT}*_${RLON}*.week.rss.json 2>/dev/null))
|
||||
for RSS in ${RSSWARM[@]}; do
|
||||
[[ $(cat ${RSS}) != "[]" ]] \
|
||||
&& cp ${RSS} ~/.zen/tmp/${MOATS}/${REGION}/RSS/ \
|
||||
&& ${MY_PATH}/../tools/RSS2WEEKnewsfile.sh ${RSS} >> ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL
|
||||
done
|
||||
NS=${#RSSWARM[@]}
|
||||
|
||||
## CREATE /.all.json FROM *.rss.json
|
||||
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${MOATS}/${REGION}/RSS
|
||||
|
||||
## REMOVE SECTORS PARTS
|
||||
rm -f ~/.zen/tmp/${MOATS}/${REGION}/RSS/*.week.rss.json
|
||||
|
||||
## MAKE FINAL _${RLAT}_${RLON}.week.rss.json
|
||||
mv ~/.zen/tmp/${MOATS}/${REGION}/RSS/.all.json \
|
||||
~/.zen/tmp/${MOATS}/${REGION}/RSS/_${RLAT}_${RLON}.week.rss.json
|
||||
|
||||
## PREPARING JOURNAL
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/REGIONS/_${RLAT}_${RLON}
|
||||
|
||||
###################################
|
||||
## NODE PUBLISH REGION TODATENS LINK
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATEREGIONNS}'\" />/_${RLAT}_${RLON}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/REGIONS/_${RLAT}_${RLON}/_index.html
|
||||
|
||||
#~ ## DEMO : PREPARE Ask.IA link - PROD will be launched during RUNTIME.
|
||||
#~ echo "<meta http-equiv=\"refresh\" content=\"0; url='https://api.copylaradio.com/tellme/?cid=/ipfs/${RWEEKCID}'\" />" \
|
||||
#~ > ~/.zen/tmp/${MOATS}/${REGION}/Ask.IA._${RLAT}_${RLON}.redir.html
|
||||
|
||||
TOTL=$((${NL}+${NS}))
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
echo "Numbers of REGION WEEK RSS : ${NL} + ${NS} : "${TOTL}
|
||||
|
||||
rm ~/.zen/tmp/${MOATS}/${REGION}/N_* 2>/dev/null
|
||||
|
||||
echo ${TOTL} > ~/.zen/tmp/${MOATS}/${REGION}/N_${TOTL}
|
||||
|
||||
RWEEKCID=$(ipfs add -q ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL 2>/dev/null)
|
||||
if [[ ${RWEEKCID} ]]; then
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/QmYNH85cJCwSVw4c7SyHtc2jtgh7dL5RegozX7e8Re28a9/md.htm?src=/ipfs/${RWEEKCID}'\" />" \
|
||||
> ~/.zen/tmp/${MOATS}/${REGION}/Journal._${RLAT}_${RLON}.view.html
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${REGION}/JOURNAL \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/REGIONS/_${RLAT}_${RLON}/JOURNAL.md
|
||||
fi
|
||||
|
||||
IPFSPOP=$(ipfs add -rwq ~/.zen/tmp/${MOATS}/${REGION}/* | tail -n 1)
|
||||
ipfs --timeout 180s name publish -k ${TODATE}${REGIONG1PUB} /ipfs/${IPFSPOP}
|
||||
|
||||
|
||||
ipfs key rm ${REGIONG1PUB} ${YESTERDATE}${REGIONG1PUB} > /dev/null 2>&1
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,282 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
# INSERT NEW TIDDLERS FROM RSS JSON INTO UPLANET TW
|
||||
# DETECTING CONFLICT WITH SAME TITLE
|
||||
# ASKING TO EXISTING SIGNATURES TO UPDATE THEIR TW OR FORK TITLE
|
||||
# CALLED BY "SECTOR.refresh.sh"
|
||||
# SEND 10 ZEN TO EACH SIGNATURE
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
|
||||
RSS=$1 ## filepath to RSS
|
||||
SECTOR=$2 ## Sector identifier _0.0_0.0
|
||||
MOATS=$3 ## temp cache access
|
||||
INDEX=$4 ## SECTOR TW index file
|
||||
|
||||
echo
|
||||
|
||||
[[ ! -s ${RSS} ]] && echo "BAD RSS INPUT" && exit 1
|
||||
[[ "$(cat ${RSS})" == "[]" ]] && echo "EMPTY RSS " && exit 0
|
||||
|
||||
[[ ! -d ~/.zen/tmp/${MOATS}/${SECTOR}/ ]] && echo "- ERROR - BAD UPLANET CONTEXT - look inside code - " && exit 1
|
||||
[[ ! -s ${INDEX} ]] \
|
||||
&& sed "s~_SECTOR_~${SECTOR}~g" ${MY_PATH}/../templates/twsector.html > ${INDEX} \
|
||||
&& echo "- WARNING - REFRESHING SECTOR FROM empty TEMPLATE *****"
|
||||
|
||||
## EXTRACT PLAYER FROM RSS FILE NAME
|
||||
PLAYER=$(echo ${RSS} | rev | cut -d '/' -f 1 | rev | sed "s~.rss.json~~g")
|
||||
## GET PLAYER INFORMATION
|
||||
$($MY_PATH/../tools/search_for_this_email_in_players.sh ${PLAYER})
|
||||
echo "export ASTROPORT=${ASTROPORT} ASTROTW=${ASTROTW} ASTROG1=${ASTROG1} ASTROMAIL=${EMAIL} ASTROFEED=${FEEDNS}"
|
||||
|
||||
echo "======= ${INDEX} =======
|
||||
SECTOR ${SECTOR} TW INSERTING ${PLAYER}
|
||||
${RSS}
|
||||
=================================================================="
|
||||
cat "${RSS}" | jq 'sort_by(.created) | reverse | .[]' | jq -r '.title' > ~/.zen/tmp/${MOATS}/${SECTOR}/tiddlers.list
|
||||
##
|
||||
gloops=0
|
||||
signatures=0
|
||||
|
||||
while read title; do
|
||||
|
||||
[[ ${floop} -gt 1 ]] && echo "Other Tiddlers are similaR... BREAK LOOP" && break
|
||||
|
||||
# FILTER "UPPERCASE" + Astroport Tid, less than 4 characters title Tiddlers (ex: GPS, ...).
|
||||
[[ ${title} == "GettingStarted" || "${title^^}" == "${title}" || "${title::3}" == '$:/' || ${title::4} == ${title} || ${title} == "AstroID" || ${title} == "Voeu1.png" || ${title} == "Astroport" || ${title} == "MadeInZion" || ${title} == "G1Visa" || ${title} == "ZenCard" || ${title::5} == "Draft" ]] \
|
||||
&& echo "FILTERED TITLE ${title}" && continue
|
||||
|
||||
## CHECK FOR TIDDLER WITH SAME TITTLE IN SECTOR TW
|
||||
rm -f ~/.zen/tmp/${MOATS}/TMP.json
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${MOATS} --render '.' 'TMP.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${title}"
|
||||
ISHERE=$(cat ~/.zen/tmp/${MOATS}/TMP.json | jq -r ".[].title")
|
||||
|
||||
[[ ! "${ISHERE}" ]] && echo "No Tiddler found in ${INDEX}"
|
||||
|
||||
TMPTAGS=$(cat ~/.zen/tmp/${MOATS}/TMP.json | jq -r .[].tags)
|
||||
TMPEMAILS=($(echo "$TMPTAGS" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
TMPSIGN=${#TMPEMAILS[@]}
|
||||
#~ echo "INSIDE TIDDLER HAVE ${TMPSIGN} SIGNATURE(S)"
|
||||
|
||||
if [[ "${ISHERE}" != "${title}" || ${TMPSIGN} == 0 ]]; then
|
||||
|
||||
## NEW TIDDLER
|
||||
echo "Importing Title: $title"
|
||||
cat "${RSS}" | jq -rc ".[] | select(.title == \"$title\")" > ~/.zen/tmp/${MOATS}/NEW.json
|
||||
|
||||
#~ echo "DEBUG"
|
||||
#~ cat ~/.zen/tmp/${MOATS}/NEW.json | jq
|
||||
#~ echo "tiddlywiki --load ${INDEX} --import ~/.zen/tmp/${MOATS}/NEW.json 'application/json' --output ~/.zen/tmp/${MOATS}/${SECTOR} --render '$:/core/save/all' '"${SECTOR}.html"' 'text/plain'"
|
||||
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import ~/.zen/tmp/${MOATS}/NEW.json 'application/json' \
|
||||
--output ~/.zen/tmp/${MOATS}/${SECTOR} --render '$:/core/save/all' "${SECTOR}.html" 'text/plain'
|
||||
|
||||
[[ -s ~/.zen/tmp/${MOATS}/${SECTOR}/${SECTOR}.html ]] \
|
||||
&& rm ${INDEX} \
|
||||
&& mv ~/.zen/tmp/${MOATS}/${SECTOR}/${SECTOR}.html ${INDEX} \
|
||||
&& ((gloops++)) \
|
||||
&& echo "GLOOPS (${gloops}) : ${title}" \
|
||||
&& signatures=$((signatures + TMPSIGN))
|
||||
|
||||
[[ ! -s ${INDEX} ]] && echo "ERROR. TW could not ingest ~/.zen/tmp/${MOATS}/NEW.json" && exit 1
|
||||
|
||||
else
|
||||
|
||||
## SAME TIDDLER
|
||||
echo "TIDDLER : $title (${TMPSIGN} signature(s)) ... ALREADY EXISTS..."
|
||||
|
||||
## Remove [] and put inline to compare
|
||||
cat ~/.zen/tmp/${MOATS}/TMP.json | jq -rc .[] > ~/.zen/tmp/${MOATS}/INSIDE.json
|
||||
cat "${RSS}" | jq -rc ".[] | select(.title == \"$title\")" > ~/.zen/tmp/${MOATS}/NEW.json
|
||||
|
||||
if [[ $(diff ~/.zen/tmp/${MOATS}/NEW.json ~/.zen/tmp/${MOATS}/INSIDE.json) == "" ]]; then
|
||||
echo "... Tiddlers are similar ..."
|
||||
((floop++))
|
||||
continue
|
||||
fi
|
||||
floop=1
|
||||
## LOG TIDDLERS
|
||||
#~ echo
|
||||
#~ echo "=========== INSIDE.json"
|
||||
#~ cat ~/.zen/tmp/${MOATS}/INSIDE.json | jq -c
|
||||
#~ echo
|
||||
#~ echo "=========== NEW.json"
|
||||
#~ cat ~/.zen/tmp/${MOATS}/NEW.json | jq -c
|
||||
#~ echo
|
||||
## TODO EXTEND CONTROL TO text & ipfs & _canonical_url
|
||||
## NEED SIGNATURES & TIDDLER SIMILARITY TO COME UP
|
||||
|
||||
## CHECK FOR EMAIL SIGNATURES DIFFERENCE
|
||||
NTAGS=$(cat ~/.zen/tmp/${MOATS}/NEW.json | jq -r .tags)
|
||||
NEMAILS=($(echo "$NTAGS" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
NSIGN=${#NEMAILS[@]}
|
||||
echo "New Tiddler $NSIGN signatures : ${NEMAILS[*]}"
|
||||
|
||||
ITAGS=$(cat ~/.zen/tmp/${MOATS}/INSIDE.json | jq -r .tags)
|
||||
IEMAILS=($(echo "$ITAGS" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"))
|
||||
ISIGN=${#IEMAILS[@]}
|
||||
echo "Inside Tiddler $ISIGN signatures : ${IEMAILS[*]}"
|
||||
|
||||
## New should have more signatures than Inside
|
||||
[[ ${NSIGN} -le ${ISIGN} ]] && echo "Most signed already in..." && continue
|
||||
## UPLANET GRID COLLISION PARAM ###
|
||||
# [[ ${NSIGN} -le 3 ]] && update TW OR continue
|
||||
# https://www.copylaradio.com/blog/blog-1/post/decentralized-information-ecosystem-51
|
||||
|
||||
if [[ "${NEMAILS[*]}" != "${IEMAILS[*]}" ]]; then
|
||||
|
||||
## SEARCH FOR DIFFERENCE IN EMAIL SIGNATURES TAGS
|
||||
COMMON=(); NUNIQUE=(); IUNIQUE=()
|
||||
|
||||
# Detect common and unique elements
|
||||
for email in "${NEMAILS[@]}"; do
|
||||
if [[ " ${IEMAILS[*]} " == *" $email "* ]]; then
|
||||
COMMON+=("$email")
|
||||
else
|
||||
NUNIQUE+=("$email")
|
||||
fi
|
||||
done
|
||||
|
||||
for email in "${IEMAILS[@]}"; do
|
||||
if [[ " ${NEMAILS[*]} " != *" $email "* ]]; then
|
||||
IUNIQUE+=("$email")
|
||||
fi
|
||||
done
|
||||
|
||||
# Print the results
|
||||
echo "Common email addresses : ${COMMON[*]}"
|
||||
echo "Email addresses unique in NEW Tiddler : ${NUNIQUE[*]}"
|
||||
echo "Email addresses unique in INSIDE Tiddler : ${IUNIQUE[*]}"
|
||||
|
||||
combined=("${IEMAILS[@]}" "${NEMAILS[@]}")
|
||||
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
NEWTID=$(ipfs add -q ~/.zen/tmp/${MOATS}/NEW.json | tail -n 1)
|
||||
INSIDETID=$(ipfs add -q ~/.zen/tmp/${MOATS}/INSIDE.json | tail -n 1)
|
||||
|
||||
###############################
|
||||
## TODO : check STAR level and activate auto merge
|
||||
|
||||
for email in "${unique_combined[@]}"; do
|
||||
|
||||
echo "<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style></head>
|
||||
<body>
|
||||
<h1>$(date)</h1>
|
||||
|
||||
<h2>$title</h2>
|
||||
Tiddler appears in <b>${unique_combined[*]}</b> TW(s)
|
||||
<br>
|
||||
<ul>
|
||||
<li><a href='$(myIpfsGw)/ipfs/${INSIDETID}'>Actual Tiddler</a></li>
|
||||
<li><a href='$(myIpfsGw)/ipfs/${NEWTID}'>NEW Tiddler</a> being overwrite by ${NUNIQUE[*]}</li>
|
||||
</ul>
|
||||
<h2><a href='$(myIpfsGw)${VDONINJA}/?room=${MOATS}'>Record VISIO for this event...</a></h2>
|
||||
</body></html>" > ~/.zen/tmp/${MOATS}/g1message
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "$email" ~/.zen/tmp/${MOATS}/g1message "Upgrade Tiddler : ${title}"
|
||||
|
||||
done
|
||||
|
||||
## SEND ZEN G1PalPay Signal
|
||||
|
||||
#~ ##############################################################
|
||||
#~ G1AMOUNT=$(echo "$NSIGN / 10" | bc -l | xargs printf "%.2f" | sed "s~,~.~g" )
|
||||
#~ G1AMOUNT=$NSIGN ## SEND FLUID COIN
|
||||
#~ echo "***** SECTOR $SECTOR REWARD *****************"
|
||||
#~ echo "SPREAD $NSIGN G1 TO ${unique_combined[@]} SIGNATURES
|
||||
#~ to ${PLAYER} WALLET ${ASTROG1}"
|
||||
#~ echo "************************************************************"
|
||||
#~ ${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/sector.dunikey "${$G1AMOUNT}" "${ASTROG1}" "${unique_combined[@]}"
|
||||
#~ ################################################ GRATITUDE SENT
|
||||
|
||||
## AND OVER WRITE TIDDLER...
|
||||
|
||||
|
||||
else
|
||||
|
||||
echo "SIGNATURES ARE THE SAME : ${NEMAILS[*]}"
|
||||
|
||||
fi
|
||||
|
||||
echo "______________________"
|
||||
#~ echo "CHECKING DIFFERENCES"
|
||||
#~ diff ~/.zen/tmp/${MOATS}/NEW.json ~/.zen/tmp/${MOATS}/INSIDE.json
|
||||
|
||||
## TODO CHECK MORE DIFFERENCE
|
||||
DATENEW=$(cat ~/.zen/tmp/${MOATS}/NEW.json | jq -r .modified)
|
||||
TEXTNEW=$(cat ~/.zen/tmp/${MOATS}/NEW.json | jq -r .text)
|
||||
TAGSNEW=$(cat ~/.zen/tmp/${MOATS}/NEW.json | jq -r .tags)
|
||||
DATEINSIDE=$(cat ~/.zen/tmp/${MOATS}/INSIDE.json | jq -r .modified)
|
||||
TEXTINSIDE=$(cat ~/.zen/tmp/${MOATS}/INSIDE.json | jq -r .text)
|
||||
TAGSINSIDE=$(cat ~/.zen/tmp/${MOATS}/INSIDE.json | jq -r .tags)
|
||||
|
||||
TIDLEREMAILSNEW=($(echo "$TAGSNEW" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b")) ## MUST BE SAME IN BOTH
|
||||
TIDLEREMAILSINSIDE=($(echo "$TAGSINSIDE" | grep -E -o "\b[a-zA-Z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b")) ## MUST BE SAME IN BOTH
|
||||
# [[ "${TIDLEREMAILSNEW[*]}" == "${TIDLEREMAILSINSIDE[*]}" ]]
|
||||
|
||||
if [ ${DATENEW} -gt ${DATEINSIDE} ]; then
|
||||
|
||||
echo "Newer Tiddler version... Updating SECTOR TW"
|
||||
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import ~/.zen/tmp/${MOATS}/NEW.json "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "${SECTOR}.html" "text/plain"
|
||||
|
||||
[[ -s ~/.zen/tmp/${MOATS}/${SECTOR}.html ]] \
|
||||
&& rm ${INDEX} \
|
||||
&& mv ~/.zen/tmp/${MOATS}/${SECTOR}.html ${INDEX} \
|
||||
|| ((gloops--))
|
||||
|
||||
signatures=$((signatures + ISIGN))
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
## CLEANING
|
||||
rm ~/.zen/tmp/${MOATS}/INSIDE.json 2>/dev/null
|
||||
rm ~/.zen/tmp/${MOATS}/TMP.json 2>/dev/null
|
||||
rm ~/.zen/tmp/${MOATS}/NEW.json 2>/dev/null
|
||||
|
||||
done < ~/.zen/tmp/${MOATS}/${SECTOR}/tiddlers.list
|
||||
|
||||
####################################################
|
||||
################################################ ${signatures} -gt ${gloops}
|
||||
## SECTOR SENDS GRATITUDE TO PUBLISHING PLAYER
|
||||
###################################################
|
||||
|
||||
#~ if [[ ${gloops} -gt 0 && ${signatures} -gt ${gloops} && ${ASTROG1} ]]; then
|
||||
#~ # GENERATE SECTOR PRIVATE KEY ################################
|
||||
#~ ${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/sector.dunikey "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}"
|
||||
#~ G1SECTOR=$(cat ~/.zen/tmp/${MOATS}/sector.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
|
||||
#~ cp -f ~/.zen/tmp/coucou/${G1SECTOR}.COINS ~/.zen/tmp/${IPFSNODEID}/${SECTOR}.COINS
|
||||
|
||||
#~ ##############################################################
|
||||
#~ GRATITUDE=$($MY_PATH/../tools/getcoins_from_gratitude_box.sh)
|
||||
#~ G1AMOUNT=$(echo "$GRATITUDE / 10" | bc -l | xargs printf "%.2f" | sed "s~,~.~g" )
|
||||
#~ echo "***** SECTOR $SECTOR REWARD *****************"
|
||||
#~ echo "GRATITUDE ${GRATITUDE} ZEN = ${G1AMOUNT} G1
|
||||
#~ to ${PLAYER} WALLET ${ASTROG1} (${gloops} Tiddlers)"
|
||||
#~ echo "************************************************************"
|
||||
#~ ${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/sector.dunikey "${G1AMOUNT}" "${ASTROG1}" "THANKS ${gloops} GLOOPS"
|
||||
#~ ################################################ GRATITUDE SENT
|
||||
#~ fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,402 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
start=`date +%s`
|
||||
## SECTOR REFRESH
|
||||
# SHARE & UPDATE IPNS TOGETHER
|
||||
############################################
|
||||
echo
|
||||
echo
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
echo "> RUNNING SECTOR.refresh"
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir ~/.zen/tmp/${MOATS}
|
||||
|
||||
## UMAPS list made BY UPLANET.refresh.sh
|
||||
for i in $*; do
|
||||
UMAPS=("$i" ${UMAPS[@]})
|
||||
done
|
||||
|
||||
## NO $i PARAMETERS - GET ALL UMAPS
|
||||
if [[ ${#UMAPS[@]} == 0 ]]; then
|
||||
MEMAPS=($(ls -td ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
||||
UMAPS=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
fi
|
||||
######## INIT SECTORS ########################
|
||||
for UMAP in ${UMAPS[@]}; do
|
||||
|
||||
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
||||
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
||||
|
||||
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
|
||||
MYSECTORS=("_${SLAT}_${SLON}" ${MYSECTORS[@]})
|
||||
|
||||
done
|
||||
|
||||
## GET UNIQ SECTORS LIST
|
||||
SECTORS=($(echo "${MYSECTORS[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
[[ ${SECTORS[@]} == "" ]] && echo "> NO SECTOR FOUND" && exit 0
|
||||
#########################################################""
|
||||
echo "ACTIVATED SECTORS : ${SECTORS[@]}"
|
||||
|
||||
for SECTOR in ${SECTORS[@]}; do
|
||||
echo "############################################"
|
||||
echo "_____SECTOR ${SECTOR}"
|
||||
echo "################################ $(date)"
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/
|
||||
SLAT=$(echo ${SECTOR} | cut -d '_' -f 2)
|
||||
SLON=$(echo ${SECTOR} | cut -d '_' -f 3)
|
||||
|
||||
##############################################################
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}"
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[[ ! ${G1PUB} ]] && echo "ERROR generating SECTOR WALLET" && exit 1
|
||||
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
||||
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${SECTOR}.priv "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}"
|
||||
ipfs key rm ${G1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
SECTORNS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${SECTOR}.priv)
|
||||
|
||||
echo "___ ORIGIN ___ ${myIPFS}/ipns/${SECTORNS}/"
|
||||
echo "SECTOR : ${SECTOR} (${COINS} G1 <=> ${ZEN} ZEN) : ${G1PUB}"
|
||||
|
||||
###################### SPATIO TEMPORAL KEYS
|
||||
## YESTERDATE ###############
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv "${YESTERDATE}${UPLANETNAME}${SECTOR}" "${YESTERDATE}${UPLANETNAME}${SECTOR}"
|
||||
ipfs key rm ${YESTERDATE}${G1PUB} > /dev/null 2>&1
|
||||
YESTERDATENS=$(ipfs key import ${YESTERDATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv)
|
||||
echo "YESTERDAY : ${myIPFS}/ipns/${YESTERDATENS}"
|
||||
|
||||
## TODATE #########################################
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${TODATE}.priv "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}"
|
||||
ipfs key rm ${TODATE}${G1PUB} > /dev/null 2>&1
|
||||
TODATENS=$(ipfs key import ${TODATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${TODATE}.priv)
|
||||
echo "TODAY : ${myIPFS}/ipns/${TODATENS}"
|
||||
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
start=`date +%s`
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
#~ ## IPFS GET ONLINE YESTERDATE SECTORNS
|
||||
ipfs --timeout 180s get --progress=false -o ~/.zen/tmp/${MOATS}/${SECTOR}/ /ipns/${YESTERDATENS}/
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "(╥☁╥ ) swarm memory empty (╥☁╥ )"
|
||||
# Try retieve memory from UPlanet ZEN Memory
|
||||
[[ ${ZEN} -gt 0 ]] \
|
||||
&& echo "INTERCOM Refreshing from ZEN MEMORY" \
|
||||
&& ${MY_PATH}/../RUNTIME/ZEN.SECTOR.memory.sh "${SECTOR}" "${MOATS}" "${G1PUB}"
|
||||
fi
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
end=`date +%s`
|
||||
echo "_____SECTOR${SECTOR} GET time was "`expr $end - $start` seconds.
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
### SHOW ${SECTOR}
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${SECTOR}/${SECTOR}
|
||||
## CONTROL CHAIN TIME
|
||||
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_chain | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
||||
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_moats 2>/dev/null)
|
||||
[[ ${ZCHAIN} && ${ZMOATS} ]] \
|
||||
&& cp ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_chain ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_chain.${ZMOATS} \
|
||||
&& echo "UPDATING MOATS ${MOATS}"
|
||||
|
||||
MOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${MOATS})
|
||||
ZMOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${ZMOATS})
|
||||
DIFF_SECONDS=$((MOATS_SECONDS - ZMOATS_SECONDS))
|
||||
hours=$((DIFF_SECONDS / 3600))
|
||||
minutes=$(( (DIFF_SECONDS % 3600) / 60 ))
|
||||
seconds=$((DIFF_SECONDS % 60))
|
||||
echo "SECTOR DATA is ${hours} hours ${minutes} minutes ${seconds} seconds OLD"
|
||||
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
## CONTROL ACTINGNODE : BOOSTRAP DISTRIBUTED (jeu du mouchoir, token ring aléatoire)
|
||||
UREFRESH="${HOME}/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/SECTOR.refresher"
|
||||
ALLNODES=($(cat ${UREFRESH} | grep -v '^[[:space:]]*$' 2>/dev/null)) # ${ALLNODES[@]} without empty line
|
||||
STRAPS=($(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | rev | cut -d '/' -f 1 | rev | grep -v '^[[:space:]]*$')) ## ${STRAPS[@]}
|
||||
|
||||
if [[ ${ALLNODES[@]} == "" ]]; then
|
||||
for STRAP in ${STRAPS[@]}; do
|
||||
echo ${STRAP} >> ${UREFRESH} ## FILL SECTOR.refresher file with all STRAPS
|
||||
done
|
||||
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
||||
fi
|
||||
|
||||
ACTINGNODE=${ALLNODES[0]} ## FIST NODE IN SECTOR.refresher
|
||||
|
||||
## IN CASE OLD BOOSTRAP IS STILL IN CHARGE - CHOOSE 1ST STRAP -
|
||||
[[ ! $(echo ${STRAPS[@]} | grep ${ACTINGNODE}) ]] && ACTINGNODE=${STRAPS[0]}
|
||||
|
||||
## IF NOT UPDATED FOR TOO LONG : STRAPS[0] get key control
|
||||
[ ${DIFF_SECONDS} -gt $(( 26 * 60 * 60 )) ] \
|
||||
&& echo ">>>>>>>>>>>>>> More than 26H update - BOOSTRAP 0 ACTION -" \
|
||||
&& ACTINGNODE=${STRAPS[0]}
|
||||
|
||||
echo "* ACTINGNODE=${ACTINGNODE}"
|
||||
|
||||
if [[ "${ACTINGNODE}" != "${IPFSNODEID}" ]]; then
|
||||
echo ">> ACTINGNODE NOT ME - CONTINUE -"
|
||||
ipfs key rm "${TODATE}${G1PUB}" "${YESYERDATE}${G1PUB}" "${G1PUB}"
|
||||
echo "------8<-------------8<------------------8<-----------------8<-----------------8<"
|
||||
continue
|
||||
fi
|
||||
### NEXT REFRESHER SHUFFLE
|
||||
rm ${UREFRESH}
|
||||
for STRAP in ${STRAPS[@]}; do
|
||||
echo ${STRAP} >> ${UREFRESH} ## RESET SECTOR.refresher file with actual STRAPS
|
||||
done
|
||||
# SHUFFLE UMAP.refresher
|
||||
cat ${UREFRESH} | sort | uniq | shuf > ${UREFRESH}.shuf
|
||||
mv ${UREFRESH}.shuf ${UREFRESH}
|
||||
echo "SETTING NEXT REFRESHER : $(cat ${UREFRESH} | head -n 1)"
|
||||
|
||||
############ 101 ZEN (11.1 G1) REFILL ?!
|
||||
CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev)
|
||||
[[ ${COINS} == "" || ${COINS} == "null" ]] \
|
||||
&& [[ ${ZEN} -lt 100 && ${CURRENT} != "" ]] \
|
||||
&& MIUSER=$(${MY_PATH}/../tools/clyuseryomail.sh "${CURRENT}") \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/.current/secret.dunikey" "11.1" "${G1PUB}" "UPLANET:101ZEN:${SECTOR}:${MIUSER}" \
|
||||
&& echo "UPLANET:101:${SECTOR}:${MIUSER}" && echo " ~~~ (♥‿‿♥) ~~ ${SECTOR} ~~ (♥‿‿♥) ~~~ "
|
||||
|
||||
##############################################################
|
||||
## FEED SECTOR TW WITH UMAPS RSS
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${SECTOR}/TW
|
||||
INDEX="${HOME}/.zen/tmp/${MOATS}/${SECTOR}/TW/index.html"
|
||||
|
||||
## NEW TW TEMPLATE
|
||||
[[ ! -s ${INDEX} ]] \
|
||||
&& sed "s~_SECTOR_~${SECTOR}~g" ${MY_PATH}/../templates/twsector.html > ${INDEX} \
|
||||
&& echo "REFRESHING SECTOR FROM empty TEMPLATE *****" \
|
||||
&& [[ ${IPFSNODEID} != ${STRAPS[0]} ]] && echo "1ST BOOSTRAP JOB" && continue
|
||||
|
||||
## SET SECTOR
|
||||
sed -i "s~_SECTOR_~${SECTOR}~g" ${INDEX}
|
||||
|
||||
## REFRESH ALL TWs in that SECTOR
|
||||
rm -Rf ~/.zen/tmp/${MOATS}/${SECTOR}/TWz
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${SECTOR}/TWz
|
||||
|
||||
cp -rf ~/.zen/tmp/swarm/12D*/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/TW/* \
|
||||
~/.zen/tmp/${MOATS}/${SECTOR}/TWz
|
||||
cp -rf ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/TW/* \
|
||||
~/.zen/tmp/${MOATS}/${SECTOR}/TWz 2>/dev/null
|
||||
|
||||
## GET ALL RSS json's AND Feed SECTOR TW with it
|
||||
RSSNODE=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/RSS/*.rss.json 2>/dev/null))
|
||||
NL=${#RSSNODE[@]}
|
||||
|
||||
RSSWARM=($(ls ~/.zen/tmp/swarm/12D*/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/RSS/*.rss.json 2>/dev/null))
|
||||
NS=${#RSSWARM[@]}
|
||||
|
||||
combinedrss=("${RSSNODE[@]}" "${RSSWARM[@]}")
|
||||
RSSALL=($(echo "${combinedrss[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${SECTOR}/RSS
|
||||
rm -f ~/.zen/tmp/${MOATS}/${SECTOR}/RSS/_all.json
|
||||
|
||||
#################### RSS2UPlanetSECTORTW #########################
|
||||
############################ TRANSFER SIGNED TIDDLER IN SECTOR TW
|
||||
for RSS in ${RSSALL[@]}; do
|
||||
############################################################
|
||||
## Extract New Tiddlers and maintain fusion in Sector TW.
|
||||
############################################################
|
||||
${MY_PATH}/RSS2UPlanetSECTORTW.sh "${RSS}" "${SECTOR}" "${MOATS}" "${INDEX}"
|
||||
############################################################
|
||||
## create sector RSS _all.json
|
||||
cat ${RSS} >> ~/.zen/tmp/${MOATS}/${SECTOR}/RSS/_all.json
|
||||
############################################################
|
||||
done
|
||||
TOTL=$((${NL}+${NS}))
|
||||
##############################################################
|
||||
|
||||
# Update COIN & ZEN value
|
||||
echo ${COINS} > ~/.zen/tmp/${MOATS}/${SECTOR}/COINS
|
||||
echo ${ZEN} > ~/.zen/tmp/${MOATS}/${SECTOR}/ZEN
|
||||
|
||||
echo "Number of RSS : "${TOTL}
|
||||
echo ${TOTL} > ~/.zen/tmp/${MOATS}/${SECTOR}/N
|
||||
|
||||
###########################################################################################
|
||||
## MAKE SECTOR PLANET WITH ASTONAUTENS LINKS
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
## PREPARE Ŋ1 WORLD MAP ##################################################################
|
||||
echo "var examples = {};
|
||||
examples['locations'] = function() {
|
||||
var locations = {
|
||||
" > ~/.zen/tmp/world.js
|
||||
floop=1
|
||||
|
||||
SWARMTW=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/TW/*/index.html 2>/dev/null))
|
||||
NODETW=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_${SLAT}_${SLON}/_*_*/TW/*/index.html 2>/dev/null))
|
||||
TWFILES=("${SWARMTW[@]}" "${NODETW[@]}")
|
||||
|
||||
for TWRED in ${TWFILES[@]}; do
|
||||
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
||||
TWADD=$(cat ${TWRED} | grep -o "/ipns/[^\"]*" | sed "s/'$//")
|
||||
[[ -z ${TWADD} ]] && TWADD=$(cat ${TWRED} | grep -o "/ipfs/[^\"]*" | sed "s/'$//")
|
||||
|
||||
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
|
||||
echo "${floop}: {
|
||||
alpha: Math.random() * 2 * Math.PI,
|
||||
delta: Math.random() * 2 * Math.PI,
|
||||
name: '"${ZMAIL}"',
|
||||
link: '"${TWADD}"'
|
||||
}
|
||||
," >> ~/.zen/tmp/world.js
|
||||
|
||||
((floop++))
|
||||
done
|
||||
|
||||
# REMOVE la dernière virgule
|
||||
sed -i '$ d' ~/.zen/tmp/world.js
|
||||
##################################
|
||||
## FINISH LOCATIONS
|
||||
echo "
|
||||
};
|
||||
\$('#sphere').earth3d({
|
||||
locationsElement: \$('#locations'),
|
||||
dragElement: \$('#locations'),
|
||||
locations: locations
|
||||
});
|
||||
};
|
||||
" >> ~/.zen/tmp/world.js
|
||||
|
||||
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
|
||||
echo "JSON WISH WORLD READY /ipfs/${IAMAP}/world.js"
|
||||
|
||||
###########################################################################################
|
||||
## ADD SECTOR ZENPUB.png & INFO.png
|
||||
convert -font 'Liberation-Sans' \
|
||||
-pointsize 80 -fill purple -draw 'text 50,120 "'"${ZEN} Zen"'"' \
|
||||
-pointsize 30 -fill purple -draw 'text 40, 180 "'"${SECTOR}:${YESTERDATE}"'"' \
|
||||
$MY_PATH/../images/G1WorldMap.png "${HOME}/.zen/tmp/${MOATS}/${SECTOR}.png"
|
||||
# CREATE G1PUB AMZQR
|
||||
amzqr ${G1PUB} -l H -p "$MY_PATH/../images/zenticket.png" -c -n ZENPUB.png -d ~/.zen/tmp/${MOATS}/${SECTOR}/
|
||||
convert ~/.zen/tmp/${MOATS}/${SECTOR}/ZENPUB.png -resize 250 ~/.zen/tmp/${MOATS}/ZENPUB.png
|
||||
# ADD IT
|
||||
composite -compose Over -gravity NorthEast -geometry +0+0 ~/.zen/tmp/${MOATS}/ZENPUB.png ~/.zen/tmp/${MOATS}/${SECTOR}.png ~/.zen/tmp/${MOATS}/${SECTOR}/INFO.png
|
||||
|
||||
## zday marking
|
||||
rm ~/.zen/tmp/${MOATS}/${SECTOR}/z* 2>/dev/null
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />${TODATE} ${SECTOR}" > ~/.zen/tmp/${MOATS}/${SECTOR}/z$(date +%A-%d_%m_%Y).html
|
||||
|
||||
###########################################################################################
|
||||
### APPLY ON APP MODEL TODATE REGIONNS LINKING
|
||||
RLAT=$(echo ${SLAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${SLON} | cut -d '.' -f 1)
|
||||
REGION="_${RLAT}_${RLON}"
|
||||
TODATEREGIONNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${REGION}" "${TODATE}${UPLANETNAME}${REGION}")
|
||||
REGIONG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${TODATE}${UPLANETNAME}${REGION}" "${TODATE}${UPLANETNAME}${REGION}")
|
||||
|
||||
PHONEBOOTH="${G1PUB::30}"
|
||||
cat ${MY_PATH}/../templates/UPlanetSector/index.html \
|
||||
| sed -e "s~_ZONE_~SECTOR ${SECTOR}~g" \
|
||||
-e "s~_UPZONE_~REGION ${REGION}~g" \
|
||||
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
||||
-e "s~_ZONENS_~${TODATENS}~g" \
|
||||
-e "s~_ZCHAIN_~${ZCHAIN}~g" \
|
||||
-e "s~_UPZONENS_~${TODATEREGIONNS}~g" \
|
||||
-e "s~_SECTORG1PUB_~${G1PUB}~g" \
|
||||
-e "s~_IPFSNINJA_~${VDONINJA}~g" \
|
||||
-e "s~_CESIUMIPFS_~${CESIUMIPFS}~g" \
|
||||
-e "s~_HACKGIPFS_~${HACKGIPFS}~g" \
|
||||
-e "s~_PHONEBOOTH_~${PHONEBOOTH}~g" \
|
||||
-e "s~_LAT_~${SLAT}~g" \
|
||||
-e "s~_LON_~${SLON}~g" \
|
||||
-e "s~_EARTHCID_~${EARTHCID}~g" \
|
||||
-e "s~_ZCHAIN_~${ZCHAIN}~g" \
|
||||
-e "s~_DATE_~$(date +%A-%d_%m_%Y)~g" \
|
||||
-e "s~_UPLANETLINK_~${EARTHCID}/map_render.html\?southWestLat=${RLAT}\&southWestLon=${RLON}\°=1~g" \
|
||||
-e "s~http://127.0.0.1:8080~~g" \
|
||||
> ~/.zen/tmp/${MOATS}/${SECTOR}/_index.html
|
||||
|
||||
##################################
|
||||
cp -f ~/.zen/tmp/${MOATS}/${SECTOR}/_index.html ~/.zen/tmp/${MOATS}/${SECTOR}/index.html
|
||||
rm ~/.zen/tmp/${MOATS}/${SECTOR}/index.html ## MAKE SECTOR VISIBLE ##
|
||||
###################################################### CHAINING BACKUP
|
||||
IPFSPOP=$(ipfs add -rwq ~/.zen/tmp/${MOATS}/${SECTOR}/* | tail -n 1)
|
||||
|
||||
################
|
||||
## DOES CHAIN CHANGED or INIT ?
|
||||
[[ ${ZCHAIN} != ${IPFSPOP} || ${ZCHAIN} == "" ]] \
|
||||
&& echo "${MOATS}:${IPFSNODEID}:${IPFSPOP}" > ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_chain \
|
||||
&& echo "${MOATS}" > ~/.zen/tmp/${MOATS}/${SECTOR}/CHAIN/_moats \
|
||||
&& IPFSPOP=$(ipfs add -rwq ~/.zen/tmp/${MOATS}/${SECTOR}/* | tail -n 1) && echo "ROOT was ${ZCHAIN}"
|
||||
######################################################
|
||||
## ZEN CHAINING
|
||||
# Send 1 ZEN to UPlanet REGIONG1PUB Wallet containing REGION TW HASH
|
||||
INTERCOM="UPLANET:${SECTOR}:${TODATE}:/ipfs/${IPFSPOP}"
|
||||
echo "> INTERCOM ${INTERCOM} (${ZEN} ZEN)"
|
||||
if [[ ${ZEN} -gt 11 ]]; then
|
||||
echo "---ZZZ-- SECTOR 2 REGION ZEN CHAINING ---ZZZ------ZZZ----"
|
||||
${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey "0.1" "${REGIONG1PUB}" "${INTERCOM}"
|
||||
fi
|
||||
##############################################################
|
||||
## PUBLISHING ${SECTOR}
|
||||
###############################
|
||||
echo "% PUBLISHING ${SECTOR} ${myIPFS}/ipns/${TODATENS}"
|
||||
start=`date +%s`
|
||||
ipfs --timeout 240s name publish -k ${TODATE}${G1PUB} /ipfs/${IPFSPOP}
|
||||
ipfs key rm ${YESTERDATE}${G1PUB} ${G1PUB} > /dev/null 2>&1
|
||||
|
||||
################# REGISTER UPlanet SECTOR to G1PODs
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey -n ${myDATA} \
|
||||
set -n "UPlanet SECTOR ${SECTOR}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
||||
-pos ${SLAT} ${SLON} -s ${myLIBRA}/ipfs/${IPFSPOP} \
|
||||
-A ${MY_PATH}/../images/zenticket.png
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey -n ${myCESIUM} \
|
||||
set -n "UPlanet SECTOR ${SECTOR}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
||||
-pos ${SLAT} ${SLON} -s ${myLIBRA}/ipfs/${IPFSPOP} \
|
||||
-A ${MY_PATH}/../images/zenticket.png
|
||||
|
||||
######################################################
|
||||
rm ~/.zen/tmp/${MOATS}/${SECTOR}.dunikey
|
||||
[[ ${ZCHAIN} != "" ]] && ipfs pin rm ${ZCHAIN}
|
||||
|
||||
###################################################
|
||||
## EXTRACT SECTOR LAST WEEK TIDDLERS TO IPFSNODEID CACHE
|
||||
echo "(☉_☉ ) ${REGION}.week.rss.json (☉_☉ )"
|
||||
|
||||
rm -Rf ~/.zen/tmp/${IPFSNODEID}/SECTORS/ ## TODO REMOVE
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/SECTORS/_${RLAT}_${RLON}/_${SLAT}_${SLON}
|
||||
## CREATING 7 DAYS JSON RSS STREAM
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/UPLANET/SECTORS/_${RLAT}_${RLON}/_${SLAT}_${SLON} \
|
||||
--render '.' "${SECTOR}.week.rss.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-7]!is[system]!tag[G1Voeu]]'
|
||||
|
||||
###################################
|
||||
## NODE CACHE SECTOR TODATENS
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATENS}'\" />_${SLAT}_${SLON}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/SECTORS/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_index.html
|
||||
|
||||
## TODO FILTER INFORMATION WITH MULTIPLE SIGNATURES (DONE in REGION.refresh.sh)
|
||||
## TODO EXPORT AS RSS ## https://talk.tiddlywiki.org/t/has-anyone-generated-an-rss-feed-from-tiddlywiki/966/28
|
||||
end=`date +%s`
|
||||
echo "_____SECTOR${SECTOR} TREATMENT time was "`expr $end - $start` seconds.
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
{
|
||||
"title": "/TEST/ForemostPoets-Moonraker.mp3",
|
||||
"text": "<audio controls><source src='/ipfs/Qmc799UU3zqFojnR13qSiJYKx8mKPXJ3CXMgKyLGvVndUD' type='audio/mpeg'>Your browser does not support the audio element.</audio>",
|
||||
"tags": "mp3"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Generate a unique timestamp
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
# Check if TiddlyWiki file exists
|
||||
TW="$1"
|
||||
[[ ! -s $TW ]] && echo "No TiddlyWiki found at: $TW" && exit 1
|
||||
|
||||
# Check if Tiddler title is provided
|
||||
TITLE="$2"
|
||||
[[ -z $TITLE ]] && echo "Need a Tiddler title" && exit 1
|
||||
|
||||
# Delete the specified Tiddler from the TiddlyWiki
|
||||
echo "Deleting Tiddler: $TITLE"
|
||||
tiddlywiki --load $TW \
|
||||
--deletetiddlers "$TITLE" \
|
||||
--output ~/.zen/tmp --render "$:/core/save/all" "${MOATS}.html" "text/plain"
|
||||
|
||||
# Check if deletion was successful
|
||||
if [[ -s ~/.zen/tmp/${MOATS}.html ]]; then
|
||||
echo "Tiddler deleted successfully."
|
||||
cp ~/.zen/tmp/${MOATS}.html ${TW}
|
||||
rm ~/.zen/tmp/${MOATS}.html
|
||||
echo "Updated TiddlyWiki:
|
||||
${TW}"
|
||||
else
|
||||
echo "ERROR: Cannot delete $TITLE from
|
||||
$TW"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Generate a unique timestamp
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
# Check if TiddlyWiki file exists
|
||||
TW="$1"
|
||||
[[ ! -s $TW ]] \
|
||||
&& echo "Missing TiddlyWiki index.html \$1: $TW" \
|
||||
&& exit 1
|
||||
|
||||
# Check if Tiddler JSON file exists
|
||||
TIDDLER="$2"
|
||||
[[ ! -s $TIDDLER || $TIDDLER == "" ]] \
|
||||
&& echo "Missing Tiddler JSON file \$2: $TIDDLER" \
|
||||
&& exit 1
|
||||
|
||||
# Add created and modified fields to the Tiddler JSON file
|
||||
echo "Putting ${TIDDLER} in ${TW}"
|
||||
jq '.[] + {created: $MOATS, modified: $MOATS}' --arg MOATS "$MOATS" "$TIDDLER" > "${TIDDLER}.tmp"
|
||||
|
||||
# Run TiddlyWiki import command
|
||||
echo "Running TiddlyWiki import..."
|
||||
tiddlywiki --load "${TW}" \
|
||||
--import "${TIDDLER}.tmp" 'application/json' \
|
||||
--output /tmp \
|
||||
--render '$:/core/save/all' "${MOATS}.html" 'text/plain'
|
||||
|
||||
# Check if import was successful
|
||||
if [[ -s /tmp/${MOATS}.html ]]; then
|
||||
echo "Import successful."
|
||||
cp /tmp/${MOATS}.html ${TW}
|
||||
rm /tmp/${MOATS}.html
|
||||
rm "${TIDDLER}.tmp"
|
||||
echo "Updated TiddlyWiki:
|
||||
${TW}"
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR"
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,19 @@
|
|||
TiddlyWiki acts as a distributed object database
|
||||
|
||||
this scripts provides elemental TW interactions
|
||||
|
||||
* Import a Tiddler (json) in a TiddliWiki
|
||||
|
||||
```./import_tiddler.sh tiddlywiki.html ForemostPoets-Moonraker.json```
|
||||
|
||||
https://talk.tiddlywiki.org/t/how-to-add-extract-modify-tiddlers-from-command-line-to-do-ipfs-media-transfer/4345?u=papiche
|
||||
|
||||
* Delete a Tiddler (title) from a TiddliWiki
|
||||
|
||||
```./delete_tiddler.sh tiddlywiki.html "/TEST/ForemostPoets-Moonraker.mp3"```
|
||||
|
||||
https://talk.tiddlywiki.org/t/how-to-filter-and-delete-multiple-tiddlers/4950
|
||||
|
||||
|
||||
you can add more complex queries ....
|
||||
|
|
@ -0,0 +1,574 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.2
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
################################################################################
|
||||
## SEEK FOR UPLANET KEYS
|
||||
# GET & UPDATE IPNS
|
||||
############################################
|
||||
echo "############################################"
|
||||
echo "
|
||||
_________________________
|
||||
< RUNNING UPLANET.refresh >
|
||||
-------------------------
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
(__)\ )\\/\\
|
||||
||----w |
|
||||
|| ||
|
||||
|
||||
"
|
||||
echo "############################################"
|
||||
echo "############################################"
|
||||
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
mkdir ~/.zen/tmp/${MOATS}
|
||||
|
||||
#################################################################
|
||||
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
||||
############################
|
||||
## RUNING FOR ALL UMAP FOUND IN STATION MAP CACHE : "_LAT_LON"
|
||||
|
||||
## SEARCH UMAP (created by PLAYER.refresh.sh) /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
||||
MEMAPS=($(ls -td ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
||||
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
echo "ACTIVATED ${#unique_combined[@]} UMAPS : ${unique_combined[@]}" # "_LAT_LON" directories
|
||||
|
||||
######################################################
|
||||
### LEVEL 1 ###########################################
|
||||
######################################################
|
||||
for UMAP in ${unique_combined[@]}; do
|
||||
|
||||
start=`date +%s`
|
||||
echo
|
||||
echo "-------------------------------------------------------------------"
|
||||
echo "____________REFRESHING ${UMAP}__________ $(date)"
|
||||
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
||||
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
||||
|
||||
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||
|
||||
## SECTOR BANK COORD
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
## REGION
|
||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||
|
||||
##############################################################
|
||||
## UMAP WALLET CHECK
|
||||
##############################################################
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${UMAP}.dunikey "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/${UMAP}.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
[[ ! ${G1PUB} ]] && echo "ERROR generating UMAP WALLET" && exit 1
|
||||
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
||||
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
|
||||
echo "UMAP (${COINS} G1) ${ZEN} ZEN : ${G1PUB}"
|
||||
|
||||
## ORIGIN ##########################################################
|
||||
## CALCULATE INITIAL UMAP GEOSPACIAL IPNS KEY
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${UMAP}.priv "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
||||
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
||||
UMAPNS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${UMAP}.priv)
|
||||
echo "ORIGIN : ${myIPFS}/ipns/${UMAPNS}"
|
||||
|
||||
###################### SPATIO TEMPORAL KEYS
|
||||
## TODATE #########################################
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${TODATE}.priv "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}"
|
||||
ipfs key rm ${TODATE}${G1PUB} > /dev/null 2>&1
|
||||
TODATENS=$(ipfs key import ${TODATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${TODATE}.priv)
|
||||
echo "TODAY : ${myIPFS}/ipns/${TODATENS}"
|
||||
|
||||
## YESTERDATE ###############
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv "${YESTERDATE}${UPLANETNAME}${LAT}" "${YESTERDATE}${UPLANETNAME}${LON}"
|
||||
ipfs key rm ${YESTERDATE}${G1PUB} > /dev/null 2>&1
|
||||
YESTERDATENS=$(ipfs key import ${YESTERDATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv)
|
||||
echo "YESTERDAY : ${myIPFS}/ipns/${YESTERDATENS}"
|
||||
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
start=`date +%s`
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
mkdir ~/.zen/tmp/${MOATS}/${UMAP}
|
||||
echo "## IPFS GET YESTERDATENS /ipns/${YESTERDATENS}/"
|
||||
ipfs --timeout 300s get --progress=false -o ~/.zen/tmp/${MOATS}/${UMAP}/ /ipns/${YESTERDATENS}/
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "(╥☁╥ ) swarm online memory empty (╥☁╥ )"
|
||||
# Try retieve memory from UPlanet ZEN Memory
|
||||
[[ ${ZEN} -gt 0 ]] \
|
||||
&& echo "INTERCOM Refreshing from ZEN MEMORY" \
|
||||
&& ${MY_PATH}/../RUNTIME/ZEN.UMAP.memory.sh "${UMAP}" "${MOATS}" "${G1PUB}"
|
||||
fi
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
end=`date +%s`
|
||||
echo "_____UMAP${UMAP} GET time was "`expr $end - $start` seconds.
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
## FORMAT CONTROL WARNING
|
||||
[[ ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN || ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} ]] \
|
||||
&& echo ">>> INFO - INTIALIZE UMAP FORMAT - NEW UMAP KEY -" \
|
||||
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} \
|
||||
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN \
|
||||
&& echo ${MOATS} > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats
|
||||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW
|
||||
|
||||
echo "~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/"
|
||||
|
||||
## zday of the week for IPFSNODEID
|
||||
rm -f ~/.zen/tmp/${MOATS}/${UMAP}/z*.html 2>/dev/null
|
||||
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain 2>/dev/null | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
||||
[[ "${ZCHAIN}" != "" ]] \
|
||||
&& echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/z$(date +%A-%d_%m_%Y).html
|
||||
|
||||
########################################################
|
||||
## NODE SELECTION in UMAP.refresher
|
||||
UREFRESH="${HOME}/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON}/UMAP.refresher"
|
||||
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
||||
STRAPS=($(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | rev | cut -d '/' -f 1 | rev | grep -v '^[[:space:]]*$')) ## ${STRAPS[@]}
|
||||
|
||||
if [[ ${ALLNODES[@]} == "" ]]; then
|
||||
for STRAP in ${STRAPS[@]}; do
|
||||
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
||||
done
|
||||
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
||||
fi
|
||||
|
||||
ACTINGNODE=${ALLNODES[0]} ## FIST NODE IN UMAP.refresher
|
||||
|
||||
## IN CASE OLD BOOSTRAP IS STILL IN CHARGE - CHOOSE 1ST STRAP -
|
||||
[[ ! $(echo ${STRAPS[@]} | grep ${ACTINGNODE}) ]] && ACTINGNODE=${STRAPS[0]}
|
||||
|
||||
# ++++++++++++++++++++ - - - - FIND LAST TREATMENT TIME
|
||||
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats 2>/dev/null) || ZMOATS=${MOATS}
|
||||
# ZMOATS SHOULD BE MORE THAT 5 HOURS.
|
||||
MOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${MOATS})
|
||||
ZMOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${ZMOATS})
|
||||
DIFF_SECONDS=$((MOATS_SECONDS - ZMOATS_SECONDS))
|
||||
hours=$((DIFF_SECONDS / 3600))
|
||||
minutes=$(( (DIFF_SECONDS % 3600) / 60 ))
|
||||
seconds=$((DIFF_SECONDS % 60))
|
||||
echo "UMAP DATA is ${hours} hours ${minutes} minutes ${seconds} seconds "
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
## IF NOT UPDATED FOR TOO LONG
|
||||
[[ ${DIFF_SECONDS} -gt $(( 26 * 60 * 60 )) || ${DIFF_SECONDS} -eq 0 ]] \
|
||||
&& echo ">>>>>>>>>>>>>> More than 26H update - BOOSTRAP 0 ACTION -" \
|
||||
&& ACTINGNODE=${STRAPS[0]}
|
||||
|
||||
echo "* ACTINGNODE=${ACTINGNODE}"
|
||||
|
||||
if [[ "${ACTINGNODE}" != "${IPFSNODEID}" ]]; then
|
||||
echo ">> ACTINGNODE NOT ME - CONTINUE -"
|
||||
ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}"
|
||||
echo "------8<-------------8<------------------8<-----------------8<-----------------8<"
|
||||
continue
|
||||
fi
|
||||
################################################################################
|
||||
# ~~~~~~~~~~~~~ GOING FURTHER ~~~ MEANS IPFSNODEID IS UMAP REFRESHER ~~~~~~~~~~~
|
||||
################################################################################
|
||||
## NEXT REFRESHER
|
||||
# TODO: INTRODUCE NODE BALANCE AND CHOOSE THE MOST CONFIDENT ONE
|
||||
rm ${UREFRESH}
|
||||
for STRAP in ${STRAPS[@]}; do
|
||||
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
||||
done
|
||||
# SHUFFLE UMAP.refresher
|
||||
cat ${UREFRESH} | sort | uniq | shuf > ${UREFRESH}.shuf
|
||||
mv ${UREFRESH}.shuf ${UREFRESH}
|
||||
## NEXT REFRESHER
|
||||
echo ">> NEXT REFRESHER WILL BE $(cat ${UREFRESH} | head -n 1)"
|
||||
######################################################## # NODE SELECTION in UMAP.refresher
|
||||
|
||||
############ 101 ZEN (11.1 G1) REFILL ?!
|
||||
CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev)
|
||||
[[ ${COINS} == "" || ${COINS} == "null" ]] \
|
||||
&& [[ ${ZEN} -lt 100 && ${CURRENT} != "" ]] \
|
||||
&& MIUSER=$(${MY_PATH}/../tools/clyuseryomail.sh "${CURRENT}") \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/.current/secret.dunikey" "11.1" "${G1PUB}" "UPLANET:101ZEN:${UMAP}:${MIUSER}" \
|
||||
&& echo "UPLANET:101:${UMAP}:${MIUSER}" && echo " ~~~ (ZEN‿‿ZEN) ~~ _${LAT}_${LON} ~~ (ZEN‿‿ZEN) ~~~ "
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
## SECTOR LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${SLAT}_${SLON}
|
||||
# %%%%%%%%%% ##################################################
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
SECTOR="_${SLAT}_${SLON}"
|
||||
echo "SECTOR ${SECTOR}"
|
||||
############################################################## "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
||||
SECTORG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}")
|
||||
[[ ! ${SECTORG1PUB} ]] && echo "ERROR generating SECTOR WALLET" && exit 1
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${SECTORG1PUB} | tail -n 1)
|
||||
echo "SECTOR : ${SECTOR} (${COINS} G1) WALLET : ${SECTORG1PUB}"
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${SECTOR}.priv "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}"
|
||||
ipfs key rm ${SECTORG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
SECTORNS=$(ipfs key import ${SECTORG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${SECTOR}.priv)
|
||||
ipfs key rm ${SECTORG1PUB}
|
||||
##############################################################
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${SECTORNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}/index.html
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
## REGION LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ${RLAT}_${RLON}
|
||||
# %%%%%%%%%% ##################################################
|
||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||
REGION="_${RLAT}_${RLON}"
|
||||
echo "REGION ${REGION}"
|
||||
##############################################################
|
||||
REGIONG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${REGION}" "${UPLANETNAME}${REGION}")
|
||||
[[ ! ${REGIONG1PUB} ]] && echo "ERROR generating REGION WALLET" && exit 1
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${REGIONG1PUB} | tail -n 1)
|
||||
echo "REGION : ${REGION} (${COINS} G1) WALLET : ${REGIONG1PUB}"
|
||||
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/REGION.priv "${TODATE}${UPLANETNAME}${REGION}" "${TODATE}${UPLANETNAME}${REGION}"
|
||||
ipfs key rm ${REGIONG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
||||
TODATEREGIONNS=$(ipfs key import ${REGIONG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/REGION.priv)
|
||||
ipfs key rm ${REGIONG1PUB}
|
||||
##############################################################
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATEREGIONNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}/index.html
|
||||
|
||||
####################################################################################
|
||||
#######################################################################################
|
||||
echo "# NEXTNS : UMAP, SECTOR, REGION ## BOOSTRAP TO SWARM ##"
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
####################################################################################
|
||||
#################################################################################
|
||||
## DEMAIN DATA
|
||||
####################################################################################
|
||||
## UMAP NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.umap
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${LAT}" "${DEMAINDATE}${UPLANETNAME}${LON}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
||||
echo "UMAP NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.umapns
|
||||
echo "${G1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
## SECTOR NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.sector
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${SECTOR}" "${DEMAINDATE}${UPLANETNAME}${SECTOR}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
||||
echo "SECTOR NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.sectorns
|
||||
echo "${SECTORG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
## REGION NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.region
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${REGION}" "${DEMAINDATE}${UPLANETNAME}${REGION}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
||||
echo "REGION NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
||||
ipfs key rm "next" > /dev/null 2>&1
|
||||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.regionns
|
||||
echo "${REGIONG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
####################################################################################
|
||||
## TODATE DATA
|
||||
echo "WRITE $TODATE DATA ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}"
|
||||
####################################################################################
|
||||
echo "${TODATENS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/TODATENS
|
||||
echo "${SECTORNS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORNS
|
||||
echo "${TODATEREGIONNS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONNS
|
||||
echo "${G1PUB}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/G1PUB
|
||||
echo "${SECTORG1PUB}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORG1PUB
|
||||
echo "${REGIONG1PUB}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONG1PUB
|
||||
|
||||
####################################################################################
|
||||
ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
## COLLECT RSS FROM ALL PLAYERS WITH SAME UMAP IN SWARM MEMORY /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
||||
# %%%%%%%%%% ##################################################
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json \
|
||||
~/.zen/tmp/${MOATS}/${UMAP}/RSS/ 2>/dev/null
|
||||
RSSFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json 2>/dev/null))
|
||||
for RSSFILE in ${RSSFILES[@]}; do
|
||||
cp ${RSSFILE} ~/.zen/tmp/${MOATS}/${UMAP}/RSS/
|
||||
done
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
## COLLECT TW LINKS FROM NODE & SWARM
|
||||
# %%%%%%%%%% ##################################################
|
||||
cp -r ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* \
|
||||
~/.zen/tmp/${MOATS}/${UMAP}/TW/ 2>/dev/null
|
||||
TWFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
||||
for TWRED in ${TWFILES[@]}; do
|
||||
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}
|
||||
cp ${TWRED} ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}/
|
||||
done
|
||||
|
||||
##################################
|
||||
## OSM2IPFS
|
||||
### UMAP = 0.01° Planet Slice
|
||||
UMAPGEN="${EARTHCID}/Umap.html?southWestLat=${LAT}&southWestLon=${LON}°=0.01&ipns=${TODATENS}/_index.html"
|
||||
USATGEN="${EARTHCID}/Usat.html?southWestLat=${LAT}&southWestLon=${LON}°=0.01&ipns=${TODATENS}/_index.html"
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='${UMAPGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Umap.html
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='${USATGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Usat.html
|
||||
|
||||
## ¤$£€ removed copy OSM map to IPFS. TODO. scrap tiles instead of screen copy
|
||||
## TODO # GET SCREENSHOT UMAP SECTOR & REGION JPG
|
||||
## PROBLEM ON LIBRA ... MORE TEST NEEDED ...
|
||||
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] \
|
||||
#~ && python ${MY_PATH}/../tools/page_screenshot.py "${myIPFS}${UMAPGEN}" ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg 900 900 2>/dev/null \
|
||||
#~ && [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] && killall chrome
|
||||
|
||||
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] \
|
||||
#~ && python ${MY_PATH}/../tools/page_screenshot.py "${myIPFS}${USATGEN}" ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg 900 900 2>/dev/null \
|
||||
#~ && [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] && killall chrome
|
||||
#### NOT WORKING !!!
|
||||
|
||||
## GEOLINKING CALCULATE SURROUNDING UMAPS ###############################
|
||||
#~ if [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/geolinks.json ]]; then
|
||||
|
||||
#~ ${MY_PATH}/../tools/Umap_geolinks.sh "${LAT}" "${LON}" "${UMAP}" "${MOATS}" "${UMAPNS}"
|
||||
|
||||
#~ fi
|
||||
#~ ### SET navigator.html ## MAKE EVOLVE template/umap.html
|
||||
#~ cp ${MY_PATH}/../templates/umap.html ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Umap.html
|
||||
#~ cat ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Umap.html | sed "s~Umap~Usat~g" > ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Usat.html
|
||||
#### IS IT USEFUL ?..??
|
||||
|
||||
####################################
|
||||
# %%%%%%%%%% ##################################################
|
||||
## GET FROM WEB2.0 POI's AROUND >>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
# %%%%%%%%%% ##################################################
|
||||
####################################
|
||||
echo "################### WEB2.0 SCRAPING TIME >>>>>>>>>>>>>>>>"
|
||||
## RECORD P4N SPOT DATA
|
||||
echo "* park4night : https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr"
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
||||
&& curl -s -L "https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
|
||||
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json) ]] \
|
||||
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json \
|
||||
&& echo "UPDATED PARK4NIGHT" \
|
||||
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
||||
|
||||
####################################
|
||||
echo "* gchange : ./tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON}"
|
||||
## GET 100KM GCHANGE ADS ( https://data.gchange.fr )
|
||||
${MY_PATH}/../tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON} > ~/.zen/tmp/${MOATS}/${UMAP}/gchange50.json
|
||||
|
||||
## GET ALL WALLETS
|
||||
echo "* GET WALLETS https://g1-stats.axiom-team.fr/data/geoloc-members.json"
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
||||
&& curl -s "https://g1-stats.axiom-team.fr/data/geoloc-members.json" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
|
||||
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json) ]] \
|
||||
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json \
|
||||
&& echo "UPDATED WALLALL" \
|
||||
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
||||
|
||||
## FILTER LOCAL WALLETS
|
||||
target_lat=${LAT}
|
||||
target_lon=${LON}
|
||||
precision=0.1
|
||||
jq --argjson target_lat "$target_lat" \
|
||||
--argjson target_lon "$target_lon" \
|
||||
--argjson precision "$precision" \
|
||||
'.wallets | map(select((.geoPoint.lat | tonumber) >= ($target_lat - $precision) and (.geoPoint.lat | tonumber) <= ($target_lat + $precision) and (.geoPoint.lon | tonumber) >= ($target_lon - $precision) and (.geoPoint.lon | tonumber) <= ($target_lon + $precision)))' ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json
|
||||
|
||||
echo "MAKING _index.p4n.html with ./templates/P4N/index.html"
|
||||
## CREATE INDEX LOADING JSONs ON OPENSTREETMAP
|
||||
cat ${MY_PATH}/../templates/P4N/index.html \
|
||||
| sed -e "s~43.61000~${LAT}~g" \
|
||||
-e "s~1.43000~${LON}~g" \
|
||||
-e "s~_SERVICE_~Commons~g" \
|
||||
-e "s~_UMAP_~${UMAP}~g" \
|
||||
-e "s~http://127.0.0.1:8080~~g" \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.p4n.html
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
########################################################
|
||||
echo "CREATING SPHERICAL LOCATIONS"
|
||||
# %%%%%%%%%% ##################################################
|
||||
## PREPARE SPHERE MAP ##################################################################
|
||||
echo "var examples = {};
|
||||
examples['locations'] = function() {
|
||||
var locations = {
|
||||
" > ~/.zen/tmp/world.js
|
||||
floop=1
|
||||
|
||||
SWARMTW=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
||||
NODETW=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
||||
TWFILES=("${SWARMTW[@]}" "${NODETW[@]}")
|
||||
|
||||
for TWRED in ${TWFILES[@]}; do
|
||||
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
||||
TWADD=$(cat ${TWRED} | grep -o "/ipns/[^\"]*" | sed "s/'$//")
|
||||
[[ -z ${TWADD} ]] && TWADD=$(cat ${TWRED} | grep -o "/ipfs/[^\"]*" | sed "s/'$//")
|
||||
|
||||
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
|
||||
echo "${floop}: {
|
||||
alpha: Math.random() * 2 * Math.PI,
|
||||
delta: Math.random() * 2 * Math.PI,
|
||||
name: '"${ZMAIL}"',
|
||||
link: '"${TWADD}"'
|
||||
}
|
||||
," >> ~/.zen/tmp/world.js
|
||||
|
||||
((floop++))
|
||||
done
|
||||
|
||||
# REMOVE la dernière virgule
|
||||
sed -i '$ d' ~/.zen/tmp/world.js
|
||||
##################################
|
||||
## FINISH LOCATIONS
|
||||
echo "
|
||||
};
|
||||
\$('#sphere').earth3d({
|
||||
locationsElement: \$('#locations'),
|
||||
dragElement: \$('#locations'),
|
||||
locations: locations
|
||||
});
|
||||
};
|
||||
" >> ~/.zen/tmp/world.js
|
||||
|
||||
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
|
||||
echo "JSON UMAP WORLD READY /ipfs/${IAMAP}/world.js"
|
||||
###########################################################################################
|
||||
### APPLY ON APP MODEL
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
SECTOR="_${SLAT}_${SLON}"
|
||||
TODATESECTORNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}")
|
||||
|
||||
PHONEBOOTH="${G1PUB::30}"
|
||||
cat ${MY_PATH}/../templates/UPlanetUmap/index.html \
|
||||
| sed -e "s~_ZONE_~${UMAP}~g" \
|
||||
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
||||
-e "s~_ZONENS_~${TODATENS}~g" \
|
||||
-e "s~_ZCHAIN_~${ZCHAIN}~g" \
|
||||
-e "s~_IPFSNINJA_~${VDONINJA}~g" \
|
||||
-e "s~_HACKGIPFS_~${HACKGIPFS}~g" \
|
||||
-e "s~_UPZONE_~SECTOR ${SECTOR}~g" \
|
||||
-e "s~_UPZONENS_~${TODATESECTORNS}~g" \
|
||||
-e "s~_UPUPZONE_~REGION ${REGION}~g" \
|
||||
-e "s~_UPUPZONENS_~${TODATEREGIONNS}~g" \
|
||||
-e "s~_PHONEBOOTH_~${PHONEBOOTH}~g" \
|
||||
-e "s~_CESIUMIPFS_~${CESIUMIPFS}~g" \
|
||||
-e "s~_G1PUB_~${G1PUB}~g" \
|
||||
-e "s~_DATE_~$(date +%A-%d_%m_%Y)~g" \
|
||||
-e "s~_UPLANETLINK_~${EARTHCID}/map_render.html\?southWestLat=${LAT}\&southWestLon=${LON}\°=0.01~g" \
|
||||
-e "s~http://127.0.0.1:8080~~g" \
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.html
|
||||
|
||||
## Make it root App
|
||||
#~ mv ~/.zen/tmp/${MOATS}/${UMAP}/_index.html \
|
||||
#~ ~/.zen/tmp/${MOATS}/${UMAP}/index.html
|
||||
##################################
|
||||
|
||||
###########################################################################################
|
||||
########################################################
|
||||
## CREATE .all.json for RSS in this UMAP
|
||||
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
||||
|
||||
##############################################################
|
||||
############################ PUBLISHING UMAP
|
||||
##############################################################
|
||||
UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1)
|
||||
|
||||
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
||||
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats 2>/dev/null)
|
||||
[[ ${ZCHAIN} && ${ZMOATS} ]] \
|
||||
&& cp ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain.${ZMOATS} \
|
||||
&& echo "UPDATING MOATS=${MOATS}"
|
||||
|
||||
######################################################
|
||||
## ZEN CHAINING
|
||||
# Send 1 ZEN to UPlanet SECTORG1PUB Wallet containing REGION TW HASH
|
||||
INTERCOM="UPLANET:${UMAP}:${TODATE}:/ipfs/${UMAPROOT}"
|
||||
echo "> INTERCOM ${INTERCOM} (${ZEN} ZEN > 11 ?)"
|
||||
if [[ ${ZEN} -gt 11 ]]; then
|
||||
echo "---ZZZ-- UMAP 2 SECTOR ZEN CHAINING ---ZZZ------ZZZ----"
|
||||
${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/${UMAP}.dunikey "0.1" "${SECTORG1PUB}" "${INTERCOM}"
|
||||
fi
|
||||
|
||||
## MICRO LEDGER CHAIN CHANGED or INIT ?
|
||||
[[ ${ZCHAIN} != ${UMAPROOT} || ${ZCHAIN} == "" ]] \
|
||||
&& echo "${MOATS}:${IPFSNODEID}:${UMAPROOT}" > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain \
|
||||
&& echo "${MOATS}" > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats \
|
||||
&& UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1) \
|
||||
&& echo "ROOT was ${ZCHAIN}"
|
||||
|
||||
echo "PUBLISHING ${TODATE} UMAPROOT : ${myIPFS}/ipfs/${UMAPROOT}"
|
||||
|
||||
ipfs --timeout 300s name publish --key=${TODATE}${G1PUB} /ipfs/${UMAPROOT}
|
||||
end=`date +%s`
|
||||
echo "(UMAP) ${UMAP} ${TODATE} PUBLISH time was "`expr $end - $start` seconds.
|
||||
|
||||
ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}" ## REMOVE IPNS KEY
|
||||
[[ ${ZCHAIN} != "" ]] && ipfs pin rm ${ZCHAIN}
|
||||
|
||||
################# PUBLISH UPlanet UMAP to G1PODs
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${UMAP}.dunikey -n ${myDATA} \
|
||||
set -n "UPlanet ${UMAP}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
||||
-pos ${LAT} ${LON} -s ${myLIBRA}/ipfs/${UMAPROOT} \
|
||||
-A ${MY_PATH}/../images/extension_territoire.jpg
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 \
|
||||
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${UMAP}.dunikey -n ${myCESIUM} \
|
||||
set -n "UPlanet ${UMAP}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
||||
-pos ${LAT} ${LON} -s ${myLIBRA}/ipfs/${UMAPROOT} \
|
||||
-A ${MY_PATH}/../images/extension_territoire.jpg
|
||||
|
||||
rm ~/.zen/tmp/${MOATS}/*.priv
|
||||
rm ~/.zen/tmp/${MOATS}/${UMAP}.dunikey
|
||||
|
||||
done
|
||||
|
||||
|
||||
######################################################
|
||||
### LEVEL 2 ###########################################
|
||||
######################################################
|
||||
### SECTOR = 0.1° Planet Slice
|
||||
${MY_PATH}/SECTOR.refresh.sh "${unique_combined[@]}"
|
||||
|
||||
######################################################
|
||||
### LEVEL 3 ###########################################
|
||||
######################################################
|
||||
### REGION = 1° Planet Slice
|
||||
${MY_PATH}/REGION.refresh.sh "${unique_combined[@]}"
|
||||
######################################################
|
||||
|
||||
|
||||
######################################################
|
||||
exit 0
|
||||
######################################################
|
|
@ -0,0 +1,638 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"${MY_PATH}\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
! ipfs swarm peers >/dev/null 2>&1 && echo "Lancez 'ipfs daemon' SVP" && exit 1
|
||||
################################################################################
|
||||
[[ ! ${MOATS} ]] && MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}
|
||||
|
||||
SALT="$1"
|
||||
PEPPER="$2"
|
||||
PLAYER="$3"
|
||||
PSEUDO="$4"
|
||||
[[ $PSEUDO == "" ]] && PSEUDO="Anonymous"
|
||||
|
||||
LANG="$5"
|
||||
[[ $LANG == "" ]] && LANG="_LANG_"
|
||||
|
||||
## UPLANET UMAP
|
||||
LAT="$6"
|
||||
[[ $LAT == "" ]] && LAT="0.00"
|
||||
LON="$7"
|
||||
[[ $LON == "" ]] && LON="0.00"
|
||||
|
||||
################################################################################
|
||||
YOU=$(myIpfsApi);
|
||||
################################################################################
|
||||
## LIST TW MODELS
|
||||
################################################################################
|
||||
#~ TWMODEL="/ipfs/bafybeid7xwuqkgyiffehs77x3wky3dghjncxepr5ln6dewapgvbwrqi7n4"
|
||||
#~ # ipfs cat $TWMODEL > templates/twdefault.html
|
||||
TWUPLANET="/ipfs/bafybeigpwapdih24vnakummoyj6vodxiem4i6ezp5hxa35yt3paxpqz53y" ## WITH LIGHTBEAMS SAVER
|
||||
TWUPLANET="/ipfs/bafybeidxa45qgbf34p7uvmphj5zt6jp2zgpw7ouwb3e3urnbu4jrt2dgiq" ## WITH IPFS SAVER
|
||||
# ipfs cat $TWUPLANET > templates/twuplanet.html
|
||||
################################################################################
|
||||
|
||||
mkdir -p ~/.zen/tmp/${MOATS}/TW
|
||||
|
||||
## TEST chargement ONLINE TW !!!
|
||||
if [[ $SALT != "" && PEPPER != "" ]]; then
|
||||
|
||||
## Creating SALT/PEPPER IPNS KEY
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/player.key "$SALT" "$PEPPER" 2>/dev/null
|
||||
ASTRONAUTENS=$(ipfs key import ${MOATS} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/player.key 2>/dev/null)
|
||||
# echo "/ipns/${ASTRONAUTENS}"
|
||||
|
||||
echo "SCANNING /ipns/${ASTRONAUTENS} for 180s"
|
||||
## GETTING LAST TW via IPFS or HTTP GW
|
||||
ipfs --timeout 180s cat --progress=false /ipns/${ASTRONAUTENS} > ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/TW/index.html ]]; then
|
||||
echo "TW FOUND... BACKUP TIDDLERS"
|
||||
# BACKUP tiddlers
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'backup.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]'
|
||||
|
||||
[[ -s ~/.zen/tmp/${MOATS}/backup.json ]] \
|
||||
&& echo ">> Tiddlers Backup : ~/.zen/tmp/${MOATS}/backup.json" \
|
||||
|| echo "ERROR EXTRACTING TIDDLERS"
|
||||
|
||||
rm ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
fi
|
||||
|
||||
#############################################
|
||||
## CREATE NEW TW FROM TEMPLATE
|
||||
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
#### REFILL WITH BACKUP
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/backup.json ]]; then
|
||||
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||
--import ~/.zen/tmp/${MOATS}/backup.json "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "tw.html" "text/plain"
|
||||
|
||||
[[ -s ~/.zen/tmp/${MOATS}/tw.html ]] \
|
||||
&& cp -f ~/.zen/tmp/${MOATS}/tw.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
echo "BACKUP RESTORED"
|
||||
fi
|
||||
#############################################
|
||||
# EXISTING TW : DATA TESTING & CACHE
|
||||
rm -f ~/.zen/tmp/${MOATS}/Astroport.json
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
||||
HPass=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].HPASS)
|
||||
echo "ASTROPORT=${ASTROPORT}"
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'AstroID.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'AstroID'
|
||||
AstroID=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[]._canonical_uri) ## Can be deleted
|
||||
[[ -z $HPass ]] && HPass=$(cat ~/.zen/tmp/${MOATS}/AstroID.json | jq -r .[].HPASS) ## Double HPASS
|
||||
echo "AstroID=$AstroID ($HPass)"
|
||||
tiddlywiki --load ~/.zen/tmp/${MOATS}/TW/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'ZenCard.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'ZenCard'
|
||||
ZenCard=$(cat ~/.zen/tmp/${MOATS}/ZenCard.json | jq -r .[]._canonical_uri)
|
||||
echo "ZenCard=$ZenCard"
|
||||
|
||||
if [[ ${ASTROPORT} != "" && ${ASTROPORT} != "null" ]]; then
|
||||
|
||||
IPNSTAIL=$(echo ${ASTROPORT} | rev | cut -f 1 -d '/' | rev) # Remove "/ipns/" part
|
||||
echo "TW ASTROPORT GATEWAY : ${ASTROPORT}"
|
||||
echo "---> CONNECTING PLAYER $(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].pseudo) TW NOW with $IPFSNODEID"
|
||||
|
||||
else
|
||||
|
||||
echo ">> NO ACTIVE TW - CREATING FRESH NEW ONE"
|
||||
cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
ipfs key rm ${MOATS} 2>/dev/null ## CLEANING MOATS KEY
|
||||
|
||||
fi
|
||||
|
||||
|
||||
##################################################### # NEW PLAYER ###############
|
||||
################################################################################
|
||||
#~ echo "=============================================
|
||||
#~ ASTROPORT DIPLOMATIC PASSPORT - MadeInZion VISA -
|
||||
#~ =============================================
|
||||
#~ A Cryptographic Key to control your INTERNET
|
||||
#~ Adventure & Exploration P2P Terraforming Game.
|
||||
#~ =============================================
|
||||
#~ WELCOME 'Astronaute'"; # sleep 1
|
||||
|
||||
#~ echo "Inscription..."
|
||||
|
||||
[[ $SALT == "" ]] && SALT=$(${MY_PATH}/../tools/diceware.sh 4 | xargs)
|
||||
#~ echo "-> ID : $SALT"
|
||||
|
||||
[[ $PEPPER == "" ]] && PEPPER=$(${MY_PATH}/../tools/diceware.sh 4 | xargs)
|
||||
#~ echo "-> PASS : $PEPPER"
|
||||
|
||||
[[ ! $PSEUDO ]] && PSEUDO=${PLAYER%%[0-9]*}
|
||||
[[ ! $PSEUDO ]] && PSEUDO="Anonymous"
|
||||
[[ $(ls ~/.zen/game/players/$PSEUDO 2>/dev/null) ]] && echo "$PSEUDO EST DEJA UN PLAYER. EXIT" && exit 1
|
||||
|
||||
# PSEUDO=${PSEUDO,,} #lowercase
|
||||
[[ ! ${PLAYER} ]] \
|
||||
&& PLAYER=${PSEUDO}${RANDOM:0:3}@$(${MY_PATH}/../tools/diceware.sh 1 | xargs).${RANDOM:0:3} \
|
||||
&& echo "ADRESSE EMAIL ?" && read OPLAYER && [[ $OPLAYER ]] && PLAYER=$OPLAYER ## CLI MODE
|
||||
|
||||
PLAYER=${PLAYER,,}
|
||||
|
||||
# 4 DIGIT PASS CODE TO PROTECT QRSEC
|
||||
PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-5)
|
||||
|
||||
############################################################
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/secret.dunikey "$SALT" "$PEPPER"
|
||||
|
||||
G1PUB=$(cat ~/.zen/tmp/${MOATS}/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
||||
|
||||
[[ ! $G1PUB ]] && echo "Désolé. clef Cesium absente. ERROR" && exit 1
|
||||
|
||||
## CREATE Player personnal files storage and IPFS publish directory
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/.ipfs # Prepare PLAYER datastructure
|
||||
echo "/ip4/127.0.0.1/tcp/5001" > ~/.zen/game/players/${PLAYER}/.ipfs/api
|
||||
|
||||
## secret.june = SALT PEPPER CREDENTIALS
|
||||
echo "SALT=\"$SALT\"" > ~/.zen/game/players/${PLAYER}/secret.june
|
||||
echo "PEPPER=\"$PEPPER\"" >> ~/.zen/game/players/${PLAYER}/secret.june
|
||||
####
|
||||
## MOVE ${MOATS} secret.dunikey IN PLAYER DIRECTORY
|
||||
mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/${PLAYER}/
|
||||
|
||||
NID="${myIPFS}"
|
||||
WID="${myAPI}" ## https://ipfs.libra.copylaradio.com
|
||||
|
||||
[[ $isLAN ]] && NID="http://ipfs.localhost:8080" \
|
||||
&& WID="http://ipfs.localhost:5001"
|
||||
|
||||
# Create ${PLAYER} "IPNS Key"
|
||||
ipfs key rm ${PLAYER} >/dev/null 2>&1
|
||||
ipfs key rm ${G1PUB} >/dev/null 2>&1
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/game/players/${PLAYER}/secret.player "$SALT" "$PEPPER"
|
||||
TWNS=$(ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
|
||||
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/game/players/${PLAYER}/secret.player)
|
||||
|
||||
## TODO MAKE CLEANER
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/ipfs/G1SSB # Prepare astrXbian sub-datastructure "old scarf code"
|
||||
qrencode -s 12 -o ~/.zen/game/players/${PLAYER}/QR.png "$G1PUB" ## Check by VISA.print.sh
|
||||
cp ~/.zen/game/players/${PLAYER}/QR.png ~/.zen/game/players/${PLAYER}/ipfs/QR.png
|
||||
echo "$G1PUB" > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
||||
qrencode -s 12 -o ~/.zen/game/players/${PLAYER}/QR.ASTRONAUTENS.png "$myLIBRA/ipns/${ASTRONAUTENS}"
|
||||
|
||||
############################################################################
|
||||
## SEC PASS PROTECTED QRCODE : base58 secret.june / openssl(pass)
|
||||
#~ secFromDunikey=$(cat ~/.zen/game/players/${PLAYER}/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
||||
#~ echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
|
||||
|
||||
USALT=$(echo "$SALT" | jq -Rr @uri)
|
||||
UPEPPER=$(echo "$PEPPER" | jq -Rr @uri)
|
||||
DISCO="/?salt=${USALT}&pepper=${UPEPPER}"
|
||||
|
||||
## PGP ENCODING SALT/PEPPER API ACCESS
|
||||
echo "${DISCO}" > ~/.zen/tmp/${MOATS}/topgp
|
||||
cat ~/.zen/tmp/${MOATS}/topgp | gpg --symmetric --armor --batch --passphrase "$PASS" -o ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc
|
||||
rm ~/.zen/tmp/${MOATS}/topgp
|
||||
#~ openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -in ~/.zen/game/players/${PLAYER}/secret.june -out "$HOME/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec" -k "$PASS"
|
||||
#~ PASsec=$(cat ~/.zen/tmp/${MOATS}/enc.${PSEUDO}.sec | base64 -w 0 | jq -sRr '@uri' )
|
||||
#~ HPass=$(echo "$PASS" | sha512sum | cut -d ' ' -f 1)
|
||||
#~ qrencode -s 12 -o $HOME/.zen/game/players/${PLAYER}/QRsec.png $PASsec
|
||||
|
||||
## Add logo to QRCode
|
||||
cp ${MY_PATH}/../images/astrologo_nb.png ~/.zen/tmp/${MOATS}/fond.png
|
||||
|
||||
## ASTROID ~~~~~
|
||||
ASTROIDQR="$(cat ~/.zen/tmp/${MOATS}/gpg.${PSEUDO}.asc | tr '-' '~' | tr '\n' '-' | tr '+' '_' | jq -Rr @uri )"
|
||||
## MAKE amzqr ASTROID PGP QRCODE
|
||||
amzqr "${ASTROIDQR}" \
|
||||
-d ~/.zen/tmp/${MOATS} \
|
||||
-l H \
|
||||
-p ~/.zen/tmp/${MOATS}/fond.png 1>/dev/null
|
||||
|
||||
## ADD PLAYER EMAIL
|
||||
convert -gravity northwest -pointsize 28 -fill black -draw "text 5,5 \"$PLAYER\"" ~/.zen/tmp/${MOATS}/fond_qrcode.png ~/.zen/game/players/${PLAYER}/result_qrcode.png
|
||||
convert ~/.zen/game/players/${PLAYER}/result_qrcode.png -resize 480 ~/.zen/game/players/${PLAYER}/AstroID.png
|
||||
|
||||
ASTROQR="/ipfs/$(ipfs add -q $HOME/.zen/game/players/${PLAYER}/AstroID.png | tail -n 1)"
|
||||
|
||||
## DO NOT PIN ASTROID QRCODE
|
||||
ipfs pin rm ${ASTROQR}
|
||||
|
||||
############################################################################ TW
|
||||
### INITALISATION WIKI dans leurs répertoires de publication IPFS
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/ipfs/moa/
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/TW/index.html ]] \
|
||||
&& cp ${MY_PATH}/../templates/twuplanet.html ~/.zen/tmp/${MOATS}/TW/index.html
|
||||
|
||||
sed "s~_BIRTHDATE_~${MOATS}~g" ~/.zen/tmp/${MOATS}/TW/index.html \
|
||||
> ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
# INSERT ASTROPORT ADDRESS
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/${MOATS} --render '.' 'Astroport.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'Astroport'
|
||||
ASTROPORT=$(cat ~/.zen/tmp/${MOATS}/Astroport.json | jq -r .[].astroport)
|
||||
sed -i "s~${ASTROPORT}~/ipns/${IPFSNODEID}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
# TW CHAIN INIT WITH TWMODEL
|
||||
sed -i "s~_MOATS_~${MOATS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_CHAIN_~${TWUPLANET}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_TWMODEL_~${TWUPLANET}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_ASTRONAUTENS_~/ipns/${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## AND HACK QRCODE.sh FOR _PGP KEY_ TO VERIFY LAST HASH OF PROVIDED PASS
|
||||
HPASS=$(echo $PASS | sha512sum | cut -d ' ' -f 1)
|
||||
[[ ${HPass} != "" && ${HPass} != "null" ]] && SRCPASS=${HPass} || SRCPASS="_HPASS_"
|
||||
sed -i "s~${SRCPASS}~${HPASS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## RESET WISHES TO DEPLOY DERIVATED KEYS ON HOST AGAIN ( DONE IN PLAYER_REFRESH )
|
||||
#~ sed -i "s~G1Voeu~voeu~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
# INSERT PLAYER DATA
|
||||
CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev)
|
||||
[[ -z ${CURRENT} ]] && CURRENT=${PLAYER}
|
||||
sed -i "s~_PLAYER_~${PLAYER}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_CURRENT_~${CURRENT}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_PSEUDO_~${PSEUDO}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~_G1PUB_~${G1PUB}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
#~ sed -i "s~_QRSEC_~${PASsec}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
# La Clef IPNS porte comme nom G1PUB et ${PLAYER}
|
||||
sed -i "s~_MEDIAKEY_~${PLAYER}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~k2k4r8kxfnknsdf7tpyc46ks2jb3s9uvd3lqtcv9xlq9rsoem7jajd75~${ASTRONAUTENS}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
|
||||
## AstroID Tiddler UPGRADE
|
||||
cat ${MY_PATH}/../templates/data/AstroID.json \
|
||||
| sed -e "s~/ipfs/bafybeifbebc3ewnzrzbm44arddedbralegnxklhua5d5ymzaqtf2kaub7i~${ASTROQR}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_G1PUB_~${G1PUB}~g" \
|
||||
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
||||
-e "s~_HPASS_~${HPASS}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/AstroID.json
|
||||
|
||||
sed -i "s~tube.copylaradio.com~$myTUBE~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
sed -i "s~ipfs.copylaradio.com~$myTUBE~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
## PREPARE UMAP LAT LON replacement
|
||||
[[ ! ${LAT} ]] && LAT="0.00"
|
||||
[[ ! ${LON} ]] && LON="0.00"
|
||||
|
||||
SECTOR="_${LAT::-1}_${LON::-1}" ### SECTOR = 0.1° Planet Slice in MadeInZion Tiddler
|
||||
echo "UPlanet 0.1° SECTOR : ${SECTOR}"
|
||||
PLAYERONE=($(ls -t ~/.zen/game/players/ | grep "@" 2>/dev/null))
|
||||
sed -i "s~_SECTOR_~${SECTOR}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ## MadeInZion
|
||||
sed -i "s~_DAO_~${LANG}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ## MadeInZion
|
||||
sed -i "s~_NUMBER_~${#PLAYERONE[@]}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ## MadeInZion
|
||||
|
||||
# GET ACTUAL GPS VALUES
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS'
|
||||
|
||||
OLAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
|
||||
OLON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
|
||||
|
||||
# REPLACE WITH NEW LAT LON UMAP
|
||||
sed -i "s~${OLAT}~${LAT}~g" ~/.zen/tmp/${MOATS}/GPS.json
|
||||
sed -i "s~${OLON}~${LON}~g" ~/.zen/tmp/${MOATS}/GPS.json
|
||||
## Add _SECTORTW_
|
||||
cat ~/.zen/tmp/${MOATS}/GPS.json | jq '.[0] + {"sectortw": "_SECTORTW_"}' \
|
||||
> ~/.zen/tmp/${MOATS}/GPStw.json \
|
||||
&& mv ~/.zen/tmp/${MOATS}/GPStw.json ~/.zen/tmp/${MOATS}/GPS.json
|
||||
|
||||
###########
|
||||
## GET OLD16 FROM MadeInZion
|
||||
tiddlywiki \
|
||||
--load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'MIZ.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
OLD16=$(cat ~/.zen/tmp/${MOATS}/MIZ.json | jq -r ".[].secret")
|
||||
[[ ${OLD16} == "" || ${OLD16} == "null" ]] && OLD16="_SECRET_"
|
||||
echo "${OLD16}"
|
||||
|
||||
# TODO : MAKE NODE FORGET PASS THEN DECODE ${PLAYER}/secret.june FROM TW # PROD #
|
||||
MACHINEPUB=$(cat $HOME/.zen/game/myswarm_secret.dunikey | grep pub | cut -d ' ' -f 2)
|
||||
|
||||
if [[ "${MACHINEPUB}" != "" ]]; then
|
||||
#~ echo "# CRYPTO ENCODING PLAYER KEY WITH MACHINEPUB
|
||||
${MY_PATH}/../tools/natools.py encrypt \
|
||||
-p ${MACHINEPUB} \
|
||||
-i $HOME/.zen/game/players/${PLAYER}/secret.june \
|
||||
-o $HOME/.zen/tmp/${MOATS}/secret.june.${G1PUB}.enc
|
||||
ENCODING=$(cat ~/.zen/tmp/${MOATS}/secret.june.$G1PUB.enc | base16)
|
||||
sed -i "s~${OLD16}~${ENCODING}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
echo "ENCODING: ${ENCODING}"
|
||||
|
||||
# GIVE ZEN STATION TW ACCESS #
|
||||
###########
|
||||
#~ echo "# CRYPTO DECODING TESTING..."
|
||||
tiddlywiki \
|
||||
--load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
|
||||
cat ~/.zen/tmp/${MOATS}/MadeInZion.json \
|
||||
| jq -r ".[].secret" | base16 -d \
|
||||
> ~/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2
|
||||
|
||||
${MY_PATH}/../tools/natools.py decrypt \
|
||||
-f pubsec \
|
||||
-k $HOME/.zen/game/myswarm_secret.dunikey \
|
||||
-i $HOME/.zen/tmp/${MOATS}/crypto.$G1PUB.enc.2 \
|
||||
-o $HOME/.zen/tmp/${MOATS}/crypto.2
|
||||
#~ echo "DEBUG : $(cat $HOME/.zen/tmp/${MOATS}/crypto.2)"
|
||||
###########
|
||||
## CRYPTO PROCESS VALIDATED
|
||||
[[ -s ~/.zen/tmp/${MOATS}/crypto.2 ]] \
|
||||
&& echo "NATOOLS LOADED STATION TW KEY " \
|
||||
|| echo "NATOOLS ERRORS - CHECK STATION" # MACHINEPUB CRYPTO ERROR
|
||||
|
||||
else
|
||||
echo " - WARNING - MISSING ~/.zen/game/myswarm_secret.dunikey - WARNING -"
|
||||
fi
|
||||
########### SECTOR = 0.1° UPLANET SLICE
|
||||
OSECTOR=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].sector)
|
||||
[[ ${OSECTOR} != "null" ]] && sed -i "s~${OSECTOR}~${SECTOR}~g" ~/.zen/tmp/${MOATS}/MadeInZion.json
|
||||
|
||||
### CREATE ${NID} ADDRESS FOR API & ROUND ROBIN FOR GW
|
||||
cat ${MY_PATH}/../templates/data/local.api.json | sed "s~_NID_~${WID}~g" > ~/.zen/tmp/${MOATS}/local.api.json
|
||||
cat ${MY_PATH}/../templates/data/local.gw.json | sed "s~_NID_~${NID}~g" > ~/.zen/tmp/${MOATS}/local.gw.json
|
||||
|
||||
# Create"${PLAYER}_feed" Key ! DERIVATED ! "$SALT" "$PEPPER $G1PUB"
|
||||
ipfs key rm "${PLAYER}_feed" 2>/dev/null
|
||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/feed.ipfskey "$SALT" "$PEPPER $G1PUB"
|
||||
FEEDNS=$(ipfs key import "${PLAYER}_feed" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/feed.ipfskey)
|
||||
|
||||
## MAKE LightBeam Plugin Tiddler ${PLAYER}_feed
|
||||
# $:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-name","text":"'${PLAYER}_feed'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-name.json
|
||||
echo '[{"title":"$:/plugins/astroport/lightbeams/saver/ipns/lightbeam-key","text":"'${FEEDNS}'","tags":""}]' > ~/.zen/tmp/${MOATS}/lightbeam-key.json
|
||||
|
||||
## ADD SYSTEM TW
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.api.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/local.gw.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/GPS.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/AstroID.json "application/json" \
|
||||
--import ~/.zen/tmp/${MOATS}/MadeInZion.json "application/json" \
|
||||
--import "${MY_PATH}/../templates/tw/\$ _ipfs_saver_api.json" "application/json" \
|
||||
--import "${MY_PATH}/../templates/tw/\$ _ipfs_saver_gateway.json" "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "tw.html" "text/plain"
|
||||
|
||||
## COPY TO LOCAL & 12345 IPFSNODEID MAP
|
||||
[[ -s ~/.zen/tmp/${MOATS}/tw.html ]] \
|
||||
&& cp -f ~/.zen/tmp/${MOATS}/tw.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
|
||||
&& mkdir -p ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER} \
|
||||
&& cp ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/ \
|
||||
|| ( echo "Problem with TW - EXIT" && exit 1 )
|
||||
|
||||
############################################################################ G1TW
|
||||
#### MAKE G1TW
|
||||
[[ -s ~/.zen/G1BILLET/MAKE_G1BILLET.sh ]] && \
|
||||
~/.zen/G1BILLET/MAKE_G1BILLET.sh "$SALT" "$PEPPER" "___" "$G1PUB" "${PASS}" "${PSEUDO-xastro}" "$ASTRONAUTENS" "$PLAYER"
|
||||
#### MADE # BILLETNAME=$(echo "$SALT" | sed 's/ /_/g') ##
|
||||
# IMAGE ~/.zen/G1BILLET/tmp/g1billet/${PASS}/${BILLETNAME}.BILLET.jpg
|
||||
############################################################################
|
||||
|
||||
## MAKE IMAGE AVATAR WITH G1PUB QRCODE
|
||||
if [[ $(which amzqr) ]]; then
|
||||
|
||||
GIMG="${MY_PATH}/../images/moa_net.png"
|
||||
CIMG="${MY_PATH}/../images/zenticket.png"
|
||||
|
||||
# QRG1avatar.png
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/QRG1avatar.png ]] && amzqr "${G1PUB}" -l H -p "$CIMG" -c -n QRG1avatar.png -d ~/.zen/game/players/${PLAYER}/ 1>/dev/null
|
||||
# QRTWavatar.png
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]] && amzqr "${myIPFSGW}/ipns/${ASTRONAUTENS}" -l H -p "$GIMG" -c -n QRTWavatar.png -d ~/.zen/game/players/${PLAYER}/ 1>/dev/null
|
||||
|
||||
else
|
||||
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/QRG1avatar.png ]] \
|
||||
&& cp ~/.zen/game/players/${PLAYER}/QR.png ~/.zen/game/players/${PLAYER}/QRG1avatar.png
|
||||
|
||||
[[ ! -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]] \
|
||||
&& cp ~/.zen/game/players/${PLAYER}/QR.ASTRONAUTENS.png ~/.zen/game/players/${PLAYER}/QRTWavatar.png
|
||||
|
||||
fi
|
||||
|
||||
## ID CARD & QRCODE
|
||||
convert ~/.zen/game/players/${PLAYER}/QRG1avatar.png -resize 300 ~/.zen/tmp/${MOATS}/QR.png 2>/dev/null
|
||||
convert ~/.zen/game/players/${PLAYER}/QRTWavatar.png -resize 240 ~/.zen/tmp/${MOATS}/TW.png 2>/dev/null
|
||||
convert ${MY_PATH}/../images/astroport.jpg -resize 240 ~/.zen/tmp/${MOATS}/ASTROPORT.png 2>/dev/null
|
||||
|
||||
|
||||
composite -compose Over -gravity SouthEast -geometry +5+5 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png 2>/dev/null
|
||||
composite -compose Over -gravity NorthEast -geometry +10+55 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png 2>/dev/null
|
||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport2.png ~/.zen/tmp/${MOATS}/one.png 2>/dev/null
|
||||
convert -gravity SouthWest -pointsize 12 -fill black -draw "text 5,3 \"$G1PUB\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/txt.png
|
||||
|
||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
|
||||
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/txt.png ~/.zen/tmp/${MOATS}/image.png
|
||||
convert -gravity northwest -pointsize 20 -fill black -draw "text 300,40 \"${PLAYER}\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
|
||||
|
||||
|
||||
## WITH CONFIDENTIAL (LOCAL PRINT)
|
||||
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/${MOATS}/pseudo.png ~/.zen/tmp/${MOATS}/pass.png
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/${MOATS}/pass.png ~/.zen/tmp/${MOATS}/salt.png
|
||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/${PLAYER}/ID.png
|
||||
|
||||
# INSERTED IMAGE IPFS
|
||||
# IASTRO=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ID.png | tail -n 1) ## ZENCARD PUBLIC / PRIVATE
|
||||
IASTRO="/ipfs/$(ipfs add -Hq ~/.zen/tmp/${MOATS}/pseudo.png | tail -n 1)" ## ZENCARD PUBLIC ONLY
|
||||
|
||||
## Update ZenCard
|
||||
[[ ! $ZenCard ]] && ZenCard="/ipfs/bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a"
|
||||
sed -i "s~${ZenCard}~${IASTRO}~g" ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
|
||||
|
||||
echo
|
||||
echo "♥ IPFS Ŋ1 TW INIT ♥"
|
||||
echo "TW ${NID}/ipns/${ASTRONAUTENS}/"
|
||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html | tail -n 1)
|
||||
echo $IPUSH > ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain # Contains last IPFS backup PLAYER KEY
|
||||
echo $MOATS > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats
|
||||
|
||||
(
|
||||
#~ echo "$MOATS :: /ipfs/$IPUSH"
|
||||
ipfs name publish --key=${PLAYER} /ipfs/$IPUSH
|
||||
#~ echo "TW PUBLISHING DONE"
|
||||
) &
|
||||
|
||||
## MEMORISE PLAYER Ŋ1 ZONE
|
||||
echo "${PLAYER}" > ~/.zen/game/players/${PLAYER}/.player
|
||||
echo "$PSEUDO" > ~/.zen/game/players/${PLAYER}/.pseudo
|
||||
echo "$G1PUB" > ~/.zen/game/players/${PLAYER}/.g1pub
|
||||
|
||||
echo "${ASTRONAUTENS}" > ~/.zen/game/players/${PLAYER}/.playerns
|
||||
|
||||
#~ echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
|
||||
|
||||
echo "--- PLAYER : ${PLAYER} - DATA PROTOCOL LAYER LOADED";
|
||||
# ls ~/.zen/game/players/${PLAYER}
|
||||
|
||||
[[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]] && xdg-open "${myIPFS}/ipns/${ASTRONAUTENS}" && espeak "YOUR PASS IS $PASS"
|
||||
|
||||
####### CORRECT NO CURRENT ? PLAYER = .current
|
||||
[[ ! -e ~/.zen/game/players/.current ]] \
|
||||
&& rm ~/.zen/game/players/.current 2>/dev/null \
|
||||
&& ln -s ~/.zen/game/players/${PLAYER} ~/.zen/game/players/.current
|
||||
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
|
||||
#################################################################
|
||||
#### make player ipfs docker ## TODO
|
||||
# [[ $USER == 'zen' ]] && make player MAIL=$(myPlayer) USER_HOST=$(myPlayerHost) > /dev/null 2>&1
|
||||
## 1ST RELEASE BASED ON DIRECT NODE IPFSNODEID KEY "ADD / DEL" API
|
||||
#################################################################
|
||||
|
||||
#################################################
|
||||
# !! TODO !! # DEMO MODE. REMOVE FOR PRODUCTION - RECALCULATE AND RENEW AFTER EACH NEW KEY DELEGATION
|
||||
echo "$PASS" > ~/.zen/game/players/${PLAYER}/.pass
|
||||
# ~/.zen/game/players/${PLAYER}/secret.june SECURITY TODO
|
||||
# Astronaut QRCode + PASS = LOGIN (=> DECRYPTING CRYPTO IPFS INDEX)
|
||||
# TODO : Allow Astronaut PASS change ;)
|
||||
#####################################################
|
||||
|
||||
## MANAGE GCHANGE+ & Ŋ1 EXPLORATION
|
||||
${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "${PLAYER}"
|
||||
|
||||
### IF PRINTER -> PRINT VISA
|
||||
LP=$(ls /dev/usb/lp* 2>/dev/null)
|
||||
[[ $LP ]] && ${MY_PATH}/../tools/VISA.print.sh "${PLAYER}" &
|
||||
|
||||
## INIT FRIENDSHIP CAPTAIN/ASTRONAUTS (LATER THROUGH GCHANGE)
|
||||
## ${MY_PATH}/FRIENDS.init.sh
|
||||
## NO. GCHANGE+ IS THE MAIN INTERFACE, astrXbian manage
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
echo "$(${MY_PATH}/../tools/face.sh cool)"
|
||||
echo " 'Astronaut' $PSEUDO"
|
||||
echo
|
||||
echo "* ZenCard : Public Key and Wallet
|
||||
${NID}/ipns/${ASTRONAUTENS}#ZenCard"
|
||||
echo " "
|
||||
echo "* AstroID : with PASS : $PASS"
|
||||
echo "${NID}/ipns/${ASTRONAUTENS}#AstroID"
|
||||
echo
|
||||
echo "* UMap : registration at ${LAT}, ${LON}"
|
||||
echo
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
echo ""
|
||||
|
||||
####tools##########################################getUMAP_ENV.sh
|
||||
$(${MY_PATH}/../tools/getUMAP_ENV.sh "${LAT}" "${LON}" | tail -n 1)
|
||||
|
||||
|
||||
ipns2did=""
|
||||
|
||||
# Loop through the ASTRONAUTENS two characters at a time
|
||||
for ((i = 0; i < ${#ASTRONAUTENS}; i += 2)); do
|
||||
ipns2did+=" ${ASTRONAUTENS:i:2}"
|
||||
# Check if 12 doublets have been added
|
||||
if (( (i / 2 + 1) % 12 == 0 )); then
|
||||
ipns2did+="<br>" # Add a newline character
|
||||
fi
|
||||
done
|
||||
|
||||
# Print the result with leading space removed
|
||||
echo -e "${ipns2did:1}"
|
||||
####################################################### EMAIL
|
||||
[[ -s ${MY_PATH}/../templates/UPlanetZINE/day0/index.${LANG}.html ]] \
|
||||
&& ZINE="${MY_PATH}/../templates/UPlanetZINE/day0/index.${LANG}.html" \
|
||||
|| ZINE="${MY_PATH}/../templates/UPlanetZINE/day0/index.html"
|
||||
##UPlanetZine::/ipfs/QmUjgQYK74UgRoyLFfmR2LMX7rd6vNxmtWeUtRxjemELuZ - chained release -
|
||||
cat ${ZINE} \
|
||||
| sed -e "s~/ipfs/QmdmeZhD8ncBFptmD5VSJoszmu41edtT265Xq3HVh8PhZP~${ASTROQR}~g" \
|
||||
-e "s~/ipfs/QmTL7VDgkYjpYC2qiiFCfah2pSqDMkTANMeMtjMndwXq9y~${IASTRO}~g" \
|
||||
-e "s~_MOATS_~${MOATS}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
-e "s~_G1PUB_~${G1PUB}~g" \
|
||||
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
||||
-e "s~_ASTRODID_~${ipns2did:1}~g" \
|
||||
-e "s~0448~${PASS}~g" \
|
||||
-e "s~_SALT_~${SALT}~g" \
|
||||
-e "s~_PEPPER_~${PEPPER}~g" \
|
||||
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
|
||||
-e "s~_EARTHCID_~${EARTHCID}~g" \
|
||||
-e "s~_SECTOR_~${SECTOR}~g" \
|
||||
-e "s~_SLAT_~${SLAT}~g" \
|
||||
-e "s~_SLON_~${SLON}~g" \
|
||||
> ~/.zen/tmp/${MOATS}/UPlanetZine.html
|
||||
|
||||
|
||||
$MY_PATH/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/${MOATS}/UPlanetZine.html "${PLAYER} MULTIPASS"
|
||||
|
||||
#####################################################################"_EARTHCID_
|
||||
|
||||
#~ echo "<html><head>
|
||||
#~ <style>
|
||||
#~ body {
|
||||
#~ font-family: 'Courier New', monospace;
|
||||
#~ }
|
||||
#~ pre {
|
||||
#~ white-space: pre-wrap;
|
||||
#~ }
|
||||
#~ </style></head>
|
||||
#~ <body>
|
||||
#~ <center>
|
||||
#~ <h3><a href='${myUPLANET}'>UPlanet</a></h3>
|
||||
#~ <h1>\"<a target='TW' href='$(myIpfsGw)/ipns/${ASTRONAUTENS}'>TW5</a>\"</h1>
|
||||
#~ did:/ipns/${ASTRONAUTENS}
|
||||
#~ <hr>
|
||||
#~ <hr><a target='TW' href='$(myIpfsGw)/ipns/${ASTRONAUTENS}#AstroID'>AstroID<br>
|
||||
#~ <img width=300px src='$(myIpfsGw)${ASTROQR}'\></a><br>
|
||||
#~ <h2>SECRET1=\"$SALT\"<br>SECRET2=\"$PEPPER\"</h2>
|
||||
#~ <h2> CODE : $PASS </h2>
|
||||
#~ <hr>
|
||||
#~ <a target='TW' href='$(myIpfsGw)/ipns/${ASTRONAUTENS}#ZenCard' title='${G1PUB}'>ZenCard</a><br>
|
||||
#~ <img src='$(myIpfsGw)${IASTRO}'\><br><hr>
|
||||
#~ ${G1PUB}" > ~/.zen/tmp/${MOATS}/AstroID.html
|
||||
|
||||
#~ echo "
|
||||
#~ <h3> /-> ASTROPORT : <a href='$(myIpfsGw)/ipns/${IPFSNODEID}'>/ipns/${IPFSNODEID}</a></h3>
|
||||
#~ <h3> /--> SECTOR : <a href='${EARTHCID}/map_render.html?southWestLat=${LAT::-1}&southWestLon=${LON::-1}°=0.1'>${SECTOR}</a></h3>
|
||||
#~ " >> ~/.zen/tmp/${MOATS}/AstroID.html
|
||||
|
||||
#~ asciiart="${MY_PATH}/../images/logoastro.art"
|
||||
#~ while IFS= read -r line
|
||||
#~ do
|
||||
#~ echo "$line" | sed "s~ ~\ ~g" >> ~/.zen/tmp/${MOATS}/AstroID.html
|
||||
#~ echo "<br>" >> ~/.zen/tmp/${MOATS}/AstroID.html
|
||||
#~ done <"$asciiart"
|
||||
|
||||
#~ echo "<br>${MOATS}<br>- print a copy -</center></body></html>" >> ~/.zen/tmp/${MOATS}/AstroID.html
|
||||
|
||||
#~ $MY_PATH/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/${MOATS}/AstroID.html "TW5 & AstroID"
|
||||
|
||||
#~ mpack -a -s "✅ UPlanet : AstroID ($PASS)" -d ~/.zen/tmp/${MOATS}/intro.txt \
|
||||
#~ $HOME/.zen/game/players/${PLAYER}/AstroID.png ${PLAYER}
|
||||
|
||||
## CLEANING CACHE
|
||||
rm -Rf ~/.zen/tmp/${MOATS}
|
||||
|
||||
|
||||
#####################################################################"
|
||||
|
||||
## CHECK .current
|
||||
[[ ! -d $(readlink ~/.zen/game/players/.current) ]] \
|
||||
&& rm ~/.zen/game/players/.current 2>/dev/null \
|
||||
&& ln -s ~/.zen/game/players/${PLAYER} ~/.zen/game/players/.current
|
||||
|
||||
|
||||
echo $PSEUDO > ~/.zen/tmp/PSEUDO ## Return data to command.sh # KEEP IT
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
################################################ LAST LINE REPORT VALUES TO CALLING SCRIPT | tail -n 1
|
||||
echo "export ASTROTW=/ipns/$ASTRONAUTENS ASTROG1=$G1PUB ASTROMAIL=$PLAYER ASTROFEED=$FEEDNS PASS=$PASS"
|
||||
exit 0
|
|
@ -22,13 +22,19 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1)
|
|||
|
||||
[[ ! $ASTRONAUTENS ]] && echo "$PLAYER IPNS INTROUVABLE" && exit 1
|
||||
|
||||
G1PUB="$3"
|
||||
[[ -s $HOME/.zen/tmp/coucou/${G1PUB}.COINS ]] \
|
||||
&& COINS=$(cat $HOME/.zen/tmp/coucou/${G1PUB}.COINS) \
|
||||
&& [[ ${COINS} == "null" || ${COINS} == "" ]] \
|
||||
&& echo ">>> ${COINS} : G1 NEEDED TO EXECUTE A WISH"
|
||||
|
||||
## EXPORT [tag[voeu]]
|
||||
echo "## EXTRACTION DE NOUVEAUX VOEUX pour $PLAYER TW"
|
||||
echo "$INDEX [tag[voeu]] ?"
|
||||
rm -f ~/.zen/tmp/voeu.json
|
||||
rm -f ~/.zen/tmp/voeu.json 2>/dev/null
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp --render '.' 'voeu.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[voeu]]'
|
||||
|
||||
[[ ! -s ~/.zen/tmp/voeu.json ]] && echo "AUCUN VOEU - EXIT -" && exit 0
|
||||
[[ ! -s ~/.zen/tmp/voeu.json ]] && echo "AUCUN VOEU A ACTIVER" && exit 0
|
||||
|
||||
## Tous les tiddlers comportant le tag "voeu" lancent la création d'un G1VOEU ayant le titre du Voeu comme génrateur de clef TW (pepper).
|
||||
cat ~/.zen/tmp/voeu.json | jq -r '.[].title' > ~/.zen/tmp/$PLAYER.voeux.create.list
|
||||
|
@ -39,7 +45,7 @@ do
|
|||
VOEU=$(echo "$VOEU" | sed -r 's/\<./\U&/g' | sed 's/ //g') # CapitalGluedWords
|
||||
|
||||
echo "CREATION G1Voeu G1$VOEU"
|
||||
~/.zen/Astroport.ONE/ASTROBOT/G1Voeu.sh "$VOEU" "$PLAYER" "$INDEX"
|
||||
~/.zen/Astroport.ONE/RUNTIME/G1Voeu.sh "$VOEU" "$PLAYER" "$INDEX"
|
||||
|
||||
done < ~/.zen/tmp/$PLAYER.voeux.create.list
|
||||
|
|
@ -0,0 +1,334 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "$MY_PATH/../tools/my.sh"
|
||||
|
||||
################################################################################
|
||||
# Inspect game wishes, refresh latest IPNS version
|
||||
# SubProcess Backup and chain
|
||||
# ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*
|
||||
# ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/*
|
||||
# _PLAYER.json
|
||||
|
||||
# change SWARM memory
|
||||
### # ~/.zen/tmp/${IPFSNODEID}/WISH/${WISHNAME}/${PLAYER}/*
|
||||
|
||||
PLAYER="$1" ## IPNS KEY NAME - G1PUB - PLAYER ...
|
||||
[[ ! ${PLAYER} ]] && echo "Please provide PLAYER publish key" && exit 1
|
||||
|
||||
MOATS="$2"
|
||||
|
||||
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
|
||||
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
||||
COINS=$(cat $HOME/.zen/tmp/coucou/${G1PUB}.COINS)
|
||||
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
|
||||
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
||||
[[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore --" && ASTRONAUTENS=$ASTRONS
|
||||
[[ ! $ASTRONAUTENS ]] && echo "Missing ${PLAYER} IPNS KEY - CONTINUE --" && exit 1
|
||||
|
||||
INDEX="$3"
|
||||
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/${PLAYER}/ipfs/moa/index.html"
|
||||
[[ ! -s $INDEX ]] && echo "TW ${PLAYER} manquant" && exit 1
|
||||
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu
|
||||
|
||||
###############################
|
||||
####### NEED G1 / ZEN TO RUN
|
||||
[[ ${COINS} == "null" || ${COINS} == "" ]] \
|
||||
&& echo ">>> ${COINS} : DESACTIVATED - NEED G1 TO REFRESH WISH - EXIT - " \
|
||||
&& exit 0
|
||||
echo "%% ${COINS} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
[[ $(echo "$COINS < 2" | bc -l) -eq 1 ]] && echo ">>> ${COINS} ONLY : 1 G1 + 10 ZEN NEEDED TO CONTINUE" && exit 0
|
||||
|
||||
###############################
|
||||
## EXTRACT G1Voeu from PLAYER TW
|
||||
echo "Exporting ${PLAYER} TW [days:created[-360]tag[G1Voeu]]"
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json
|
||||
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-360]tag[G1Voeu]]'
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json ]] \
|
||||
&& echo "AUCUN G1VOEU - EXIT -" && exit 0
|
||||
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq -r 'map(select(.wish != null)) | .[].wish' > ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
||||
wishnumbers=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt | wc -l)
|
||||
echo "${wishnumbers} VOEUX : ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt "
|
||||
|
||||
## ${PLAYER}.g1wishes.txt contains all TW G1PUB : IPNS key name
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
## GET VoeuTitle LIST
|
||||
while read WISH
|
||||
do
|
||||
[[ ${WISH} == "" || ${WISH} == "null" ]] && echo "BLURP. EMPTY WISH" && continue
|
||||
echo "==============================="
|
||||
## Get ${WISHNAME}
|
||||
WISHNAME=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title')
|
||||
[[ ! ${WISHNAME} ]] && echo "WISH sans NOM - CONTINUE -" && continue
|
||||
echo "G1Voeu ${WISH} (${WISHNAME})"
|
||||
|
||||
IPNS_VOEUNS=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wishns')
|
||||
VOEUKEY=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wish')
|
||||
|
||||
ICHECK=$(ipfs key list -l | grep -w "$VOEUKEY" | cut -d ' ' -f 1 )
|
||||
|
||||
if [[ ! $ICHECK ]]; then
|
||||
echo ">>> STATION MISSING $VOEUKEY - RESET ASTRONAUT WISHES - DERIVATED KEYS RECREATE -"
|
||||
sed -i "s~G1Voeu~voeu~g" $INDEX
|
||||
break
|
||||
else
|
||||
VCOINS=$($MY_PATH/../tools/COINScheck.sh $VOEUKEY | tail -n 1)
|
||||
[[ $VCOINS == "" || $VCOINS == "null" ]] \
|
||||
&& echo "G1WALLET NOT EXISTING YET : $VCOINS" \
|
||||
|| echo "WISH G1WALLET = $VCOINS G1"
|
||||
fi
|
||||
|
||||
## RUNNING WISH REFRESH : PLAYER CACHE
|
||||
mkdir -p ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/${WISH}
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json \
|
||||
| jq .[] | jq -r 'select(.wish=="'${WISH}'")' \
|
||||
> ~/.zen/tmp/${MOATS}/${WISH}.json
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
## RUN SPECIFIC G1Voeu ASTROBOT PROGRAM (like G1CopierYoutube.sh)
|
||||
if [[ -s $MY_PATH/../ASTROBOT/G1${WISHNAME}.sh ]]; then
|
||||
echo "........................ Astrobot G1${WISHNAME}.sh PROGRAM FOUND !"
|
||||
echo "________________________________ Running it *****"
|
||||
${MY_PATH}/../ASTROBOT/G1${WISHNAME}.sh "$INDEX" "${PLAYER}" "$MOATS" "~/.zen/tmp/${MOATS}/${WISH}.json"
|
||||
echo "________________________________ Finished ******"
|
||||
else
|
||||
echo "......................... NO G1${WISHNAME} PROGRAM... "
|
||||
fi
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
###########################################################################################
|
||||
##################################
|
||||
## MAKE MY OWN EXTRACTION : [tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]
|
||||
################################## MOA MAINTENANT
|
||||
echo "> EXPORT [tag[G1${WISHNAME}]!tag[G1Voeu]] § $myIPFSGW${IPNS_VOEUNS}/_${PLAYER}.tiddlers.rss.json"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME} \
|
||||
--render '.' _${PLAYER}'.tiddlers.rss.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]'
|
||||
|
||||
|
||||
## RUN TW Ŋ1 search & copy treatment
|
||||
echo "*********************************"
|
||||
##################################
|
||||
## Search for [tag[G1${WISHNAME}]] in all Friends TW.
|
||||
## Copy tiddlers ...
|
||||
##################################
|
||||
echo "NOW SEARCH Ŋ1 FRIENDS TW's FOR tag=G1${WISHNAME}"
|
||||
echo "ls ~/.zen/game/players/${PLAYER}/FRIENDS/*/index.html"
|
||||
echo "*********************************"
|
||||
## Search in Local World (NB! G1Voeu TW copied by Connect_PLAYER_To_Gchange.sh)
|
||||
FINDEX=($( ls $HOME/.zen/game/players/${PLAYER}/FRIENDS/*/index.html))
|
||||
|
||||
## PREPARE Ŋ1 WORLD MAP
|
||||
echo "var examples = {};
|
||||
examples['locations'] = function() {
|
||||
var locations = {
|
||||
" > ~/.zen/tmp/world.js
|
||||
floop=1
|
||||
|
||||
for FRIENDTW in ${FINDEX[@]};
|
||||
do
|
||||
|
||||
[[ ! -s ${FRIENDTW} ]] && echo "$floop / ${#FINDEX[@]} ${FRIENDTW} VIDE (AMI SANS TW)" && echo && ((floop++)) && continue
|
||||
|
||||
## GET FRIEND EMAIL = APLAYER (VERIFY TW IS OK)
|
||||
tiddlywiki --load ${FRIENDTW} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
||||
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json ]] && echo "${PLAYER} MadeInZion : BAD TW (☓‿‿☓) " && continue
|
||||
|
||||
APLAYER=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
||||
|
||||
## EXPORT LAST 30 DAYS G1WishName in _${APLAYER}.tiddlers.rss.json
|
||||
rm -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json
|
||||
echo "$floop / ${#FINDEX[@]} TRY EXPORT [tag[G1${WISHNAME}]] FROM $APLAYER TW"
|
||||
tiddlywiki --load ${FRIENDTW} \
|
||||
--output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME} \
|
||||
--render '.' _${APLAYER}'.tiddlers.rss.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]'
|
||||
|
||||
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json ]] \
|
||||
&& echo "NO ${WISHNAME} - CONTINUE -" \
|
||||
&& echo && ((floop++)) && continue
|
||||
|
||||
[[ $(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json) == "[]" ]] \
|
||||
&& echo "EMPTY ${WISHNAME} - CONTINUE -" && echo && ((floop++)) \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json \
|
||||
&& continue
|
||||
|
||||
#####################################################
|
||||
echo "## TIDDLERS FOUND ;) MIAM >>> (◕‿‿◕) <<<"
|
||||
##############################
|
||||
## WRITE FRIEND SAME WISH TIDDLERS IN PLAYER TW ########
|
||||
##############################
|
||||
## SIGN Tiddlers
|
||||
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json \
|
||||
| sed "s~${PLAYER}~~g" \
|
||||
| sed "s~${APLAYER}~${APLAYER} ${PLAYER}~g" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.signed.json
|
||||
|
||||
## ADD TO TW
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--import ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.signed.json "application/json" \
|
||||
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||
## CHECK IT IS OK
|
||||
[[ -s ~/.zen/tmp/${MOATS}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${MOATS}/newindex.html ${INDEX} \
|
||||
&& rm ~/.zen/tmp/${MOATS}/newindex.html
|
||||
|
||||
##############################
|
||||
echo ">>> G1FRIEND § $myIPFS${IPNS_VOEUNS}/_${APLAYER}.tiddlers.rss.json ${WISHNAME}"
|
||||
|
||||
# Extract Origin G1Voeu Tiddler
|
||||
tiddlywiki --load ${FRIENDTW} --output ~/.zen/tmp --render '.' "${APLAYER}.${WISHNAME}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${WISHNAME}"
|
||||
FWISHNS=$(cat ~/.zen/tmp/${APLAYER}.${WISHNAME}.json | jq -r '.[].wishns')
|
||||
# FWISHPROG=$(cat ~/.zen/tmp/${APLAYER}.${WISHNAME}.json | jq -r '.[].text')
|
||||
# TIDDLER COULD CONTAIN #!/bin/bash PROGRAM !!!
|
||||
[[ $FWISHNS == "null" ]] && echo "NO FWISHNS in ~/.zen/tmp/${APLAYER}.${WISHNAME}.json" && echo && ((floop++)) && continue
|
||||
echo ">>> ${myIPFS}${FWISHNS}"
|
||||
|
||||
###########################################################################################
|
||||
## ADD WISH ON THE WORLD MAP (TODO: EXTRACT REAL GPS)
|
||||
echo "${floop}: {
|
||||
alpha: Math.random() * 2 * Math.PI,
|
||||
delta: Math.random() * 2 * Math.PI,
|
||||
name: '"${WISNAME} ${APLAYER}"',
|
||||
link: '"${myIPFS}${FWISHNS}"'
|
||||
}
|
||||
," >> ~/.zen/tmp/world.js
|
||||
|
||||
((floop++))
|
||||
done
|
||||
|
||||
# REMOVE la dernière virgule
|
||||
sed -i '$ d' ~/.zen/tmp/world.js
|
||||
##################################
|
||||
## FINISH LOCATIONS
|
||||
echo "
|
||||
};
|
||||
\$('#sphere').earth3d({
|
||||
locationsElement: \$('#locations'),
|
||||
dragElement: \$('#locations'),
|
||||
locations: locations
|
||||
});
|
||||
};
|
||||
" >> ~/.zen/tmp/world.js
|
||||
|
||||
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
|
||||
echo "JSON WISH WORLD READY /ipfs/${IAMAP}/world.js"
|
||||
##################################
|
||||
## PREPARE PLAYER G1 QRCODE : QRG1avatar.png
|
||||
[[ -s ~/.zen/game/players/${PLAYER}/voeux/${WISHNAME}/${VOEUKEY}/voeu.png ]] \
|
||||
&& QRLINK=$(ipfs add -q ~/.zen/game/players/${PLAYER}/voeux/${WISHNAME}/${VOEUKEY}/voeu.png | tail -n 1)
|
||||
[[ $QRLINK == "" ]] && QRLINK=$(ipfs add -q ~/.zen/game/players/${PLAYER}/QRG1avatar.png | tail -n 1)
|
||||
|
||||
### APPLY FOR ${WISHNAME} APP MODEL : make index.html
|
||||
################################## ${WISHNAME}/index.html
|
||||
if [[ -s ${MY_PATH}/../WWW/${WISHNAME}/index.html ]]; then
|
||||
|
||||
cat ${MY_PATH}/../WWW/${WISHNAME}/index.html \
|
||||
| sed -e "s~_LIBRA_~$(myIpfsGw)~g" \
|
||||
-e "s~_G1VOEU_~${WISHNAME}~g" \
|
||||
-e "s~_PLAYER_~${PLAYER}~g" \
|
||||
-e "s~_____~${COINS}~g" \
|
||||
-e "s~_G1PUB_~${G1PUB}~g" \
|
||||
-e "s~_VOEUNS_~${IPNS_VOEUNS}~g" \
|
||||
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
||||
-e "s~http://astroport.localhost:1234~${myASTROPORT}~g" \
|
||||
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
||||
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
||||
-e "s~QmWUpjGFuF7NhpXgkrCmx8Tbu4xjcFpKhE7Bsvt6HeKYxu/g1ticket_qrcode.png~${QRLINK}~g" \
|
||||
-e "s~http://127.0.0.1:8080~~g" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/index.html
|
||||
|
||||
fi
|
||||
### PREPARE WISHNAME index.html - CREATE YOUR OWN DAPP -
|
||||
##################################
|
||||
|
||||
###########################################################################################
|
||||
## N1Program are run through PLAYER G1PalPay RUNTIME
|
||||
## CAN BE EXTENDED WITH DATA POST TREATMENT PROGRAMS
|
||||
## RUN Z1Program ASTROBOT PROGRAM
|
||||
#~ if [[ -s $MY_PATH/../ASTROBOT/Z1${WISHNAME}.sh ]]; then
|
||||
#~ echo "........................ Astrobot Z1${WISHNAME}.sh post-treatment found !"
|
||||
#~ echo "________________________________ Running it *****"
|
||||
#~ ${MY_PATH}/../ASTROBOT/Z1${WISHNAME}.sh "~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}" "${PLAYER}" "$MOATS"
|
||||
#~ echo "________________________________ Finished ******"
|
||||
#~ fi
|
||||
|
||||
###########################################################################################
|
||||
### ADD ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*
|
||||
### AND PUBLISH WISH TO IPFS
|
||||
echo "++WISH PUBLISHING++ ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*"
|
||||
ls ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/
|
||||
|
||||
## CREATE .all.json for WISHNAME
|
||||
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}
|
||||
|
||||
WISHFLUX=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/* | tail -n 1) # ADDING JSONS TO IPFS
|
||||
ipfs --timeout 180s name publish -k $VOEUKEY /ipfs/$WISHFLUX # PUBLISH $VOEUKEY
|
||||
|
||||
echo "## ASK ${myIPFSGW}${IPNS_VOEUNS} TO REFRESH" ## TODO LOOP BOOSTRAP & ONLINE FRIENDS
|
||||
curl -m 120 -so ~/.zen/tmp/${WISHNAME}.astroindex.html "${myIPFSGW}${IPNS_VOEUNS}" &
|
||||
|
||||
## MOVE INTO PLAYER AREA
|
||||
echo ">>> ${PLAYER} G1${WISHNAME} Ŋ1 FLUX $(myIpfsGw)${IPNS_VOEUNS}"
|
||||
echo "WALLET ${VOEUKEY} FOUNDED by ${G1PUB}"
|
||||
cp -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/* ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/ 2>/dev/null
|
||||
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
echo "SEARCH WORLD SAME WISH CACHE"
|
||||
[[ "$WISHNAME" != "" ]] && cat ~/.zen/game/world/$WISHNAME/*/.link 2>/dev/null
|
||||
## ANYTIME A PLAYER CHOOSE AN ASTROPORT - LOCAL WISH CACHE IS EXTENDED -
|
||||
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
|
||||
done < ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
||||
|
||||
################################################
|
||||
### SEND GRATITUDE TO SECTOR
|
||||
## GET "GPS" TIDDLER
|
||||
if [[ ${wishnumbers} -gt 0 ]]; then
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS' ## GPS Tiddler
|
||||
TWMAPNS=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].umap)
|
||||
[[ $TWMAPNS == "null" || $TWMAPNS == "" ]] && TWMAPNS="/ipns/k51qzi5uqu5djg1gqzujq5p60w25mi235gdg0lgkk5qztkfrpi5c22oolrriyu"
|
||||
LAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
|
||||
[[ ${LAT} == "null" || ${LAT} == "" ]] && LAT="0.00"
|
||||
LAT=$(makecoord $LAT)
|
||||
LON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
|
||||
[[ ${LON} == "null" || ${LON} == "" ]] && LON="0.00"
|
||||
LON=$(makecoord $LON)
|
||||
echo "LAT=${LAT}; LON=${LON}; UMAPNS=${TWMAPNS}"
|
||||
rm ~/.zen/tmp/${MOATS}/GPS.json
|
||||
|
||||
## GET UMAP ENV
|
||||
$(${MY_PATH}/../tools/getUMAP_ENV.sh ${LAT} ${LON} | tail -n 1)
|
||||
echo "export UMAPG1PUB=$UMAPG1PUB UMAPIPNS=$UMAPIPNS SECTOR=$SECTOR SECTORG1PUB=$SECTORG1PUB SECTORIPNS=$SECTORIPNS REGION=$REGION REGIONG1PUB=$REGIONG1PUB REGIONIPNS=$REGIONIPNS LAT=$LAT LON=$LON SLAT=$SLAT SLON=$SLON RLAT=$RLAT RLON=$RLON"
|
||||
|
||||
##############################################################
|
||||
GRATITUDE=$($MY_PATH/../tools/getcoins_from_gratitude_box.sh)
|
||||
G1AMOUNT=$(echo "$GRATITUDE / 10" | bc -l | xargs printf "%.2f" | sed "s~,~.~g" )
|
||||
echo "***** PLAYER $PLAYER *************************************"
|
||||
echo "GRATITUDE ${GRATITUDE} ZEN (${G1AMOUNT} G1)
|
||||
to UMAP_${LAT}_${LON} WALLET ${UMAPG1PUB}"
|
||||
echo "************************************************************"
|
||||
YOUSER=$($MY_PATH/../tools/clyuseryomail.sh "${PLAYER}")
|
||||
MYWISHFLUX=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/* | tail -n 1) # ADDING JSONS TO IPFS
|
||||
${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${G1AMOUNT}" "${UMAPG1PUB}" "UPLANET:UWISH:$YOUSER:/ipfs/${MYWISHFLUX}"
|
||||
fi
|
||||
################################################
|
||||
################################################ GRATITUDE SENT TO SECTOR
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,76 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
#~ ZEN.SECTOR.memory.sh
|
||||
#~ Search for last "UPLANET:$1:..." in UPLANETG1PUB wallet history
|
||||
#~ INTERCOM="UPLANET:${SECTOR}:${TODATE}:/ipfs/${IPFSPOP}" TX COMMENT are made during SECTOR.refresh.sh
|
||||
#~ ~/.zen/tmp/${MOATS}/${SECTOR} <=> "/ipfs/$ipfs_pop"
|
||||
################################################################################
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
################################################################################
|
||||
|
||||
SECTOR="$1"
|
||||
[[ $SECTOR == "" ]] && echo "MISSING SECTOR ADRESS" && exit 1
|
||||
MOATS="$2"
|
||||
G1PUB="$3"
|
||||
|
||||
## CHECK FOR BAD PARAM
|
||||
[[ ! -d ~/.zen/tmp/${MOATS-empty}/${SECTOR-empty}/ ]] \
|
||||
&& echo "BAD ~/.zen/tmp/${MOATS}/${SECTOR}" \
|
||||
&& exit 1
|
||||
|
||||
## STARTING
|
||||
start=`date +%s`
|
||||
|
||||
## CORRESPONDING REGION UKEY
|
||||
LAT=$(echo ${SECTOR} | cut -d '_' -f 2)
|
||||
LON=$(echo ${SECTOR} | cut -d '_' -f 3)
|
||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||
|
||||
REGION="_${RLAT}_${RLON}"
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${REGION}.priv "${UPLANETNAME}${REGION}" "${UPLANETNAME}${REGION}"
|
||||
REGIONG1PUB=$(cat ~/.zen/tmp/${MOATS}/${REGION}.priv | grep "pub:" | cut -d ' ' -f 2)
|
||||
[[ ! ${REGIONG1PUB} ]] && echo "ERROR generating REGION WALLET" && exit 1
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${REGIONG1PUB} | tail -n 1)
|
||||
echo "REGION : ${REGION} (${COINS} G1) WALLET : ${REGIONG1PUB}"
|
||||
|
||||
## RETRIEVE FROM REGION UKEY
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 ${MY_PATH}/../tools/jaklis/jaklis.py history -n 40 -p ${REGIONG1PUB} -j \
|
||||
> ~/.zen/tmp/${MOATS}/${REGION}.g1history.json
|
||||
|
||||
## SCAN FOR UPLANET:${SECTOR} in TX
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/${REGION}.g1history.json ]]; then
|
||||
|
||||
intercom=$(jq -r '.[] | select(.comment | test("UPLANET:'"${SECTOR}"'")) | .comment' ~/.zen/tmp/${MOATS}/${REGION}.g1history.json | tail -n 1)
|
||||
ipfs_pop=$(echo "$intercom" | rev | cut -d ':' -f 1 | rev)
|
||||
todate=$(echo "$intercom" | rev | cut -d ':' -f 2 | rev)
|
||||
echo "SYNC ${SECTOR} <= $todate (=${YESTERDATE})=> $ipfs_pop"
|
||||
|
||||
[[ ${todate} != ${YESTERDATE} ]] && echo "NO GOOD MEMORY - EXIT" && exit 1
|
||||
|
||||
## TODO: SECURITY PATCH : check payment emitter is from BOOSTRAP
|
||||
if [[ $ipfs_pop ]]; then
|
||||
g1pub=$(jq -r '.[] | select(.comment | test("UPLANET:'"${SECTOR}"'")) | .pubkey' ~/.zen/tmp/${MOATS}/${REGION}.g1history.json | tail -n 1)
|
||||
echo "INFO :: $g1pub Memory updater"
|
||||
ipfs --timeout 180s get --progress="false" -o ~/.zen/tmp/${MOATS}/${SECTOR} $ipfs_pop \
|
||||
&& ipfs pin rm $ipfs_pop \
|
||||
|| echo "$ipfs_pop ERROR ... "
|
||||
else
|
||||
echo "WARNING cannot revover any memory !!"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "FATAL ERROR cannot access to REGIONG1PUB history"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
end=`date +%s`
|
||||
echo "(${SECTOR}.memory) ${todate} get time : "`expr $end - $start` seconds.
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,89 @@
|
|||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
#~ ZEN.UMAP.memory.sh
|
||||
#~ Search for last "UPLANET:$1:..." in UPLANETG1PUB wallet history
|
||||
#~ INTERCOM="UPLANET:${UMAP}:${TODATE}:/ipfs/${IPFSPOP}" TX COMMENT are made during UPLANET.refresh.sh
|
||||
#~ ~/.zen/tmp/${MOATS}/${UMAP} <=> "/ipfs/$ipfs_pop"
|
||||
################################################################################
|
||||
################################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
. "${MY_PATH}/../tools/my.sh"
|
||||
################################################################################
|
||||
|
||||
UMAP="$1"
|
||||
[[ $UMAP == "" ]] && echo "MISSING UMAP ADRESS" && exit 1
|
||||
MOATS="$2"
|
||||
G1PUB="$3"
|
||||
|
||||
## CHECK FOR BAD PARAM
|
||||
[[ ! -d ~/.zen/tmp/${MOATS-empty}/${UMAP-empty}/ ]] \
|
||||
&& echo "BAD ~/.zen/tmp/${MOATS}/${UMAP}" \
|
||||
&& exit 1
|
||||
|
||||
## STARTING
|
||||
start=`date +%s`
|
||||
|
||||
## CORRESPONDING SECTOR UKEY
|
||||
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
||||
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
||||
|
||||
## SECTOR COORD
|
||||
SLAT="${LAT::-1}"
|
||||
SLON="${LON::-1}"
|
||||
|
||||
SECTOR="_${SLAT}_${SLON}"
|
||||
|
||||
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${SECTOR}.priv "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}"
|
||||
SECTORG1PUB=$(cat ~/.zen/tmp/${MOATS}/${SECTOR}.priv | grep "pub:" | cut -d ' ' -f 2)
|
||||
[[ ! ${SECTORG1PUB} ]] && echo "ERROR generating SECTOR WALLET" && exit 1
|
||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${SECTORG1PUB} | tail -n 1)
|
||||
echo "SECTOR : ${SECTOR} (${COINS} G1) WALLET : ${SECTORG1PUB}"
|
||||
|
||||
## RETRIEVE FROM SECTOR UKEY
|
||||
${MY_PATH}/../tools/timeout.sh -t 20 ${MY_PATH}/../tools/jaklis/jaklis.py history -n 40 -p ${SECTORG1PUB} -j \
|
||||
> ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json
|
||||
|
||||
## SCAN FOR UPLANET:${UMAP} in TX
|
||||
if [[ -s ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json ]]; then
|
||||
|
||||
intercom=$(jq -r '.[] | select(.comment | test("UPLANET:'"${UMAP}"'")) | .comment' ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json | tail -n 1)
|
||||
ipfs_pop=$(echo "$intercom" | rev | cut -d ':' -f 1 | rev)
|
||||
todate=$(echo "$intercom" | rev | cut -d ':' -f 2 | rev)
|
||||
echo "SYNC ${UMAP} <= $todate (=${YESTERDATE})=> $ipfs_pop"
|
||||
|
||||
[[ ${todate} != ${YESTERDATE} ]] && echo "NO GOOD MEMORY - EXIT" && exit 1
|
||||
|
||||
if [[ $ipfs_pop ]]; then
|
||||
echo "FOUND $todate MEMORY SLOT"
|
||||
g1pub=$(jq -r '.[] | select(.comment | test("UPLANET:'"${UMAP}"'")) | .pubkey' ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json | tail -n 1)
|
||||
echo "INFO :: $g1pub Memory updater"
|
||||
|
||||
## ADD SECURITY : check payment emitter is a "BOOSTRAP" (TODO)
|
||||
nodeid=$(${MY_PATH}/../tools/g1_to_ipfs.py $g1pub)
|
||||
|
||||
ipfs --timeout 360s get --progress="false" -o ~/.zen/tmp/${MOATS}/${UMAP} $ipfs_pop \
|
||||
&& ipfs pin rm $ipfs_pop \
|
||||
|| echo "$ipfs_pop ERROR ... "
|
||||
else
|
||||
echo "WARNING cannot revover any memory !!"
|
||||
fi
|
||||
|
||||
## REMOVE PREVIOUS PIN (in case last one was not mine)
|
||||
antecom=$(jq -r '.[] | select(.comment | test("UPLANET:'"${UMAP}"'")) | .comment' ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json | tail -n 2 | head -n 1)
|
||||
ipfs_b=$(echo "$antecom" | rev | cut -d ':' -f 1 | rev)
|
||||
[[ ! -z ${ipfs_b} ]] && ipfs pin rm ${ipfs_b}
|
||||
|
||||
|
||||
else
|
||||
echo "FATAL ERROR cannot access to SECTORG1PUB history"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
end=`date +%s`
|
||||
echo "(${UMAP}.memory) ${todate} get time : "`expr $end - $start` seconds.
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,60 @@
|
|||
CESIUM PLUS POD API
|
||||
https://github.com/duniter/cesium-plus-pod/blob/master/src/site/markdown/REST_API.md
|
||||
|
||||
FIND IN SYNC DUNITER NODES
|
||||
|
||||
https://g1.data.e-is.pro/g1/block/current
|
||||
|
||||
https://g1.duniter.fr/network/peers
|
||||
https://g1.duniter.fr/network/ws2p/heads
|
||||
|
||||
EXTRACT MEMBER
|
||||
https://g1.data.e-is.pro/wot/members
|
||||
|
||||
FOLLOW THE G1 (FIND LOOPS)
|
||||
https://g1.data.e-is.pro/g1/movement/_search?pretty&q=DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech
|
||||
|
||||
|
||||
# TODO LIST
|
||||
MADE BY
|
||||
```
|
||||
./search TODO
|
||||
```
|
||||
./ajouter_media.sh:## KEEPS KODI COMPATIBILITY (BROKEN astroport.py !! ) : TODO DEBUG
|
||||
./ajouter_media.sh: # Funny Crypto Level # TODO MAKE IT MORE SECURE # THIS KEY OWNS THE DOMAIN NOW
|
||||
./ajouter_media.sh: ## NB TEXT IS MADE WITH TIDDLERS FIELDS VALUES (LEARN TODO)
|
||||
./ajouter_media.sh: #~ ## TODO
|
||||
./ajouter_media.sh: FILE_NAME="$(echo "${TITLE}" | detox --inline).pdf" ## TODO make it better
|
||||
./ajouter_media.sh: ## TODO : CHECK CACHE LAST MODIFIED
|
||||
./setup_nginx.sh: echo "TODO: make it easier ;)"
|
||||
./tools/Connect_PLAYER_To_Gchange.sh:# TODO: could make better ES stars requests
|
||||
./tools/Connect_PLAYER_To_Gchange.sh:#### TODO RECUP ANNONCES Gchange ADD TO TW
|
||||
./tools/RSS2UPlanetTW.sh: ## TODO EXTEND CONTROL TO text AND ipfs _canonical_url
|
||||
./tools/RSS2UPlanetTW.sh: ## NB: COULD NEED SORTING (TODO)
|
||||
./tools/streaming/install.sh:# TODO: why is this needed?
|
||||
./tools/streaming/process-stream.sh:#TODO# Fix this one
|
||||
./tools/make_video_gifanim_ipfs.sh:## Create gifanime ## TODO Search for similarities BEFORE ADD
|
||||
./tools/create_ipfsnodeid_from_tmp_secret.dunikey.py:# TODO controls
|
||||
./tools/cron_VRFY.sh:## TODO check for Station geoposition in ~/.zen/GPS and calibrate 20H12
|
||||
./tools/cron_VRFY.sh:cat ~/.zen/GPS 2>/dev/null && echo " TODO calibrate 20H12 with GPS"
|
||||
./tools/PAY4SURE.sh: echo "SENT" > ${PENDINGFILE} ## TODO : MONITOR POTENTIAL CHAIN REJECTION (FORK/MERGE WINDOW)
|
||||
./tools/duniter_getnode.sh:# TODO: REMOVE 777 PATCH, ACTIVATE ramdisk
|
||||
./tools/search_for_this_email_in_players.sh: ## TODO ? SEARCH WITH DNSLINK
|
||||
./tools/new_file_in_astroport.sh: ## Create gifanime ## TODO Search for similarities BEFORE ADD
|
||||
./tools/new_file_in_astroport.sh:# EXTRACT INDEX REFERENCE : TMDB or YOUTUBE (TODO : EXTEND)
|
||||
./tools/new_file_in_astroport.sh: ## TODO USE IT TO MAKE A MEDIAKEY IMAGE KEY "SONDE" FOR FILTERING ?
|
||||
./tools/new_file_in_astroport.sh: TidType="text/vnd.tiddlywiki" ## MAYBE REAL ONCE TW CAN SHOW ATTACHED IPFS VIDEO (TODO: TESTINGS)
|
||||
./tools/new_file_in_astroport.sh:## TODO : Do we keep that ?
|
||||
./ASTROBOT/N1Kodi.sh: ## TODO CREATE A TEMP IPNS KEY ?!
|
||||
./ASTROBOT/N1Kodi.sh:## TODO CREATE FROM FRIEND LOCAL KODI RSS
|
||||
./ASTROBOT/_sandbox/_GCHANGE.process.sh:# Create tiddler informing ... TODO Add keyword ... Use tag="annonce" for tiddlers propagation
|
||||
./ASTROBOT/_sandbox/_GCHANGE.process.sh:echo "TODO DEBUG. CONTINUE?"
|
||||
./ASTROBOT/_sandbox/_GCHANGE.process.sh: # Message tiddlywiki TODO
|
||||
./ASTROBOT/G1CopierYoutube.sh: ## TODO CORRECT - CACHE CHANGED -
|
||||
./ASTROBOT/G1CopierYoutube.sh: ## TODO ACCEPT MORE WITH COINS
|
||||
./ASTROBOT/G1CopierYoutube.sh: # TODO : DELAY COPY OPERATION... Astro can download quicker at 03:00 AM
|
||||
./ASTROBOT/G1CopierYoutube.sh: ## COPY FROM YOUTUBE (TODO DOUBLE COPY & MKV to MP4 OPTIMISATION)
|
||||
./ASTROBOT/G1CopierYoutube.sh: ## Create gifanime ## TODO Search for similarities BEFORE ADD
|
||||
./ASTROBOT/G1CopierYoutube.sh: ## TODO : ADD EMAIL TAG ( TIMESTAMP & ADD SIGNATURE over existing ones)
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
####################################
|
||||
# stats.sh
|
||||
# analyse LOCAL & SWARM data structure
|
||||
####################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
. "${MY_PATH}/tools/my.sh"
|
||||
echo "==========================================================="
|
||||
|
||||
####################################
|
||||
# search for active TWS
|
||||
####################################
|
||||
echo " ## SEARCH TW in UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??/TW/*"
|
||||
METW=($(ls -d ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??/TW/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
SWARMTW=($(ls -d ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??/TW/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
combined=("${METW[@]}" "${SWARMTW[@]}")
|
||||
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
echo "${#unique_combined[@]} TW(S) : ${unique_combined[@]}"
|
||||
echo "==========================================================="
|
||||
|
||||
####################################
|
||||
# search for active UMAPS
|
||||
####################################
|
||||
echo " ## SEARCH UMAPS in UPLANET/__/_*_*/_*.?_*.?/*"
|
||||
MEMAPS=($(ls -td ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
||||
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||
|
||||
echo "${#unique_combined[@]} UMAP(S) : ${unique_combined[@]}"
|
||||
echo "==========================================================="
|
||||
for umap in ${unique_combined[@]}; do
|
||||
lat=$(echo $umap | cut -d '_' -f 2)
|
||||
lon=$(echo $umap | cut -d '_' -f 3)
|
||||
echo $lat $lon
|
||||
${MY_PATH}/tools/getUMAP_ENV.sh $lat $lon | tail -n 1
|
||||
echo
|
||||
done
|
|
@ -0,0 +1 @@
|
|||
HELLO THERE
|
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 305 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,280 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>_G1VOEU_ : _PLAYER_ : http://astroport.localhost:1234</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" type="image/x-icon" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/favicon.ico">
|
||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/demo.css">
|
||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-ui.min.css">
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/requestanimationframe.polyfill.js"></script>
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/instascan.min.js"></script>
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/html5-qrcode.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery-ui.0.min.js"></script>
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/sphere-hacked.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/jquery.earth-3d.js"></script>
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js"></script>
|
||||
|
||||
<script type="text/javascript" src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/demo.js"></script>
|
||||
|
||||
<script src="http://127.0.0.1:8080/ipfs/Qmae5v9zydax9u6C9ceDijURu5PYdd5avmv4NkenCw7RFv/astro.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
examples['simple_mars'] = function() {
|
||||
$('#sphere').earth3d({
|
||||
texture: 'http://127.0.0.1:8080/ipfs/QmNNSAJyzVSF2m16dReYgmqmiRkKa5HMKvFUgwhbRzTYto/mars1024x1024.jpg', // texture used by G1Wish planet
|
||||
dragElement: $('#locations') // where do we catch the mouse drag
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.slidecontainer {
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gif-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gif-container img {
|
||||
margin: 10px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.slider {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.slider #prev {
|
||||
float: left;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.slider #next {
|
||||
float: right;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
#glow-shadows.earth {
|
||||
background: url(http://127.0.0.1:8080/ipfs/QmTVspfoaNL1BK2CR1vVNrEnwo4PfUjwdQxEt57mGJjsLX/earth-glow-shadows.png);
|
||||
}
|
||||
|
||||
#glow-shadows.mars {
|
||||
background: url(http://127.0.0.1:8080/ipfs/QmTVspfoaNL1BK2CR1vVNrEnwo4PfUjwdQxEt57mGJjsLX/mars-glow-shadows.png);
|
||||
}
|
||||
|
||||
.flight {
|
||||
position: absolute;
|
||||
width: 24px;
|
||||
height: 25px;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
background: url(http://127.0.0.1:8080/ipfs/QmTVspfoaNL1BK2CR1vVNrEnwo4PfUjwdQxEt57mGJjsLX/plain.png);
|
||||
background-size: 100% 100%;
|
||||
margin-left: -12px;
|
||||
margin-top: -12.5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#yellow {
|
||||
background: black;
|
||||
position: absolute;
|
||||
top: 2%;
|
||||
right: 4%;
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
#green {
|
||||
background: black;
|
||||
position: absolute;
|
||||
top: 12%;
|
||||
right: 5%;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
#ainfo {
|
||||
background: grey;
|
||||
position: absolute;
|
||||
top: 1%;
|
||||
right: 1%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button id="ainfo" onclick="javascript:var x = document.getElementById('yellow'); if (x.style.visibility === 'hidden') {x.style.visibility = 'visible';} else {x.style.visibility = 'hidden';}">0/1</button>
|
||||
<iframe name="aframe" id="aframe" src="http://127.0.0.1:8080/ipns/_ASTRONAUTENS_" width="100%" height="640px"></iframe>
|
||||
|
||||
|
||||
<div id="demo">
|
||||
<div id="description">
|
||||
|
||||
<a href="javascript:FriendWithMe()"><img title="Connect with Me" width=20% src="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/l0g0.png" alt="Link in Le Claude"></a>
|
||||
<div id="countdown"></div>
|
||||
<h2>G1_G1VOEU_ _PLAYER_</h2>
|
||||
<div class="subtitle">A Friendly Planet of Friends</div>
|
||||
|
||||
<div class="slidecontainer">
|
||||
|
||||
<div class="gif-container">
|
||||
<!-- gifs -->
|
||||
</div>
|
||||
<div class="slider">
|
||||
<a href="#" id="prev"><</a>
|
||||
<a href="#" id="next">></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function FriendWithMe() {
|
||||
let cookies = document.cookie;
|
||||
console.log(cookies);
|
||||
let salt = prompt("Secret 1");
|
||||
let pepper = prompt("Secret 2");
|
||||
let resultUt = 'http://astroport.localhost:1234/?salt=' + salt + '&pepper=' + pepper + '&friend=_G1PUB_&stars=3';
|
||||
console.log(resultUt)
|
||||
homeAstroportStation( resultUt,'aframe', 4000)
|
||||
}
|
||||
|
||||
const gifContainer = document.querySelector('.gif-container');
|
||||
const prevBtn = document.querySelector('#prev');
|
||||
const nextBtn = document.querySelector('#next');
|
||||
const pageSize = 2;
|
||||
|
||||
let pageNumber = 0;
|
||||
let gifs = [];
|
||||
let urls = [];
|
||||
let titles = [];
|
||||
let durees = [];
|
||||
|
||||
// Récupérer les données
|
||||
fetch('http://127.0.0.1:8080_VOEUNS_/__PLAYER_.tiddlers.rss.json')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
// Extraire les gifanime
|
||||
gifs = data.map(tiddler => tiddler.gifanime);
|
||||
urls = data.map(tiddler => tiddler.ipfs);
|
||||
titles = data.map(tiddler => tiddler.title);
|
||||
durees = data.map(tiddler => tiddler.duree);
|
||||
// Afficher les gifs
|
||||
showGifs();
|
||||
});
|
||||
|
||||
// Afficher les images
|
||||
function showGifs() {
|
||||
let start = pageNumber * pageSize;
|
||||
let end = start + pageSize;
|
||||
let pageGifs = gifs.slice(start, end);
|
||||
let pageUrls = urls.slice(start, end);
|
||||
let pageTitles = titles.slice(start, end);
|
||||
let pageDurees = durees.slice(start, end);
|
||||
let output = '';
|
||||
|
||||
// Générer le HTML
|
||||
// <a target="aframe" href="http://127.0.0.1:8080${pageUrls[i]}">
|
||||
// <a target="aframe" href="http://127.0.0.1:8080/ipns/_ASTRONAUTENS_#${pageTitles[i]}">
|
||||
pageGifs.forEach((gif, i) => {
|
||||
output += `
|
||||
<a target="aframe" href="http://127.0.0.1:8080/ipns/_ASTRONAUTENS_#${pageTitles[i]}">
|
||||
<img src="http://127.0.0.1:8080${gif}" title="${pageDurees[i]} - ${pageTitles[i]}" />
|
||||
</a>
|
||||
`;
|
||||
});
|
||||
|
||||
// Ajouter le HTML
|
||||
gifContainer.innerHTML = output;
|
||||
}
|
||||
|
||||
// Écouter les évènements
|
||||
prevBtn.addEventListener('click', () => {
|
||||
pageNumber--;
|
||||
showGifs();
|
||||
});
|
||||
nextBtn.addEventListener('click', () => {
|
||||
pageNumber++;
|
||||
showGifs();
|
||||
});
|
||||
</script>
|
||||
<br><br>
|
||||
<h3>_PLAYER_ </h3>
|
||||
<p>
|
||||
<a target="_PLAYER_" href="http://127.0.0.1:8080/ipns/_ASTRONAUTENS_">
|
||||
<img src="http://127.0.0.1:8080/ipfs/QmWUpjGFuF7NhpXgkrCmx8Tbu4xjcFpKhE7Bsvt6HeKYxu/g1ticket_qrcode.png" width=300>
|
||||
</a>
|
||||
</p>
|
||||
<h2>:⚡:~ <a href="https://cesium.app">Cesium </a> ~:📱: _____ </h2>
|
||||
<p>
|
||||
<div id="astropub"> 🏡 : <a target="gchange" href="https://www.gchange.fr/#/app/user/_G1PUB_/">_G1PUB_</a></div>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="showoff">
|
||||
<div id="yellow" >
|
||||
<div id="container">
|
||||
<br><br>
|
||||
<br><br>
|
||||
<canvas id="sphere" width="400" height="400"></canvas>
|
||||
<div id="glow-shadows" class="earth"></div>
|
||||
<canvas id="flights" width="400" height="400"></canvas>
|
||||
<div id="locations"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p><a target="_PLAYER_" href="http://127.0.0.1:8080/ipns/_ASTRONAUTENS_">TW♥BOX of "_PLAYER_"</a></p>
|
||||
|
||||
<p>
|
||||
<br>
|
||||
<br> 👍 IPFS DATA STORAGE 👍 </p>
|
||||
<p>Powered by <a href="https://github.com/papiche/Astroport.ONE">Astroport.ONE</a></p>
|
||||
<p>/ <a href="https://opencollective.com/monnaie-libre/projects/stiits">STI</a> / <a href="https://opencollective.com/monnaie-libre/projects/coeurbox">La♥BOX</a> /
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="choose_example">
|
||||
Choose Planet: <select id="example">
|
||||
<!--
|
||||
<option value="simple">Simple earth</option>
|
||||
<option value="simple_tilted">Simple tilted earth</option>
|
||||
-->
|
||||
<option value="simple_mars">Simple mars</option>
|
||||
<!--
|
||||
<option value="flights">Earth with locations and flights</option>
|
||||
-->
|
||||
<option value="locations" selected >Ŋ1 Friends</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="code">
|
||||
<a href="#" onclick="$('#example_code').show(); $(this).hide().siblings('a').show(); return false;">Show code</a>
|
||||
<a href="#" style="display: none;" onclick="$('#example_code').hide(); $(this).hide().siblings('a').show(); return false;">Hide code</a>
|
||||
<textarea id="example_code" onclick="this.focus();this.select();"></textarea>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
body {
|
||||
background: black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #DDD;
|
||||
text-align: center;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 10px;
|
||||
font-size: 40px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 20px;
|
||||
margin-bottom: 20px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#demo {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#description {
|
||||
text-align: left;
|
||||
float: left;
|
||||
width: 49%;
|
||||
max-width: 500px;
|
||||
padding-top: 50px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#showoff {
|
||||
float: left;
|
||||
width: 49%;
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#sphere, #flights, #glow-shadows, #locations, #drag {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#glow-shadows {
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
}
|
||||
|
||||
.location {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
border: 2px solid white;
|
||||
margin-left: -5px;
|
||||
margin-top: -5px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.location:hover {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
margin-left: -7.5px;
|
||||
margin-top: -7.5px;
|
||||
}
|
||||
|
||||
|
||||
.flight:hover {
|
||||
width: 36px;
|
||||
height: 37.5px;
|
||||
margin-left: -18px;
|
||||
margin-top: -18.75px;
|
||||
}
|
||||
|
||||
|
||||
.choose_example {
|
||||
width: 35%;
|
||||
margin-left: 32.5%;
|
||||
}
|
||||
|
||||
#example_code {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
background-color: black;
|
||||
color: white;
|
||||
border: 0px;
|
||||
resize: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.code {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.social {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.social.twitter {
|
||||
vertical-align: -3px;
|
||||
}
|
||||
|
||||
.social.google {
|
||||
vertical-align: -7px;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
function selectExample(example) {
|
||||
$('#sphere').earth3d('destroy');
|
||||
$('#sphere').replaceWith($('<canvas id="sphere" width="400" height="400"></canvas>'));
|
||||
$('.location').remove();
|
||||
//~ $('.flight').remove();
|
||||
//~ $('#flights')[0].getContext('2d').clearRect(0, 0, 400, 400);
|
||||
if (example == 'simple_mars') {
|
||||
$('#glow-shadows').removeClass('earth').addClass('mars');
|
||||
} else {
|
||||
$('#glow-shadows').removeClass('mars').addClass('earth');
|
||||
}
|
||||
var code = examples[example].toString();
|
||||
code = code.substring(14);
|
||||
code = code.substring(0, code.length - 2);
|
||||
var lines = code.split("\n");
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
lines[i] = lines[i].substring(2);
|
||||
}
|
||||
code = lines.join("\n");
|
||||
$('#example_code').val(code);
|
||||
|
||||
examples[example]();
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
selectExample('locations');
|
||||
|
||||
$('#example').change(function() {
|
||||
selectExample($(this).val());
|
||||
});
|
||||
});
|
||||
|
||||
function addPath() {
|
||||
$('#sphere').earth3d('changePaths', {path2: {
|
||||
origin: 'obj1',
|
||||
destination: 'obj3'
|
||||
}});
|
||||
}
|
|
@ -0,0 +1,851 @@
|
|||
|
||||
/*
|
||||
jquery.earth3d.js
|
||||
|
||||
jQuery ui plugin that allow you to draw a beautiful 3d spinning earth on canvas
|
||||
|
||||
Author: Sebastien Drouyer
|
||||
|
||||
Based on the amazing sphere.js plug of Sam Hasler
|
||||
|
||||
Licensed under the MIT license (MIT-LICENSE.txt)
|
||||
|
||||
http://sdrdis.github.com/jquery.earth-3d/
|
||||
|
||||
|
||||
|
||||
Depends:
|
||||
ui.core.js
|
||||
|
||||
|
||||
|
||||
|
||||
Options:
|
||||
* texture: texture map used by the planet
|
||||
|
||||
* sphere: rotation and size of the planet
|
||||
|
||||
* defaultSpeed: default spinning speed of the planet
|
||||
|
||||
* backToDefaultTime: time (in ms) to return by to default speed when planet is dragged
|
||||
|
||||
* locations: locations to display on the planet:
|
||||
* Each position must have a key, an alpha and delta position (or x and y if you want to display a static location).
|
||||
Any additional key can be reached via callbacks functions
|
||||
Example:
|
||||
{
|
||||
obj1: {
|
||||
alpha: Math.PI / 4,
|
||||
delta: 0,
|
||||
name: 'location 1'
|
||||
}
|
||||
}
|
||||
|
||||
* paths: paths and flights to display over the planet:
|
||||
Each path must have a key, an origin and a destination. The values are the location's key.
|
||||
You can, if you want to, define flights on these paths.
|
||||
Each flight has a key, a destination (the location's key) and a position.
|
||||
The position is the progress a fleet has made on its path.
|
||||
Any additional key can be reach via callbacks functions.
|
||||
Example:
|
||||
{
|
||||
path: {
|
||||
origin: 'obj1',
|
||||
destination: 'obj2',
|
||||
flights: {
|
||||
flight: {
|
||||
position: 0.25,
|
||||
destination: 'obj2',
|
||||
name: 'Flight 1'
|
||||
},
|
||||
flight2: {
|
||||
position: 0.25,
|
||||
destination: 'obj1',
|
||||
name: 'Flight 2'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
* flightsCanvas: Dom element which is a canvas and where the flights and paths are drawn
|
||||
|
||||
* dragElement: Dom element where we catch the mouse drag
|
||||
|
||||
* locationsElement: Dom elements where the locations are drawn
|
||||
|
||||
* flightsCanvasPosition: position of the flight canvas (can be use if you have some gap between your planet and your flights
|
||||
|
||||
* pixelRadiusMultiplier: (TEMPORARY) used by the getSphereRadiusInPixel (see the functions)
|
||||
|
||||
* onInitLocation: callback function which allows you to define what to do when the locations are initialized
|
||||
* Parameters:
|
||||
* location: location (coming from locations option)
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onShowLocation: callback function which allows you to define what to do when a location becomes visible (was behind the planet and is now in front of it)
|
||||
* Parameters:
|
||||
* location: location (coming from locations option)
|
||||
* x: 2d left position
|
||||
* y: 2d top position
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onRefreshLocation: callback function which allows you to define what to do when a location is refreshed (it moves)
|
||||
* Parameters:
|
||||
* location: location (coming from locations option)
|
||||
* x: 2d left position
|
||||
* y: 2d top position
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onHideLocation: callback function which allows you to define what to do when a location becomes invisible (was in front of the planet and is now behind it)
|
||||
* Parameters:
|
||||
* location: location (coming from locations option)
|
||||
* x: 2d left position
|
||||
* y: 2d top position
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onInitFlight: callback function which allows you to define what to do when the flights are initialized
|
||||
* Parameters:
|
||||
* flight: flight (coming from flights option)
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onShowFlight: callback function which allows you to define what to do when a flight becomes visible (was behind the planet and is now in front of it)
|
||||
* Parameters:
|
||||
* flight: flight (coming from flights option)
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onRefreshFlight: callback function which allows you to define what to do when a flight is refreshed (it moves)
|
||||
* Parameters:
|
||||
* flight: flight (coming from flights option)
|
||||
* x: 2d left position
|
||||
* y: 2d top position
|
||||
* widget: earth3d widget object
|
||||
|
||||
* onHideFlight: callback function which allows you to define what to do when a flight becomes invisible (was in front of the planet and is now behind it)
|
||||
* Parameters:
|
||||
* flight: flight (coming from flights option)
|
||||
* widget: earth3d widget object
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Functions
|
||||
|
||||
* getSphereRadiusInPixel: function which allows you to get the sphere radius in pixel
|
||||
/!| WARNING: this function needs to be refactored, since I didn't find out (my maths courses are far away) how to
|
||||
get the exact value. I did a basic linear regression, but it is not exact, and you will have to change the pixelRadiusMultiplier
|
||||
option to get the correct value
|
||||
|
||||
* destroy: use this function when you want to destroy the object. It will throw a cancel animation frame, so the
|
||||
CPU won't be used anymore.
|
||||
|
||||
* changePaths: use this function when you want to update paths and flights (options on widget)
|
||||
it will add the callback functions support
|
||||
|
||||
*/
|
||||
var earth3d;
|
||||
(function($) {
|
||||
$.widget('ui.earth3d', {
|
||||
options: {
|
||||
texture: '/ipfs/QmRpS3HcsawVGL6D3ZjJwP5HBFivydb4mcMNVykKem3jai/earth1024x1024.jpg',
|
||||
sphere: {
|
||||
tilt: 0,
|
||||
turn: 0,
|
||||
r: 10
|
||||
},
|
||||
defaultSpeed: 20,
|
||||
backToDefaultTime: 4000,
|
||||
locations: {
|
||||
},
|
||||
paths: {
|
||||
},
|
||||
flightsCanvas: null,
|
||||
dragElement: null,
|
||||
locationsElement: null,
|
||||
flightsCanvasPosition: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
tiling: {horizontal: 1, vertical: 1},
|
||||
pixelRadiusMultiplier: 0.97,
|
||||
onInitLocation: function(location, widget) {
|
||||
var $elem = $('<div class="location"></div>');
|
||||
$elem.appendTo(widget.options.locationsElement);
|
||||
$elem.click(function() {
|
||||
alert('Clicked on ' + location.name + ' : ' + location.link );
|
||||
window.open( location.link, "AstroTab");
|
||||
});
|
||||
location.$element = $elem;
|
||||
},
|
||||
onShowLocation: function(location, x, y) {
|
||||
location.$element.show();
|
||||
},
|
||||
onRefreshLocation: function(location, x, y) {
|
||||
//console.log(x, y);
|
||||
location.$element.css({
|
||||
left: x,
|
||||
top: y
|
||||
});
|
||||
},
|
||||
onHideLocation: function(location, x, y) {
|
||||
location.$element.hide();
|
||||
},
|
||||
onDeleteLocation: function(location) {
|
||||
location.$element.remove();
|
||||
},
|
||||
onInitFlight: function(flight, widget) {
|
||||
var $elem = $('<div class="flight"></div>');
|
||||
$elem.appendTo(widget.options.locationsElement);
|
||||
$elem.click(function() {
|
||||
alert('Clicked on ' + flight.name);
|
||||
|
||||
});
|
||||
flight.$element = $elem;
|
||||
},
|
||||
onShowFlight: function(flight) {
|
||||
flight.$element.show();
|
||||
},
|
||||
onRefreshFlight: function(flight, x, y, angle, widget) {
|
||||
flight.$element.css({
|
||||
left: x,
|
||||
top: y,
|
||||
'-webkit-transform':'rotate(' + ((angle + Math.PI / 2) * 360 / (2 * Math.PI)) + 'deg)',
|
||||
'-moz-transform':'rotate(' + ((angle + Math.PI / 2) * 360 / (2 * Math.PI)) + 'deg)',
|
||||
'-o-transform':'rotate(' + ((angle + Math.PI / 2) * 360 / (2 * Math.PI)) + 'deg)'
|
||||
});
|
||||
},
|
||||
onHideFlight: function(flight) {
|
||||
flight.$element.hide();
|
||||
},
|
||||
onDeleteFlight: function(flight) {
|
||||
flight.$element.remove();
|
||||
}
|
||||
},
|
||||
earth: null,
|
||||
posVar: 24 * 3600 * 1000,
|
||||
lastMousePos: null,
|
||||
lastSpeed: null,
|
||||
lastTime: null,
|
||||
lastTurnByTime: null,
|
||||
textureWidth: null,
|
||||
textureHeight: null,
|
||||
obj: null,
|
||||
flightsCtx: null,
|
||||
renderAnimationFrameId: null,
|
||||
mousePressed: null,
|
||||
|
||||
_create: function() {
|
||||
earth3d = this;
|
||||
var self = this;
|
||||
this.obj = $('div');
|
||||
if (this.options.flightsCanvas !== null) {
|
||||
this.flightsCtx = this.options.flightsCanvas[0].getContext('2d');
|
||||
}
|
||||
createSphere(this.element[0], this.options.texture, function(earth, textureWidth, textureHeight) { self._onSphereCreated(earth, textureWidth, textureHeight); }, this.options.tiling);
|
||||
if (this.options.dragElement !== null) {
|
||||
this.options.dragElement
|
||||
.bind('mousedown vmousedown', function(e) {
|
||||
self._mouseDragStart(e);
|
||||
self.mousePressed = true;
|
||||
})
|
||||
.bind('mouseup vmouseup', function(e) {
|
||||
self._mouseDragStop(e);
|
||||
self.mousePressed = false;
|
||||
})
|
||||
.bind('mousemove vmousemove', function(e){
|
||||
if (self.mousePressed) {
|
||||
self._mouseDrag(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
this._initLocations();
|
||||
this._initFlights();
|
||||
},
|
||||
|
||||
_initLocations: function() {
|
||||
for (var key in this.options.locations) {
|
||||
var location = this.options.locations[key];
|
||||
location.visible = true;
|
||||
this.options.onInitLocation(location, this);
|
||||
}
|
||||
},
|
||||
|
||||
_initFlights: function() {
|
||||
for (var key in this.options.paths) {
|
||||
var path = this.options.paths[key];
|
||||
for (var key in path.flights) {
|
||||
path.flights[key].visible = true;
|
||||
this.options.onInitFlight(path.flights[key], this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getSphereRadiusInPixel: function() {
|
||||
return this.earth.getRadius() / 2;
|
||||
},
|
||||
|
||||
_onSphereCreated: function(earth, textureWidth, textureHeight) {
|
||||
var self = this;
|
||||
this.textureWidth = textureWidth;
|
||||
this.textureHeight = textureHeight;
|
||||
this.earth = earth;
|
||||
this.earth.init(this.options.sphere);
|
||||
this.earth.turnBy = function(time) { return self._turnBy(time); };
|
||||
|
||||
var renderAnimationFrame = function(/* time */ time) {
|
||||
/* time ~= +new Date // the unix time */
|
||||
earth.renderFrame(time);
|
||||
self._renderAnimationFrame(time);
|
||||
self.renderAnimationFrameId = window.requestAnimationFrame(renderAnimationFrame);
|
||||
};
|
||||
this.renderAnimationFrameId = window.requestAnimationFrame(renderAnimationFrame);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
window.cancelAnimationFrame(this.renderAnimationFrameId);
|
||||
},
|
||||
|
||||
_renderAnimationFrame: function(time) {
|
||||
|
||||
|
||||
var ry=90+this.options.sphere.tilt;
|
||||
var rz=180+this.options.sphere.turn;
|
||||
|
||||
var RY = (90-ry);
|
||||
var RZ = (180-rz);
|
||||
var RX = 0,RY,RZ;
|
||||
|
||||
var rx=RX*Math.PI/180;
|
||||
var ry=RY*Math.PI/180;
|
||||
var rz=RZ*Math.PI/180;
|
||||
//console.log(rx, ry, rz);
|
||||
var r = this.getSphereRadiusInPixel();
|
||||
|
||||
var center = {
|
||||
x: this.element.width() / 2,
|
||||
y: this.element.height() / 2
|
||||
}
|
||||
|
||||
for (var key in this.options.locations) {
|
||||
var location = this.options.locations[key];
|
||||
|
||||
if (typeof location.delta === 'undefined') {
|
||||
location.flatPosition = {x: location.x, y: location.y};
|
||||
this.options.onRefreshLocation(location, location.x, location.y, this);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
WARNING: calculation of alphaAngle and deltaAngle is not exact
|
||||
I had to create the _calibrated functions to modify the deltaAngle to make the result look good on
|
||||
a spinning planet without rotation. It will totally bug with rotation!
|
||||
* */
|
||||
var progression = (((this.posVar + this.textureWidth * location.delta / (2 * Math.PI)) % this.textureWidth) / this.textureWidth);
|
||||
var alphaAngle = progression * 2 * Math.PI;
|
||||
var deltaAngle = this._calibrated(progression, location.alpha) * 2 * Math.PI;
|
||||
|
||||
|
||||
var objAlpha = ry + location.alpha - Math.sin(alphaAngle / 2) * 0.15 * (location.alpha - Math.PI / 2) / (Math.PI / 4);
|
||||
var objDelta = rz + deltaAngle;
|
||||
|
||||
var a = this._orbitalTo3d(objAlpha, objDelta, r);
|
||||
|
||||
var flatPosition = this._orthographicProjection(a);
|
||||
|
||||
if (a.x < 0 && !location.visible) {
|
||||
this.options.onShowLocation(location, flatPosition.x, flatPosition.y, this);
|
||||
}
|
||||
if (a.x > 0 && location.visible) {
|
||||
this.options.onHideLocation(location, flatPosition.x, flatPosition.y, this);
|
||||
}
|
||||
this.options.onRefreshLocation(location, flatPosition.x, flatPosition.y, this);
|
||||
|
||||
location.visible = a.x < 0;
|
||||
location.position = a;
|
||||
location.flatPosition = flatPosition;
|
||||
location.rAlpha = objAlpha;
|
||||
location.rDelta = objDelta;
|
||||
|
||||
}
|
||||
|
||||
if (this.flightsCtx !== null) {
|
||||
this.flightsCtx.clearRect(0, 0, this.options.flightsCanvas.width(), this.options.flightsCanvas.height());
|
||||
for (var key in this.options.paths) {
|
||||
this._drawPath(this.options.paths[key], center, r);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
_line_circle_intersection: function(A, B, C, r) {
|
||||
var d = {
|
||||
x: B.x - A.x,
|
||||
y: B.y - A.y
|
||||
};
|
||||
|
||||
var f = {
|
||||
x: A.x - C.x,
|
||||
y: A.y - C.y
|
||||
};
|
||||
|
||||
var a = this._dot(d, d);
|
||||
var b = 2 * this._dot(f, d);
|
||||
var c = this._dot(f, f) - r * r;
|
||||
|
||||
var discriminant = b * b - 4 * a * c;
|
||||
if (discriminant < 0) {
|
||||
return false;
|
||||
} else {
|
||||
discriminant = Math.sqrt(discriminant);
|
||||
var t1 = (-b + discriminant) / (2 * a);
|
||||
var t2 = (-b - discriminant) / (2 * a);
|
||||
|
||||
|
||||
var sols = [];
|
||||
|
||||
if (t1 >= 0 && t1 <= 1) {
|
||||
sols.push({
|
||||
x:A.x + t1 * d.x,
|
||||
y:A.y + t1 * d.y
|
||||
});
|
||||
}
|
||||
|
||||
if (t2 >= 0 && t2 <= 1) {
|
||||
sols.push({
|
||||
x:A.x + t2 * d.x,
|
||||
y:A.y + t2 * d.y
|
||||
});
|
||||
}
|
||||
|
||||
return sols;
|
||||
}
|
||||
},
|
||||
|
||||
_dot: function(A, B) {
|
||||
return A.x * B.x + A.y * B.y;
|
||||
},
|
||||
|
||||
_drawPath: function(path, center, r) {
|
||||
|
||||
|
||||
var originLocation = this.options.locations[path.origin];
|
||||
var destinationLocation = this.options.locations[path.destination];
|
||||
|
||||
var dotSize = 50;
|
||||
var spacing = 0.15;
|
||||
|
||||
if (typeof originLocation.delta === 'undefined' || typeof destinationLocation.delta === 'undefined') {
|
||||
var pathVisible = originLocation.visible && destinationLocation.visible;
|
||||
if (pathVisible) {
|
||||
|
||||
|
||||
var flatDistance = this._distance(originLocation.flatPosition, destinationLocation.flatPosition);
|
||||
|
||||
var nb = flatDistance * 0.9 / 20;
|
||||
// WARNING: we are drawing the paths on canvas, intensively using CPU. Could we gain by instead using SVG or the DOM ?
|
||||
for (var i = 0; i < nb; i++) {
|
||||
|
||||
|
||||
var fromFlatPosition = {
|
||||
x: ((nb - i) / nb) * originLocation.flatPosition.x + (i / nb) * destinationLocation.flatPosition.x,
|
||||
y: ((nb - i) / nb) * originLocation.flatPosition.y + (i / nb) * destinationLocation.flatPosition.y
|
||||
};
|
||||
|
||||
var toFlatPosition = {
|
||||
x: Math.max(((nb - (i + 1)) / nb), 0) * originLocation.flatPosition.x + Math.min(((i + 1) / nb), 1) * destinationLocation.flatPosition.x,
|
||||
y: Math.max(((nb - (i + 1)) / nb), 0) * originLocation.flatPosition.y + Math.min(((i + 1) / nb), 1) * destinationLocation.flatPosition.y
|
||||
};
|
||||
|
||||
var diff = {
|
||||
x: fromFlatPosition.x - toFlatPosition.x,
|
||||
y: fromFlatPosition.y - toFlatPosition.y,
|
||||
z: fromFlatPosition.z - toFlatPosition.z
|
||||
};
|
||||
|
||||
fromFlatPosition.x -= diff.x * spacing;
|
||||
fromFlatPosition.y -= diff.y * spacing;
|
||||
fromFlatPosition.z -= diff.z * spacing;
|
||||
toFlatPosition.x += diff.x * spacing;
|
||||
toFlatPosition.y += diff.y * spacing;
|
||||
toFlatPosition.z += diff.z * spacing;
|
||||
|
||||
|
||||
this.flightsCtx.lineWidth = 3;
|
||||
this.flightsCtx.beginPath();
|
||||
this.flightsCtx.strokeStyle = 'rgba(255, 255, 255, 0.5)';
|
||||
this.flightsCtx.moveTo(fromFlatPosition.x + this.options.flightsCanvasPosition.x, fromFlatPosition.y + this.options.flightsCanvasPosition.y);
|
||||
this.flightsCtx.lineTo(toFlatPosition.x + this.options.flightsCanvasPosition.x, toFlatPosition.y + this.options.flightsCanvasPosition.y);
|
||||
this.flightsCtx.stroke();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (var key in path.flights) {
|
||||
var flight = path.flights[key];
|
||||
|
||||
var position = flight.destination == path.destination ? flight.position : (1 - flight.position);
|
||||
|
||||
|
||||
var flightFlatPosition = {
|
||||
x: (1 - position) * originLocation.flatPosition.x + position * destinationLocation.flatPosition.x,
|
||||
y: (1 - position) * originLocation.flatPosition.y + position * destinationLocation.flatPosition.y
|
||||
};
|
||||
|
||||
if (!flight.visible && pathVisible) {
|
||||
this.options.onShowFlight(flight, this);
|
||||
flight.visible = true;
|
||||
}
|
||||
|
||||
if (flight.visible && !pathVisible) {
|
||||
this.options.onHideFlight(flight, this);
|
||||
flight.visible = false;
|
||||
}
|
||||
|
||||
var angle = Math.atan2(destinationLocation.flatPosition.y - originLocation.flatPosition.y, destinationLocation.flatPosition.x - originLocation.flatPosition.x) + (flight.destination == path.destination ? 0 : Math.PI);
|
||||
//console.log(flightAheadFlatPosition.y - flightFlatPosition.y);
|
||||
|
||||
this.options.onRefreshFlight(flight, flightFlatPosition.x, flightFlatPosition.y, angle, this);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var locationsDistance = this._distance(originLocation.position, destinationLocation.position);
|
||||
|
||||
|
||||
var middlePosition = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
};
|
||||
|
||||
|
||||
var radius = this._distance(originLocation.position, middlePosition);
|
||||
|
||||
var originP = {
|
||||
delta: Math.atan2((originLocation.position.y - middlePosition.y), (originLocation.position.x - middlePosition.x)),
|
||||
alpha: Math.acos((originLocation.position.z - middlePosition.z) / radius)
|
||||
};
|
||||
|
||||
var destinationP = {
|
||||
delta: Math.atan2((destinationLocation.position.y - middlePosition.y), (destinationLocation.position.x - middlePosition.x)),
|
||||
alpha: Math.acos((destinationLocation.position.z - middlePosition.z) / radius)
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (Math.abs(originP.delta - destinationP.delta) > Math.PI) {
|
||||
if ((originP.delta - destinationP.delta) > Math.PI) {
|
||||
originP.delta -= 2 * Math.PI;
|
||||
} else {
|
||||
originP.delta += 2 * Math.PI;
|
||||
}
|
||||
}
|
||||
|
||||
if (path.sens) {
|
||||
if (((originP.delta - destinationP.delta) > 0 ? 1 : -1) != path.sens) {
|
||||
if (Math.abs(originP.delta - destinationP.delta) > Math.PI / 2) {
|
||||
originP.delta += path.sens * 2 * Math.PI;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
path.sens = (originP.delta - destinationP.delta) > 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
|
||||
if (!path.nb) {
|
||||
path.nb = Math.round(((locationsDistance / (2 * r)) * Math.PI * 2 * r + (1 - (locationsDistance / (2 * r))) * locationsDistance) / dotSize);
|
||||
}
|
||||
var nb = path.nb;
|
||||
var maxDistance = 1.2;
|
||||
for (var i = 0; i < nb; i++) {
|
||||
var fromP = {
|
||||
alpha: ((nb - i) / nb) * originP.alpha + (i / nb) * destinationP.alpha,
|
||||
delta: ((nb - i) / nb) * originP.delta + (i / nb) * destinationP.delta
|
||||
};
|
||||
|
||||
var toP = {
|
||||
alpha: ((nb - 1 - i) / nb) * originP.alpha + ((i + 1) / nb) * destinationP.alpha,
|
||||
delta: ((nb - 1 - i) / nb) * originP.delta + ((i + 1) / nb) * destinationP.delta
|
||||
};
|
||||
//console.log(i, fromP.alpha, fromP.delta, toP.alpha, toP.delta);
|
||||
|
||||
var fromPosition = this._orbitalTo3d(fromP.alpha, fromP.delta, -(Math.sin(Math.PI * i / nb) * (maxDistance - 1) + 1) * radius);
|
||||
var toPosition = this._orbitalTo3d(toP.alpha, toP.delta, -(Math.sin(Math.PI * (i + 1) / nb) * (maxDistance - 1) + 1) * radius);
|
||||
var diff = {
|
||||
x: fromPosition.x - toPosition.x,
|
||||
y: fromPosition.y - toPosition.y,
|
||||
z: fromPosition.z - toPosition.z
|
||||
};
|
||||
|
||||
|
||||
|
||||
fromPosition.x -= diff.x * spacing;
|
||||
fromPosition.y -= diff.y * spacing;
|
||||
fromPosition.z -= diff.z * spacing;
|
||||
toPosition.x += diff.x * spacing;
|
||||
toPosition.y += diff.y * spacing;
|
||||
toPosition.z += diff.z * spacing;
|
||||
|
||||
|
||||
fromPosition.x += middlePosition.x;
|
||||
fromPosition.y += middlePosition.y;
|
||||
fromPosition.z += middlePosition.z;
|
||||
toPosition.x += middlePosition.x;
|
||||
toPosition.y += middlePosition.y;
|
||||
toPosition.z += middlePosition.z;
|
||||
|
||||
|
||||
|
||||
var fromFlatPosition = this._orthographicProjection(fromPosition);
|
||||
var toFlatPosition = this._orthographicProjection(toPosition);
|
||||
|
||||
var fromDistanceCenter = this._distance(fromFlatPosition, center);
|
||||
var toDistanceCenter = this._distance(toFlatPosition, center);
|
||||
|
||||
var fromVisible = true;
|
||||
var toVisible = true;
|
||||
if (fromPosition.x > 0) {
|
||||
if (fromDistanceCenter <= r) {
|
||||
fromVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (toPosition.x > 0) {
|
||||
if (toDistanceCenter <= r) {
|
||||
toVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(i, fromVisible, toVisible);
|
||||
|
||||
if (!fromVisible && !toVisible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fromVisible) {
|
||||
var intersection = this._line_circle_intersection(fromFlatPosition, toFlatPosition, center, r);
|
||||
if (intersection.length == 0) {
|
||||
continue;
|
||||
}
|
||||
fromFlatPosition = intersection[0];
|
||||
}
|
||||
|
||||
if (!toVisible) {
|
||||
var intersection = this._line_circle_intersection(fromFlatPosition, toFlatPosition, center, r);
|
||||
if (intersection.length == 0) {
|
||||
continue;
|
||||
}
|
||||
toFlatPosition = intersection[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.flightsCtx.lineWidth = 3;
|
||||
this.flightsCtx.beginPath();
|
||||
this.flightsCtx.strokeStyle = 'rgba(255, 255, 255, 0.5)';
|
||||
this.flightsCtx.moveTo(fromFlatPosition.x + this.options.flightsCanvasPosition.x, fromFlatPosition.y + this.options.flightsCanvasPosition.y);
|
||||
this.flightsCtx.lineTo(toFlatPosition.x + this.options.flightsCanvasPosition.x, toFlatPosition.y + this.options.flightsCanvasPosition.y);
|
||||
this.flightsCtx.stroke();
|
||||
|
||||
}
|
||||
|
||||
for (var key in path.flights) {
|
||||
var flight = path.flights[key];
|
||||
|
||||
var position = flight.destination == path.destination ? flight.position : (1 - flight.position);
|
||||
var positionAhead = flight.destination == path.destination ? (flight.position + 0.01) : (1 - (flight.position + 0.01));
|
||||
|
||||
var flightP = {
|
||||
alpha: (1 - position) * originP.alpha + position * destinationP.alpha,
|
||||
delta: (1 - position) * originP.delta + position * destinationP.delta
|
||||
};
|
||||
|
||||
var flightAheadP = {
|
||||
alpha: (1 - positionAhead) * originP.alpha + positionAhead * destinationP.alpha,
|
||||
delta: (1 - positionAhead) * originP.delta + positionAhead * destinationP.delta
|
||||
};
|
||||
|
||||
var flightPosition = this._orbitalTo3d(flightP.alpha, flightP.delta, -(Math.sin(Math.PI * position) * (maxDistance - 1) + 1) * radius);
|
||||
var flightAheadPosition = this._orbitalTo3d(flightAheadP.alpha, flightAheadP.delta, -(Math.sin(Math.PI * positionAhead) * (maxDistance - 1) + 1) * radius);
|
||||
|
||||
flightPosition.x += middlePosition.x;
|
||||
flightPosition.y += middlePosition.y;
|
||||
flightPosition.z += middlePosition.z;
|
||||
flightAheadPosition.x += middlePosition.x;
|
||||
flightAheadPosition.y += middlePosition.y;
|
||||
flightAheadPosition.z += middlePosition.z;
|
||||
|
||||
var flightFlatPosition = this._orthographicProjection(flightPosition);
|
||||
var flightAheadFlatPosition = this._orthographicProjection(flightAheadPosition);
|
||||
|
||||
var flightDistanceCenter = this._distance(flightFlatPosition, center);
|
||||
|
||||
if (!flight.visible && (flightPosition.x < 0 || flightDistanceCenter > r)) {
|
||||
this.options.onShowFlight(flight, this);
|
||||
flight.visible = true;
|
||||
}
|
||||
|
||||
if (flight.visible && (flightPosition.x > 0 && flightDistanceCenter < r)) {
|
||||
this.options.onHideFlight(flight, this);
|
||||
flight.visible = false;
|
||||
}
|
||||
|
||||
var angle = Math.atan2(flightAheadFlatPosition.y - flightFlatPosition.y, flightAheadFlatPosition.x - flightFlatPosition.x);
|
||||
//console.log(flightAheadFlatPosition.y - flightFlatPosition.y);
|
||||
|
||||
this.options.onRefreshFlight(flight, flightFlatPosition.x, flightFlatPosition.y, angle, this);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_distance: function(A, B) {
|
||||
if (A.z) {
|
||||
return Math.sqrt(
|
||||
(A.x - B.x) * (A.x - B.x) +
|
||||
(A.y - B.y) * (A.y - B.y) +
|
||||
(A.z - B.z) * (A.z - B.z)
|
||||
);
|
||||
} else {
|
||||
return Math.sqrt(
|
||||
(A.x - B.x) * (A.x - B.x) +
|
||||
(A.y - B.y) * (A.y - B.y)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// WARNING: temporary function to make the locations look good on a spinning planet without rotation
|
||||
_calibrated: function(x, alpha) {
|
||||
var calib = 0.3 + 0.15 * Math.abs(alpha - Math.PI / 2) / (Math.PI / 4);
|
||||
//console.log(calib);
|
||||
var y = calib * (4 * (x - 0.5) * (x - 0.5) * (x - 0.5) + 0.5) + (1 - calib) * x;
|
||||
return y;
|
||||
},
|
||||
|
||||
|
||||
/* WARNING:
|
||||
Obviously there is something wrong with _orbitalTo3d and _orthographicProjection, since
|
||||
I can't get a descent display of locations when the planet is rotated. That's why I had to create the _calibrated
|
||||
function in the first place. I didn't have time to look precisely into it, and I probably don't know enough math.
|
||||
|
||||
I leaved the _3dProjection function I found on wikipedia but is not working. (I might not have correctly understood / write it)
|
||||
*/
|
||||
_orbitalTo3d: function(alpha, delta, r) {
|
||||
return {
|
||||
x: -r * Math.sin(alpha) * Math.cos(delta),
|
||||
y: -r * Math.sin(alpha) * Math.sin(delta),
|
||||
z: -r * Math.cos(alpha)
|
||||
};
|
||||
},
|
||||
|
||||
_orthographicProjection: function(position) {
|
||||
return {x: position.y + this.element.width() / 2, y: position.z + this.element.height() / 2};
|
||||
},
|
||||
|
||||
_3dProjection: function(a, c, delta, e) {
|
||||
// Wikipedia is your friend :) : http://en.wikipedia.org/wiki/3D_projection
|
||||
var d = {x: 0, y: 0, z: 0};
|
||||
d.x = Math.cos(delta.y) * (Math.sin(delta.z) * (a.y - c.y) + Math.cos(delta.z) * (a.x - c.x)) - Math.sin(delta.y) * (a.z - c.z);
|
||||
d.y = Math.sin(delta.x) * (Math.cos(delta.y) * (a.z - c.z) + Math.sin(delta.y) * (Math.sin(delta.z) * (a.y - c.y) + Math.cos(delta.z) * (a.x - c.x)))
|
||||
+ Math.cos(delta.x) * (Math.cos(delta.z) * (a.y - c.y) - Math.sin(delta.z) * (a.x - c.x))
|
||||
d.z = Math.cos(delta.x) * (Math.cos(delta.y) * (a.z - c.z) + Math.sin(delta.y) * (Math.sin(delta.z) * (a.y - c.y) + Math.cos(delta.z) * (a.x - c.x)))
|
||||
- Math.sin(delta.x) * (Math.cos(delta.z) * (a.y - c.y) - Math.sin(delta.z) * (a.x - c.x));
|
||||
|
||||
return {
|
||||
x: d.z, //(d.x - e.x) * (e.y / d.y),
|
||||
y: d.y //(d.z - e.z) * (e.y / d.y)
|
||||
};
|
||||
},
|
||||
|
||||
_mouseDragStart: function(e) {
|
||||
this.lastMousePos = e.clientX;
|
||||
this.lastSpeed = null;
|
||||
},
|
||||
|
||||
_mouseDrag: function(e) {
|
||||
this.lastSpeed = (e.clientX - this.lastMousePos);
|
||||
this.posVar = this.posVar - this.lastSpeed;
|
||||
this.lastMousePos = e.clientX;
|
||||
},
|
||||
_mouseDragStop: function(e) {
|
||||
this.lastMousePos = null;
|
||||
this.lastTime = null;
|
||||
},
|
||||
|
||||
_turnBy: function(time) {
|
||||
if (this.lastTurnByTime === null) {
|
||||
this.lastTurnByTime = time;
|
||||
}
|
||||
var timeDiff = (time - this.lastTurnByTime) / 1000;
|
||||
if (this.lastMousePos === null) {
|
||||
if (this.lastSpeed !== null) {
|
||||
if (this.lastTime === null) {
|
||||
this.lastTime = time;
|
||||
}
|
||||
if (this.options.backToDefaultTime + this.lastTime - time < 0) {
|
||||
this.lastSpeed = null;
|
||||
} else {
|
||||
var backToDef = (this.options.backToDefaultTime + this.lastTime - time) / this.options.backToDefaultTime;
|
||||
this.posVar -= this.lastSpeed * backToDef + (this.options.defaultSpeed * timeDiff) * (1 - backToDef);
|
||||
}
|
||||
} else {
|
||||
this.posVar -= this.options.defaultSpeed * timeDiff;
|
||||
}
|
||||
}
|
||||
this.lastTurnByTime = time;
|
||||
return this.posVar;
|
||||
},
|
||||
|
||||
_getQBezierValue: function (t, p1, p2, p3) {
|
||||
var iT = 1 - t;
|
||||
return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3;
|
||||
},
|
||||
|
||||
_getQBezierDerivation: function(t, p1, p2, p3) {
|
||||
return (2 * p1 - 4 * p2 + 2 * p3) * t + 2 * p2 - 2 * p1;
|
||||
},
|
||||
|
||||
_getQBezierAngle: function(startX, startY, cpX, cpY, endX, endY, position) {
|
||||
var x = this._getQBezierDerivation(position, startX, cpX, endX);
|
||||
var y = this._getQBezierDerivation(position, startY, cpY, endY);
|
||||
return Math.atan2(y, x);
|
||||
},
|
||||
|
||||
_getQuadraticCurvePoint: function(startX, startY, cpX, cpY, endX, endY, position) {
|
||||
return {
|
||||
x: this._getQBezierValue(position, startX, cpX, endX),
|
||||
y: this._getQBezierValue(position, startY, cpY, endY),
|
||||
angle: this._getQBezierAngle(startX, startY, cpX, cpY, endX, endY, position)
|
||||
};
|
||||
},
|
||||
|
||||
changeLocations: function(locations) {
|
||||
for (var key in this.options.locations) {
|
||||
this.options.onDeleteLocation(this.options.locations[key], this);
|
||||
}
|
||||
this.options.locations = locations;
|
||||
this._initLocations();
|
||||
},
|
||||
|
||||
changePaths: function(paths) {
|
||||
for (var key in this.options.paths) {
|
||||
var path = this.options.paths[key];
|
||||
for (var keyFlight in path.flights) {
|
||||
var flight = path.flights[keyFlight];
|
||||
this.options.onDeleteFlight(flight, this);
|
||||
}
|
||||
}
|
||||
this.options.paths = paths;
|
||||
this._initFlights();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})($);
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
(function(){var m,aa=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}},ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a},ca=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");
|
||||
},da=ca(this),r=function(a,b){if(b)a:{var c=da;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&ba(c,a,{configurable:!0,writable:!0,value:b})}};
|
||||
r("Symbol",function(a){if(a)return a;var b=function(f,g){this.ia=f;ba(this,"description",{configurable:!0,writable:!0,value:g})};b.prototype.toString=function(){return this.ia};var c="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",d=0,e=function(f){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new b(c+(f||"")+"_"+d++,f)};return e});
|
||||
r("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=da[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(aa(this))}})}return a});
|
||||
var ea=function(a){a={next:a};a[Symbol.iterator]=function(){return this};return a},fa=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};
|
||||
r("String.prototype.endsWith",function(a){return a?a:function(b,c){var d=fa(this,b,"endsWith");b+="";void 0===c&&(c=d.length);c=Math.max(0,Math.min(c|0,d.length));for(var e=b.length;0<e&&0<c;)if(d[--c]!=b[--e])return!1;return 0>=e}});var ha=function(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e};
|
||||
r("Array.prototype.entries",function(a){return a?a:function(){return ha(this,function(b,c){return[b,c]})}});r("Array.prototype.keys",function(a){return a?a:function(){return ha(this,function(b){return b})}});r("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});
|
||||
r("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var f=d[c];if(f===b||Object.is(f,b))return!0}return!1}});r("String.prototype.includes",function(a){return a?a:function(b,c){return-1!==fa(this,b,"includes").indexOf(b,c||0)}});window.gapi=window.gapi||{};window.gapi.ua=(new Date).getTime();/*
|
||||
|
||||
Copyright The Closure Library Authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var t=this||self,ia=function(a){var b=typeof a;return"object"!=b?b:a?Array.isArray(a)?"array":b:"null"},la=function(a){var b=ia(a);return"array"==b||"object"==b&&"number"==typeof a.length},u=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},ma="closure_uid_"+(1E9*Math.random()>>>0),na=0,oa=function(a,b,c){return a.call.apply(a.bind,arguments)},pa=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);
|
||||
Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}},qa=function(a,b,c){qa=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?oa:pa;return qa.apply(null,arguments)},ra=function(a,b){function c(){}c.prototype=b.prototype;a.ya=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.B=function(d,e,f){for(var g=Array(arguments.length-2),k=2;k<arguments.length;k++)g[k-2]=arguments[k];return b.prototype[e].apply(d,
|
||||
g)}},sa=function(a){return a},ta=function(a){var b=null,c=t.trustedTypes;if(!c||!c.createPolicy)return b;try{b=c.createPolicy(a,{createHTML:sa,createScript:sa,createScriptURL:sa})}catch(d){t.console&&t.console.error(d.message)}return b};function ua(a,b){if(Error.captureStackTrace)Error.captureStackTrace(this,ua);else{var c=Error().stack;c&&(this.stack=c)}a&&(this.message=String(a));void 0!==b&&(this.cause=b)}ra(ua,Error);ua.prototype.name="CustomError";var va;function wa(a,b){a=a.split("%s");for(var c="",d=a.length-1,e=0;e<d;e++)c+=a[e]+(e<b.length?b[e]:"%s");ua.call(this,c+a[d])}ra(wa,ua);wa.prototype.name="AssertionError";function xa(a,b,c,d){var e="Assertion failed";if(c){e+=": "+c;var f=d}else a&&(e+=": "+a,f=b);throw new wa(""+e,f||[]);}
|
||||
var ya=function(a,b,c){a||xa("",null,b,Array.prototype.slice.call(arguments,2));return a},za=function(a,b){throw new wa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Aa=function(a,b,c){"string"!==typeof a&&xa("Expected string but got %s: %s.",[ia(a),a],b,Array.prototype.slice.call(arguments,2))};var Ba=Array.prototype.forEach?function(a,b){ya(null!=a.length);Array.prototype.forEach.call(a,b,void 0)}:function(a,b){for(var c=a.length,d="string"===typeof a?a.split(""):a,e=0;e<c;e++)e in d&&b.call(void 0,d[e],e,a)};function Ca(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]};function Da(a,b){for(var c in a)b.call(void 0,a[c],c,a)};var Ea;var v=function(a,b){this.U=a===Fa&&b||"";this.ja=Ga};v.prototype.G=!0;v.prototype.F=function(){return this.U};v.prototype.toString=function(){return"Const{"+this.U+"}"};var Ia=function(a){if(a instanceof v&&a.constructor===v&&a.ja===Ga)return a.U;za("expected object of type Const, got '"+a+"'");return"type_error:Const"},Ga={},Fa={};var x=function(a,b){this.S=b===Ja?a:""};x.prototype.toString=function(){return this.S.toString()};x.prototype.G=!0;x.prototype.F=function(){return this.S.toString()};
|
||||
var Ka=function(a){if(a instanceof x&&a.constructor===x)return a.S;za("expected object of type SafeUrl, got '"+a+"' of type "+ia(a));return"type_error:SafeUrl"},La=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i,Ma=function(a){if(a instanceof x)return a;a="object"==typeof a&&a.G?a.F():String(a);ya(La.test(a),"%s does not match the safe URL pattern",a)||(a="about:invalid#zClosurez");return new x(a,Ja)},Ja={};var Na={},Oa=function(a,b){this.R=b===Na?a:"";this.G=!0};Oa.prototype.F=function(){return this.R.toString()};Oa.prototype.toString=function(){return this.R.toString()};var Pa=function(a,b){this.name=a;this.value=b};Pa.prototype.toString=function(){return this.name};var Qa=new Pa("OFF",Infinity),Ra=new Pa("WARNING",900),Sa=new Pa("CONFIG",700),Ta=function(){this.C=0;this.clear()},Ua;Ta.prototype.clear=function(){this.X=Array(this.C);this.Z=-1;this.ba=!1};var Va=function(a,b,c){this.reset(a||Qa,b,c,void 0,void 0)};Va.prototype.reset=function(){};
|
||||
var Wa=function(a,b){this.level=null;this.na=[];this.parent=(void 0===b?null:b)||null;this.children=[];this.pa={N:function(){return a}}},Xa=function(a){if(a.level)return a.level;if(a.parent)return Xa(a.parent);za("Root logger has no level set.");return Qa},Ya=function(a,b){for(;a;)a.na.forEach(function(c){c(b)}),a=a.parent},Za=function(){this.entries={};var a=new Wa("");a.level=Sa;this.entries[""]=a},$a,ab=function(a,b){var c=a.entries[b];if(c)return c;c=ab(a,b.slice(0,Math.max(b.lastIndexOf("."),
|
||||
0)));var d=new Wa(b,c);a.entries[b]=d;c.children.push(d);return d},bb=function(){$a||($a=new Za);return $a};/*
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var cb=[],db=function(a){var b;if(b=ab(bb(),"safevalues").pa){var c="A URL with content '"+a+"' was sanitized away.",d=Ra;if(a=b)if(a=b&&d){a=d.value;var e=b?Xa(ab(bb(),b.N())):Qa;a=a>=e.value}if(a){d=d||Qa;a=ab(bb(),b.N());"function"===typeof c&&(c=c());Ua||(Ua=new Ta);e=Ua;b=b.N();if(0<e.C){var f=(e.Z+1)%e.C;e.Z=f;e.ba?(e=e.X[f],e.reset(d,c,b),b=e):(e.ba=f==e.C-1,b=e.X[f]=new Va(d,c,b))}else b=new Va(d,c,b);Ya(a,b)}}};-1===cb.indexOf(db)&&cb.push(db);var eb=function(a,b){if(!u(a)||!u(a)||!u(a)||1!==a.nodeType||a.namespaceURI&&"http://www.w3.org/1999/xhtml"!==a.namespaceURI||a.tagName.toUpperCase()!==b.toString()){b=b.toString()+"; got: ";if(u(a))try{var c=a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a)}catch(d){c="<object could not be stringified>"}else c=void 0===a?"undefined":null===a?"null":typeof a;za("Argument is not an HTML Element with tag name "+(b+c))}return a};var hb=function(a,b){Da(b,function(c,d){c&&"object"==typeof c&&c.G&&(c=c.F());"style"==d?a.style.cssText=c:"class"==d?a.className=c:"for"==d?a.htmlFor=c:fb.hasOwnProperty(d)?a.setAttribute(fb[d],c):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,c):a[d]=c})},fb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",
|
||||
width:"width"},ib=function(a,b,c,d){function e(k){k&&b.appendChild("string"===typeof k?a.createTextNode(k):k)}for(;d<c.length;d++){var f=c[d];if(!la(f)||u(f)&&0<f.nodeType)e(f);else{a:{if(f&&"number"==typeof f.length){if(u(f)){var g="function"==typeof f.item||"string"==typeof f.item;break a}if("function"===typeof f){g="function"==typeof f.item;break a}}g=!1}Ba(g?Ca(f):f,e)}}},jb=function(a,b){b=String(b);"application/xhtml+xml"===a.contentType&&(b=b.toLowerCase());return a.createElement(b)},kb=function(a){ya(a,
|
||||
"Node cannot be null or undefined.");return 9==a.nodeType?a:a.ownerDocument||a.document},lb=function(a){this.D=a||t.document||document};m=lb.prototype;m.getElementsByTagName=function(a,b){return(b||this.D).getElementsByTagName(String(a))};m.ma=function(a,b,c){var d=this.D,e=arguments,f=e[1],g=jb(d,String(e[0]));f&&("string"===typeof f?g.className=f:Array.isArray(f)?g.className=f.join(" "):hb(g,f));2<e.length&&ib(d,g,e,2);return g};m.createElement=function(a){return jb(this.D,a)};
|
||||
m.createTextNode=function(a){return this.D.createTextNode(String(a))};m.appendChild=function(a,b){ya(null!=a&&null!=b,"goog.dom.appendChild expects non-null arguments");a.appendChild(b)};m.append=function(a,b){ib(kb(a),a,arguments,1)};m.canHaveChildren=function(a){if(1!=a.nodeType)return!1;switch(a.tagName){case "APPLET":case "AREA":case "BASE":case "BR":case "COL":case "COMMAND":case "EMBED":case "FRAME":case "HR":case "IMG":case "INPUT":case "IFRAME":case "ISINDEX":case "KEYGEN":case "LINK":case "NOFRAMES":case "NOSCRIPT":case "META":case "OBJECT":case "PARAM":case "SCRIPT":case "SOURCE":case "STYLE":case "TRACK":case "WBR":return!1}return!0};
|
||||
m.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};m.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};/*
|
||||
gapi.loader.OBJECT_CREATE_TEST_OVERRIDE &&*/
|
||||
var y=window,A=document,mb=y.location,nb=function(){},ob=/\[native code\]/,B=function(a,b,c){return a[b]=a[b]||c},pb=function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1},qb=function(a){a=a.sort();for(var b=[],c=void 0,d=0;d<a.length;d++){var e=a[d];e!=c&&b.push(e);c=e}return b},rb=/&/g,sb=/</g,tb=/>/g,ub=/"/g,vb=/'/g,wb=function(a){return String(a).replace(rb,"&").replace(sb,"<").replace(tb,">").replace(ub,""").replace(vb,"'")},C=function(){var a;if((a=Object.create)&&
|
||||
ob.test(a))a=a(null);else{a={};for(var b in a)a[b]=void 0}return a},D=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},xb=function(a){if(ob.test(Object.keys))return Object.keys(a);var b=[],c;for(c in a)D(a,c)&&b.push(c);return b},E=function(a,b){a=a||{};for(var c in a)D(a,c)&&(b[c]=a[c])},yb=function(a){return function(){y.setTimeout(a,0)}},F=function(a,b){if(!a)throw Error(b||"");},H=B(y,"gapi",{});var I=function(a,b,c){var d=new RegExp("([#].*&|[#])"+b+"=([^&#]*)","g");b=new RegExp("([?#].*&|[?#])"+b+"=([^&#]*)","g");if(a=a&&(d.exec(a)||b.exec(a)))try{c=decodeURIComponent(a[2])}catch(e){}return c},zb=new RegExp(/^/.source+/([a-zA-Z][-+.a-zA-Z0-9]*:)?/.source+/(\/\/[^\/?#]*)?/.source+/([^?#]*)?/.source+/(\?([^#]*))?/.source+/(#((#|[^#])*))?/.source+/$/.source),Ab=/[\ud800-\udbff][\udc00-\udfff]|[^!-~]/g,Bb=new RegExp(/(%([^0-9a-fA-F%]|[0-9a-fA-F]([^0-9a-fA-F%])?)?)*/.source+/%($|[^0-9a-fA-F]|[0-9a-fA-F]($|[^0-9a-fA-F]))/.source,
|
||||
"g"),Cb=/%([a-f]|[0-9a-fA-F][a-f])/g,Db=/^(https?|ftp|file|chrome-extension):$/i,Eb=function(a){a=String(a);a=a.replace(Ab,function(e){try{return encodeURIComponent(e)}catch(f){return encodeURIComponent(e.replace(/^[^%]+$/g,"\ufffd"))}}).replace(Bb,function(e){return e.replace(/%/g,"%25")}).replace(Cb,function(e){return e.toUpperCase()});a=a.match(zb)||[];var b=C(),c=function(e){return e.replace(/\\/g,"%5C").replace(/\^/g,"%5E").replace(/`/g,"%60").replace(/\{/g,"%7B").replace(/\|/g,"%7C").replace(/\}/g,
|
||||
"%7D")},d=!!(a[1]||"").match(Db);b.B=c((a[1]||"")+(a[2]||"")+(a[3]||(a[2]&&d?"/":"")));d=function(e){return c(e.replace(/\?/g,"%3F").replace(/#/g,"%23"))};b.query=a[5]?[d(a[5])]:[];b.j=a[7]?[d(a[7])]:[];return b},Fb=function(a){return a.B+(0<a.query.length?"?"+a.query.join("&"):"")+(0<a.j.length?"#"+a.j.join("&"):"")},Gb=function(a,b){var c=[];if(a)for(var d in a)if(D(a,d)&&null!=a[d]){var e=b?b(a[d]):a[d];c.push(encodeURIComponent(d)+"="+encodeURIComponent(e))}return c},Hb=function(a,b,c,d){a=Eb(a);
|
||||
a.query.push.apply(a.query,Gb(b,d));a.j.push.apply(a.j,Gb(c,d));return Fb(a)},Ib=new RegExp(/\/?\??#?/.source+"("+/[\/?#]/i.source+"|"+/[\uD800-\uDBFF]/i.source+"|"+/%[c-f][0-9a-f](%[89ab][0-9a-f]){0,2}(%[89ab]?)?/i.source+"|"+/%[0-9a-f]?/i.source+")$","i"),Jb=function(a,b){var c=Eb(b);b=c.B;c.query.length&&(b+="?"+c.query.join(""));c.j.length&&(b+="#"+c.j.join(""));var d="";2E3<b.length&&(d=b,b=b.substr(0,2E3),b=b.replace(Ib,""),d=d.substr(b.length));var e=a.createElement("div");a=a.createElement("a");
|
||||
c=Eb(b);b=c.B;c.query.length&&(b+="?"+c.query.join(""));c.j.length&&(b+="#"+c.j.join(""));b=null===b?"null":void 0===b?"undefined":b;if("string"!==typeof b)throw Error("Expected a string");b=new x(b,Ja);eb(a,"A");b=b instanceof x?b:Ma(b);a.href=Ka(b);e.appendChild(a);a=e.innerHTML;b=new v(Fa,"Assignment to self.");Aa(Ia(b),"must provide justification");ya(!/^[\s\xa0]*$/.test(Ia(b)),"must provide non-empty justification");void 0===Ea&&(Ea=ta("gapi#html"));a=(b=Ea)?b.createHTML(a):a;a=new Oa(a,Na);
|
||||
if(void 0!==e.tagName){if("script"===e.tagName.toLowerCase())throw Error("Use setTextContent with a SafeScript.");if("style"===e.tagName.toLowerCase())throw Error("Use setTextContent with a SafeStyleSheet.");}a instanceof Oa&&a.constructor===Oa?a=a.R:(za("expected object of type SafeHtml, got '"+a+"' of type "+ia(a)),a="type_error:SafeHtml");e.innerHTML=a;b=String(e.firstChild.href);e.parentNode&&e.parentNode.removeChild(e);c=Eb(b+d);d=c.B;c.query.length&&(d+="?"+c.query.join(""));c.j.length&&(d+=
|
||||
"#"+c.j.join(""));return d},Kb=/^https?:\/\/[^\/%\\?#\s]+\/[^\s]*$/i;var Lb;var Mb=function(a,b,c,d){if(y[c+"EventListener"])y[c+"EventListener"](a,b,!1);else if(y[d+"tachEvent"])y[d+"tachEvent"]("on"+a,b)},Nb=function(){var a=A.readyState;return"complete"===a||"interactive"===a&&-1==navigator.userAgent.indexOf("MSIE")},Qb=function(a){var b=Ob;if(!Nb())try{b()}catch(c){}Pb(a)},Pb=function(a){if(Nb())a();else{var b=!1,c=function(){if(!b)return b=!0,a.apply(this,arguments)};y.addEventListener?(y.addEventListener("load",c,!1),y.addEventListener("DOMContentLoaded",c,!1)):y.attachEvent&&
|
||||
(y.attachEvent("onreadystatechange",function(){Nb()&&c.apply(this,arguments)}),y.attachEvent("onload",c))}},Rb=function(a){for(;a.firstChild;)a.removeChild(a.firstChild)},Sb={button:!0,div:!0,span:!0};var M={};M=B(y,"___jsl",C());B(M,"I",0);B(M,"hel",10);var Tb=function(a){return M.dpo?M.h:I(a,"jsh",M.h)},Ub=function(a){var b=B(M,"sws",[]);b.push.apply(b,a)},Vb=function(a){return B(M,"watt",C())[a]},Wb=function(a){var b=B(M,"PQ",[]);M.PQ=[];var c=b.length;if(0===c)a();else for(var d=0,e=function(){++d===c&&a()},f=0;f<c;f++)b[f](e)},Xb=function(a){return B(B(M,"H",C()),a,C())};var Yb=B(M,"perf",C()),Zb=B(Yb,"g",C()),$b=B(Yb,"i",C());B(Yb,"r",[]);C();C();
|
||||
var ac=function(a,b,c){var d=Yb.r;"function"===typeof d?d(a,b,c):d.push([a,b,c])},N=function(a,b,c){Zb[a]=!b&&Zb[a]||c||(new Date).getTime();ac(a)},cc=function(a,b,c){b&&0<b.length&&(b=bc(b),c&&0<c.length&&(b+="___"+bc(c)),28<b.length&&(b=b.substr(0,28)+(b.length-28)),c=b,b=B($b,"_p",C()),B(b,c,C())[a]=(new Date).getTime(),ac(a,"_p",c))},bc=function(a){return a.join("__").replace(/\./g,"_").replace(/\-/g,"_").replace(/,/g,"_")};var dc=C(),O=[],P=function(a){throw Error("Bad hint: "+a);};O.push(["jsl",function(a){for(var b in a)if(D(a,b)){var c=a[b];"object"==typeof c?M[b]=B(M,b,[]).concat(c):B(M,b,c)}if(b=a.u)a=B(M,"us",[]),a.push(b),(b=/^https:(.*)$/.exec(b))&&a.push("http:"+b[1])}]);var ec=/^(\/[a-zA-Z0-9_\-]+)+$/,fc=[/\/amp\//,/\/amp$/,/^\/amp$/],gc=/^[a-zA-Z0-9\-_\.,!]+$/,hc=/^gapi\.loaded_[0-9]+$/,ic=/^[a-zA-Z0-9,._-]+$/,mc=function(a,b,c,d,e){var f=a.split(";"),g=f.shift(),k=dc[g],h=null;k?h=k(f,b,c,d):P("no hint processor for: "+g);h||P("failed to generate load url");b=h;c=b.match(jc);(d=b.match(kc))&&1===d.length&&lc.test(b)&&c&&1===c.length||P("failed sanity: "+a);try{a="?";if(e&&0<e.length){c=b=0;for(d={};c<e.length;){var l=e[c++];f=void 0;f=u(l)?"o"+(Object.prototype.hasOwnProperty.call(l,
|
||||
ma)&&l[ma]||(l[ma]=++na)):(typeof l).charAt(0)+l;Object.prototype.hasOwnProperty.call(d,f)||(d[f]=!0,e[b++]=l)}e.length=b;h=h+"?le="+e.join(",");a="&"}if(M.rol){var n=M.ol;n&&n.length&&(h=""+h+a+"ol="+n.length)}}catch(q){}return h},pc=function(a,b,c,d){a=nc(a);hc.test(c)||P("invalid_callback");b=oc(b);d=d&&d.length?oc(d):null;var e=function(f){return encodeURIComponent(f).replace(/%2C/g,",")};return[encodeURIComponent(a.pathPrefix).replace(/%2C/g,",").replace(/%2F/g,"/"),"/k=",e(a.version),"/m=",
|
||||
e(b),d?"/exm="+e(d):"","/rt=j/sv=1/d=1/ed=1",a.W?"/am="+e(a.W):"",a.fa?"/rs="+e(a.fa):"",a.ha?"/t="+e(a.ha):"","/cb=",e(c)].join("")},nc=function(a){"/"!==a.charAt(0)&&P("relative path");for(var b=a.substring(1).split("/"),c=[];b.length;){a=b.shift();if(!a.length||0==a.indexOf("."))P("empty/relative directory");else if(0<a.indexOf("=")){b.unshift(a);break}c.push(a)}a={};for(var d=0,e=b.length;d<e;++d){var f=b[d].split("="),g=decodeURIComponent(f[0]),k=decodeURIComponent(f[1]);2==f.length&&g&&k&&(a[g]=
|
||||
a[g]||k)}b="/"+c.join("/");ec.test(b)||P("invalid_prefix");c=0;for(d=fc.length;c<d;++c)fc[c].test(b)&&P("invalid_prefix");c=qc(a,"k",!0);d=qc(a,"am");e=qc(a,"rs");a=qc(a,"t");return{pathPrefix:b,version:c,W:d,fa:e,ha:a}},oc=function(a){for(var b=[],c=0,d=a.length;c<d;++c){var e=a[c].replace(/\./g,"_").replace(/-/g,"_");ic.test(e)&&b.push(e)}return b.join(",")},qc=function(a,b,c){a=a[b];!a&&c&&P("missing: "+b);if(a){if(gc.test(a))return a;P("invalid: "+b)}return null},lc=/^https?:\/\/[a-z0-9_.-]+\.google(rs)?\.com(:\d+)?\/[a-zA-Z0-9_.,!=\-\/]+$/,
|
||||
kc=/\/cb=/g,jc=/\/\//g;dc.m=function(a,b,c,d){(a=a[0])||P("missing_hint");return"https://apis.google.com"+pc(a,b,c,d)};var rc=decodeURI("%73cript"),sc=/^[-+_0-9\/A-Za-z]+={0,2}$/,tc=function(a,b){for(var c=[],d=0;d<a.length;++d){var e=a[d];e&&0>pb.call(b,e)&&c.push(e)}return c},uc=function(){var a=M.nonce;return void 0!==a?a&&a===String(a)&&a.match(sc)?a:M.nonce=null:A.querySelector?(a=A.querySelector("script[nonce]"))?(a=a.nonce||a.getAttribute("nonce")||"",a&&a===String(a)&&a.match(sc)?M.nonce=a:M.nonce=null):null:null},xc=function(a){if("loading"!=A.readyState)vc(a);else{var b=uc(),c="";null!==b&&(c=' nonce="'+
|
||||
b+'"');a="<"+rc+' src="'+encodeURI(a)+'"'+c+"></"+rc+">";A.write(wc?wc.createHTML(a):a)}},vc=function(a){var b=A.createElement(rc);b.setAttribute("src",wc?wc.createScriptURL(a):a);a=uc();null!==a&&b.setAttribute("nonce",a);b.async="true";(a=A.getElementsByTagName(rc)[0])?a.parentNode.insertBefore(b,a):(A.head||A.body||A.documentElement).appendChild(b)},zc=function(a,b,c){yc(function(){var d=b===Tb(mb.href)?B(H,"_",C()):C();d=B(Xb(b),"_",d);a(d)},c)},Bc=function(a,b){var c=b||{};"function"==typeof b&&
|
||||
(c={},c.callback=b);var d=(b=c)&&b._c;if(d)for(var e=0;e<O.length;e++){var f=O[e][0],g=O[e][1];g&&D(d,f)&&g(d[f],a,b)}b=[];a?b=a.split(":"):c.features&&(b=c.features);if(!(a=c.h)&&(a=Tb(mb.href),!a))throw Error("Bad hint: !hint");Ac(b||[],c,a)},Ac=function(a,b,c){var d=!!M.glrp;a=qb(a)||[];var e=b.callback,f=b.config,g=b.timeout,k=b.ontimeout,h=b.onerror,l=void 0;"function"==typeof h&&(l=h);var n=null,q=!1;if(g&&!k||!g&&k)throw"Timeout requires both the timeout parameter and ontimeout parameter to be set";
|
||||
h=B(Xb(c),"r",[]).sort();var p=B(Xb(c),"L",[]).sort(),J=M.le||[],z=[].concat(h),w=function(R,ja){if(q)return 0;y.clearTimeout(n);p.push.apply(p,G);var ka=((H||{}).config||{}).update;ka?ka(f):f&&B(M,"cu",[]).push(f);if(ja){cc("me0",R,z);try{zc(ja,c,l)}finally{cc("me1",R,z)}}return 1};0<g&&(n=y.setTimeout(function(){q=!0;k()},g));var G=tc(a,p);if(G.length){G=tc(a,h);var K=B(M,"CP",[]),L=K.length;K[L]=function(R){if(!R)return 0;cc("ml1",G,z);var ja=function(Ha){d||(K[L]=null);w(G,R)&&(d&&(K[L]=null),
|
||||
Wb(function(){e&&e();Ha()}))},ka=function(){var Ha=K[L+1];Ha&&Ha()};0<L&&K[L-1]?K[L]=function(){ja(ka)}:ja(ka)};if(G.length){var gb="loaded_"+M.I++;H[gb]=function(R){K[L](R);H[gb]=null};a=mc(c,G,"gapi."+gb,h,J);h.push.apply(h,G);cc("ml0",G,z);b.sync||y.___gapisync?xc(a):vc(a)}else K[L](nb)}else w(G)&&e&&e()},wc=ta("gapi#gapi");var yc=function(a,b){if(M.hee&&0<M.hel)try{return a()}catch(c){b&&b(c),M.hel--,Bc("debug_error",function(){try{window.___jsl.hefn(c)}catch(d){throw c;}})}else try{return a()}catch(c){throw b&&b(c),c;}};var Cc=H.load;Cc&&B(M,"ol",[]).push(Cc);H.load=function(a,b){return yc(function(){return Bc(a,b)})};var Dc=function(a){var b=window.___jsl=window.___jsl||{};b[a]=b[a]||[];return b[a]},Ec=function(a){var b=window.___jsl=window.___jsl||{};b.cfg=!a&&b.cfg||{};return b.cfg},Fc=function(a){return"object"===typeof a&&/\[native code\]/.test(a.push)},Q=function(a,b,c){if(b&&"object"===typeof b)for(var d in b)!Object.prototype.hasOwnProperty.call(b,d)||c&&"___goc"===d&&"undefined"===typeof b[d]||(a[d]&&b[d]&&"object"===typeof a[d]&&"object"===typeof b[d]&&!Fc(a[d])&&!Fc(b[d])?Q(a[d],b[d]):b[d]&&"object"===
|
||||
typeof b[d]?(a[d]=Fc(b[d])?[]:{},Q(a[d],b[d])):a[d]=b[d])},Gc=function(a){if(a&&!/^\s+$/.test(a)){for(;0==a.charCodeAt(a.length-1);)a=a.substring(0,a.length-1);try{var b=window.JSON.parse(a)}catch(c){}if("object"===typeof b)return b;try{b=(new Function("return ("+a+"\n)"))()}catch(c){}if("object"===typeof b)return b;try{b=(new Function("return ({"+a+"\n})"))()}catch(c){}return"object"===typeof b?b:{}}},Hc=function(a,b){var c={___goc:void 0};a.length&&a[a.length-1]&&Object.hasOwnProperty.call(a[a.length-
|
||||
1],"___goc")&&"undefined"===typeof a[a.length-1].___goc&&(c=a.pop());Q(c,b);a.push(c)},Ic=function(a){Ec(!0);var b=window.___gcfg,c=Dc("cu"),d=window.___gu;b&&b!==d&&(Hc(c,b),window.___gu=b);b=Dc("cu");var e=document.scripts||document.getElementsByTagName("script")||[];d=[];var f=[];f.push.apply(f,Dc("us"));for(var g=0;g<e.length;++g)for(var k=e[g],h=0;h<f.length;++h)k.src&&0==k.src.indexOf(f[h])&&d.push(k);0==d.length&&0<e.length&&e[e.length-1].src&&d.push(e[e.length-1]);for(e=0;e<d.length;++e)d[e].getAttribute("gapi_processed")||
|
||||
(d[e].setAttribute("gapi_processed",!0),(f=d[e])?(g=f.nodeType,f=3==g||4==g?f.nodeValue:f.textContent||""):f=void 0,(f=Gc(f))&&b.push(f));a&&Hc(c,a);d=Dc("cd");a=0;for(b=d.length;a<b;++a)Q(Ec(),d[a],!0);d=Dc("ci");a=0;for(b=d.length;a<b;++a)Q(Ec(),d[a],!0);a=0;for(b=c.length;a<b;++a)Q(Ec(),c[a],!0)},S=function(a){var b=Ec();if(!a)return b;a=a.split("/");for(var c=0,d=a.length;b&&"object"===typeof b&&c<d;++c)b=b[a[c]];return c===a.length&&void 0!==b?b:void 0},Jc=function(a,b){var c;if("string"===typeof a){var d=
|
||||
c={};a=a.split("/");for(var e=0,f=a.length;e<f-1;++e){var g={};d=d[a[e]]=g}d[a[e]]=b}else c=a;Ic(c)};var Kc=function(){var a=window.__GOOGLEAPIS;a&&(a.googleapis&&!a["googleapis.config"]&&(a["googleapis.config"]=a.googleapis),B(M,"ci",[]).push(a),window.__GOOGLEAPIS=void 0)};var Lc={callback:1,clientid:1,cookiepolicy:1,openidrealm:-1,includegrantedscopes:-1,requestvisibleactions:1,scope:1},Mc=!1,Nc=C(),Oc=function(){if(!Mc){for(var a=document.getElementsByTagName("meta"),b=0;b<a.length;++b){var c=a[b].name.toLowerCase();if(0==c.lastIndexOf("google-signin-",0)){c=c.substring(14);var d=a[b].content;Lc[c]&&d&&(Nc[c]=d)}}if(window.self!==window.top){a=document.location.toString();for(var e in Lc)0<Lc[e]&&(b=I(a,e,""))&&(Nc[e]=b)}Mc=!0}e=C();E(Nc,e);return e},Pc=function(a){return!!(a.clientid&&
|
||||
a.scope&&a.callback)};var Qc=function(){this.i=window.console};Qc.prototype.log=function(a){this.i&&this.i.log&&this.i.log(a)};Qc.prototype.error=function(a){this.i&&(this.i.error?this.i.error(a):this.i.log&&this.i.log(a))};Qc.prototype.warn=function(a){this.i&&(this.i.warn?this.i.warn(a):this.i.log&&this.i.log(a))};Qc.prototype.debug=function(){};var Rc=new Qc;var Sc=function(){return!!M.oa},Tc=function(){};var T=B(M,"rw",C()),Uc=function(a){for(var b in T)a(T[b])},Vc=function(a,b){(a=T[a])&&a.state<b&&(a.state=b)};var U=function(a){var b=window.___jsl=window.___jsl||{};b.cfg=b.cfg||{};b=b.cfg;if(!a)return b;a=a.split("/");for(var c=0,d=a.length;b&&"object"===typeof b&&c<d;++c)b=b[a[c]];return c===a.length&&void 0!==b?b:void 0};var Wc=/^https?:\/\/(?:\w|[\-\.])+\.google\.(?:\w|[\-:\.])+(?:\/[^\?#]*)?\/u\/(\d)\//,Xc=/^https?:\/\/(?:\w|[\-\.])+\.google\.(?:\w|[\-:\.])+(?:\/[^\?#]*)?\/b\/(\d{10,21})\//,Yc=function(){var a=U("googleapis.config/sessionIndex");"string"===typeof a&&254<a.length&&(a=null);null==a&&(a=window.__X_GOOG_AUTHUSER);"string"===typeof a&&254<a.length&&(a=null);if(null==a){var b=window.google;b&&(a=b.authuser)}"string"===typeof a&&254<a.length&&(a=null);null==a&&(b=window.location.href,a=I(b,"authuser")||
|
||||
null,null==a&&(a=(a=b.match(Wc))?a[1]:null));if(null==a)return null;a=String(a);254<a.length&&(a=null);return a},Zc=function(){var a=U("googleapis.config/sessionDelegate");"string"===typeof a&&21<a.length&&(a=null);null==a&&(a=(a=window.location.href.match(Xc))?a[1]:null);if(null==a)return null;a=String(a);21<a.length&&(a=null);return a};var $c,V,W=void 0,X=function(a){try{return t.JSON.parse.call(t.JSON,a)}catch(b){return!1}},Y=function(a){return Object.prototype.toString.call(a)},ad=Y(0),bd=Y(new Date(0)),cd=Y(!0),dd=Y(""),ed=Y({}),fd=Y([]),gd=function(a,b){if(b)for(var c=0,d=b.length;c<d;++c)if(a===b[c])throw new TypeError("Converting circular structure to JSON");d=typeof a;if("undefined"!==d){c=Array.prototype.slice.call(b||[],0);c[c.length]=a;b=[];var e=Y(a);if(null!=a&&"function"===typeof a.toJSON&&(Object.prototype.hasOwnProperty.call(a,
|
||||
"toJSON")||(e!==fd||a.constructor!==Array&&a.constructor!==Object)&&(e!==ed||a.constructor!==Array&&a.constructor!==Object)&&e!==dd&&e!==ad&&e!==cd&&e!==bd))return gd(a.toJSON.call(a),c);if(null==a)b[b.length]="null";else if(e===ad)a=Number(a),isNaN(a)||isNaN(a-a)?a="null":-0===a&&0>1/a&&(a="-0"),b[b.length]=String(a);else if(e===cd)b[b.length]=String(!!Number(a));else{if(e===bd)return gd(a.toISOString.call(a),c);if(e===fd&&Y(a.length)===ad){b[b.length]="[";var f=0;for(d=Number(a.length)>>0;f<d;++f)f&&
|
||||
(b[b.length]=","),b[b.length]=gd(a[f],c)||"null";b[b.length]="]"}else if(e==dd&&Y(a.length)===ad){b[b.length]='"';f=0;for(c=Number(a.length)>>0;f<c;++f)d=String.prototype.charAt.call(a,f),e=String.prototype.charCodeAt.call(a,f),b[b.length]="\b"===d?"\\b":"\f"===d?"\\f":"\n"===d?"\\n":"\r"===d?"\\r":"\t"===d?"\\t":"\\"===d||'"'===d?"\\"+d:31>=e?"\\u"+(e+65536).toString(16).substr(1):32<=e&&65535>=e?d:"\ufffd";b[b.length]='"'}else if("object"===d){b[b.length]="{";d=0;for(f in a)Object.prototype.hasOwnProperty.call(a,
|
||||
f)&&(e=gd(a[f],c),void 0!==e&&(d++&&(b[b.length]=","),b[b.length]=gd(f),b[b.length]=":",b[b.length]=e));b[b.length]="}"}else return}return b.join("")}},hd=/[\0-\x07\x0b\x0e-\x1f]/,id=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*[\0-\x1f]/,jd=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*\\[^\\\/"bfnrtu]/,kd=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*\\u([0-9a-fA-F]{0,3}[^0-9a-fA-F])/,ld=/"([^\0-\x1f\\"]|\\[\\\/"bfnrt]|\\u[0-9a-fA-F]{4})*"/g,md=/-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?/g,nd=/[ \t\n\r]+/g,
|
||||
od=/[^"]:/,pd=/""/g,qd=/true|false|null/g,rd=/00/,sd=/[\{]([^0\}]|0[^:])/,td=/(^|\[)[,:]|[,:](\]|\}|[,:]|$)/,ud=/[^\[,:][\[\{]/,vd=/^(\{|\}|\[|\]|,|:|0)+/,wd=/\u2028/g,xd=/\u2029/g,yd=function(a){a=String(a);if(hd.test(a)||id.test(a)||jd.test(a)||kd.test(a))return!1;var b=a.replace(ld,'""');b=b.replace(md,"0");b=b.replace(nd,"");if(od.test(b))return!1;b=b.replace(pd,"0");b=b.replace(qd,"0");if(rd.test(b)||sd.test(b)||td.test(b)||ud.test(b)||!b||(b=b.replace(vd,"")))return!1;a=a.replace(wd,"\\u2028").replace(xd,
|
||||
"\\u2029");b=void 0;try{b=W?[X(a)]:eval("(function (var_args) {\n return Array.prototype.slice.call(arguments, 0);\n})(\n"+a+"\n)")}catch(c){return!1}return b&&1===b.length?b[0]:!1},zd=function(){var a=((t.document||{}).scripts||[]).length;if((void 0===$c||void 0===W||V!==a)&&-1!==V){$c=W=!1;V=-1;try{try{W=!!t.JSON&&'{"a":[3,true,"1970-01-01T00:00:00.000Z"]}'===t.JSON.stringify.call(t.JSON,{a:[3,!0,new Date(0)],c:function(){}})&&!0===X("true")&&3===X('[{"a":3}]')[0].a}catch(b){}$c=W&&!X("[00]")&&
|
||||
!X('"\u0007"')&&!X('"\\0"')&&!X('"\\v"')}finally{V=a}}},Ad=function(a){if(-1===V)return!1;zd();return($c?X:yd)(a)},Bd=function(a){if(-1!==V)return zd(),W?t.JSON.stringify.call(t.JSON,a):gd(a)},Cd=!Date.prototype.toISOString||"function"!==typeof Date.prototype.toISOString||"1970-01-01T00:00:00.000Z"!==(new Date(0)).toISOString(),Dd=function(){var a=Date.prototype.getUTCFullYear.call(this);return[0>a?"-"+String(1E6-a).substr(1):9999>=a?String(1E4+a).substr(1):"+"+String(1E6+a).substr(1),"-",String(101+
|
||||
Date.prototype.getUTCMonth.call(this)).substr(1),"-",String(100+Date.prototype.getUTCDate.call(this)).substr(1),"T",String(100+Date.prototype.getUTCHours.call(this)).substr(1),":",String(100+Date.prototype.getUTCMinutes.call(this)).substr(1),":",String(100+Date.prototype.getUTCSeconds.call(this)).substr(1),".",String(1E3+Date.prototype.getUTCMilliseconds.call(this)).substr(1),"Z"].join("")};Date.prototype.toISOString=Cd?Dd:Date.prototype.toISOString;var Ed=function(){this.blockSize=-1};var Fd=function(){this.blockSize=-1;this.blockSize=64;this.g=[];this.M=[];this.ka=[];this.J=[];this.J[0]=128;for(var a=1;a<this.blockSize;++a)this.J[a]=0;this.K=this.v=0;this.reset()};ra(Fd,Ed);Fd.prototype.reset=function(){this.g[0]=1732584193;this.g[1]=4023233417;this.g[2]=2562383102;this.g[3]=271733878;this.g[4]=3285377520;this.K=this.v=0};
|
||||
var Gd=function(a,b,c){c||(c=0);var d=a.ka;if("string"===typeof b)for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.g[0];c=a.g[1];var g=a.g[2],k=a.g[3],h=a.g[4];for(e=0;80>e;e++){if(40>e)if(20>e){f=k^c&(g^k);var l=1518500249}else f=c^g^k,l=1859775393;else 60>e?(f=c&g|k&(c|g),l=2400959708):
|
||||
(f=c^g^k,l=3395469782);f=(b<<5|b>>>27)+f+h+l+d[e]&4294967295;h=k;k=g;g=(c<<30|c>>>2)&4294967295;c=b;b=f}a.g[0]=a.g[0]+b&4294967295;a.g[1]=a.g[1]+c&4294967295;a.g[2]=a.g[2]+g&4294967295;a.g[3]=a.g[3]+k&4294967295;a.g[4]=a.g[4]+h&4294967295};
|
||||
Fd.prototype.update=function(a,b){if(null!=a){void 0===b&&(b=a.length);for(var c=b-this.blockSize,d=0,e=this.M,f=this.v;d<b;){if(0==f)for(;d<=c;)Gd(this,a,d),d+=this.blockSize;if("string"===typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.blockSize){Gd(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.blockSize){Gd(this,e);f=0;break}}this.v=f;this.K+=b}};
|
||||
Fd.prototype.digest=function(){var a=[],b=8*this.K;56>this.v?this.update(this.J,56-this.v):this.update(this.J,this.blockSize-(this.v-56));for(var c=this.blockSize-1;56<=c;c--)this.M[c]=b&255,b/=256;Gd(this,this.M);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.g[c]>>d&255,++b;return a};var Hd=function(){this.T=new Fd};Hd.prototype.reset=function(){this.T.reset()};var Id=y.crypto,Jd=!1,Kd=0,Ld=0,Md=1,Nd=0,Od="",Pd=function(a){a=a||y.event;var b=a.screenX+a.clientX<<16;b+=a.screenY+a.clientY;b*=(new Date).getTime()%1E6;Md=Md*b%Nd;0<Kd&&++Ld==Kd&&Mb("mousemove",Pd,"remove","de")},Qd=function(a){var b=new Hd;a=unescape(encodeURIComponent(a));for(var c=[],d=0,e=a.length;d<e;++d)c.push(a.charCodeAt(d));b.T.update(c);b=b.T.digest();a="";for(c=0;c<b.length;c++)a+="0123456789ABCDEF".charAt(Math.floor(b[c]/16))+"0123456789ABCDEF".charAt(b[c]%16);return a};
|
||||
Jd=!!Id&&"function"==typeof Id.getRandomValues;Jd||(Nd=1E6*(screen.width*screen.width+screen.height),Od=Qd(A.cookie+"|"+A.location+"|"+(new Date).getTime()+"|"+Math.random()),Kd=U("random/maxObserveMousemove")||0,0!=Kd&&Mb("mousemove",Pd,"add","at"));var Rd=function(){var a=M.onl;if(!a){a=C();M.onl=a;var b=C();a.e=function(c){var d=b[c];d&&(delete b[c],d())};a.a=function(c,d){b[c]=d};a.r=function(c){delete b[c]}}return a},Sd=function(a,b){b=b.onload;return"function"===typeof b?(Rd().a(a,b),b):null},Td=function(a){F(/^\w+$/.test(a),"Unsupported id - "+a);return'onload="window.___jsl.onl.e("'+a+'")"'},Ud=function(a){Rd().r(a)};var Vd={allowtransparency:"true",frameborder:"0",hspace:"0",marginheight:"0",marginwidth:"0",scrolling:"no",style:"",tabindex:"0",vspace:"0",width:"100%"},Wd={allowtransparency:!0,onload:!0},Xd=0,Yd=function(a){F(!a||Kb.test(a),"Illegal url for new iframe - "+a)},Zd=function(a,b,c,d,e){Yd(c.src);var f,g=Sd(d,c),k=g?Td(d):"";try{document.all&&(f=a.createElement('<iframe frameborder="'+wb(String(c.frameborder))+'" scrolling="'+wb(String(c.scrolling))+'" '+k+' name="'+wb(String(c.name))+'"/>'))}catch(l){}finally{f||
|
||||
(f=(a?new lb(kb(a)):va||(va=new lb)).ma("IFRAME"),g&&(f.onload=function(){f.onload=null;g.call(this)},Ud(d)))}f.setAttribute("ng-non-bindable","");for(var h in c)a=c[h],"style"===h&&"object"===typeof a?E(a,f.style):Wd[h]||f.setAttribute(h,String(a));(h=e&&e.beforeNode||null)||e&&e.dontclear||Rb(b);b.insertBefore(f,h);f=h?h.previousSibling:b.lastChild;c.allowtransparency&&(f.allowTransparency=!0);return f};var $d=/^:[\w]+$/,ae=/:([a-zA-Z_]+):/g,be=function(){var a=Yc()||"0",b=Zc();var c=Yc()||a;var d=Zc(),e="";c&&(e+="u/"+encodeURIComponent(String(c))+"/");d&&(e+="b/"+encodeURIComponent(String(d))+"/");c=e||null;(e=(d=!1===U("isLoggedIn"))?"_/im/":"")&&(c="");var f=U("iframes/:socialhost:"),g=U("iframes/:im_socialhost:");return Lb={socialhost:f,ctx_socialhost:d?g:f,session_index:a,session_delegate:b,session_prefix:c,im_prefix:e}},ce=function(a,b){return be()[b]||""},de=function(a){return function(b,
|
||||
c){return a?be()[c]||a[c]||"":be()[c]||""}};var ee=function(a){var b;a.match(/^https?%3A/i)&&(b=decodeURIComponent(a));a=b?b:a;return Jb(document,a)},fe=function(a){a=a||"canonical";for(var b=document.getElementsByTagName("link"),c=0,d=b.length;c<d;c++){var e=b[c],f=e.getAttribute("rel");if(f&&f.toLowerCase()==a&&(e=e.getAttribute("href"))&&(e=ee(e))&&null!=e.match(/^https?:\/\/[\w\-_\.]+/i))return e}return window.location.href};var ge={se:"0"},he={post:!0},ie={style:"position:absolute;top:-10000px;width:450px;margin:0px;border-style:none"},je="onPlusOne _ready _close _open _resizeMe _renderstart oncircled drefresh erefresh".split(" "),ke=B(M,"WI",C()),le=function(a,b,c){var d;var e={};var f=d=a;"plus"==a&&b.action&&(d=a+"_"+b.action,f=a+"/"+b.action);(d=S("iframes/"+d+"/url"))||(d=":im_socialhost:/:session_prefix::im_prefix:_/widget/render/"+f+"?usegapi=1");for(var g in ge)e[g]=g+"/"+(b[g]||ge[g])+"/";e=Jb(A,d.replace(ae,
|
||||
de(e)));g="iframes/"+a+"/params/";f={};E(b,f);(d=S("lang")||S("gwidget/lang"))&&(f.hl=d);he[a]||(f.origin=window.location.origin||window.location.protocol+"//"+window.location.host);f.exp=S(g+"exp");if(g=S(g+"location"))for(d=0;d<g.length;d++){var k=g[d];f[k]=y.location[k]}switch(a){case "plus":case "follow":g=f.href;d=b.action?void 0:"publisher";g=(g="string"==typeof g?g:void 0)?ee(g):fe(d);f.url=g;delete f.href;break;case "plusone":g=(g=b.href)?ee(g):fe();f.url=g;g=b.db;d=S();null==g&&d&&(g=d.db,
|
||||
null==g&&(g=d.gwidget&&d.gwidget.db));f.db=g||void 0;g=b.ecp;d=S();null==g&&d&&(g=d.ecp,null==g&&(g=d.gwidget&&d.gwidget.ecp));f.ecp=g||void 0;delete f.href;break;case "signin":f.url=fe()}M.ILI&&(f.iloader="1");delete f["data-onload"];delete f.rd;for(var h in ge)f[h]&&delete f[h];f.gsrc=S("iframes/:source:");h=S("inline/css");"undefined"!==typeof h&&0<c&&h>=c&&(f.ic="1");h=/^#|^fr-/;c={};for(var l in f)D(f,l)&&h.test(l)&&(c[l.replace(h,"")]=f[l],delete f[l]);l="q"==S("iframes/"+a+"/params/si")?f:
|
||||
c;h=Oc();for(var n in h)!D(h,n)||D(f,n)||D(c,n)||(l[n]=h[n]);n=[].concat(je);(l=S("iframes/"+a+"/methods"))&&"object"===typeof l&&ob.test(l.push)&&(n=n.concat(l));for(var q in b)D(b,q)&&/^on/.test(q)&&("plus"!=a||"onconnect"!=q)&&(n.push(q),delete f[q]);delete f.callback;c._methods=n.join(",");return Hb(e,f,c)},me=["style","data-gapiscan"],oe=function(a){for(var b=C(),c=0!=a.nodeName.toLowerCase().indexOf("g:"),d=a.attributes.length,e=0;e<d;e++){var f=a.attributes[e],g=f.name,k=f.value;0<=pb.call(me,
|
||||
g)||c&&0!=g.indexOf("data-")||"null"===k||"specified"in f&&!f.specified||(c&&(g=g.substr(5)),b[g.toLowerCase()]=k)}a=a.style;(c=ne(a&&a.height))&&(b.height=String(c));(a=ne(a&&a.width))&&(b.width=String(a));return b},ne=function(a){var b=void 0;"number"===typeof a?b=a:"string"===typeof a&&(b=parseInt(a,10));return b},re=function(){var a=M.drw;Uc(function(b){if(a!==b.id&&4!=b.state&&"share"!=b.type){var c=b.id,d=b.type,e=b.url;b=b.userParams;var f=A.getElementById(c);if(f){var g=le(d,b,0);g?(f=f.parentNode,
|
||||
pe(e)!==pe(g)&&(b.dontclear=!0,b.rd=!0,b.ri=!0,b.type=d,qe(f,b),(d=T[f.lastChild.id])&&(d.oid=c),Vc(c,4))):delete T[c]}else delete T[c]}})},pe=function(a){var b=RegExp("(\\?|&)ic=1");return a.replace(/#.*/,"").replace(b,"")};var se,te,ue,ve,we,xe=/(?:^|\s)g-((\S)*)(?:$|\s)/,ye={plusone:!0,autocomplete:!0,profile:!0,signin:!0,signin2:!0};se=B(M,"SW",C());te=B(M,"SA",C());ue=B(M,"SM",C());ve=B(M,"FW",[]);we=null;
|
||||
var ze=function(a,b){return("string"===typeof a?document.getElementById(a):a)||b},Be=function(a,b){Ae(void 0,!1,a,b)},Ae=function(a,b,c,d){N("ps0",!0);c=ze(c,A);var e=A.documentMode;if(c.querySelectorAll&&(!e||8<e)){e=d?[d]:xb(se).concat(xb(te)).concat(xb(ue));for(var f=[],g=0;g<e.length;g++){var k=e[g];f.push(".g-"+k,"g\\:"+k)}e=c.querySelectorAll(f.join(","))}else e=c.getElementsByTagName("*");c=C();for(f=0;f<e.length;f++){g=e[f];k=d;var h=g.nodeName.toLowerCase(),l=void 0;if(g.getAttribute("data-gapiscan"))k=
|
||||
null;else{var n=h.indexOf("g:");0==n?l=h.substr(2):(n=(n=String(g.className||g.getAttribute("class")))&&xe.exec(n))&&(l=n[1]);k=!l||!(se[l]||te[l]||ue[l])||k&&l!==k?null:l}k&&(ye[k]||0==g.nodeName.toLowerCase().indexOf("g:")||0!=xb(oe(g)).length)&&(g.setAttribute("data-gapiscan",!0),B(c,k,[]).push(g))}if(b)for(var q in c)for(b=c[q],d=0;d<b.length;d++)b[d].setAttribute("data-onload",!0);for(var p in c)ve.push(p);N("ps1",!0);if((q=ve.join(":"))||a)try{H.load(q,a)}catch(z){Rc.log(z);return}if(Ce(we||
|
||||
{}))for(var J in c){a=c[J];p=0;for(b=a.length;p<b;p++)a[p].removeAttribute("data-gapiscan");De(J)}else{d=[];for(J in c)for(a=c[J],p=0,b=a.length;p<b;p++)e=a[p],Ee(J,e,oe(e),d,b);Fe(q,d)}},Ge=function(a){var b=B(H,a,{});b.go||(b.go=function(c){return Be(c,a)},b.render=function(c,d){d=d||{};d.type=a;return qe(c,d)})},He=function(a){se[a]=!0},Ie=function(a){te[a]=!0},Je=function(a){ue[a]=!0};var De=function(a,b){var c=Vb(a);b&&c?(c(b),(c=b.iframeNode)&&c.setAttribute("data-gapiattached",!0)):H.load(a,function(){var d=Vb(a),e=b&&b.iframeNode,f=b&&b.userParams;e&&d?(d(b),e.setAttribute("data-gapiattached",!0)):(d=H[a].go,"signin2"==a?d(e,f):d(e&&e.parentNode,f))})},Ce=function(){return!1},Fe=function(){},Ee=function(a,b,c,d,e,f){switch(Ke(b,a,f)){case 0:a=ue[a]?a+"_annotation":a;d={};d.iframeNode=b;d.userParams=c;De(a,d);break;case 1:if(b.parentNode){for(var g in c){if(f=D(c,g))f=c[g],
|
||||
f=!!f&&"object"===typeof f&&(!f.toString||f.toString===Object.prototype.toString||f.toString===Array.prototype.toString);if(f)try{c[g]=Bd(c[g])}catch(G){delete c[g]}}var k=!0;c.dontclear&&(k=!1);delete c.dontclear;Tc();f=le(a,c,e);g={allowPost:1,attributes:ie};g.dontclear=!k;e={};e.userParams=c;e.url=f;e.type=a;if(c.rd)var h=b;else h=document.createElement("div"),b.setAttribute("data-gapistub",!0),h.style.cssText="position:absolute;width:450px;left:-10000px;",b.parentNode.insertBefore(h,b);e.siteElement=
|
||||
h;h.id||(b=h,B(ke,a,0),k="___"+a+"_"+ke[a]++,b.id=k);b=C();b[">type"]=a;E(c,b);k=f;c=h;f=g||{};b=f.attributes||{};F(!(f.allowPost||f.forcePost)||!b.onload,"onload is not supported by post iframe (allowPost or forcePost)");g=b=k;$d.test(b)&&(g=U("iframes/"+g.substring(1)+"/url"),F(!!g,"Unknown iframe url config for - "+b));k=Jb(A,g.replace(ae,ce));b=c.ownerDocument||A;h=0;do g=f.id||["I",Xd++,"_",(new Date).getTime()].join("");while(b.getElementById(g)&&5>++h);F(5>h,"Error creating iframe id");h={};
|
||||
var l={};b.documentMode&&9>b.documentMode&&(h.hostiemode=b.documentMode);E(f.queryParams||{},h);E(f.fragmentParams||{},l);var n=f.pfname;var q=C();U("iframes/dropLegacyIdParam")||(q.id=g);q._gfid=g;q.parent=b.location.protocol+"//"+b.location.host;var p=I(b.location.href,"parent");n=n||"";!n&&p&&(p=I(b.location.href,"_gfid","")||I(b.location.href,"id",""),n=I(b.location.href,"pfname",""),n=p?n+"/"+p:"");n||(p=Ad(I(b.location.href,"jcp","")))&&"object"==typeof p&&(n=(n=p.id)?p.pfname+"/"+n:"");q.pfname=
|
||||
n;f.connectWithJsonParam&&(p={},p.jcp=Bd(q),q=p);p=I(k,"rpctoken")||h.rpctoken||l.rpctoken;if(!p){if(!(p=f.rpctoken)){p=String;n=Math;var J=n.round;if(Jd){var z=new y.Uint32Array(1);Id.getRandomValues(z);z=Number("0."+z[0])}else z=Md,z+=parseInt(Od.substr(0,20),16),Od=Qd(Od),z/=Nd+Math.pow(16,20);p=p(J.call(n,1E8*z))}q.rpctoken=p}f.rpctoken=p;E(q,f.connectWithQueryParams?h:l);p=b.location.href;q=C();(n=I(p,"_bsh",M.bsh))&&(q._bsh=n);(p=Tb(p))&&(q.jsh=p);f.hintInFragment?E(q,l):E(q,h);k=Hb(k,h,l,f.paramsSerializer);
|
||||
l=C();E(Vd,l);E(f.attributes,l);l.name=l.id=g;l.src=k;f.eurl=k;h=f||{};q=!!h.allowPost;if(h.forcePost||q&&2E3<k.length){h=Eb(k);l.src="";f.dropDataPostorigin||(l["data-postorigin"]=k);k=Zd(b,c,l,g);if(-1!=navigator.userAgent.indexOf("WebKit")){var w=k.contentWindow.document;w.open();l=w.createElement("div");q={};p=g+"_inner";q.name=p;q.src="";q.style="display:none";Zd(b,l,q,p,f)}l=(f=h.query[0])?f.split("&"):[];f=[];for(q=0;q<l.length;q++)p=l[q].split("=",2),f.push([decodeURIComponent(p[0]),decodeURIComponent(p[1])]);
|
||||
h.query=[];l=Fb(h);F(Kb.test(l),"Invalid URL: "+l);h=b.createElement("form");h.method="POST";h.target=g;h.style.display="none";g=l instanceof x?l:Ma(l);eb(h,"FORM").action=Ka(g);for(g=0;g<f.length;g++)l=b.createElement("input"),l.type="hidden",l.name=f[g][0],l.value=f[g][1],h.appendChild(l);c.appendChild(h);h.submit();h.parentNode.removeChild(h);w&&w.close();w=k}else w=Zd(b,c,l,g,f);e.iframeNode=w;e.id=w.getAttribute("id");w=e.id;c=C();c.id=w;c.userParams=e.userParams;c.url=e.url;c.type=e.type;c.state=
|
||||
1;T[w]=c;w=e}else w=null;w&&((e=w.id)&&d.push(e),De(a,w))}},Ke=function(a,b,c){if(a&&1===a.nodeType&&b){if(c)return 1;if(ue[b]){if(Sb[a.nodeName.toLowerCase()])return(a=a.innerHTML)&&a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")?0:1}else{if(te[b])return 0;if(se[b])return 1}}return null},qe=function(a,b){var c=b.type;delete b.type;var d=ze(a);if(d){a={};for(var e in b)D(b,e)&&(a[e.toLowerCase()]=b[e]);a.rd=1;(b=!!a.ri)&&delete a.ri;e=[];Ee(c,d,a,e,0,b);Fe(c,e)}else Rc.log("string"==="gapi."+c+".render: missing element "+
|
||||
typeof a?a:"")};B(H,"platform",{}).go=Be;Ce=function(a){for(var b=["_c","jsl","h"],c=0;c<b.length&&a;c++)a=a[b[c]];b=Tb(mb.href);return!a||0!=a.indexOf("n;")&&0!=b.indexOf("n;")&&a!==b};Fe=function(a,b){Le(a,b)};var Ob=function(a){Ae(a,!0)},Me=function(a,b){b=b||[];for(var c=0;c<b.length;++c)a(b[c]);for(a=0;a<b.length;a++)Ge(b[a])};
|
||||
O.push(["platform",function(a,b,c){we=c;(b||c.features)&&ve.push(b||c.features.join(":"));Me(He,a);Me(Ie,c._c.annotation);Me(Je,c._c.bimodal);Kc();Ic();if("explicit"!=S("parsetags")){Ub(a);Pc(Oc())&&!S("disableRealtimeCallback")&&Tc();if(c&&(a=c.callback)){var d=yb(a);delete c.callback}Qb(function(){Ob(d)})}}]);H._pl=!0;var Ne=function(a){a=(a=T[a])?a.oid:void 0;if(a){var b=A.getElementById(a);b&&b.parentNode.removeChild(b);delete T[a];Ne(a)}};var Oe=/^\{h:'/,Pe=/^!_/,Qe="",Le=function(a,b){function c(){Mb("message",d,"remove","de")}function d(f){var g=f.data,k=f.origin;if(Re(g,b)){var h=e;e=!1;h&&N("rqe");Se(a,function(){h&&N("rqd");c();for(var l=B(M,"RPMQ",[]),n=0;n<l.length;n++)l[n]({data:g,origin:k})})}}if(0!==b.length){Qe=I(mb.href,"pfname","");var e=!0;Mb("message",d,"add","at");Bc(a,c)}},Re=function(a,b){a=String(a);if(Oe.test(a))return!0;var c=!1;Pe.test(a)&&(c=!0,a=a.substr(2));if(!/^\{/.test(a))return!1;var d=Ad(a);if(!d)return!1;
|
||||
a=d.f;if(d.s&&a&&-1!=pb.call(b,a)){if("_renderstart"===d.s||d.s===Qe+"/"+a+"::_renderstart")if(d=d.a&&d.a[c?0:1],b=A.getElementById(a),Vc(a,2),d&&b&&d.width&&d.height){a:{c=b.parentNode;a=d||{};if(Sc()){var e=b.id;if(e){d=(d=T[e])?d.state:void 0;if(1===d||4===d)break a;Ne(e)}}(d=c.nextSibling)&&d.getAttribute&&d.getAttribute("data-gapistub")&&(c.parentNode.removeChild(d),c.style.cssText="");d=a.width;var f=a.height,g=c.style;g.textIndent="0";g.margin="0";g.padding="0";g.background="transparent";g.borderStyle=
|
||||
"none";g.cssFloat="none";g.styleFloat="none";g.lineHeight="normal";g.fontSize="1px";g.verticalAlign="baseline";c=c.style;c.display="inline-block";g=b.style;g.position="static";g.left="0";g.top="0";g.visibility="visible";d&&(c.width=g.width=d+"px");f&&(c.height=g.height=f+"px");a.verticalAlign&&(c.verticalAlign=a.verticalAlign);e&&Vc(e,3)}b["data-csi-wdt"]=(new Date).getTime()}return!0}return!1},Se=function(a,b){Bc(a,b)};var Te=function(a,b){this.P=a;a=b||{};this.qa=Number(a.maxAge)||0;this.aa=a.domain;this.da=a.path;this.ra=!!a.secure};Te.prototype.read=function(){for(var a=this.P+"=",b=document.cookie.split(/;\s*/),c=0;c<b.length;++c){var d=b[c];if(0==d.indexOf(a))return d.substr(a.length)}};
|
||||
Te.prototype.write=function(a,b){if(!Ue.test(this.P))throw"Invalid cookie name";if(!Ve.test(a))throw"Invalid cookie value";a=this.P+"="+a;this.aa&&(a+=";domain="+this.aa);this.da&&(a+=";path="+this.da);b="number"===typeof b?b:this.qa;if(0<=b){var c=new Date;c.setSeconds(c.getSeconds()+b);a+=";expires="+c.toUTCString()}this.ra&&(a+=";secure");document.cookie=a;return!0};Te.prototype.clear=function(){this.write("",0)};var Ve=/^[-+/_=.:|%&a-zA-Z0-9@]*$/,Ue=/^[A-Z_][A-Z0-9_]{0,63}$/;
|
||||
Te.iterate=function(a){for(var b=document.cookie.split(/;\s*/),c=0;c<b.length;++c){var d=b[c].split("="),e=d.shift();a(e,d.join("="))}};var We=function(a){this.H=a};We.prototype.read=function(){if(Z.hasOwnProperty(this.H))return Z[this.H]};We.prototype.write=function(a){Z[this.H]=a;return!0};We.prototype.clear=function(){delete Z[this.H]};var Z={};We.iterate=function(a){for(var b in Z)Z.hasOwnProperty(b)&&a(b,Z[b])};var Xe="https:"===window.location.protocol,Ye=Xe||"http:"===window.location.protocol?Te:We,Ze=function(a){var b=a.substr(1),c="",d=window.location.hostname;if(""!==b){c=parseInt(b,10);if(isNaN(c))return null;b=d.split(".");if(b.length<c-1)return null;b.length==c-1&&(d="."+d)}else d="";return{l:"S"==a.charAt(0),domain:d,o:c}},$e=function(){var a,b=null;Ye.iterate(function(c,d){0===c.indexOf("G_AUTHUSER_")&&(c=Ze(c.substring(11)),!a||c.l&&!a.l||c.l==a.l&&c.o>a.o)&&(a=c,b=d)});return{la:a,L:b}};function af(a){if(0!==a.indexOf("GCSC"))return null;var b={ca:!1};a=a.substr(4);if(!a)return b;var c=a.charAt(0);a=a.substr(1);var d=a.lastIndexOf("_");if(-1==d)return b;var e=Ze(a.substr(d+1));if(null==e)return b;a=a.substring(0,d);if("_"!==a.charAt(0))return b;d="E"===c&&e.l;return!d&&("U"!==c||e.l)||d&&!Xe?b:{ca:!0,l:d,va:a.substr(1),domain:e.domain,o:e.o}}
|
||||
var bf=function(a){if(!a)return[];a=a.split("=");return a[1]?a[1].split("|"):[]},cf=function(a){a=a.split(":");return{clientId:a[0].split("=")[1],ta:bf(a[1]),xa:bf(a[2]),wa:bf(a[3])}},df=function(){var a=$e(),b=a.la;a=a.L;if(null!==a){var c;Ye.iterate(function(f,g){(f=af(f))&&f.ca&&f.l==b.l&&f.o==b.o&&(c=g)});if(c){var d=cf(c),e=d&&d.ta[Number(a)];d=d&&d.clientId;if(e)return{L:a,sa:e,clientId:d}}}return null};var ff=function(){this.Y=ef};m=ff.prototype;m.ga=function(){this.O||(this.A=0,this.O=!0,this.ea())};m.ea=function(){this.O&&(this.Y()?this.A=this.V:this.A=Math.min(2*(this.A||this.V),120),window.setTimeout(qa(this.ea,this),1E3*this.A))};m.A=0;m.V=2;m.Y=null;m.O=!1;var gf=null;Sc=function(){return M.oa=!0};Tc=function(){M.oa=!0;var a=df();(a=a&&a.L)&&Jc("googleapis.config/sessionIndex",a);gf||(gf=B(M,"ss",new ff));a=gf;a.ga&&a.ga()};
|
||||
var ef=function(){var a=df(),b=a&&a.sa||null,c=a&&a.clientId;Bc("auth",{callback:function(){var d=y.gapi.auth,e={client_id:c,session_state:b};d.checkSessionState(e,function(f){var g=e.session_state,k=!!S("isLoggedIn");f=S("debug/forceIm")?!1:g&&f||!g&&!f;if(k=k!==f)Jc("isLoggedIn",f),Tc(),re(),f||((f=d.signOut)?f():(f=d.setToken)&&f(null));f=Oc();var h=S("savedUserState");g=d._guss(f.cookiepolicy);h=h!=g&&"undefined"!=typeof h;Jc("savedUserState",g);(k||h)&&Pc(f)&&!S("disableRealtimeCallback")&&d._pimf(f,
|
||||
!0)})}});return!0};O.unshift(["url",function(a,b,c){!a||b&&""!==b||!a.endsWith(".js")||(a=a.substring(0,a.length-3),b=a.lastIndexOf("/")+1,b>=a.length||(a=a.substr(b).split(":").filter(function(d){return!["api","platform"].includes(d)}),c.features=a))}]);N("bs0",!0,window.gapi._bs);N("bs1",!0);delete window.gapi._bs;window.gapi.load("",{callback:window["gapi_onload"],_c:{url:"https://apis.google.com/js/plusone.js",jsl:{ci:{"oauth-flow":{authUrl:"https://accounts.google.com/o/oauth2/auth",proxyUrl:"https://accounts.google.com/o/oauth2/postmessageRelay",disableOpt:!0,idpIframeUrl:"https://accounts.google.com/o/oauth2/iframe",usegapi:!1},debug:{reportExceptionRate:1,forceIm:!1,rethrowException:!0,host:"https://apis.google.com"},enableMultilogin:!0,"googleapis.config":{auth:{useFirstPartyAuthV2:!0},root:"https://content.googleapis.com","root-1p":"https://clients6.google.com"},inline:{css:1},
|
||||
disableRealtimeCallback:!1,drive_share:{skipInitCommand:!0},csi:{rate:.01},client:{cors:!1},signInDeprecation:{rate:0},include_granted_scopes:!0,llang:"fr",iframes:{youtube:{params:{location:["search","hash"]},url:":socialhost:/:session_prefix:_/widget/render/youtube?usegapi=1",methods:["scroll","openwindow"]},ytsubscribe:{url:"https://www.youtube.com/subscribe_embed?usegapi=1"},plus_circle:{params:{url:""},url:":socialhost:/:session_prefix::se:_/widget/plus/circle?usegapi=1"},plus_share:{params:{url:""},
|
||||
url:":socialhost:/:session_prefix::se:_/+1/sharebutton?plusShare=true&usegapi=1"},rbr_s:{params:{url:""},url:":socialhost:/:session_prefix::se:_/widget/render/recobarsimplescroller"},":source:":"3p",playemm:{url:"https://play.google.com/work/embedded/search?usegapi=1&usegapi=1"},savetoandroidpay:{url:"https://pay.google.com/gp/v/widget/save"},blogger:{params:{location:["search","hash"]},url:":socialhost:/:session_prefix:_/widget/render/blogger?usegapi=1",methods:["scroll","openwindow"]},evwidget:{params:{url:""},
|
||||
url:":socialhost:/:session_prefix:_/events/widget?usegapi=1"},partnersbadge:{url:"https://www.gstatic.com/partners/badge/templates/badge.html?usegapi=1"},dataconnector:{url:"https://dataconnector.corp.google.com/:session_prefix:ui/widgetview?usegapi=1"},surveyoptin:{url:"https://www.google.com/shopping/customerreviews/optin?usegapi=1"},":socialhost:":"https://apis.google.com",shortlists:{url:""},hangout:{url:"https://talkgadget.google.com/:session_prefix:talkgadget/_/widget"},plus_followers:{params:{url:""},
|
||||
url:":socialhost:/_/im/_/widget/render/plus/followers?usegapi=1"},post:{params:{url:""},url:":socialhost:/:session_prefix::im_prefix:_/widget/render/post?usegapi=1"},signin:{params:{url:""},url:":socialhost:/:session_prefix:_/widget/render/signin?usegapi=1",methods:["onauth"]},rbr_i:{params:{url:""},url:":socialhost:/:session_prefix::se:_/widget/render/recobarinvitation"},share:{url:":socialhost:/:session_prefix::im_prefix:_/widget/render/share?usegapi=1"},plusone:{params:{count:"",size:"",url:""},
|
||||
url:":socialhost:/:session_prefix::se:_/+1/fastbutton?usegapi=1"},comments:{params:{location:["search","hash"]},url:":socialhost:/:session_prefix:_/widget/render/comments?usegapi=1",methods:["scroll","openwindow"]},":im_socialhost:":"https://plus.googleapis.com",backdrop:{url:"https://clients3.google.com/cast/chromecast/home/widget/backdrop?usegapi=1"},visibility:{params:{url:""},url:":socialhost:/:session_prefix:_/widget/render/visibility?usegapi=1"},autocomplete:{params:{url:""},url:":socialhost:/:session_prefix:_/widget/render/autocomplete"},
|
||||
":signuphost:":"https://plus.google.com",ratingbadge:{url:"https://www.google.com/shopping/customerreviews/badge?usegapi=1"},appcirclepicker:{url:":socialhost:/:session_prefix:_/widget/render/appcirclepicker"},follow:{url:":socialhost:/:session_prefix:_/widget/render/follow?usegapi=1"},community:{url:":ctx_socialhost:/:session_prefix::im_prefix:_/widget/render/community?usegapi=1"},sharetoclassroom:{url:"https://classroom.google.com/sharewidget?usegapi=1"},ytshare:{params:{url:""},url:":socialhost:/:session_prefix:_/widget/render/ytshare?usegapi=1"},
|
||||
plus:{url:":socialhost:/:session_prefix:_/widget/render/badge?usegapi=1"},family_creation:{params:{url:""},url:"https://families.google.com/webcreation?usegapi=1&usegapi=1"},commentcount:{url:":socialhost:/:session_prefix:_/widget/render/commentcount?usegapi=1"},configurator:{url:":socialhost:/:session_prefix:_/plusbuttonconfigurator?usegapi=1"},zoomableimage:{url:"https://ssl.gstatic.com/microscope/embed/"},appfinder:{url:"https://workspace.google.com/:session_prefix:marketplace/appfinder?usegapi=1"},savetowallet:{url:"https://pay.google.com/gp/v/widget/save"},
|
||||
person:{url:":socialhost:/:session_prefix:_/widget/render/person?usegapi=1"},savetodrive:{url:"https://drive.google.com/savetodrivebutton?usegapi=1",methods:["save"]},page:{url:":socialhost:/:session_prefix:_/widget/render/page?usegapi=1"},card:{url:":socialhost:/:session_prefix:_/hovercard/card"}}},h:"m;/_/scs/abc-static/_/js/k=gapi.lb.fr.CAOyDGt5mKU.O/d=1/rs=AHpOoo_3N2T_xTSzzfu-Lp8hVcRjkVoYFQ/m=__features__",u:"https://apis.google.com/js/plusone.js",hee:!0,dpo:!1,le:["scs"],glrp:false},platform:"backdrop blogger comments commentcount community donation family_creation follow hangout health page partnersbadge person playemm playreview plus plusone post ratingbadge savetoandroidpay savetodrive savetowallet sharetoclassroom shortlists signin2 surveyoptin visibility youtube ytsubscribe zoomableimage".split(" "),
|
||||
annotation:["interactivepost","recobar","signin2","autocomplete"]}});}).call(this);
|
|
@ -0,0 +1,30 @@
|
|||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller
|
||||
// fixes from Paul Irish and Tino Zijdel
|
||||
|
||||
(function() {
|
||||
var lastTime = 0;
|
||||
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
||||
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|
||||
|| window[vendors[x]+'CancelRequestAnimationFrame'];
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}());
|
|
@ -0,0 +1,608 @@
|
|||
// **Sphere** renders a mathematically perfect textured sphere.
|
||||
// It calculates the surface of the sphere instead of approximating it with triangles.
|
||||
// Shamefully hacked by Sébastien Drouyer
|
||||
|
||||
/*jshint laxcomma: true, laxbreak: true, browser: true */
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
var opts = { tilt: 40
|
||||
, turn: 20
|
||||
};
|
||||
|
||||
// Tiling informations
|
||||
var tiling = {
|
||||
horizontal: 1,
|
||||
vertical: 1
|
||||
};
|
||||
|
||||
// frame count, current angle of rotation. inc/dec to turn.
|
||||
var gCtx;
|
||||
var gImage, gCtxImg;
|
||||
|
||||
//Variable to hold the size of the canvas
|
||||
var size;
|
||||
|
||||
var canvasImageData, textureImageData;
|
||||
|
||||
// Constants for indexing dimentions
|
||||
var X=0, Y=1, Z=2;
|
||||
|
||||
var textureWidth, textureHeight;
|
||||
|
||||
var hs=30; // Horizontal scale of viewing area
|
||||
var vs=30; // Vertical scale of viewing area
|
||||
|
||||
// NB The viewing area is an abstract rectangle in the 3d world and is not
|
||||
// the same as the canvas used to display the image.
|
||||
|
||||
var F = [0,0,0]; // Focal point of viewer
|
||||
var S = [0,30,0]; // Centre of sphere/planet
|
||||
|
||||
var r=12; // Radius of sphere/planet
|
||||
|
||||
// Distance of the viewing area from the focal point. This seems
|
||||
// to give strange results if it is not equal to S[Y]. It should
|
||||
// theoreticaly be changable but hs & vs can still be used along
|
||||
// with r to change how large the sphere apears on the canvas.
|
||||
// HOWEVER, the values of hs, vs, S[Y], f & r MUST NOT BE TOO BIG
|
||||
// as this will result in overflow errors which are not traped
|
||||
// and do not stop the script but will result in incorrect
|
||||
// displaying of the texture upon the sphere.
|
||||
var f = 30;
|
||||
|
||||
|
||||
// There may be a solution to the above problem by finding L in
|
||||
// a slightly different way.
|
||||
// Since the problem is equivelent to finding the intersection
|
||||
// in 2D space of a line and a circle then each view area pixel
|
||||
// and associated vector can be used define a 2D plane in the 3D
|
||||
// space that 'contains' the vector S-F which is the focal point
|
||||
// to centre of the sphere.
|
||||
//
|
||||
// This is essentialy the same problem but I belive/hope it will
|
||||
// not result in the same exact solution. I have hunch that the
|
||||
// math will not result in such big numbers. Since this abstract
|
||||
// plane will be spinning, it may be posilbe to use the symetry
|
||||
// of the arangement to reuse 1/4 of the calculations.
|
||||
|
||||
|
||||
|
||||
// Variables to hold rotations about the 3 axis
|
||||
var RX = 0,RY,RZ;
|
||||
// Temp variables to hold them whilst rendering so they won't get updated.
|
||||
var rx,ry,rz;
|
||||
|
||||
var a;
|
||||
var b;
|
||||
var b2; // b squared
|
||||
var bx=F[X]-S[X]; // = 0 for current values of F and S
|
||||
var by=F[Y]-S[Y];
|
||||
var bz=F[Z]-S[Z]; // = 0 for current values of F and S
|
||||
|
||||
// c = Fx^2 + Sx^2 -2FxSx + Fy^2 + Sy^2 -2FySy + Fz^2 + Sz^2 -2FzSz - r^2
|
||||
// for current F and S this means c = Sy^2 - r^2
|
||||
|
||||
var c = F[X]*F[X] + S[X]*S[X]
|
||||
+ F[Y]*F[Y] + S[Y]*S[Y]
|
||||
+ F[Z]*F[Z] + S[Z]*S[Z]
|
||||
- 2*(F[X]*S[X] + F[Y]*S[Y] + F[Z]*S[Z])
|
||||
- r*r
|
||||
;
|
||||
|
||||
var c4 = c*4; // save a bit of time maybe during rendering
|
||||
|
||||
var s;
|
||||
|
||||
var m1 = 0;
|
||||
//double m2 = 0;
|
||||
|
||||
// The following are use to calculate the vector of the current pixel to be
|
||||
// drawn from the focus position F
|
||||
|
||||
var hs_ch; // horizontal scale divided by canvas width
|
||||
var vs_cv; // vertical scale divided by canvas height
|
||||
var hhs = 0.5*hs; // half horizontal scale
|
||||
var hvs = 0.5*vs; // half vertical scale
|
||||
|
||||
var V = new Array(3); // vector for storing direction of each pixel from F
|
||||
var L = new Array(3); // Location vector from S that pixel 'hits' sphere
|
||||
|
||||
var VY2=f*f; // V[Y] ^2 NB May change if F changes
|
||||
|
||||
|
||||
var rotCache = {};
|
||||
|
||||
|
||||
var calculateVector = function(h,v) {
|
||||
|
||||
// Calculate vector from focus point (Origin, so can ignor) to pixel
|
||||
V[X]=(hs_ch*h)-hhs;
|
||||
|
||||
// V[Y] always the same as view frame doesn't mov
|
||||
V[Z]=(vs_cv*v)-hvs;
|
||||
|
||||
// Vector (L) from S where m*V (m is an unknown scalar) intersects
|
||||
// surface of sphere is as follows
|
||||
//
|
||||
// <pre>
|
||||
// L = F + mV - S
|
||||
//
|
||||
// ,-------.
|
||||
// / \ -----m------
|
||||
// | S<-L->| <-V->F
|
||||
// \ /
|
||||
// `-------'
|
||||
//
|
||||
// L and m are unknown so find magnitude of vectors as the magnitude
|
||||
// of L is the radius of the sphere
|
||||
//
|
||||
// |L| = |F + mV - S| = r
|
||||
//
|
||||
// Can be rearranged to form a quadratic
|
||||
//
|
||||
// 0 = am² +bm + c
|
||||
//
|
||||
// and solved to find m, using the following formula
|
||||
//
|
||||
// <pre>
|
||||
// ___________
|
||||
// m = ( -b ± \/(b²) - 4ac ) /2a
|
||||
// </pre>
|
||||
//
|
||||
// r = |F + mV - S|
|
||||
// __________________________________________________
|
||||
// r = v(Fx + mVx -Sx)² + (Fy + mVy -Sy)² + (Fz + mVz -Sz)²
|
||||
//
|
||||
// r² = (Fx + mVx -Sx)² + (Fy + mVy -Sy)² + (Fz + mVz -Sz)²
|
||||
//
|
||||
// r² = (Fx + mVx -Sx)² + (Fy + mVy -Sy)² + (Fz + mVz -Sz)²
|
||||
//
|
||||
// 0 = Fx² + FxVxm -FxSx + FxVxm + Vx²m² -SxVxm -SxFx -SxVxm + Sx²
|
||||
// +Fy² + FyVym -FySy + FyVym + Vy²m² -SyVym -SyFy -SyVym + Sy²
|
||||
// +Fz² + FzVzm -FzSz + FzVzm + Vz²m² -SzVzm -SzFz -SzVzm + Sz² - r²
|
||||
//
|
||||
// 0 = Vx²m² + FxVxm + FxVxm -2SxVxm + Fx² -FxSx -SxFx + Sx²
|
||||
// +Vy²m² + FyVym + FyVym -2SyVym + Fy² -FySy -SyFy + Sy²
|
||||
// +Vz²m² + FzVzm + FzVzm -2SzVzm + Fz² -FzSz -SzFz + Sz² - r²
|
||||
//
|
||||
// 0 = (Vx² + Vy² + Vz²)m² + (FxVx + FxVx -2SxVx)m + Fx² - 2FxSx + Sx²
|
||||
// + (FyVy + FyVy -2SyVy)m + Fy² - 2FySy + Sy²
|
||||
// + (FzVz + FzVz -2SzVz)m + Fz² - 2FzSz + Sz² - r²
|
||||
//
|
||||
// 0 = |Vz|m² + (FxVx + FxVx -2SxVx)m + |F| - 2FxSx + |S|
|
||||
// + (FyVy + FyVy -2SyVy)m - 2FySy
|
||||
// + (FyVy + FyVy -2SyVy)m - 2FySy - r²
|
||||
//
|
||||
// a = |Vz|
|
||||
// b =
|
||||
// c = Fx² + Sx² -2FxSx + Fy² + Sy² -2FySy + Fz² + Sz² -2FzSz - r²
|
||||
// for current F and S this means c = Sy² - r²
|
||||
// </pre>
|
||||
|
||||
// Where a, b and c are as in the code.
|
||||
// Only the solution for the negative square root term is needed as the
|
||||
// closest intersection is wanted. The other solution to m would give
|
||||
// the intersection of the 'back' of the sphere.
|
||||
|
||||
a=V[X]*V[X]+VY2+V[Z]*V[Z];
|
||||
|
||||
|
||||
s=(b2-a*c4); // the square root term
|
||||
|
||||
// if s is negative then there are no solutions to m and the
|
||||
// sphere is not visible on the current pixel on the canvas
|
||||
// so only draw a pixel if the sphere is visable
|
||||
// 0 is a special case as it is the 'edge' of the sphere as there
|
||||
// is only one solution. (I have never seen it happen though)
|
||||
// of the two solutions m1 & m2 the nearest is m1, m2 being the
|
||||
// far side of the sphere.
|
||||
|
||||
if (s > 0) {
|
||||
|
||||
m1 = ((-b)-(Math.sqrt(s)))/(2*a);
|
||||
|
||||
L[X]=m1*V[X]; // bx+m1*V[X];
|
||||
L[Y]=by+(m1*V[Y]);
|
||||
L[Z]=m1*V[Z]; // bz+m1*V[Z];
|
||||
|
||||
// Do a couple of rotations on L
|
||||
|
||||
var lx=L[X];
|
||||
var srz = Math.sin(rz);
|
||||
var crz = Math.cos(rz);
|
||||
L[X]=lx*crz-L[Y]*srz;
|
||||
L[Y]=lx*srz+L[Y]*crz;
|
||||
|
||||
var lz;
|
||||
lz=L[Z];
|
||||
var sry = Math.sin(ry);
|
||||
var cry = Math.cos(ry);
|
||||
L[Z]=lz*cry-L[Y]*sry;
|
||||
L[Y]=lz*sry+L[Y]*cry;
|
||||
|
||||
|
||||
// Calculate the position that this location on the sphere
|
||||
// coresponds to on the texture
|
||||
|
||||
var lh = textureWidth + textureWidth * ( Math.atan2(L[Y],L[X]) + Math.PI ) / (2*Math.PI);
|
||||
|
||||
// %textureHeight at end to get rid of south pole bug. probaly means that one
|
||||
// pixel may be a color from the opposite pole but as long as the
|
||||
// poles are the same color this won't be noticed.
|
||||
|
||||
var lv = textureWidth * Math.floor(textureHeight-1-(textureHeight*(Math.acos(L[Z]/r)/Math.PI)%textureHeight));
|
||||
return {lv:lv,lh:lh};
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create the sphere function opject
|
||||
*/
|
||||
var sphere = function(){
|
||||
|
||||
var textureData = textureImageData.data;
|
||||
var canvasData = canvasImageData.data;
|
||||
|
||||
var copyFnc;
|
||||
|
||||
if (canvasData.splice){
|
||||
//2012-04-19 splice on canvas data not supported in any current browser
|
||||
copyFnc = function(idxC, idxT){
|
||||
canvasData.splice(idxC, 4 , textureData[idxT + 0]
|
||||
, textureData[idxT + 1]
|
||||
, textureData[idxT + 2]
|
||||
, 255);
|
||||
};
|
||||
} else {
|
||||
copyFnc = function(idxC, idxT){
|
||||
canvasData[idxC + 0] = textureData[idxT + 0];
|
||||
canvasData[idxC + 1] = textureData[idxT + 1];
|
||||
canvasData[idxC + 2] = textureData[idxT + 2];
|
||||
canvasData[idxC + 3] = 255;
|
||||
};
|
||||
}
|
||||
|
||||
var getVector = (function(){
|
||||
var cache = new Array(size*size);
|
||||
return function(pixel){
|
||||
if (cache[pixel] === undefined){
|
||||
var v = Math.floor(pixel / size);
|
||||
var h = pixel - v * size;
|
||||
cache[pixel] = calculateVector(h,v);
|
||||
}
|
||||
return cache[pixel];
|
||||
};
|
||||
})();
|
||||
|
||||
var posDelta = textureWidth*0.2/(20*1000);
|
||||
//var firstFramePos = (new Date()) * posDelta;
|
||||
|
||||
var stats = {fastCount: 0, fastSumMs: 0};
|
||||
|
||||
return {
|
||||
posDelta: posDelta,
|
||||
firstFramePos: (new Date()) * posDelta,
|
||||
positionsCache: [],
|
||||
minX: null,
|
||||
minY: null,
|
||||
maxX: null,
|
||||
maxY: null,
|
||||
|
||||
init: function(options) {
|
||||
this.changeRotation(options);
|
||||
|
||||
|
||||
hs=30; // Horizontal scale of viewing area
|
||||
vs=30; // Vertical scale of viewing area
|
||||
|
||||
F = [0,0,0]; // Focal point of viewer
|
||||
S = [0,30,0]; // Centre of sphere/planet
|
||||
|
||||
r=options.r; // Radius of sphere/planet
|
||||
|
||||
|
||||
f = 30;
|
||||
|
||||
|
||||
|
||||
bx=F[X]-S[X]; // = 0 for current values of F and S
|
||||
by=F[Y]-S[Y];
|
||||
bz=F[Z]-S[Z]; // = 0 for current values of F and S
|
||||
|
||||
c = F[X]*F[X] + S[X]*S[X]
|
||||
+ F[Y]*F[Y] + S[Y]*S[Y]
|
||||
+ F[Z]*F[Z] + S[Z]*S[Z]
|
||||
- 2*(F[X]*S[X] + F[Y]*S[Y] + F[Z]*S[Z])
|
||||
- r*r
|
||||
;
|
||||
|
||||
c4 = c*4; // save a bit of time maybe during rendering
|
||||
|
||||
m1 = 0;
|
||||
|
||||
hhs = 0.5*hs; // half horizontal scale
|
||||
hvs = 0.5*vs; // half vertical scale
|
||||
|
||||
/*V = new Array(3);*/ // vector for storing direction of each pixel from F
|
||||
L = new Array(3); // Location vector from S that pixel 'hits' sphere
|
||||
|
||||
VY2=f*f; // V[Y] ^2 NB May change if F changes
|
||||
|
||||
|
||||
|
||||
rotCache = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (canvasData.splice){
|
||||
//2012-04-19 splice on canvas data not supported in any current browser
|
||||
copyFnc = function(idxC, idxT){
|
||||
canvasData.splice(idxC, 4 , textureData[idxT + 0]
|
||||
, textureData[idxT + 1]
|
||||
, textureData[idxT + 2]
|
||||
, 255);
|
||||
};
|
||||
} else {
|
||||
copyFnc = function(idxC, idxT){
|
||||
canvasData[idxC + 0] = textureData[idxT + 0];
|
||||
canvasData[idxC + 1] = textureData[idxT + 1];
|
||||
canvasData[idxC + 2] = textureData[idxT + 2];
|
||||
canvasData[idxC + 3] = 255;
|
||||
};
|
||||
}
|
||||
|
||||
posDelta = textureWidth*0.2/(20*1000);
|
||||
//var firstFramePos = (new Date()) * posDelta;
|
||||
|
||||
stats = {fastCount: 0, fastSumMs: 0};
|
||||
|
||||
getVector = (function(){
|
||||
var cache = new Array(size*size);
|
||||
return function(pixel){
|
||||
if (cache[pixel] === undefined){
|
||||
var v = Math.floor(pixel / size);
|
||||
var h = pixel - v * size;
|
||||
cache[pixel] = calculateVector(h,v);
|
||||
}
|
||||
return cache[pixel];
|
||||
};
|
||||
})();
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
renderFrame: function(time){
|
||||
this.RF(time);
|
||||
return;
|
||||
stats.firstMs = new Date() - time;
|
||||
this.renderFrame = this.sumRF;
|
||||
console.log(rotCache);
|
||||
for (var key in rotCache){
|
||||
if (rotCache[key] > 1){
|
||||
console.log(rotCache[key]);
|
||||
}
|
||||
}
|
||||
},
|
||||
sumRF: function(time){
|
||||
this.RF(time);
|
||||
stats.fastSumMs += new Date() - time;
|
||||
stats.fastCount++;
|
||||
if (stats.fastSumMs > stats.firstMs) {
|
||||
// alert("calc:precompute ratio = 1:"+ stats.fastCount +" "+ stats.fastSumMs +" "+ stats.firstMs);
|
||||
this.renderFrame = this.RF;
|
||||
}
|
||||
},
|
||||
|
||||
turnBy: function(time){
|
||||
return 24*60*60 + this.firstFramePos - time * this.posDelta
|
||||
},
|
||||
|
||||
changeRotation: function(opts) {
|
||||
ry=90+opts.tilt;
|
||||
rz=180+opts.turn;
|
||||
|
||||
RY = (90-ry);
|
||||
RZ = (180-rz);
|
||||
RX = 0,RY,RZ;
|
||||
},
|
||||
|
||||
getRadius: function() {
|
||||
if (this.minX === null) {
|
||||
return null;
|
||||
} else {
|
||||
return ((this.maxX - this.minX) + (this.maxY - this.minY)) / 2;
|
||||
}
|
||||
},
|
||||
|
||||
getTexturePointPosition: function(x, y) {
|
||||
var maxDistance = 30;
|
||||
for (var i = 0; i < maxDistance; i++) {
|
||||
var xx
|
||||
var yy;
|
||||
var pos;
|
||||
for (xx = x - i; xx < x + i + 1; xx++) {
|
||||
yy = y - i;
|
||||
pos = this.getTexturePointPositionExact(xx, yy);
|
||||
if (typeof pos !== 'undefined') {
|
||||
return pos;
|
||||
}
|
||||
yy = y + i;
|
||||
pos = this.getTexturePointPositionExact(xx, yy);
|
||||
if (typeof pos !== 'undefined') {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
for (yy = y - i + 1; yy < y + i; yy++) {
|
||||
xx = x - i;
|
||||
pos = this.getTexturePointPositionExact(xx, yy);
|
||||
if (typeof pos !== 'undefined') {
|
||||
return pos;
|
||||
}
|
||||
xx = x + i;
|
||||
pos = this.getTexturePointPositionExact(xx, yy);
|
||||
if (typeof pos !== 'undefined') {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getTexturePointPositionExact: function(x, y) {
|
||||
var pixel = this.positionsCache[x + y * textureWidth];
|
||||
if (typeof pixel === 'undefined') {
|
||||
return pixel;
|
||||
} else {
|
||||
return {x: pixel % size, y: Math.floor(pixel / size), pixel: pixel, originalX: x, originalY: y};
|
||||
}
|
||||
},
|
||||
|
||||
RF: function(time){
|
||||
// RX, RY & RZ may change part way through if the newR? (change tilt/turn) meathods are called while
|
||||
// this meathod is running so put them in temp vars at render start.
|
||||
// They also need converting from degrees to radians
|
||||
rx=RX*Math.PI/180;
|
||||
ry=RY*Math.PI/180;
|
||||
rz=RZ*Math.PI/180;
|
||||
|
||||
// add to 24*60*60 so it will be a day before turnBy is negative and it hits the slow negative modulo bug
|
||||
var turnBy = this.turnBy(time);
|
||||
var pixel = size*size;
|
||||
var h2 = (textureHeight * textureHeight);
|
||||
|
||||
this.positionsCache = new Array(h2);
|
||||
|
||||
this.minX = null;
|
||||
this.minY = null;
|
||||
this.maxX = null;
|
||||
this.maxY = null;
|
||||
|
||||
while(pixel--){
|
||||
var vector = getVector(pixel);
|
||||
if (vector !== null){
|
||||
var x = pixel % size;
|
||||
var y = Math.floor(pixel / size);
|
||||
if (this.minX == null) {
|
||||
this.minX = x;
|
||||
this.maxX = x;
|
||||
this.minY = y;
|
||||
this.maxY = y;
|
||||
} else {
|
||||
if (this.minX > x) {
|
||||
this.minX = x;
|
||||
}
|
||||
if (this.maxX < x) {
|
||||
this.maxX = x;
|
||||
}
|
||||
if (this.minY > y) {
|
||||
this.minY = y;
|
||||
}
|
||||
if (this.maxY < y) {
|
||||
this.maxY = y;
|
||||
}
|
||||
}
|
||||
//rotate texture on sphere
|
||||
var lh = Math.floor(vector.lh * tiling.horizontal + turnBy * tiling.horizontal) % textureWidth;
|
||||
/* lh = (lh < 0)
|
||||
? ((textureWidth-1) - ((lh-1)%textureWidth))
|
||||
: (lh % textureWidth) ;
|
||||
*/
|
||||
var idxC = pixel * 4;
|
||||
var idxT = ((lh + (vector.lv * tiling.vertical) % h2) * 4);
|
||||
this.positionsCache[Math.floor(idxT / 4)] = Math.floor(idxC / 4);
|
||||
|
||||
/* TODO light for alpha channel or alter s or l in hsl color value?
|
||||
- fn to calc distance between two points on sphere?
|
||||
- attenuate light by distance from point and rotate point separate from texture rotation
|
||||
*/
|
||||
|
||||
// Update the values of the pixel;
|
||||
canvasData[idxC + 0] = textureData[idxT + 0];
|
||||
canvasData[idxC + 1] = textureData[idxT + 1];
|
||||
canvasData[idxC + 2] = textureData[idxT + 2];
|
||||
canvasData[idxC + 3] = 255;
|
||||
|
||||
// Slower?
|
||||
/*
|
||||
canvasImageData.data[idxC + 0] = textureImageData.data[idxT + 0];
|
||||
canvasImageData.data[idxC + 1] = textureImageData.data[idxT + 1];
|
||||
canvasImageData.data[idxC + 2] = textureImageData.data[idxT + 2];
|
||||
canvasImageData.data[idxC + 3] = 255;
|
||||
*/
|
||||
// Faster?
|
||||
/* copyFnc(idxC,idxT); */
|
||||
}
|
||||
}
|
||||
gCtx.putImageData(canvasImageData, 0, 0);
|
||||
}};
|
||||
};
|
||||
|
||||
function copyImageToBuffer(aImg)
|
||||
{
|
||||
gImage = document.createElement('canvas');
|
||||
textureWidth = aImg.naturalWidth;
|
||||
textureHeight = aImg.naturalHeight;
|
||||
gImage.width = textureWidth;
|
||||
gImage.height = textureHeight;
|
||||
|
||||
gCtxImg = gImage.getContext("2d");
|
||||
gCtxImg.clearRect(0, 0, textureHeight, textureWidth);
|
||||
gCtxImg.drawImage(aImg, 0, 0);
|
||||
textureImageData = gCtxImg.getImageData(0, 0, textureHeight, textureWidth);
|
||||
|
||||
hs_ch = (hs / size);
|
||||
vs_cv = (vs / size);
|
||||
}
|
||||
|
||||
this.createSphere = function (gCanvas, textureUrl, callback, tilingInfos) {
|
||||
size = Math.min(gCanvas.width, gCanvas.height);
|
||||
gCtx = gCanvas.getContext("2d");
|
||||
canvasImageData = gCtx.createImageData(size, size);
|
||||
tiling = tilingInfos;
|
||||
|
||||
hs_ch = (hs / size);
|
||||
vs_cv = (vs / size);
|
||||
|
||||
V[Y]=f;
|
||||
|
||||
b=(2*(-f*V[Y]));
|
||||
b2=Math.pow(b,2);
|
||||
|
||||
var img = new Image();
|
||||
|
||||
img.onload = function() {
|
||||
|
||||
copyImageToBuffer(img);
|
||||
var earth = sphere();
|
||||
callback(earth, textureWidth, textureHeight);
|
||||
|
||||
|
||||
// BAD! uses 100% CPU, stats.js runs at 38FPS
|
||||
/*
|
||||
function renderFrame(){
|
||||
earth.renderFrame(new Date);
|
||||
}
|
||||
setInterval(renderFrame, 0);
|
||||
*/
|
||||
// Better - runs at steady state
|
||||
/*
|
||||
(function loop(){
|
||||
setTimeout(function(){
|
||||
earth.renderFrame(new Date);
|
||||
loop();
|
||||
}, 0);
|
||||
})();
|
||||
*/
|
||||
// Best! only renders frames that will be seen. stats.js runs at 60FPS on my desktop
|
||||
|
||||
|
||||
};
|
||||
img.setAttribute("src", textureUrl);
|
||||
};
|
||||
}).call(this);
|
|
@ -0,0 +1,198 @@
|
|||
var examples = {};
|
||||
|
||||
//~ examples['simple'] = function() {
|
||||
//~ $('#sphere').earth3d({
|
||||
//~ dragElement: $('#locations') // where do we catch the mouse drag
|
||||
//~ });
|
||||
//~ };
|
||||
|
||||
//~ examples['simple_tilted'] = function() {
|
||||
//~ $('#sphere').earth3d({
|
||||
//~ dragElement: $('#locations'), // where do we catch the mouse drag
|
||||
//~ sphere: { // rotation and size of the planet
|
||||
//~ tilt: 40,
|
||||
//~ turn: 20,
|
||||
//~ r: 10
|
||||
//~ }
|
||||
//~ });
|
||||
//~ };
|
||||
|
||||
|
||||
examples['locations'] = function() {
|
||||
/* defining locations to display.
|
||||
Each position must have a key, an alpha and delta position (or x and y if you want to display a static location).
|
||||
Any additional key can be reached via callbacks functions.
|
||||
*/
|
||||
var locations = {
|
||||
obj1: {
|
||||
alpha: Math.PI / 4,
|
||||
delta: 0,
|
||||
name: '_usa_',
|
||||
link: 'https://oasis.astroport.com#usa'
|
||||
},
|
||||
obj2: {
|
||||
alpha: 1 * Math.PI / 4,
|
||||
delta: -2 * Math.PI / 4,
|
||||
name: '_africa_',
|
||||
link: 'https://oasis.astroport.com#africa'
|
||||
},
|
||||
obj3: {
|
||||
alpha: 2 * Math.PI / 4,
|
||||
delta: 0,
|
||||
name: '_hawai_',
|
||||
link: 'https://oasis.astroport.com#awai'
|
||||
},
|
||||
obj4: {
|
||||
alpha: 3 * Math.PI / 4,
|
||||
delta: 3 * Math.PI / 4,
|
||||
name: '_australia_',
|
||||
link: 'https://oasis.astroport.com#australia'
|
||||
},
|
||||
obj5: {
|
||||
alpha: 2.2 * Math.PI / 4,
|
||||
delta: -0.9 * Math.PI / 4,
|
||||
name: '_southamerica_',
|
||||
link: 'https://oasis.astroport.com#southamerica'
|
||||
},
|
||||
obj6: {
|
||||
alpha: 1.2 * Math.PI / 4,
|
||||
delta: -2 * Math.PI / 4,
|
||||
name: '_europe_',
|
||||
link: 'https://oasis.astroport.com#europe'
|
||||
}
|
||||
};
|
||||
|
||||
$('#sphere').earth3d({
|
||||
locationsElement: $('#locations'),
|
||||
dragElement: $('#locations'), // where do we catch the mouse drag
|
||||
locations: locations
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//~ examples['flights'] = function() {
|
||||
//~ /* defining locations to display.
|
||||
//~ Each position must have a key, an alpha and delta position (or x and y if you want to display a static location).
|
||||
//~ Any additional key can be reached via callbacks functions.
|
||||
//~ */
|
||||
//~ var locations = {
|
||||
//~ obj1: {
|
||||
//~ alpha: Math.PI / 4,
|
||||
//~ delta: 0,
|
||||
//~ name: '_usa_',
|
||||
//~ link: 'https://oasis.astroport.com#usa'
|
||||
//~ },
|
||||
//~ obj2: {
|
||||
//~ alpha: 1 * Math.PI / 4,
|
||||
//~ delta: -2 * Math.PI / 4,
|
||||
//~ name: '_africa_',
|
||||
//~ link: 'https://oasis.astroport.com#africa'
|
||||
//~ },
|
||||
//~ obj3: {
|
||||
//~ alpha: 2 * Math.PI / 4,
|
||||
//~ delta: 0,
|
||||
//~ name: '_hawai_',
|
||||
//~ link: 'https://oasis.astroport.com#awai'
|
||||
//~ },
|
||||
//~ obj4: {
|
||||
//~ alpha: 3 * Math.PI / 4,
|
||||
//~ delta: 3 * Math.PI / 4,
|
||||
//~ name: '_australia_',
|
||||
//~ link: 'https://oasis.astroport.com#australia'
|
||||
//~ },
|
||||
//~ obj5: {
|
||||
//~ alpha: 2.2 * Math.PI / 4,
|
||||
//~ delta: -0.9 * Math.PI / 4,
|
||||
//~ name: '_southamerica_',
|
||||
//~ link: 'https://oasis.astroport.com#southamerica'
|
||||
//~ },
|
||||
//~ obj6: {
|
||||
//~ alpha: 1.2 * Math.PI / 4,
|
||||
//~ delta: -2 * Math.PI / 4,
|
||||
//~ name: '_europe_',
|
||||
//~ link: 'https://oasis.astroport.com#europe'
|
||||
//~ },
|
||||
//~ zero: {
|
||||
//~ alpha: 0 * Math.PI / 4,
|
||||
//~ delta: 0 * Math.PI / 4,
|
||||
//~ name: '_CraftYourWorld_',
|
||||
//~ link: 'https://ipfs.copylaradio.com/ipfs/QmNcNcYRDUFmR1Ey1MAyhzzZRJEi1Dfq8YXRTXq6XZ9n4A'
|
||||
//~ },
|
||||
//~ pi: {
|
||||
//~ alpha: -3 * Math.PI / 4,
|
||||
//~ delta: -3 * Math.PI / 4,
|
||||
//~ name: '_OpenTW_',
|
||||
//~ link: 'https://astroport.copylaradio.com'
|
||||
//~ }
|
||||
//~ };
|
||||
//~ /* defining paths to display.
|
||||
//~ Each path must have a key, an origin and a destination. The values are the location's key.
|
||||
//~ You can, if you want to, define flights on these paths.
|
||||
//~ Each flight has a key, a destination (the location's key) and a position.
|
||||
//~ The position is the progress a fleet has made on its path.
|
||||
//~ Any additional key can be reach via callbacks functions.
|
||||
//~ */
|
||||
//~ var paths = {
|
||||
//~ path: {
|
||||
//~ origin: 'obj1',
|
||||
//~ destination: 'obj2',
|
||||
//~ flights: {
|
||||
//~ flight: {
|
||||
//~ position: 0.25,
|
||||
//~ destination: 'obj2',
|
||||
//~ name: 'Flight 1'
|
||||
//~ },
|
||||
//~ flight2: {
|
||||
//~ position: 0.25,
|
||||
//~ destination: 'obj1',
|
||||
//~ name: 'Flight 2'
|
||||
//~ }
|
||||
//~ }
|
||||
//~ },
|
||||
//~ path2: {
|
||||
//~ origin: 'obj1',
|
||||
//~ destination: 'obj3',
|
||||
//~ flights: {
|
||||
//~ flight3: {
|
||||
//~ position: 0.5,
|
||||
//~ destination: 'obj3',
|
||||
//~ name: 'Flight 3'
|
||||
//~ }
|
||||
//~ }
|
||||
//~ },
|
||||
//~ path3: {
|
||||
//~ origin: 'obj1',
|
||||
//~ destination: 'obj4',
|
||||
//~ flights: {
|
||||
//~ flight4: {
|
||||
//~ position: 0.5,
|
||||
//~ destination: 'obj4',
|
||||
//~ name: 'Flight 4'
|
||||
//~ }
|
||||
//~ }
|
||||
//~ },
|
||||
//~ path4: {
|
||||
//~ origin: 'obj1',
|
||||
//~ destination: 'obj5'
|
||||
//~ },
|
||||
//~ path7: {
|
||||
//~ origin: 'obj1',
|
||||
//~ destination: 'obj5',
|
||||
//~ flights: {
|
||||
//~ flight5: {
|
||||
//~ position: 0.25,
|
||||
//~ destination: 'obj7',
|
||||
//~ name: 'Flight 5'
|
||||
//~ }
|
||||
//~ }
|
||||
//~ }
|
||||
//~ }
|
||||
|
||||
//~ $('#sphere').earth3d({
|
||||
//~ flightsCanvas: $('#flights'),
|
||||
//~ locationsElement: $('#locations'),
|
||||
//~ dragElement: $('#locations'), // where do we catch the mouse drag
|
||||
//~ paths: paths,
|
||||
//~ locations: locations
|
||||
//~ });
|
||||
//~ };
|
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,3 @@
|
|||
# Images & icons
|
||||
|
||||
Add favicon from the web2.0 you wish to copy to WEB3
|
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |