this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Breaking news: upgrade to masto v6

Expecting bugs!

Also include some fixes for states init.

+379 -608
+62 -337
package-lock.json
··· 21 21 "idb-keyval": "~6.2.1", 22 22 "just-debounce-it": "~3.2.0", 23 23 "lz-string": "~1.5.0", 24 - "masto": "~5.11.4", 24 + "masto": "~6.3.1", 25 25 "mem": "~9.0.2", 26 26 "p-retry": "~6.1.0", 27 27 "p-throttle": "~5.1.0", ··· 3133 3133 "node": ">=8" 3134 3134 } 3135 3135 }, 3136 - "node_modules/@mastojs/ponyfills": { 3137 - "version": "1.0.4", 3138 - "resolved": "https://registry.npmjs.org/@mastojs/ponyfills/-/ponyfills-1.0.4.tgz", 3139 - "integrity": "sha512-1NaIGmcU7OmyNzx0fk+cYeGTkdXlOJOSdetaC4pStVWsrhht2cdlYSAfe5NDW3FcUmcEm2vVceB9lcClN1RCxw==", 3140 - "dependencies": { 3141 - "@types/node": "^18.11.17", 3142 - "@types/node-fetch": "^2.6.2", 3143 - "abort-controller": "^3.0.0", 3144 - "form-data": "^4.0.0", 3145 - "node-fetch": "^2.6.7" 3146 - } 3147 - }, 3148 3136 "node_modules/@nodelib/fs.scandir": { 3149 3137 "version": "2.1.5", 3150 3138 "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", ··· 3373 3361 "node_modules/@types/node": { 3374 3362 "version": "18.11.17", 3375 3363 "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", 3376 - "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==" 3377 - }, 3378 - "node_modules/@types/node-fetch": { 3379 - "version": "2.6.2", 3380 - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", 3381 - "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", 3382 - "dependencies": { 3383 - "@types/node": "*", 3384 - "form-data": "^3.0.0" 3385 - } 3386 - }, 3387 - "node_modules/@types/node-fetch/node_modules/form-data": { 3388 - "version": "3.0.1", 3389 - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", 3390 - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", 3391 - "dependencies": { 3392 - "asynckit": "^0.4.0", 3393 - "combined-stream": "^1.0.8", 3394 - "mime-types": "^2.1.12" 3395 - }, 3396 - "engines": { 3397 - "node": ">= 6" 3398 - } 3364 + "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==", 3365 + "dev": true 3399 3366 }, 3400 3367 "node_modules/@types/resolve": { 3401 3368 "version": "1.17.1", ··· 3510 3477 "optional": true, 3511 3478 "peer": true 3512 3479 }, 3513 - "node_modules/abort-controller": { 3514 - "version": "3.0.0", 3515 - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", 3516 - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", 3517 - "dependencies": { 3518 - "event-target-shim": "^5.0.0" 3519 - }, 3520 - "engines": { 3521 - "node": ">=6.5" 3522 - } 3523 - }, 3524 3480 "node_modules/acorn": { 3525 3481 "version": "8.8.1", 3526 3482 "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", ··· 3597 3553 "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", 3598 3554 "dev": true 3599 3555 }, 3600 - "node_modules/asynckit": { 3601 - "version": "0.4.0", 3602 - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 3603 - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" 3604 - }, 3605 3556 "node_modules/at-least-node": { 3606 3557 "version": "1.0.0", 3607 3558 "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", ··· 3790 3741 "version": "1.0.2", 3791 3742 "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 3792 3743 "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 3744 + "dev": true, 3793 3745 "dependencies": { 3794 3746 "function-bind": "^1.1.1", 3795 3747 "get-intrinsic": "^1.0.2" ··· 3893 3845 "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", 3894 3846 "dev": true 3895 3847 }, 3896 - "node_modules/combined-stream": { 3897 - "version": "1.0.8", 3898 - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 3899 - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 3900 - "dependencies": { 3901 - "delayed-stream": "~1.0.0" 3902 - }, 3903 - "engines": { 3904 - "node": ">= 0.8" 3905 - } 3906 - }, 3907 3848 "node_modules/commander": { 3908 3849 "version": "2.20.3", 3909 3850 "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", ··· 4128 4069 "url": "https://github.com/sponsors/ljharb" 4129 4070 } 4130 4071 }, 4131 - "node_modules/delayed-stream": { 4132 - "version": "1.0.0", 4133 - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 4134 - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", 4135 - "engines": { 4136 - "node": ">=0.4.0" 4137 - } 4138 - }, 4139 4072 "node_modules/dot-case": { 4140 4073 "version": "3.0.4", 4141 4074 "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", ··· 4320 4253 "node": ">=0.10.0" 4321 4254 } 4322 4255 }, 4323 - "node_modules/event-target-shim": { 4324 - "version": "5.0.1", 4325 - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", 4326 - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", 4327 - "engines": { 4328 - "node": ">=6" 4329 - } 4330 - }, 4331 - "node_modules/eventemitter3": { 4332 - "version": "5.0.0", 4333 - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.0.tgz", 4334 - "integrity": "sha512-riuVbElZZNXLeLEoprfNYoDSwTBRR44X3mnhdI1YcnENpWTCsTTVZ2zFuqQcpoyqPQIUXdiPEU0ECAq0KQRaHg==" 4256 + "node_modules/events-to-async": { 4257 + "version": "2.0.0", 4258 + "resolved": "https://registry.npmjs.org/events-to-async/-/events-to-async-2.0.0.tgz", 4259 + "integrity": "sha512-NiZEr4g51nI4/lz/6NdwMqK/TLIctlnp9TQ3wCJjlRp47VgrthUZE4nrk2UhfZ8VzoQ/Xyth+G6MKioLCt0FVA==" 4335 4260 }, 4336 4261 "node_modules/fast-blurhash": { 4337 4262 "version": "1.1.2", ··· 4425 4350 "is-callable": "^1.1.3" 4426 4351 } 4427 4352 }, 4428 - "node_modules/form-data": { 4429 - "version": "4.0.0", 4430 - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", 4431 - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", 4432 - "dependencies": { 4433 - "asynckit": "^0.4.0", 4434 - "combined-stream": "^1.0.8", 4435 - "mime-types": "^2.1.12" 4436 - }, 4437 - "engines": { 4438 - "node": ">= 6" 4439 - } 4440 - }, 4441 4353 "node_modules/fraction.js": { 4442 4354 "version": "4.3.6", 4443 4355 "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", ··· 4489 4401 "node_modules/function-bind": { 4490 4402 "version": "1.1.1", 4491 4403 "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 4492 - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 4404 + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 4405 + "dev": true 4493 4406 }, 4494 4407 "node_modules/function.prototype.name": { 4495 4408 "version": "1.1.5", ··· 4531 4444 "version": "1.2.1", 4532 4445 "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", 4533 4446 "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", 4447 + "dev": true, 4534 4448 "dependencies": { 4535 4449 "function-bind": "^1.1.1", 4536 4450 "has": "^1.0.3", ··· 4641 4555 "version": "1.0.3", 4642 4556 "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 4643 4557 "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 4558 + "dev": true, 4644 4559 "dependencies": { 4645 4560 "function-bind": "^1.1.1" 4646 4561 }, ··· 4682 4597 "version": "1.0.1", 4683 4598 "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", 4684 4599 "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", 4600 + "dev": true, 4685 4601 "engines": { 4686 4602 "node": ">= 0.4" 4687 4603 }, ··· 4693 4609 "version": "1.0.3", 4694 4610 "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 4695 4611 "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 4612 + "dev": true, 4696 4613 "engines": { 4697 4614 "node": ">= 0.4" 4698 4615 }, ··· 5307 5224 "tslib": "^2.0.3" 5308 5225 } 5309 5226 }, 5310 - "node_modules/lru-cache": { 5311 - "version": "6.0.0", 5312 - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 5313 - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", 5314 - "dependencies": { 5315 - "yallist": "^4.0.0" 5316 - }, 5317 - "engines": { 5318 - "node": ">=10" 5319 - } 5320 - }, 5321 5227 "node_modules/lz-string": { 5322 5228 "version": "1.5.0", 5323 5229 "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", ··· 5347 5253 } 5348 5254 }, 5349 5255 "node_modules/masto": { 5350 - "version": "5.11.4", 5351 - "resolved": "https://registry.npmjs.org/masto/-/masto-5.11.4.tgz", 5352 - "integrity": "sha512-sLF3SJTNZDAP57Y+8vAdd1KQTuWWxmGUrBF1R2GLPL6zij/1wXxV05+h8GZhnfg+696arkt+w6ZlKvEEfH1yvg==", 5256 + "version": "6.3.1", 5257 + "resolved": "https://registry.npmjs.org/masto/-/masto-6.3.1.tgz", 5258 + "integrity": "sha512-Os3MlbGFNL6KHxlKldYY+d/1exO6oBjtF4vx8d6cmXRmeeeW3mKQeunTZz+yY5qWksPg2eVdk+FOhaEnOeclVw==", 5353 5259 "dependencies": { 5354 - "@mastojs/ponyfills": "^1.0.4", 5355 5260 "change-case": "^4.1.2", 5356 - "eventemitter3": "^5.0.0", 5261 + "events-to-async": "^2.0.0", 5357 5262 "isomorphic-ws": "^5.0.0", 5358 - "qs": "^6.11.0", 5359 - "semver": "^7.3.7", 5263 + "ts-custom-error": "^3.3.1", 5360 5264 "ws": "^8.13.0" 5361 - } 5362 - }, 5363 - "node_modules/masto/node_modules/semver": { 5364 - "version": "7.3.8", 5365 - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", 5366 - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", 5367 - "dependencies": { 5368 - "lru-cache": "^6.0.0" 5369 - }, 5370 - "bin": { 5371 - "semver": "bin/semver.js" 5372 - }, 5373 - "engines": { 5374 - "node": ">=10" 5375 5265 } 5376 5266 }, 5377 5267 "node_modules/mem": { ··· 5421 5311 "version": "1.52.0", 5422 5312 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 5423 5313 "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 5314 + "dev": true, 5424 5315 "engines": { 5425 5316 "node": ">= 0.6" 5426 5317 } ··· 5429 5320 "version": "2.1.35", 5430 5321 "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 5431 5322 "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 5323 + "dev": true, 5432 5324 "dependencies": { 5433 5325 "mime-db": "1.52.0" 5434 5326 }, ··· 5492 5384 "tslib": "^2.0.3" 5493 5385 } 5494 5386 }, 5495 - "node_modules/node-fetch": { 5496 - "version": "2.6.7", 5497 - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 5498 - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", 5499 - "dependencies": { 5500 - "whatwg-url": "^5.0.0" 5501 - }, 5502 - "engines": { 5503 - "node": "4.x || >=6.0.0" 5504 - }, 5505 - "peerDependencies": { 5506 - "encoding": "^0.1.0" 5507 - }, 5508 - "peerDependenciesMeta": { 5509 - "encoding": { 5510 - "optional": true 5511 - } 5512 - } 5513 - }, 5514 - "node_modules/node-fetch/node_modules/tr46": { 5515 - "version": "0.0.3", 5516 - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 5517 - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 5518 - }, 5519 - "node_modules/node-fetch/node_modules/webidl-conversions": { 5520 - "version": "3.0.1", 5521 - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 5522 - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 5523 - }, 5524 - "node_modules/node-fetch/node_modules/whatwg-url": { 5525 - "version": "5.0.0", 5526 - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 5527 - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 5528 - "dependencies": { 5529 - "tr46": "~0.0.3", 5530 - "webidl-conversions": "^3.0.0" 5531 - } 5532 - }, 5533 5387 "node_modules/node-releases": { 5534 5388 "version": "2.0.13", 5535 5389 "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", ··· 5557 5411 "version": "1.12.3", 5558 5412 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", 5559 5413 "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", 5414 + "dev": true, 5560 5415 "funding": { 5561 5416 "url": "https://github.com/sponsors/ljharb" 5562 5417 } ··· 6461 6316 "node": ">=6" 6462 6317 } 6463 6318 }, 6464 - "node_modules/qs": { 6465 - "version": "6.11.0", 6466 - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 6467 - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", 6468 - "dependencies": { 6469 - "side-channel": "^1.0.4" 6470 - }, 6471 - "engines": { 6472 - "node": ">=0.6" 6473 - }, 6474 - "funding": { 6475 - "url": "https://github.com/sponsors/ljharb" 6476 - } 6477 - }, 6478 6319 "node_modules/queue-microtask": { 6479 6320 "version": "1.2.3", 6480 6321 "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", ··· 6860 6701 "version": "1.0.4", 6861 6702 "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 6862 6703 "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 6704 + "dev": true, 6863 6705 "dependencies": { 6864 6706 "call-bind": "^1.0.0", 6865 6707 "get-intrinsic": "^1.0.2", ··· 7135 6977 "dev": true, 7136 6978 "dependencies": { 7137 6979 "punycode": "^2.1.0" 6980 + } 6981 + }, 6982 + "node_modules/ts-custom-error": { 6983 + "version": "3.3.1", 6984 + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", 6985 + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", 6986 + "engines": { 6987 + "node": ">=14.0.0" 7138 6988 } 7139 6989 }, 7140 6990 "node_modules/tslib": { ··· 7991 7841 "optional": true 7992 7842 } 7993 7843 } 7994 - }, 7995 - "node_modules/yallist": { 7996 - "version": "4.0.0", 7997 - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 7998 - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" 7999 7844 } 8000 7845 }, 8001 7846 "dependencies": { ··· 9806 9651 "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz", 9807 9652 "integrity": "sha512-uSvJdwQU5nK+Vdf6zxcWAY2A8r7uqe+gePwLWzJ+fsQehq18pc0I2hJKwypZ2aLM90+Er9u1xn4iLJPZ+xlL4g==" 9808 9653 }, 9809 - "@mastojs/ponyfills": { 9810 - "version": "1.0.4", 9811 - "resolved": "https://registry.npmjs.org/@mastojs/ponyfills/-/ponyfills-1.0.4.tgz", 9812 - "integrity": "sha512-1NaIGmcU7OmyNzx0fk+cYeGTkdXlOJOSdetaC4pStVWsrhht2cdlYSAfe5NDW3FcUmcEm2vVceB9lcClN1RCxw==", 9813 - "requires": { 9814 - "@types/node": "^18.11.17", 9815 - "@types/node-fetch": "^2.6.2", 9816 - "abort-controller": "^3.0.0", 9817 - "form-data": "^4.0.0", 9818 - "node-fetch": "^2.6.7" 9819 - } 9820 - }, 9821 9654 "@nodelib/fs.scandir": { 9822 9655 "version": "2.1.5", 9823 9656 "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", ··· 9998 9831 "@types/node": { 9999 9832 "version": "18.11.17", 10000 9833 "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", 10001 - "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==" 10002 - }, 10003 - "@types/node-fetch": { 10004 - "version": "2.6.2", 10005 - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", 10006 - "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", 10007 - "requires": { 10008 - "@types/node": "*", 10009 - "form-data": "^3.0.0" 10010 - }, 10011 - "dependencies": { 10012 - "form-data": { 10013 - "version": "3.0.1", 10014 - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", 10015 - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", 10016 - "requires": { 10017 - "asynckit": "^0.4.0", 10018 - "combined-stream": "^1.0.8", 10019 - "mime-types": "^2.1.12" 10020 - } 10021 - } 10022 - } 9834 + "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==", 9835 + "dev": true 10023 9836 }, 10024 9837 "@types/resolve": { 10025 9838 "version": "1.17.1", ··· 10128 9941 "optional": true, 10129 9942 "peer": true 10130 9943 }, 10131 - "abort-controller": { 10132 - "version": "3.0.0", 10133 - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", 10134 - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", 10135 - "requires": { 10136 - "event-target-shim": "^5.0.0" 10137 - } 10138 - }, 10139 9944 "acorn": { 10140 9945 "version": "8.8.1", 10141 9946 "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", ··· 10190 9995 "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", 10191 9996 "dev": true 10192 9997 }, 10193 - "asynckit": { 10194 - "version": "0.4.0", 10195 - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 10196 - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" 10197 - }, 10198 9998 "at-least-node": { 10199 9999 "version": "1.0.0", 10200 10000 "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", ··· 10311 10111 "version": "1.0.2", 10312 10112 "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 10313 10113 "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 10114 + "dev": true, 10314 10115 "requires": { 10315 10116 "function-bind": "^1.1.1", 10316 10117 "get-intrinsic": "^1.0.2" ··· 10390 10191 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 10391 10192 "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", 10392 10193 "dev": true 10393 - }, 10394 - "combined-stream": { 10395 - "version": "1.0.8", 10396 - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 10397 - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 10398 - "requires": { 10399 - "delayed-stream": "~1.0.0" 10400 - } 10401 10194 }, 10402 10195 "commander": { 10403 10196 "version": "2.20.3", ··· 10531 10324 "object-keys": "^1.1.1" 10532 10325 } 10533 10326 }, 10534 - "delayed-stream": { 10535 - "version": "1.0.0", 10536 - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 10537 - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" 10538 - }, 10539 10327 "dot-case": { 10540 10328 "version": "3.0.4", 10541 10329 "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", ··· 10683 10471 "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", 10684 10472 "dev": true 10685 10473 }, 10686 - "event-target-shim": { 10687 - "version": "5.0.1", 10688 - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", 10689 - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" 10690 - }, 10691 - "eventemitter3": { 10692 - "version": "5.0.0", 10693 - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.0.tgz", 10694 - "integrity": "sha512-riuVbElZZNXLeLEoprfNYoDSwTBRR44X3mnhdI1YcnENpWTCsTTVZ2zFuqQcpoyqPQIUXdiPEU0ECAq0KQRaHg==" 10474 + "events-to-async": { 10475 + "version": "2.0.0", 10476 + "resolved": "https://registry.npmjs.org/events-to-async/-/events-to-async-2.0.0.tgz", 10477 + "integrity": "sha512-NiZEr4g51nI4/lz/6NdwMqK/TLIctlnp9TQ3wCJjlRp47VgrthUZE4nrk2UhfZ8VzoQ/Xyth+G6MKioLCt0FVA==" 10695 10478 }, 10696 10479 "fast-blurhash": { 10697 10480 "version": "1.1.2", ··· 10778 10561 "is-callable": "^1.1.3" 10779 10562 } 10780 10563 }, 10781 - "form-data": { 10782 - "version": "4.0.0", 10783 - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", 10784 - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", 10785 - "requires": { 10786 - "asynckit": "^0.4.0", 10787 - "combined-stream": "^1.0.8", 10788 - "mime-types": "^2.1.12" 10789 - } 10790 - }, 10791 10564 "fraction.js": { 10792 10565 "version": "4.3.6", 10793 10566 "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", ··· 10822 10595 "function-bind": { 10823 10596 "version": "1.1.1", 10824 10597 "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 10825 - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 10598 + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 10599 + "dev": true 10826 10600 }, 10827 10601 "function.prototype.name": { 10828 10602 "version": "1.1.5", ··· 10852 10626 "version": "1.2.1", 10853 10627 "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", 10854 10628 "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", 10629 + "dev": true, 10855 10630 "requires": { 10856 10631 "function-bind": "^1.1.1", 10857 10632 "has": "^1.0.3", ··· 10932 10707 "version": "1.0.3", 10933 10708 "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 10934 10709 "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 10710 + "dev": true, 10935 10711 "requires": { 10936 10712 "function-bind": "^1.1.1" 10937 10713 } ··· 10960 10736 "has-proto": { 10961 10737 "version": "1.0.1", 10962 10738 "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", 10963 - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" 10739 + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", 10740 + "dev": true 10964 10741 }, 10965 10742 "has-symbols": { 10966 10743 "version": "1.0.3", 10967 10744 "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 10968 - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" 10745 + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 10746 + "dev": true 10969 10747 }, 10970 10748 "has-tostringtag": { 10971 10749 "version": "1.0.0", ··· 11409 11187 "tslib": "^2.0.3" 11410 11188 } 11411 11189 }, 11412 - "lru-cache": { 11413 - "version": "6.0.0", 11414 - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 11415 - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", 11416 - "requires": { 11417 - "yallist": "^4.0.0" 11418 - } 11419 - }, 11420 11190 "lz-string": { 11421 11191 "version": "1.5.0", 11422 11192 "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", ··· 11440 11210 } 11441 11211 }, 11442 11212 "masto": { 11443 - "version": "5.11.4", 11444 - "resolved": "https://registry.npmjs.org/masto/-/masto-5.11.4.tgz", 11445 - "integrity": "sha512-sLF3SJTNZDAP57Y+8vAdd1KQTuWWxmGUrBF1R2GLPL6zij/1wXxV05+h8GZhnfg+696arkt+w6ZlKvEEfH1yvg==", 11213 + "version": "6.3.1", 11214 + "resolved": "https://registry.npmjs.org/masto/-/masto-6.3.1.tgz", 11215 + "integrity": "sha512-Os3MlbGFNL6KHxlKldYY+d/1exO6oBjtF4vx8d6cmXRmeeeW3mKQeunTZz+yY5qWksPg2eVdk+FOhaEnOeclVw==", 11446 11216 "requires": { 11447 - "@mastojs/ponyfills": "^1.0.4", 11448 11217 "change-case": "^4.1.2", 11449 - "eventemitter3": "^5.0.0", 11218 + "events-to-async": "^2.0.0", 11450 11219 "isomorphic-ws": "^5.0.0", 11451 - "qs": "^6.11.0", 11452 - "semver": "^7.3.7", 11220 + "ts-custom-error": "^3.3.1", 11453 11221 "ws": "^8.13.0" 11454 - }, 11455 - "dependencies": { 11456 - "semver": { 11457 - "version": "7.3.8", 11458 - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", 11459 - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", 11460 - "requires": { 11461 - "lru-cache": "^6.0.0" 11462 - } 11463 - } 11464 11222 } 11465 11223 }, 11466 11224 "mem": { ··· 11497 11255 "mime-db": { 11498 11256 "version": "1.52.0", 11499 11257 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 11500 - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" 11258 + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 11259 + "dev": true 11501 11260 }, 11502 11261 "mime-types": { 11503 11262 "version": "2.1.35", 11504 11263 "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 11505 11264 "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 11265 + "dev": true, 11506 11266 "requires": { 11507 11267 "mime-db": "1.52.0" 11508 11268 } ··· 11542 11302 "tslib": "^2.0.3" 11543 11303 } 11544 11304 }, 11545 - "node-fetch": { 11546 - "version": "2.6.7", 11547 - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 11548 - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", 11549 - "requires": { 11550 - "whatwg-url": "^5.0.0" 11551 - }, 11552 - "dependencies": { 11553 - "tr46": { 11554 - "version": "0.0.3", 11555 - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 11556 - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 11557 - }, 11558 - "webidl-conversions": { 11559 - "version": "3.0.1", 11560 - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 11561 - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 11562 - }, 11563 - "whatwg-url": { 11564 - "version": "5.0.0", 11565 - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 11566 - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 11567 - "requires": { 11568 - "tr46": "~0.0.3", 11569 - "webidl-conversions": "^3.0.0" 11570 - } 11571 - } 11572 - } 11573 - }, 11574 11305 "node-releases": { 11575 11306 "version": "2.0.13", 11576 11307 "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", ··· 11591 11322 "object-inspect": { 11592 11323 "version": "1.12.3", 11593 11324 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", 11594 - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" 11325 + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", 11326 + "dev": true 11595 11327 }, 11596 11328 "object-keys": { 11597 11329 "version": "1.1.1", ··· 12059 11791 "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", 12060 11792 "dev": true 12061 11793 }, 12062 - "qs": { 12063 - "version": "6.11.0", 12064 - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 12065 - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", 12066 - "requires": { 12067 - "side-channel": "^1.0.4" 12068 - } 12069 - }, 12070 11794 "queue-microtask": { 12071 11795 "version": "1.2.3", 12072 11796 "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", ··· 12322 12046 "version": "1.0.4", 12323 12047 "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 12324 12048 "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 12049 + "dev": true, 12325 12050 "requires": { 12326 12051 "call-bind": "^1.0.0", 12327 12052 "get-intrinsic": "^1.0.2", ··· 12526 12251 "requires": { 12527 12252 "punycode": "^2.1.0" 12528 12253 } 12254 + }, 12255 + "ts-custom-error": { 12256 + "version": "3.3.1", 12257 + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", 12258 + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==" 12529 12259 }, 12530 12260 "tslib": { 12531 12261 "version": "2.4.1", ··· 13153 12883 "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", 13154 12884 "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", 13155 12885 "requires": {} 13156 - }, 13157 - "yallist": { 13158 - "version": "4.0.0", 13159 - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 13160 - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" 13161 12886 } 13162 12887 } 13163 12888 }
+1 -1
package.json
··· 23 23 "idb-keyval": "~6.2.1", 24 24 "just-debounce-it": "~3.2.0", 25 25 "lz-string": "~1.5.0", 26 - "masto": "~5.11.4", 26 + "masto": "~6.3.1", 27 27 "mem": "~9.0.2", 28 28 "p-retry": "~6.1.0", 29 29 "p-throttle": "~5.1.0",
+11 -10
src/app.jsx
··· 114 114 code, 115 115 }); 116 116 117 - const masto = initClient({ instance: instanceURL, accessToken }); 117 + const client = initClient({ instance: instanceURL, accessToken }); 118 118 await Promise.allSettled([ 119 - initInstance(masto, instanceURL), 120 - initAccount(masto, instanceURL, accessToken, vapidKey), 119 + initInstance(client, instanceURL), 120 + initAccount(client, instanceURL, accessToken, vapidKey), 121 121 ]); 122 122 initStates(); 123 - initPreferences(masto); 123 + initPreferences(client); 124 124 125 125 setIsLoggedIn(true); 126 126 setUIState('default'); ··· 130 130 const account = getCurrentAccount(); 131 131 if (account) { 132 132 store.session.set('currentAccount', account.info.id); 133 - const { masto, instance } = api({ account }); 134 - console.log('masto', masto); 133 + const { client } = api({ account }); 134 + const { instance } = client; 135 + // console.log('masto', masto); 135 136 initStates(); 136 - initPreferences(masto); 137 + initPreferences(client); 137 138 setUIState('loading'); 138 139 (async () => { 139 140 try { 140 - await initInstance(masto, instance); 141 + await initInstance(client, instance); 141 142 } catch (e) { 142 143 } finally { 143 144 setIsLoggedIn(true); ··· 253 254 <Shortcuts /> 254 255 )} 255 256 <Modals /> 256 - <NotificationService /> 257 + {isLoggedIn && <NotificationService />} 257 258 <BackgroundService isLoggedIn={isLoggedIn} /> 258 - <SearchCommand onClose={focusDeck} /> 259 + {uiState !== 'loading' && <SearchCommand onClose={focusDeck} />} 259 260 <KeyboardShortcutsHelp /> 260 261 </> 261 262 );
+48 -43
src/components/account-info.jsx
··· 149 149 const familiarFollowersCache = useRef([]); 150 150 async function fetchFollowers(firstLoad) { 151 151 if (firstLoad || !followersIterator.current) { 152 - followersIterator.current = masto.v1.accounts.listFollowers(id, { 152 + followersIterator.current = masto.v1.accounts.$select(id).followers.list({ 153 153 limit: LIMIT, 154 154 }); 155 155 } ··· 162 162 // On first load, fetch familiar followers, merge to top of results' `value` 163 163 // Remove dups on every fetch 164 164 if (firstLoad) { 165 - const familiarFollowers = await masto.v1.accounts.fetchFamiliarFollowers( 166 - id, 167 - ); 165 + const familiarFollowers = await masto.v1.accounts 166 + .familiarFollowers(id) 167 + .fetch(); 168 168 familiarFollowersCache.current = familiarFollowers[0].accounts; 169 169 newValue = [ 170 170 ...familiarFollowersCache.current, ··· 193 193 const followingIterator = useRef(); 194 194 async function fetchFollowing(firstLoad) { 195 195 if (firstLoad || !followingIterator.current) { 196 - followingIterator.current = masto.v1.accounts.listFollowing(id, { 196 + followingIterator.current = masto.v1.accounts.$select(id).following.list({ 197 197 limit: LIMIT, 198 198 }); 199 199 } ··· 214 214 (async () => { 215 215 try { 216 216 const fetchFamiliarFollowers = 217 - currentMasto.v1.accounts.fetchFamiliarFollowers(currentID); 217 + currentMasto.v1.accounts.familiarFollowers.fetch({ 218 + id: [currentID], 219 + }); 218 220 const fetchStatuses = currentMasto.v1.accounts 219 - .listStatuses(currentID, { 221 + .$select(currentID) 222 + .statuses.list({ 220 223 limit: 20, 221 224 }) 222 225 .next(); ··· 712 715 // Grab this account from my logged-in instance 713 716 const acctHasInstance = info.acct.includes('@'); 714 717 try { 715 - const results = await currentMasto.v2.search({ 718 + const results = await currentMasto.v2.search.fetch({ 716 719 q: acctHasInstance ? info.acct : `${info.username}@${instance}`, 717 720 type: 'accounts', 718 721 limit: 1, ··· 742 745 743 746 setRelationshipUIState('loading'); 744 747 745 - const fetchRelationships = currentMasto.v1.accounts.fetchRelationships([ 746 - currentID, 747 - ]); 748 + const fetchRelationships = currentMasto.v1.accounts.relationships.fetch( 749 + { 750 + id: [currentID], 751 + }, 752 + ); 748 753 749 754 try { 750 755 const relationships = await fetchRelationships; ··· 913 918 setRelationshipUIState('loading'); 914 919 (async () => { 915 920 try { 916 - const newRelationship = 917 - await currentMasto.v1.accounts.unmute( 918 - currentInfo?.id || id, 919 - ); 921 + const newRelationship = await currentMasto.v1.accounts 922 + .$select(currentInfo?.id || id) 923 + .unmute(); 920 924 console.log('unmuting', newRelationship); 921 925 setRelationship(newRelationship); 922 926 setRelationshipUIState('default'); ··· 962 966 (async () => { 963 967 try { 964 968 const newRelationship = 965 - await currentMasto.v1.accounts.mute( 966 - currentInfo?.id || id, 967 - { 969 + await currentMasto.v1.accounts 970 + .$select(currentInfo?.id || id) 971 + .mute({ 968 972 duration, 969 - }, 970 - ); 973 + }); 971 974 console.log('muting', newRelationship); 972 975 setRelationship(newRelationship); 973 976 setRelationshipUIState('default'); ··· 1008 1011 (async () => { 1009 1012 try { 1010 1013 if (blocking) { 1011 - const newRelationship = 1012 - await currentMasto.v1.accounts.unblock( 1013 - currentInfo?.id || id, 1014 - ); 1014 + const newRelationship = await currentMasto.v1.accounts 1015 + .$select(currentInfo?.id || id) 1016 + .unblock(); 1015 1017 console.log('unblocking', newRelationship); 1016 1018 setRelationship(newRelationship); 1017 1019 setRelationshipUIState('default'); 1018 1020 showToast(`Unblocked @${username}`); 1019 1021 } else { 1020 - const newRelationship = 1021 - await currentMasto.v1.accounts.block( 1022 - currentInfo?.id || id, 1023 - ); 1022 + const newRelationship = await currentMasto.v1.accounts 1023 + .$select(currentInfo?.id || id) 1024 + .block(); 1024 1025 console.log('blocking', newRelationship); 1025 1026 setRelationship(newRelationship); 1026 1027 setRelationshipUIState('default'); ··· 1089 1090 // ); 1090 1091 1091 1092 // if (yes) { 1092 - newRelationship = await currentMasto.v1.accounts.unfollow( 1093 - accountID.current, 1094 - ); 1093 + newRelationship = await currentMasto.v1.accounts 1094 + .$select(accountID.current) 1095 + .unfollow(); 1095 1096 // } 1096 1097 } else { 1097 - newRelationship = await currentMasto.v1.accounts.follow( 1098 - accountID.current, 1099 - ); 1098 + newRelationship = await currentMasto.v1.accounts 1099 + .$select(accountID.current) 1100 + .follow(); 1100 1101 } 1101 1102 1102 1103 if (newRelationship) setRelationship(newRelationship); ··· 1241 1242 (async () => { 1242 1243 try { 1243 1244 const lists = await masto.v1.lists.list(); 1244 - const listsContainingAccount = await masto.v1.accounts.listLists( 1245 - accountID, 1246 - ); 1245 + const listsContainingAccount = await masto.v1.accounts 1246 + .$select(accountID) 1247 + .lists.list(); 1247 1248 console.log({ lists, listsContainingAccount }); 1248 1249 setLists(lists); 1249 1250 setListsContainingAccount(listsContainingAccount); ··· 1285 1286 (async () => { 1286 1287 try { 1287 1288 if (inList) { 1288 - await masto.v1.lists.removeAccount(list.id, { 1289 - accountIds: [accountID], 1290 - }); 1289 + await masto.v1.lists 1290 + .$select(list.id) 1291 + .accounts.remove({ 1292 + accountIds: [accountID], 1293 + }); 1291 1294 } else { 1292 - await masto.v1.lists.addAccount(list.id, { 1293 - accountIds: [accountID], 1294 - }); 1295 + await masto.v1.lists 1296 + .$select(list.id) 1297 + .accounts.create({ 1298 + accountIds: [accountID], 1299 + }); 1295 1300 } 1296 1301 // setUIState('default'); 1297 1302 reload();
+2 -2
src/components/account-sheet.jsx
··· 46 46 }); 47 47 return info; 48 48 } catch (e) { 49 - const result = await masto.v2.search({ 49 + const result = await masto.v2.search.fetch({ 50 50 q: account, 51 51 type: 'accounts', 52 52 limit: 1, ··· 57 57 } else if (/https?:\/\/[^/]+\/@/.test(account)) { 58 58 const accountURL = new URL(account); 59 59 const acct = accountURL.pathname.replace(/^\//, ''); 60 - const result = await masto.v2.search({ 60 + const result = await masto.v2.search.fetch({ 61 61 q: acct, 62 62 type: 'accounts', 63 63 limit: 1,
+18 -26
src/components/background-service.jsx
··· 11 11 // - WebSocket to receive notifications when page is visible 12 12 const [visible, setVisible] = useState(true); 13 13 usePageVisibility(setVisible); 14 - const notificationStream = useRef(); 15 14 useEffect(() => { 15 + let sub; 16 16 if (isLoggedIn && visible) { 17 - const { masto, instance } = api(); 17 + const { masto, streaming, instance } = api(); 18 18 (async () => { 19 19 // 1. Get the latest notification 20 20 if (states.notificationsLast) { ··· 42 42 } 43 43 44 44 // 2. Start streaming 45 - notificationStream.current = await masto.ws.stream( 46 - '/api/v1/streaming', 47 - { 48 - stream: 'user:notification', 49 - }, 50 - ); 51 - console.log('🎏 Streaming notification', notificationStream.current); 52 - 53 - notificationStream.current.on('notification', (notification) => { 54 - console.log('🔔🔔 Notification', notification); 55 - if (notification.status) { 56 - saveStatus(notification.status, instance, { 57 - skipThreading: true, 58 - }); 45 + if (streaming) { 46 + sub = streaming.user.notification.subscribe(); 47 + console.log('🎏 Streaming notification', sub); 48 + for await (const entry of sub) { 49 + if (!sub) break; 50 + console.log('🔔🔔 Notification entry', entry); 51 + if (entry.event === 'notification') { 52 + console.log('🔔🔔 Notification', entry); 53 + saveStatus(entry.payload, instance, { 54 + skipThreading: true, 55 + }); 56 + } 57 + states.notificationsShowNew = true; 59 58 } 60 - states.notificationsShowNew = true; 61 - }); 62 - 63 - notificationStream.current.ws.onclose = () => { 64 - console.log('🔔🔔 Notification stream closed'); 65 - }; 59 + } 66 60 })(); 67 61 } 68 62 return () => { 69 - if (notificationStream.current) { 70 - notificationStream.current.ws.close(); 71 - notificationStream.current = null; 72 - } 63 + sub?.unsubscribe?.(); 64 + sub = null; 73 65 }; 74 66 }, [visible, isLoggedIn]); 75 67
+16 -17
src/components/compose.jsx
··· 197 197 setUIState('loading'); 198 198 (async () => { 199 199 try { 200 - const statusSource = await masto.v1.statuses.fetchSource( 201 - editStatus.id, 202 - ); 200 + const statusSource = await masto.v1.statuses 201 + .$select(editStatus.id) 202 + .source.fetch(); 203 203 console.log({ statusSource }); 204 204 const { text, spoilerText } = statusSource; 205 205 textareaRef.current.value = text; ··· 749 749 file, 750 750 description, 751 751 }); 752 - return masto.v2.mediaAttachments 753 - .create(params) 754 - .then((res) => { 755 - if (res.id) { 756 - attachment.id = res.id; 757 - } 758 - return res; 759 - }); 752 + return masto.v2.media.create(params).then((res) => { 753 + if (res.id) { 754 + attachment.id = res.id; 755 + } 756 + return res; 757 + }); 760 758 } 761 759 }); 762 760 const results = await Promise.allSettled(mediaPromises); ··· 784 782 /* NOTE: 785 783 Using snakecase here because masto.js's `isObject` returns false for `params`, ONLY happens when opening in pop-out window. This is maybe due to `window.masto` variable being passed from the parent window. The check that failed is `x.constructor === Object`, so maybe the `Object` in new window is different than parent window's? 786 784 Code: https://github.com/neet/masto.js/blob/dd0d649067b6a2b6e60fbb0a96597c373a255b00/src/serializers/is-object.ts#L2 785 + 786 + // TODO: Note above is no longer true in Masto.js v6. Revisit this. 787 787 */ 788 788 let params = { 789 789 status, ··· 818 818 819 819 let newStatus; 820 820 if (editStatus) { 821 - newStatus = await masto.v1.statuses.update( 822 - editStatus.id, 823 - params, 824 - ); 821 + newStatus = await masto.v1.statuses 822 + .$select(editStatus.id) 823 + .update(params); 825 824 saveStatus(newStatus, instance, { 826 825 skipThreading: true, 827 826 }); ··· 935 934 performSearch={(params) => { 936 935 const { type, q, limit } = params; 937 936 if (type === 'accounts') { 938 - return masto.v1.accounts.search({ 937 + return masto.v1.accounts.search.list({ 939 938 q, 940 939 limit, 941 940 resolve: false, 942 941 }); 943 942 } 944 - return masto.v2.search(params); 943 + return masto.v2.search.fetch(params); 945 944 }} 946 945 /> 947 946 {mediaAttachments?.length > 0 && (
+3 -3
src/components/drafts.jsx
··· 128 128 if (replyTo) { 129 129 setUIState('loading'); 130 130 try { 131 - replyToStatus = await masto.v1.statuses.fetch( 132 - replyTo.id, 133 - ); 131 + replyToStatus = await masto.v1.statuses 132 + .$select(replyTo.id) 133 + .fetch(); 134 134 } catch (e) { 135 135 console.error(e); 136 136 alert('Error fetching reply-to status!');
+6 -2
src/components/follow-request-buttons.jsx
··· 23 23 setRequestState('accept'); 24 24 (async () => { 25 25 try { 26 - const rel = await masto.v1.followRequests.authorize(accountID); 26 + const rel = await masto.v1.followRequests 27 + .$select(accountID) 28 + .authorize(); 27 29 if (!rel?.followedBy) { 28 30 throw new Error('Follow request not accepted'); 29 31 } ··· 47 49 setRequestState('reject'); 48 50 (async () => { 49 51 try { 50 - const rel = await masto.v1.followRequests.reject(accountID); 52 + const rel = await masto.v1.followRequests 53 + .$select(accountID) 54 + .reject(); 51 55 if (rel?.followedBy) { 52 56 throw new Error('Follow request not rejected'); 53 57 }
+2 -2
src/components/list-add-edit.jsx
··· 56 56 let listResult; 57 57 58 58 if (editMode) { 59 - listResult = await masto.v1.lists.update(list.id, { 59 + listResult = await masto.v1.lists.$select(list.id).update({ 60 60 title, 61 61 replies_policy: repliesPolicy, 62 62 exclusive, ··· 141 141 142 142 (async () => { 143 143 try { 144 - await masto.v1.lists.remove(list.id); 144 + await masto.v1.lists.$select(list.id).remove(); 145 145 setUIState('default'); 146 146 onClose?.({ 147 147 state: 'deleted',
+1 -1
src/components/notification-service.jsx
··· 38 38 ? getAccountByAccessToken(accessToken) 39 39 : getCurrentAccount(); 40 40 (async () => { 41 - const notification = await masto.v1.notifications.fetch(id); 41 + const notification = await masto.v1.notifications.$select(id).fetch(); 42 42 if (notification && account) { 43 43 console.log('🛎️ Notification', { id, notification, account }); 44 44 const accountInstance = account.instanceURL;
+2 -2
src/components/shortcuts-settings.jsx
··· 135 135 id: 'list', 136 136 title: mem( 137 137 async ({ id }) => { 138 - const list = await api().masto.v1.lists.fetch(id); 138 + const list = await api().masto.v1.lists.$select(id).fetch(); 139 139 return list.title; 140 140 }, 141 141 { ··· 169 169 id: 'account-statuses', 170 170 title: mem( 171 171 async ({ id }) => { 172 - const account = await api().masto.v1.accounts.fetch(id); 172 + const account = await api().masto.v1.accounts.$select(id).fetch(); 173 173 return account.username || account.acct || account.displayName; 174 174 }, 175 175 {
+43 -37
src/components/status.jsx
··· 68 68 69 69 function fetchAccount(id, masto) { 70 70 try { 71 - return masto.v1.accounts.fetch(id); 71 + return masto.v1.accounts.$select(id).fetch(); 72 72 } catch (e) { 73 73 return Promise.reject(e); 74 74 } ··· 390 390 reblogsCount: reblogsCount + (reblogged ? -1 : 1), 391 391 }; 392 392 if (reblogged) { 393 - const newStatus = await masto.v1.statuses.unreblog(id); 393 + const newStatus = await masto.v1.statuses.$select(id).unreblog(); 394 394 saveStatus(newStatus, instance); 395 395 return true; 396 396 } else { 397 - const newStatus = await masto.v1.statuses.reblog(id); 397 + const newStatus = await masto.v1.statuses.$select(id).reblog(); 398 398 saveStatus(newStatus, instance); 399 399 return true; 400 400 } ··· 418 418 reblogsCount: reblogsCount + (reblogged ? -1 : 1), 419 419 }; 420 420 if (reblogged) { 421 - const newStatus = await masto.v1.statuses.unreblog(id); 421 + const newStatus = await masto.v1.statuses.$select(id).unreblog(); 422 422 saveStatus(newStatus, instance); 423 423 return true; 424 424 } else { 425 - const newStatus = await masto.v1.statuses.reblog(id); 425 + const newStatus = await masto.v1.statuses.$select(id).reblog(); 426 426 saveStatus(newStatus, instance); 427 427 return true; 428 428 } ··· 446 446 favouritesCount: favouritesCount + (favourited ? -1 : 1), 447 447 }; 448 448 if (favourited) { 449 - const newStatus = await masto.v1.statuses.unfavourite(id); 449 + const newStatus = await masto.v1.statuses.$select(id).unfavourite(); 450 450 saveStatus(newStatus, instance); 451 451 } else { 452 - const newStatus = await masto.v1.statuses.favourite(id); 452 + const newStatus = await masto.v1.statuses.$select(id).favourite(); 453 453 saveStatus(newStatus, instance); 454 454 } 455 455 } catch (e) { ··· 470 470 bookmarked: !bookmarked, 471 471 }; 472 472 if (bookmarked) { 473 - const newStatus = await masto.v1.statuses.unbookmark(id); 473 + const newStatus = await masto.v1.statuses.$select(id).unbookmark(); 474 474 saveStatus(newStatus, instance); 475 475 } else { 476 - const newStatus = await masto.v1.statuses.bookmark(id); 476 + const newStatus = await masto.v1.statuses.$select(id).bookmark(); 477 477 saveStatus(newStatus, instance); 478 478 } 479 479 } catch (e) { ··· 708 708 <MenuItem 709 709 onClick={async () => { 710 710 try { 711 - const newStatus = await masto.v1.statuses[ 712 - muted ? 'unmute' : 'mute' 713 - ](id); 711 + const newStatus = await masto.v1.statuses 712 + .$select(id) 713 + [muted ? 'unmute' : 'mute'](); 714 714 saveStatus(newStatus, instance); 715 715 showToast(muted ? 'Conversation unmuted' : 'Conversation muted'); 716 716 } catch (e) { ··· 763 763 // if (yes) { 764 764 (async () => { 765 765 try { 766 - await masto.v1.statuses.remove(id); 766 + await masto.v1.statuses.$select(id).remove(); 767 767 const cachedStatus = getStatus(id, instance); 768 768 cachedStatus._deleted = true; 769 769 showToast('Deleted'); ··· 1212 1212 }} 1213 1213 refresh={() => { 1214 1214 return masto.v1.polls 1215 - .fetch(poll.id) 1215 + .$select(poll.id) 1216 + .fetch() 1216 1217 .then((pollResponse) => { 1217 1218 states.statuses[sKey].poll = pollResponse; 1218 1219 }) ··· 1220 1221 }} 1221 1222 votePoll={(choices) => { 1222 1223 return masto.v1.polls 1223 - .vote(poll.id, { 1224 + .$select(poll.id) 1225 + .votes.create({ 1224 1226 choices, 1225 1227 }) 1226 1228 .then((pollResponse) => { ··· 1498 1500 statusID={showEdited} 1499 1501 instance={instance} 1500 1502 fetchStatusHistory={() => { 1501 - return masto.v1.statuses.listHistory(showEdited); 1503 + return masto.v1.statuses.$select(showEdited).history.list(); 1502 1504 }} 1503 1505 onClose={() => { 1504 1506 setShowEdited(false); ··· 1585 1587 // NOTE: This is for quote post 1586 1588 // (async () => { 1587 1589 // const { masto } = api({ instance }); 1588 - // const status = await masto.v1.statuses.fetch(id); 1590 + // const status = await masto.v1.statuses.$select(id).fetch(); 1589 1591 // saveStatus(status, instance); 1590 1592 // setCardStatusID(id); 1591 1593 // })(); ··· 1805 1807 (async () => { 1806 1808 try { 1807 1809 if (firstLoad) { 1808 - reblogIterator.current = masto.v1.statuses.listRebloggedBy(statusID, { 1809 - limit: REACTIONS_LIMIT, 1810 - }); 1811 - favouriteIterator.current = masto.v1.statuses.listFavouritedBy( 1812 - statusID, 1813 - { 1810 + reblogIterator.current = masto.v1.statuses 1811 + .$select(statusID) 1812 + .rebloggedBy.list({ 1813 + limit: REACTIONS_LIMIT, 1814 + }); 1815 + favouriteIterator.current = masto.v1.statuses 1816 + .$select(statusID) 1817 + .favouritedBy.list({ 1814 1818 limit: REACTIONS_LIMIT, 1815 - }, 1816 - ); 1819 + }); 1817 1820 } 1818 1821 const [{ value: reblogResults }, { value: favouriteResults }] = 1819 1822 await Promise.allSettled([ ··· 2043 2046 if (statusMatch) { 2044 2047 const id = statusMatch[3]; 2045 2048 const { masto } = api({ instance: domain }); 2046 - remoteInstanceFetch = masto.v1.statuses.fetch(id).then((status) => { 2047 - if (status?.id) { 2048 - return { 2049 - status, 2050 - instance: domain, 2051 - }; 2052 - } else { 2053 - throw new Error('No results'); 2054 - } 2055 - }); 2049 + remoteInstanceFetch = masto.v1.statuses 2050 + .$select(id) 2051 + .fetch() 2052 + .then((status) => { 2053 + if (status?.id) { 2054 + return { 2055 + status, 2056 + instance: domain, 2057 + }; 2058 + } else { 2059 + throw new Error('No results'); 2060 + } 2061 + }); 2056 2062 } 2057 2063 2058 2064 const { masto } = api({ instance }); 2059 - const mastoSearchFetch = masto.v2 2060 - .search({ 2065 + const mastoSearchFetch = masto.v2.search 2066 + .fetch({ 2061 2067 q: url, 2062 2068 type: 'statuses', 2063 2069 resolve: true,
+1 -1
src/components/translation-block.jsx
··· 55 55 ); 56 56 }, 57 57 }); 58 - // return masto.v1.statuses.translate(id, { 58 + // return masto.v1.statuses.$select(id).translate({ 59 59 // lang: DEFAULT_LANG, 60 60 // }); 61 61 }
+16 -11
src/pages/account-statuses.jsx
··· 31 31 const results = []; 32 32 if (firstLoad) { 33 33 const { value: pinnedStatuses } = await masto.v1.accounts 34 - .listStatuses(id, { 34 + .$select(id) 35 + .statuses.list({ 35 36 pinned: true, 36 37 }) 37 38 .next(); ··· 53 54 } 54 55 } 55 56 if (firstLoad || !accountStatusesIterator.current) { 56 - accountStatusesIterator.current = masto.v1.accounts.listStatuses(id, { 57 - limit: LIMIT, 58 - exclude_replies: excludeReplies, 59 - exclude_reblogs: excludeBoosts, 60 - only_media: media, 61 - tagged, 62 - }); 57 + accountStatusesIterator.current = masto.v1.accounts 58 + .$select(id) 59 + .statuses.list({ 60 + limit: LIMIT, 61 + exclude_replies: excludeReplies, 62 + exclude_reblogs: excludeBoosts, 63 + only_media: media, 64 + tagged, 65 + }); 63 66 } 64 67 const { value, done } = await accountStatusesIterator.current.next(); 65 68 if (value?.length) { ··· 86 89 useEffect(() => { 87 90 (async () => { 88 91 try { 89 - const acc = await masto.v1.accounts.fetch(id); 92 + const acc = await masto.v1.accounts.$select(id).fetch(); 90 93 console.log(acc); 91 94 setAccount(acc); 92 95 } catch (e) { 93 96 console.error(e); 94 97 } 95 98 try { 96 - const featuredTags = await masto.v1.accounts.listFeaturedTags(id); 99 + const featuredTags = await masto.v1.accounts 100 + .$select(id) 101 + .featuredTags.list(id); 97 102 console.log({ featuredTags }); 98 103 setFeaturedTags(featuredTags); 99 104 } catch (e) { ··· 113 118 <AccountInfo 114 119 instance={instance} 115 120 account={cachedAccount || id} 116 - fetchAccount={() => masto.v1.accounts.fetch(id)} 121 + fetchAccount={() => masto.v1.accounts.$select(id).fetch()} 117 122 authenticated={authenticated} 118 123 standalone 119 124 />
+3 -3
src/pages/accounts.jsx
··· 52 52 onDblClick={async () => { 53 53 if (isCurrent) { 54 54 try { 55 - const info = await masto.v1.accounts.fetch( 56 - account.info.id, 57 - ); 55 + const info = await masto.v1.accounts 56 + .$select(account.info.id) 57 + .fetch(); 58 58 console.log('fetched account info', info); 59 59 account.info = info; 60 60 store.local.setJSON('accounts', accounts);
+26 -45
src/pages/following.jsx
··· 13 13 14 14 function Following({ title, path, id, ...props }) { 15 15 useTitle(title || 'Following', path || '/following'); 16 - const { masto, instance } = api(); 16 + const { masto, streaming, instance } = api(); 17 17 const snapStates = useSnapshot(states); 18 18 const homeIterator = useRef(); 19 19 const latestItem = useRef(); ··· 22 22 23 23 async function fetchHome(firstLoad) { 24 24 if (firstLoad || !homeIterator.current) { 25 - homeIterator.current = masto.v1.timelines.listHome({ limit: LIMIT }); 25 + homeIterator.current = masto.v1.timelines.home.list({ limit: LIMIT }); 26 26 } 27 27 const results = await homeIterator.current.next(); 28 28 let { value } = results; ··· 53 53 54 54 async function checkForUpdates() { 55 55 try { 56 - const results = await masto.v1.timelines 57 - .listHome({ 56 + const results = await masto.v1.timelines.home 57 + .list({ 58 58 limit: 5, 59 59 since_id: latestItem.current, 60 60 }) ··· 75 75 } 76 76 } 77 77 78 - const ws = useRef(); 79 - const streamUser = async () => { 80 - console.log('🎏 Start streaming user', ws.current); 81 - if ( 82 - ws.current && 83 - (ws.current.readyState === WebSocket.CONNECTING || 84 - ws.current.readyState === WebSocket.OPEN) 85 - ) { 86 - console.log('🎏 Streaming user already open'); 87 - return; 88 - } 89 - const stream = await masto.v1.stream.streamUser(); 90 - ws.current = stream.ws; 91 - ws.current.__id = Math.random(); 92 - console.log('🎏 Streaming user', ws.current); 93 - 94 - stream.on('status.update', (status) => { 95 - console.log(`🔄 Status ${status.id} updated`); 96 - saveStatus(status, instance); 97 - }); 98 - 99 - stream.on('delete', (statusID) => { 100 - console.log(`❌ Status ${statusID} deleted`); 101 - // delete states.statuses[statusID]; 102 - const s = getStatus(statusID, instance); 103 - if (s) s._deleted = true; 104 - }); 105 - 106 - stream.ws.onclose = () => { 107 - console.log('🎏 Streaming user closed'); 108 - }; 109 - 110 - return stream; 111 - }; 112 78 useEffect(() => { 113 - let stream; 79 + let sub; 114 80 (async () => { 115 - stream = await streamUser(); 81 + if (streaming) { 82 + sub = streaming.user.subscribe(); 83 + console.log('🎏 Streaming user', sub); 84 + for await (const entry of sub) { 85 + if (!sub) break; 86 + if (entry.event === 'status.update') { 87 + const status = entry.payload; 88 + console.log(`🔄 Status ${status.id} updated`); 89 + saveStatus(status, instance); 90 + } else if (entry.event === 'delete') { 91 + const statusID = entry.payload; 92 + console.log(`❌ Status ${statusID} deleted`); 93 + // delete states.statuses[statusID]; 94 + const s = getStatus(statusID, instance); 95 + if (s) s._deleted = true; 96 + } 97 + } 98 + } 116 99 })(); 117 100 return () => { 118 - if (stream) { 119 - stream.ws.close(); 120 - ws.current = null; 121 - } 101 + sub?.unsubscribe?.(); 102 + sub = null; 122 103 }; 123 - }, []); 104 + }, [streaming]); 124 105 125 106 return ( 126 107 <Timeline
+12 -8
src/pages/hashtag.jsx
··· 46 46 const maxID = useRef(undefined); 47 47 async function fetchHashtags(firstLoad) { 48 48 // if (firstLoad || !hashtagsIterator.current) { 49 - // hashtagsIterator.current = masto.v1.timelines.listHashtag(hashtag, { 49 + // hashtagsIterator.current = masto.v1.timelines.tag.$select(hashtag).list({ 50 50 // limit: LIMIT, 51 51 // any: hashtags.slice(1), 52 52 // }); ··· 54 54 // const results = await hashtagsIterator.current.next(); 55 55 56 56 // NOTE: Temporary fix for listHashtag not persisting `any` in subsequent calls. 57 - const results = await masto.v1.timelines 58 - .listHashtag(hashtag, { 57 + const results = await masto.v1.timelines.tag 58 + .$select(hashtag) 59 + .list({ 59 60 limit: LIMIT, 60 61 any: hashtags.slice(1), 61 62 maxId: firstLoad ? undefined : maxID.current, ··· 81 82 82 83 async function checkForUpdates() { 83 84 try { 84 - const results = await masto.v1.timelines 85 - .listHashtag(hashtag, { 85 + const results = await masto.v1.timelines.tag 86 + .$select(hashtag) 87 + .list({ 86 88 limit: 1, 87 89 any: hashtags.slice(1), 88 90 since_id: latestItem.current, ··· 104 106 useEffect(() => { 105 107 (async () => { 106 108 try { 107 - const info = await masto.v1.tags.fetch(hashtag); 109 + const info = await masto.v1.tags.$select(hashtag).fetch(); 108 110 console.log(info); 109 111 setInfo(info); 110 112 } catch (e) { ··· 163 165 // return; 164 166 // } 165 167 masto.v1.tags 166 - .unfollow(hashtag) 168 + .$select(hashtag) 169 + .unfollow() 167 170 .then(() => { 168 171 setInfo({ ...info, following: false }); 169 172 showToast(`Unfollowed #${hashtag}`); ··· 177 180 }); 178 181 } else { 179 182 masto.v1.tags 180 - .follow(hashtag) 183 + .$select(hashtag) 184 + .follow() 181 185 .then(() => { 182 186 setInfo({ ...info, following: true }); 183 187 showToast(`Followed #${hashtag}`);
+10 -8
src/pages/list.jsx
··· 32 32 const listIterator = useRef(); 33 33 async function fetchList(firstLoad) { 34 34 if (firstLoad || !listIterator.current) { 35 - listIterator.current = masto.v1.timelines.listList(id, { 35 + listIterator.current = masto.v1.timelines.list.$select(id).list({ 36 36 limit: LIMIT, 37 37 }); 38 38 } ··· 56 56 57 57 async function checkForUpdates() { 58 58 try { 59 - const results = await masto.v1.timelines.listList(id, { 59 + const results = await masto.v1.timelines.list.$select(id).list({ 60 60 limit: 1, 61 61 since_id: latestItem.current, 62 62 }); ··· 77 77 useEffect(() => { 78 78 (async () => { 79 79 try { 80 - const list = await masto.v1.lists.fetch(id); 80 + const list = await masto.v1.lists.$select(id).fetch(); 81 81 setList(list); 82 82 // setTitle(list.title); 83 83 } catch (e) { ··· 200 200 (async () => { 201 201 try { 202 202 if (firstLoad || !membersIterator.current) { 203 - membersIterator.current = masto.v1.lists.listAccounts(listID, { 204 - limit: MEMBERS_LIMIT, 205 - }); 203 + membersIterator.current = masto.v1.lists 204 + .$select(listID) 205 + .accounts.list({ 206 + limit: MEMBERS_LIMIT, 207 + }); 206 208 } 207 209 const results = await membersIterator.current.next(); 208 210 let { done, value } = results; ··· 274 276 setUIState('loading'); 275 277 (async () => { 276 278 try { 277 - await masto.v1.lists.addAccount(listID, { 279 + await masto.v1.lists.$select(listID).accounts.create({ 278 280 accountIds: [account.id], 279 281 }); 280 282 setUIState('default'); ··· 290 292 291 293 (async () => { 292 294 try { 293 - await masto.v1.lists.removeAccount(listID, { 295 + await masto.v1.lists.$select(listID).accounts.remove({ 294 296 accountIds: [account.id], 295 297 }); 296 298 setUIState('default');
+3 -3
src/pages/public.jsx
··· 29 29 const publicIterator = useRef(); 30 30 async function fetchPublic(firstLoad) { 31 31 if (firstLoad || !publicIterator.current) { 32 - publicIterator.current = masto.v1.timelines.listPublic({ 32 + publicIterator.current = masto.v1.timelines.public.list({ 33 33 limit: LIMIT, 34 34 local: isLocal, 35 35 }); ··· 54 54 55 55 async function checkForUpdates() { 56 56 try { 57 - const results = await masto.v1.timelines 58 - .listPublic({ 57 + const results = await masto.v1.timelines.public 58 + .list({ 59 59 limit: 1, 60 60 local: isLocal, 61 61 since_id: latestItem.current,
+1 -1
src/pages/search.jsx
··· 90 90 if (authenticated) params.offset = offsetRef.current; 91 91 } 92 92 try { 93 - const results = await masto.v2.search(params); 93 + const results = await masto.v2.search.fetch(params); 94 94 console.log(results); 95 95 if (type) { 96 96 if (firstLoad) {
+15 -11
src/pages/status.jsx
··· 100 100 if (!heroStatus && showMedia) { 101 101 (async () => { 102 102 try { 103 - const status = await masto.v1.statuses.fetch(id); 103 + const status = await masto.v1.statuses.$select(id).fetch(); 104 104 saveStatus(status, instance); 105 105 setHeroStatus(status); 106 106 } catch (err) { ··· 235 235 236 236 (async () => { 237 237 const heroFetch = () => 238 - pRetry(() => masto.v1.statuses.fetch(id), { 238 + pRetry(() => masto.v1.statuses.$select(id).fetch(), { 239 239 retries: 4, 240 240 }); 241 - const contextFetch = pRetry(() => masto.v1.statuses.fetchContext(id), { 242 - retries: 8, 243 - }); 241 + const contextFetch = pRetry( 242 + () => masto.v1.statuses.$select(id).context.fetch(), 243 + { 244 + retries: 8, 245 + }, 246 + ); 244 247 245 248 const hasStatus = !!snapStates.statuses[sKey]; 246 249 let heroStatus = snapStates.statuses[sKey]; ··· 946 949 setUIState('loading'); 947 950 (async () => { 948 951 try { 949 - const results = await currentMasto.v2.search({ 950 - q: heroStatus.url, 951 - type: 'statuses', 952 - resolve: true, 953 - limit: 1, 954 - }); 952 + const results = 953 + await currentMasto.v2.search.fetch({ 954 + q: heroStatus.url, 955 + type: 'statuses', 956 + resolve: true, 957 + limit: 1, 958 + }); 955 959 if (results.statuses.length) { 956 960 const status = results.statuses[0]; 957 961 location.hash = currentInstance
+4 -4
src/pages/trending.jsx
··· 30 30 const trendIterator = useRef(); 31 31 async function fetchTrend(firstLoad) { 32 32 if (firstLoad || !trendIterator.current) { 33 - trendIterator.current = masto.v1.trends.listStatuses({ 33 + trendIterator.current = masto.v1.trends.statuses.list({ 34 34 limit: LIMIT, 35 35 }); 36 36 37 37 // Get hashtags 38 38 try { 39 - const iterator = masto.v1.trends.listTags(); 39 + const iterator = masto.v1.trends.tags.list(); 40 40 const { value: tags } = await iterator.next(); 41 41 console.log(tags); 42 42 setHashtags(tags); ··· 64 64 65 65 async function checkForUpdates() { 66 66 try { 67 - const results = await masto.v1.trends 68 - .listStatuses({ 67 + const results = await masto.v1.trends.statuses 68 + .list({ 69 69 limit: 1, 70 70 // NOT SUPPORTED 71 71 // since_id: latestItem.current,
+67 -24
src/utils/api.js
··· 1 - import { createClient } from 'masto'; 1 + import { createRestAPIClient, createStreamingAPIClient } from 'masto'; 2 2 3 3 import store from './store'; 4 4 import { ··· 37 37 } 38 38 const url = instance ? `https://${instance}` : `https://${DEFAULT_INSTANCE}`; 39 39 40 - const client = createClient({ 40 + const masto = createRestAPIClient({ 41 41 url, 42 42 accessToken, // Can be null 43 - disableVersionCheck: true, // Allow non-Mastodon instances 44 43 timeout: 30_000, // Unfortunatly this is global instead of per-request 45 44 }); 46 - client.__instance__ = instance; 47 45 46 + const client = { 47 + masto, 48 + instance, 49 + accessToken, 50 + }; 48 51 apis[instance] = client; 49 52 if (!accountApis[instance]) accountApis[instance] = {}; 50 53 if (accessToken) accountApis[instance][accessToken] = client; ··· 55 58 // Get the instance information 56 59 // The config is needed for composing 57 60 export async function initInstance(client, instance) { 58 - const masto = client; 61 + console.log('INIT INSTANCE', client, instance); 62 + const { masto, accessToken } = client; 59 63 // Request v2, fallback to v1 if fail 60 64 let info; 61 65 try { ··· 63 67 } catch (e) {} 64 68 if (!info) { 65 69 try { 66 - info = await masto.v1.instances.fetch(); 70 + info = await masto.v1.instance.fetch(); 67 71 } catch (e) {} 68 72 } 69 73 if (!info) return; ··· 91 95 store.local.setJSON('instances', instances); 92 96 // This is a weird place to put this but here's updating the masto instance with the streaming API URL set in the configuration 93 97 // Reason: Streaming WebSocket URL may change, unlike the standard API REST URLs 94 - if (streamingApi || streaming) { 98 + const supportsWebSocket = 'WebSocket' in window; 99 + if (supportsWebSocket && (streamingApi || streaming)) { 95 100 console.log('🎏 Streaming API URL:', streaming || streamingApi); 96 - masto.config.props.streamingApiUrl = streaming || streamingApi; 101 + // masto.config.props.streamingApiUrl = streaming || streamingApi; 102 + // Legacy masto.ws 103 + const streamClient = createStreamingAPIClient({ 104 + streamingApiUrl: streaming || streamingApi, 105 + accessToken, 106 + implementation: WebSocket, 107 + }); 108 + client.streaming = streamClient; 109 + // masto.ws = streamClient; 110 + console.log('🎏 Streaming API client:', client); 97 111 } 98 112 } 99 113 100 114 // Get the account information and store it 101 115 export async function initAccount(client, instance, accessToken, vapidKey) { 102 - const masto = client; 116 + const { masto } = client; 103 117 const mastoAccount = await masto.v1.accounts.verifyCredentials(); 104 118 119 + console.log('CURRENTACCOUNT SET', mastoAccount.id); 105 120 store.session.set('currentAccount', mastoAccount.id); 106 121 107 122 saveAccount({ ··· 115 130 // Get preferences 116 131 export async function initPreferences(client) { 117 132 try { 118 - const masto = client; 133 + const { masto } = client; 119 134 const preferences = await masto.v1.preferences.fetch(); 120 135 store.account.set('preferences', preferences); 121 136 } catch (e) { ··· 134 149 135 150 // If instance and accessToken are provided, get the masto instance for that account 136 151 if (instance && accessToken) { 152 + const client = 153 + accountApis[instance]?.[accessToken] || 154 + initClient({ instance, accessToken }); 155 + const { masto, streaming } = client; 137 156 return { 138 - masto: 139 - accountApis[instance]?.[accessToken] || 140 - initClient({ instance, accessToken }), 157 + masto, 158 + streaming, 159 + client, 141 160 authenticated: true, 142 161 instance, 143 162 }; ··· 149 168 for (const instance in accountApis) { 150 169 if (accountApis[instance][accessToken]) { 151 170 console.log('X 2', accountApis, instance, accessToken); 171 + const client = accountApis[instance][accessToken]; 172 + const { masto, streaming } = client; 152 173 return { 153 - masto: accountApis[instance][accessToken], 174 + masto, 175 + streaming, 176 + client, 154 177 authenticated: true, 155 178 instance, 156 179 }; ··· 160 183 if (account) { 161 184 const accessToken = account.accessToken; 162 185 const instance = account.instanceURL.toLowerCase().trim(); 186 + const client = initClient({ instance, accessToken }); 187 + const { masto, streaming } = client; 163 188 return { 164 - masto: initClient({ instance, accessToken }), 189 + masto, 190 + streaming, 191 + client, 165 192 authenticated: true, 166 193 instance, 167 194 }; ··· 178 205 if (account) { 179 206 const accessToken = account.accessToken; 180 207 const instance = account.instanceURL.toLowerCase().trim(); 208 + const client = 209 + accountApis[instance]?.[accessToken] || 210 + initClient({ instance, accessToken }); 211 + const { masto, streaming } = client; 181 212 return { 182 - masto: 183 - accountApis[instance]?.[accessToken] || 184 - initClient({ instance, accessToken }), 213 + masto, 214 + streaming, 215 + client, 185 216 authenticated: true, 186 217 instance, 187 218 }; ··· 192 223 193 224 // If only instance is provided, get the masto instance for that instance 194 225 if (instance) { 195 - const masto = apis[instance] || initClient({ instance }); 226 + const client = apis[instance] || initClient({ instance }); 227 + const { masto, streaming, accessToken } = client; 196 228 return { 197 229 masto, 198 - authenticated: !!masto.config.props.accessToken, 230 + streaming, 231 + client, 232 + authenticated: !!accessToken, 199 233 instance, 200 234 }; 201 235 } ··· 203 237 // If no instance is provided, get the masto instance for the current account 204 238 if (currentAccountApi) { 205 239 return { 206 - masto: currentAccountApi, 240 + masto: currentAccountApi.masto, 241 + streaming: currentAccountApi.streaming, 242 + client: currentAccountApi, 207 243 authenticated: true, 208 - instance: currentAccountApi.__instance__, 244 + instance: currentAccountApi.instance, 209 245 }; 210 246 } 211 247 const currentAccount = getCurrentAccount(); ··· 215 251 accountApis[instance]?.[accessToken] || 216 252 initClient({ instance, accessToken }); 217 253 return { 218 - masto: currentAccountApi, 254 + masto: currentAccountApi.masto, 255 + streaming: currentAccountApi.streaming, 256 + client: currentAccountApi, 219 257 authenticated: true, 220 258 instance, 221 259 }; 222 260 } 223 261 224 262 // If no instance is provided and no account is logged in, get the masto instance for DEFAULT_INSTANCE 263 + const client = 264 + apis[DEFAULT_INSTANCE] || initClient({ instance: DEFAULT_INSTANCE }); 265 + const { masto, streaming } = client; 225 266 return { 226 - masto: apis[DEFAULT_INSTANCE] || initClient({ instance: DEFAULT_INSTANCE }), 267 + masto, 268 + streaming, 269 + client, 227 270 authenticated: false, 228 271 instance: DEFAULT_INSTANCE, 229 272 };
+4 -4
src/utils/push-notifications.js
··· 34 34 35 35 function createBackendPushSubscription(subscription) { 36 36 const { masto } = api(); 37 - return masto.v1.webPushSubscriptions.create(subscription); 37 + return masto.v1.push.subscription.create(subscription); 38 38 } 39 39 40 40 function fetchBackendPushSubscription() { 41 41 const { masto } = api(); 42 - return masto.v1.webPushSubscriptions.fetch(); 42 + return masto.v1.push.subscription.fetch(); 43 43 } 44 44 45 45 function updateBackendPushSubscription(subscription) { 46 46 const { masto } = api(); 47 - return masto.v1.webPushSubscriptions.update(subscription); 47 + return masto.v1.push.subscription.update(subscription); 48 48 } 49 49 50 50 function removeBackendPushSubscription() { 51 51 const { masto } = api(); 52 - return masto.v1.webPushSubscriptions.remove(); 52 + return masto.v1.push.subscription.remove(); 53 53 } 54 54 55 55 // Front-end
+2 -2
src/utils/states.js
··· 207 207 if (!prevStatus) { 208 208 if (fetchIndex++ > 3) throw 'Too many fetches for thread'; // Some people revive old threads 209 209 await new Promise((r) => setTimeout(r, 500 * fetchIndex)); // Be nice to rate limits 210 - // prevStatus = await masto.v1.statuses.fetch(inReplyToId); 210 + // prevStatus = await masto.v1.statuses.$.select(inReplyToId).fetch(); 211 211 prevStatus = await fetchStatus(inReplyToId, masto); 212 212 saveStatus(prevStatus, instance, { skipThreading: true }); 213 213 } ··· 230 230 } 231 231 232 232 const fetchStatus = mem((statusID, masto) => { 233 - return masto.v1.statuses.fetch(statusID); 233 + return masto.v1.statuses.$select(statusID).fetch(); 234 234 });