Breaking news: upgrade to masto v6

Expecting bugs!

Also include some fixes for states init.
This commit is contained in:
Lim Chee Aun 2023-10-12 12:48:09 +08:00
parent 5de7eec2ca
commit a095a30500
26 changed files with 379 additions and 608 deletions

399
package-lock.json generated
View file

@ -21,7 +21,7 @@
"idb-keyval": "~6.2.1", "idb-keyval": "~6.2.1",
"just-debounce-it": "~3.2.0", "just-debounce-it": "~3.2.0",
"lz-string": "~1.5.0", "lz-string": "~1.5.0",
"masto": "~5.11.4", "masto": "~6.3.1",
"mem": "~9.0.2", "mem": "~9.0.2",
"p-retry": "~6.1.0", "p-retry": "~6.1.0",
"p-throttle": "~5.1.0", "p-throttle": "~5.1.0",
@ -3133,18 +3133,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/@mastojs/ponyfills": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@mastojs/ponyfills/-/ponyfills-1.0.4.tgz",
"integrity": "sha512-1NaIGmcU7OmyNzx0fk+cYeGTkdXlOJOSdetaC4pStVWsrhht2cdlYSAfe5NDW3FcUmcEm2vVceB9lcClN1RCxw==",
"dependencies": {
"@types/node": "^18.11.17",
"@types/node-fetch": "^2.6.2",
"abort-controller": "^3.0.0",
"form-data": "^4.0.0",
"node-fetch": "^2.6.7"
}
},
"node_modules/@nodelib/fs.scandir": { "node_modules/@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -3373,29 +3361,8 @@
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.11.17", "version": "18.11.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz",
"integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==" "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==",
}, "dev": true
"node_modules/@types/node-fetch": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
"dependencies": {
"@types/node": "*",
"form-data": "^3.0.0"
}
},
"node_modules/@types/node-fetch/node_modules/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
}, },
"node_modules/@types/resolve": { "node_modules/@types/resolve": {
"version": "1.17.1", "version": "1.17.1",
@ -3510,17 +3477,6 @@
"optional": true, "optional": true,
"peer": true "peer": true
}, },
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.8.1", "version": "8.8.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
@ -3597,11 +3553,6 @@
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==",
"dev": true "dev": true
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/at-least-node": { "node_modules/at-least-node": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
@ -3790,6 +3741,7 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"dependencies": { "dependencies": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2" "get-intrinsic": "^1.0.2"
@ -3893,17 +3845,6 @@
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -4128,14 +4069,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/dot-case": { "node_modules/dot-case": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz",
@ -4320,18 +4253,10 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/event-target-shim": { "node_modules/events-to-async": {
"version": "5.0.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "resolved": "https://registry.npmjs.org/events-to-async/-/events-to-async-2.0.0.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "integrity": "sha512-NiZEr4g51nI4/lz/6NdwMqK/TLIctlnp9TQ3wCJjlRp47VgrthUZE4nrk2UhfZ8VzoQ/Xyth+G6MKioLCt0FVA=="
"engines": {
"node": ">=6"
}
},
"node_modules/eventemitter3": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.0.tgz",
"integrity": "sha512-riuVbElZZNXLeLEoprfNYoDSwTBRR44X3mnhdI1YcnENpWTCsTTVZ2zFuqQcpoyqPQIUXdiPEU0ECAq0KQRaHg=="
}, },
"node_modules/fast-blurhash": { "node_modules/fast-blurhash": {
"version": "1.1.2", "version": "1.1.2",
@ -4425,19 +4350,6 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fraction.js": { "node_modules/fraction.js": {
"version": "4.3.6", "version": "4.3.6",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz",
@ -4489,7 +4401,8 @@
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
}, },
"node_modules/function.prototype.name": { "node_modules/function.prototype.name": {
"version": "1.1.5", "version": "1.1.5",
@ -4531,6 +4444,7 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"dev": true,
"dependencies": { "dependencies": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"has": "^1.0.3", "has": "^1.0.3",
@ -4641,6 +4555,7 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"dependencies": { "dependencies": {
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
}, },
@ -4682,6 +4597,7 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
"dev": true,
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
}, },
@ -4693,6 +4609,7 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"dev": true,
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
}, },
@ -5307,17 +5224,6 @@
"tslib": "^2.0.3" "tslib": "^2.0.3"
} }
}, },
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/lz-string": { "node_modules/lz-string": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
@ -5347,33 +5253,17 @@
} }
}, },
"node_modules/masto": { "node_modules/masto": {
"version": "5.11.4", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/masto/-/masto-5.11.4.tgz", "resolved": "https://registry.npmjs.org/masto/-/masto-6.3.1.tgz",
"integrity": "sha512-sLF3SJTNZDAP57Y+8vAdd1KQTuWWxmGUrBF1R2GLPL6zij/1wXxV05+h8GZhnfg+696arkt+w6ZlKvEEfH1yvg==", "integrity": "sha512-Os3MlbGFNL6KHxlKldYY+d/1exO6oBjtF4vx8d6cmXRmeeeW3mKQeunTZz+yY5qWksPg2eVdk+FOhaEnOeclVw==",
"dependencies": { "dependencies": {
"@mastojs/ponyfills": "^1.0.4",
"change-case": "^4.1.2", "change-case": "^4.1.2",
"eventemitter3": "^5.0.0", "events-to-async": "^2.0.0",
"isomorphic-ws": "^5.0.0", "isomorphic-ws": "^5.0.0",
"qs": "^6.11.0", "ts-custom-error": "^3.3.1",
"semver": "^7.3.7",
"ws": "^8.13.0" "ws": "^8.13.0"
} }
}, },
"node_modules/masto/node_modules/semver": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/mem": { "node_modules/mem": {
"version": "9.0.2", "version": "9.0.2",
"resolved": "https://registry.npmjs.org/mem/-/mem-9.0.2.tgz", "resolved": "https://registry.npmjs.org/mem/-/mem-9.0.2.tgz",
@ -5421,6 +5311,7 @@
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
} }
@ -5429,6 +5320,7 @@
"version": "2.1.35", "version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"dependencies": { "dependencies": {
"mime-db": "1.52.0" "mime-db": "1.52.0"
}, },
@ -5492,44 +5384,6 @@
"tslib": "^2.0.3" "tslib": "^2.0.3"
} }
}, },
"node_modules/node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-fetch/node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"node_modules/node-fetch/node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"node_modules/node-fetch/node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.13", "version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@ -5557,6 +5411,7 @@
"version": "1.12.3", "version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
"dev": true,
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
@ -6461,20 +6316,6 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/queue-microtask": { "node_modules/queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -6860,6 +6701,7 @@
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dev": true,
"dependencies": { "dependencies": {
"call-bind": "^1.0.0", "call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2", "get-intrinsic": "^1.0.2",
@ -7137,6 +6979,14 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/ts-custom-error": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz",
"integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
@ -7991,11 +7841,6 @@
"optional": true "optional": true
} }
} }
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
} }
}, },
"dependencies": { "dependencies": {
@ -9806,18 +9651,6 @@
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.0.1.tgz",
"integrity": "sha512-uSvJdwQU5nK+Vdf6zxcWAY2A8r7uqe+gePwLWzJ+fsQehq18pc0I2hJKwypZ2aLM90+Er9u1xn4iLJPZ+xlL4g==" "integrity": "sha512-uSvJdwQU5nK+Vdf6zxcWAY2A8r7uqe+gePwLWzJ+fsQehq18pc0I2hJKwypZ2aLM90+Er9u1xn4iLJPZ+xlL4g=="
}, },
"@mastojs/ponyfills": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@mastojs/ponyfills/-/ponyfills-1.0.4.tgz",
"integrity": "sha512-1NaIGmcU7OmyNzx0fk+cYeGTkdXlOJOSdetaC4pStVWsrhht2cdlYSAfe5NDW3FcUmcEm2vVceB9lcClN1RCxw==",
"requires": {
"@types/node": "^18.11.17",
"@types/node-fetch": "^2.6.2",
"abort-controller": "^3.0.0",
"form-data": "^4.0.0",
"node-fetch": "^2.6.7"
}
},
"@nodelib/fs.scandir": { "@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -9998,28 +9831,8 @@
"@types/node": { "@types/node": {
"version": "18.11.17", "version": "18.11.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz",
"integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==" "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==",
}, "dev": true
"@types/node-fetch": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
"requires": {
"@types/node": "*",
"form-data": "^3.0.0"
},
"dependencies": {
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
}, },
"@types/resolve": { "@types/resolve": {
"version": "1.17.1", "version": "1.17.1",
@ -10128,14 +9941,6 @@
"optional": true, "optional": true,
"peer": true "peer": true
}, },
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"requires": {
"event-target-shim": "^5.0.0"
}
},
"acorn": { "acorn": {
"version": "8.8.1", "version": "8.8.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
@ -10190,11 +9995,6 @@
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==",
"dev": true "dev": true
}, },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"at-least-node": { "at-least-node": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
@ -10311,6 +10111,7 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2" "get-intrinsic": "^1.0.2"
@ -10391,14 +10192,6 @@
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true "dev": true
}, },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": { "commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -10531,11 +10324,6 @@
"object-keys": "^1.1.1" "object-keys": "^1.1.1"
} }
}, },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"dot-case": { "dot-case": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz",
@ -10683,15 +10471,10 @@
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true "dev": true
}, },
"event-target-shim": { "events-to-async": {
"version": "5.0.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "resolved": "https://registry.npmjs.org/events-to-async/-/events-to-async-2.0.0.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" "integrity": "sha512-NiZEr4g51nI4/lz/6NdwMqK/TLIctlnp9TQ3wCJjlRp47VgrthUZE4nrk2UhfZ8VzoQ/Xyth+G6MKioLCt0FVA=="
},
"eventemitter3": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.0.tgz",
"integrity": "sha512-riuVbElZZNXLeLEoprfNYoDSwTBRR44X3mnhdI1YcnENpWTCsTTVZ2zFuqQcpoyqPQIUXdiPEU0ECAq0KQRaHg=="
}, },
"fast-blurhash": { "fast-blurhash": {
"version": "1.1.2", "version": "1.1.2",
@ -10778,16 +10561,6 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"fraction.js": { "fraction.js": {
"version": "4.3.6", "version": "4.3.6",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz",
@ -10822,7 +10595,8 @@
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
}, },
"function.prototype.name": { "function.prototype.name": {
"version": "1.1.5", "version": "1.1.5",
@ -10852,6 +10626,7 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
"has": "^1.0.3", "has": "^1.0.3",
@ -10932,6 +10707,7 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
} }
@ -10960,12 +10736,14 @@
"has-proto": { "has-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
"dev": true
}, },
"has-symbols": { "has-symbols": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"dev": true
}, },
"has-tostringtag": { "has-tostringtag": {
"version": "1.0.0", "version": "1.0.0",
@ -11409,14 +11187,6 @@
"tslib": "^2.0.3" "tslib": "^2.0.3"
} }
}, },
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"lz-string": { "lz-string": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
@ -11440,27 +11210,15 @@
} }
}, },
"masto": { "masto": {
"version": "5.11.4", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/masto/-/masto-5.11.4.tgz", "resolved": "https://registry.npmjs.org/masto/-/masto-6.3.1.tgz",
"integrity": "sha512-sLF3SJTNZDAP57Y+8vAdd1KQTuWWxmGUrBF1R2GLPL6zij/1wXxV05+h8GZhnfg+696arkt+w6ZlKvEEfH1yvg==", "integrity": "sha512-Os3MlbGFNL6KHxlKldYY+d/1exO6oBjtF4vx8d6cmXRmeeeW3mKQeunTZz+yY5qWksPg2eVdk+FOhaEnOeclVw==",
"requires": { "requires": {
"@mastojs/ponyfills": "^1.0.4",
"change-case": "^4.1.2", "change-case": "^4.1.2",
"eventemitter3": "^5.0.0", "events-to-async": "^2.0.0",
"isomorphic-ws": "^5.0.0", "isomorphic-ws": "^5.0.0",
"qs": "^6.11.0", "ts-custom-error": "^3.3.1",
"semver": "^7.3.7",
"ws": "^8.13.0" "ws": "^8.13.0"
},
"dependencies": {
"semver": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"requires": {
"lru-cache": "^6.0.0"
}
}
} }
}, },
"mem": { "mem": {
@ -11497,12 +11255,14 @@
"mime-db": { "mime-db": {
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true
}, },
"mime-types": { "mime-types": {
"version": "2.1.35", "version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"requires": { "requires": {
"mime-db": "1.52.0" "mime-db": "1.52.0"
} }
@ -11542,35 +11302,6 @@
"tslib": "^2.0.3" "tslib": "^2.0.3"
} }
}, },
"node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
},
"dependencies": {
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
}
}
},
"node-releases": { "node-releases": {
"version": "2.0.13", "version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@ -11591,7 +11322,8 @@
"object-inspect": { "object-inspect": {
"version": "1.12.3", "version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
"dev": true
}, },
"object-keys": { "object-keys": {
"version": "1.1.1", "version": "1.1.1",
@ -12059,14 +11791,6 @@
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
"dev": true "dev": true
}, },
"qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"requires": {
"side-channel": "^1.0.4"
}
},
"queue-microtask": { "queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -12322,6 +12046,7 @@
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dev": true,
"requires": { "requires": {
"call-bind": "^1.0.0", "call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2", "get-intrinsic": "^1.0.2",
@ -12527,6 +12252,11 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"ts-custom-error": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz",
"integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A=="
},
"tslib": { "tslib": {
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
@ -13153,11 +12883,6 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"requires": {} "requires": {}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
} }
} }
} }

View file

@ -23,7 +23,7 @@
"idb-keyval": "~6.2.1", "idb-keyval": "~6.2.1",
"just-debounce-it": "~3.2.0", "just-debounce-it": "~3.2.0",
"lz-string": "~1.5.0", "lz-string": "~1.5.0",
"masto": "~5.11.4", "masto": "~6.3.1",
"mem": "~9.0.2", "mem": "~9.0.2",
"p-retry": "~6.1.0", "p-retry": "~6.1.0",
"p-throttle": "~5.1.0", "p-throttle": "~5.1.0",

View file

@ -114,13 +114,13 @@ function App() {
code, code,
}); });
const masto = initClient({ instance: instanceURL, accessToken }); const client = initClient({ instance: instanceURL, accessToken });
await Promise.allSettled([ await Promise.allSettled([
initInstance(masto, instanceURL), initInstance(client, instanceURL),
initAccount(masto, instanceURL, accessToken, vapidKey), initAccount(client, instanceURL, accessToken, vapidKey),
]); ]);
initStates(); initStates();
initPreferences(masto); initPreferences(client);
setIsLoggedIn(true); setIsLoggedIn(true);
setUIState('default'); setUIState('default');
@ -130,14 +130,15 @@ function App() {
const account = getCurrentAccount(); const account = getCurrentAccount();
if (account) { if (account) {
store.session.set('currentAccount', account.info.id); store.session.set('currentAccount', account.info.id);
const { masto, instance } = api({ account }); const { client } = api({ account });
console.log('masto', masto); const { instance } = client;
// console.log('masto', masto);
initStates(); initStates();
initPreferences(masto); initPreferences(client);
setUIState('loading'); setUIState('loading');
(async () => { (async () => {
try { try {
await initInstance(masto, instance); await initInstance(client, instance);
} catch (e) { } catch (e) {
} finally { } finally {
setIsLoggedIn(true); setIsLoggedIn(true);
@ -253,9 +254,9 @@ function App() {
<Shortcuts /> <Shortcuts />
)} )}
<Modals /> <Modals />
<NotificationService /> {isLoggedIn && <NotificationService />}
<BackgroundService isLoggedIn={isLoggedIn} /> <BackgroundService isLoggedIn={isLoggedIn} />
<SearchCommand onClose={focusDeck} /> {uiState !== 'loading' && <SearchCommand onClose={focusDeck} />}
<KeyboardShortcutsHelp /> <KeyboardShortcutsHelp />
</> </>
); );

View file

@ -149,7 +149,7 @@ function AccountInfo({
const familiarFollowersCache = useRef([]); const familiarFollowersCache = useRef([]);
async function fetchFollowers(firstLoad) { async function fetchFollowers(firstLoad) {
if (firstLoad || !followersIterator.current) { if (firstLoad || !followersIterator.current) {
followersIterator.current = masto.v1.accounts.listFollowers(id, { followersIterator.current = masto.v1.accounts.$select(id).followers.list({
limit: LIMIT, limit: LIMIT,
}); });
} }
@ -162,9 +162,9 @@ function AccountInfo({
// On first load, fetch familiar followers, merge to top of results' `value` // On first load, fetch familiar followers, merge to top of results' `value`
// Remove dups on every fetch // Remove dups on every fetch
if (firstLoad) { if (firstLoad) {
const familiarFollowers = await masto.v1.accounts.fetchFamiliarFollowers( const familiarFollowers = await masto.v1.accounts
id, .familiarFollowers(id)
); .fetch();
familiarFollowersCache.current = familiarFollowers[0].accounts; familiarFollowersCache.current = familiarFollowers[0].accounts;
newValue = [ newValue = [
...familiarFollowersCache.current, ...familiarFollowersCache.current,
@ -193,7 +193,7 @@ function AccountInfo({
const followingIterator = useRef(); const followingIterator = useRef();
async function fetchFollowing(firstLoad) { async function fetchFollowing(firstLoad) {
if (firstLoad || !followingIterator.current) { if (firstLoad || !followingIterator.current) {
followingIterator.current = masto.v1.accounts.listFollowing(id, { followingIterator.current = masto.v1.accounts.$select(id).following.list({
limit: LIMIT, limit: LIMIT,
}); });
} }
@ -214,9 +214,12 @@ function AccountInfo({
(async () => { (async () => {
try { try {
const fetchFamiliarFollowers = const fetchFamiliarFollowers =
currentMasto.v1.accounts.fetchFamiliarFollowers(currentID); currentMasto.v1.accounts.familiarFollowers.fetch({
id: [currentID],
});
const fetchStatuses = currentMasto.v1.accounts const fetchStatuses = currentMasto.v1.accounts
.listStatuses(currentID, { .$select(currentID)
.statuses.list({
limit: 20, limit: 20,
}) })
.next(); .next();
@ -712,7 +715,7 @@ function RelatedActions({
// Grab this account from my logged-in instance // Grab this account from my logged-in instance
const acctHasInstance = info.acct.includes('@'); const acctHasInstance = info.acct.includes('@');
try { try {
const results = await currentMasto.v2.search({ const results = await currentMasto.v2.search.fetch({
q: acctHasInstance ? info.acct : `${info.username}@${instance}`, q: acctHasInstance ? info.acct : `${info.username}@${instance}`,
type: 'accounts', type: 'accounts',
limit: 1, limit: 1,
@ -742,9 +745,11 @@ function RelatedActions({
setRelationshipUIState('loading'); setRelationshipUIState('loading');
const fetchRelationships = currentMasto.v1.accounts.fetchRelationships([ const fetchRelationships = currentMasto.v1.accounts.relationships.fetch(
currentID, {
]); id: [currentID],
},
);
try { try {
const relationships = await fetchRelationships; const relationships = await fetchRelationships;
@ -913,10 +918,9 @@ function RelatedActions({
setRelationshipUIState('loading'); setRelationshipUIState('loading');
(async () => { (async () => {
try { try {
const newRelationship = const newRelationship = await currentMasto.v1.accounts
await currentMasto.v1.accounts.unmute( .$select(currentInfo?.id || id)
currentInfo?.id || id, .unmute();
);
console.log('unmuting', newRelationship); console.log('unmuting', newRelationship);
setRelationship(newRelationship); setRelationship(newRelationship);
setRelationshipUIState('default'); setRelationshipUIState('default');
@ -962,12 +966,11 @@ function RelatedActions({
(async () => { (async () => {
try { try {
const newRelationship = const newRelationship =
await currentMasto.v1.accounts.mute( await currentMasto.v1.accounts
currentInfo?.id || id, .$select(currentInfo?.id || id)
{ .mute({
duration, duration,
}, });
);
console.log('muting', newRelationship); console.log('muting', newRelationship);
setRelationship(newRelationship); setRelationship(newRelationship);
setRelationshipUIState('default'); setRelationshipUIState('default');
@ -1008,19 +1011,17 @@ function RelatedActions({
(async () => { (async () => {
try { try {
if (blocking) { if (blocking) {
const newRelationship = const newRelationship = await currentMasto.v1.accounts
await currentMasto.v1.accounts.unblock( .$select(currentInfo?.id || id)
currentInfo?.id || id, .unblock();
);
console.log('unblocking', newRelationship); console.log('unblocking', newRelationship);
setRelationship(newRelationship); setRelationship(newRelationship);
setRelationshipUIState('default'); setRelationshipUIState('default');
showToast(`Unblocked @${username}`); showToast(`Unblocked @${username}`);
} else { } else {
const newRelationship = const newRelationship = await currentMasto.v1.accounts
await currentMasto.v1.accounts.block( .$select(currentInfo?.id || id)
currentInfo?.id || id, .block();
);
console.log('blocking', newRelationship); console.log('blocking', newRelationship);
setRelationship(newRelationship); setRelationship(newRelationship);
setRelationshipUIState('default'); setRelationshipUIState('default');
@ -1089,14 +1090,14 @@ function RelatedActions({
// ); // );
// if (yes) { // if (yes) {
newRelationship = await currentMasto.v1.accounts.unfollow( newRelationship = await currentMasto.v1.accounts
accountID.current, .$select(accountID.current)
); .unfollow();
// } // }
} else { } else {
newRelationship = await currentMasto.v1.accounts.follow( newRelationship = await currentMasto.v1.accounts
accountID.current, .$select(accountID.current)
); .follow();
} }
if (newRelationship) setRelationship(newRelationship); if (newRelationship) setRelationship(newRelationship);
@ -1241,9 +1242,9 @@ function AddRemoveListsSheet({ accountID, onClose }) {
(async () => { (async () => {
try { try {
const lists = await masto.v1.lists.list(); const lists = await masto.v1.lists.list();
const listsContainingAccount = await masto.v1.accounts.listLists( const listsContainingAccount = await masto.v1.accounts
accountID, .$select(accountID)
); .lists.list();
console.log({ lists, listsContainingAccount }); console.log({ lists, listsContainingAccount });
setLists(lists); setLists(lists);
setListsContainingAccount(listsContainingAccount); setListsContainingAccount(listsContainingAccount);
@ -1285,13 +1286,17 @@ function AddRemoveListsSheet({ accountID, onClose }) {
(async () => { (async () => {
try { try {
if (inList) { if (inList) {
await masto.v1.lists.removeAccount(list.id, { await masto.v1.lists
accountIds: [accountID], .$select(list.id)
}); .accounts.remove({
accountIds: [accountID],
});
} else { } else {
await masto.v1.lists.addAccount(list.id, { await masto.v1.lists
accountIds: [accountID], .$select(list.id)
}); .accounts.create({
accountIds: [accountID],
});
} }
// setUIState('default'); // setUIState('default');
reload(); reload();

View file

@ -46,7 +46,7 @@ function AccountSheet({ account, instance: propInstance, onClose }) {
}); });
return info; return info;
} catch (e) { } catch (e) {
const result = await masto.v2.search({ const result = await masto.v2.search.fetch({
q: account, q: account,
type: 'accounts', type: 'accounts',
limit: 1, limit: 1,
@ -57,7 +57,7 @@ function AccountSheet({ account, instance: propInstance, onClose }) {
} else if (/https?:\/\/[^/]+\/@/.test(account)) { } else if (/https?:\/\/[^/]+\/@/.test(account)) {
const accountURL = new URL(account); const accountURL = new URL(account);
const acct = accountURL.pathname.replace(/^\//, ''); const acct = accountURL.pathname.replace(/^\//, '');
const result = await masto.v2.search({ const result = await masto.v2.search.fetch({
q: acct, q: acct,
type: 'accounts', type: 'accounts',
limit: 1, limit: 1,

View file

@ -11,10 +11,10 @@ export default memo(function BackgroundService({ isLoggedIn }) {
// - WebSocket to receive notifications when page is visible // - WebSocket to receive notifications when page is visible
const [visible, setVisible] = useState(true); const [visible, setVisible] = useState(true);
usePageVisibility(setVisible); usePageVisibility(setVisible);
const notificationStream = useRef();
useEffect(() => { useEffect(() => {
let sub;
if (isLoggedIn && visible) { if (isLoggedIn && visible) {
const { masto, instance } = api(); const { masto, streaming, instance } = api();
(async () => { (async () => {
// 1. Get the latest notification // 1. Get the latest notification
if (states.notificationsLast) { if (states.notificationsLast) {
@ -42,34 +42,26 @@ export default memo(function BackgroundService({ isLoggedIn }) {
} }
// 2. Start streaming // 2. Start streaming
notificationStream.current = await masto.ws.stream( if (streaming) {
'/api/v1/streaming', sub = streaming.user.notification.subscribe();
{ console.log('🎏 Streaming notification', sub);
stream: 'user:notification', for await (const entry of sub) {
}, if (!sub) break;
); console.log('🔔🔔 Notification entry', entry);
console.log('🎏 Streaming notification', notificationStream.current); if (entry.event === 'notification') {
console.log('🔔🔔 Notification', entry);
notificationStream.current.on('notification', (notification) => { saveStatus(entry.payload, instance, {
console.log('🔔🔔 Notification', notification); skipThreading: true,
if (notification.status) { });
saveStatus(notification.status, instance, { }
skipThreading: true, states.notificationsShowNew = true;
});
} }
states.notificationsShowNew = true; }
});
notificationStream.current.ws.onclose = () => {
console.log('🔔🔔 Notification stream closed');
};
})(); })();
} }
return () => { return () => {
if (notificationStream.current) { sub?.unsubscribe?.();
notificationStream.current.ws.close(); sub = null;
notificationStream.current = null;
}
}; };
}, [visible, isLoggedIn]); }, [visible, isLoggedIn]);

View file

@ -197,9 +197,9 @@ function Compose({
setUIState('loading'); setUIState('loading');
(async () => { (async () => {
try { try {
const statusSource = await masto.v1.statuses.fetchSource( const statusSource = await masto.v1.statuses
editStatus.id, .$select(editStatus.id)
); .source.fetch();
console.log({ statusSource }); console.log({ statusSource });
const { text, spoilerText } = statusSource; const { text, spoilerText } = statusSource;
textareaRef.current.value = text; textareaRef.current.value = text;
@ -749,14 +749,12 @@ function Compose({
file, file,
description, description,
}); });
return masto.v2.mediaAttachments return masto.v2.media.create(params).then((res) => {
.create(params) if (res.id) {
.then((res) => { attachment.id = res.id;
if (res.id) { }
attachment.id = res.id; return res;
} });
return res;
});
} }
}); });
const results = await Promise.allSettled(mediaPromises); const results = await Promise.allSettled(mediaPromises);
@ -784,6 +782,8 @@ function Compose({
/* NOTE: /* NOTE:
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? 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?
Code: https://github.com/neet/masto.js/blob/dd0d649067b6a2b6e60fbb0a96597c373a255b00/src/serializers/is-object.ts#L2 Code: https://github.com/neet/masto.js/blob/dd0d649067b6a2b6e60fbb0a96597c373a255b00/src/serializers/is-object.ts#L2
// TODO: Note above is no longer true in Masto.js v6. Revisit this.
*/ */
let params = { let params = {
status, status,
@ -818,10 +818,9 @@ function Compose({
let newStatus; let newStatus;
if (editStatus) { if (editStatus) {
newStatus = await masto.v1.statuses.update( newStatus = await masto.v1.statuses
editStatus.id, .$select(editStatus.id)
params, .update(params);
);
saveStatus(newStatus, instance, { saveStatus(newStatus, instance, {
skipThreading: true, skipThreading: true,
}); });
@ -935,13 +934,13 @@ function Compose({
performSearch={(params) => { performSearch={(params) => {
const { type, q, limit } = params; const { type, q, limit } = params;
if (type === 'accounts') { if (type === 'accounts') {
return masto.v1.accounts.search({ return masto.v1.accounts.search.list({
q, q,
limit, limit,
resolve: false, resolve: false,
}); });
} }
return masto.v2.search(params); return masto.v2.search.fetch(params);
}} }}
/> />
{mediaAttachments?.length > 0 && ( {mediaAttachments?.length > 0 && (

View file

@ -128,9 +128,9 @@ function Drafts({ onClose }) {
if (replyTo) { if (replyTo) {
setUIState('loading'); setUIState('loading');
try { try {
replyToStatus = await masto.v1.statuses.fetch( replyToStatus = await masto.v1.statuses
replyTo.id, .$select(replyTo.id)
); .fetch();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
alert('Error fetching reply-to status!'); alert('Error fetching reply-to status!');

View file

@ -23,7 +23,9 @@ function FollowRequestButtons({ accountID, onChange }) {
setRequestState('accept'); setRequestState('accept');
(async () => { (async () => {
try { try {
const rel = await masto.v1.followRequests.authorize(accountID); const rel = await masto.v1.followRequests
.$select(accountID)
.authorize();
if (!rel?.followedBy) { if (!rel?.followedBy) {
throw new Error('Follow request not accepted'); throw new Error('Follow request not accepted');
} }
@ -47,7 +49,9 @@ function FollowRequestButtons({ accountID, onChange }) {
setRequestState('reject'); setRequestState('reject');
(async () => { (async () => {
try { try {
const rel = await masto.v1.followRequests.reject(accountID); const rel = await masto.v1.followRequests
.$select(accountID)
.reject();
if (rel?.followedBy) { if (rel?.followedBy) {
throw new Error('Follow request not rejected'); throw new Error('Follow request not rejected');
} }

View file

@ -56,7 +56,7 @@ function ListAddEdit({ list, onClose }) {
let listResult; let listResult;
if (editMode) { if (editMode) {
listResult = await masto.v1.lists.update(list.id, { listResult = await masto.v1.lists.$select(list.id).update({
title, title,
replies_policy: repliesPolicy, replies_policy: repliesPolicy,
exclusive, exclusive,
@ -141,7 +141,7 @@ function ListAddEdit({ list, onClose }) {
(async () => { (async () => {
try { try {
await masto.v1.lists.remove(list.id); await masto.v1.lists.$select(list.id).remove();
setUIState('default'); setUIState('default');
onClose?.({ onClose?.({
state: 'deleted', state: 'deleted',

View file

@ -38,7 +38,7 @@ export default memo(function NotificationService() {
? getAccountByAccessToken(accessToken) ? getAccountByAccessToken(accessToken)
: getCurrentAccount(); : getCurrentAccount();
(async () => { (async () => {
const notification = await masto.v1.notifications.fetch(id); const notification = await masto.v1.notifications.$select(id).fetch();
if (notification && account) { if (notification && account) {
console.log('🛎️ Notification', { id, notification, account }); console.log('🛎️ Notification', { id, notification, account });
const accountInstance = account.instanceURL; const accountInstance = account.instanceURL;

View file

@ -135,7 +135,7 @@ export const SHORTCUTS_META = {
id: 'list', id: 'list',
title: mem( title: mem(
async ({ id }) => { async ({ id }) => {
const list = await api().masto.v1.lists.fetch(id); const list = await api().masto.v1.lists.$select(id).fetch();
return list.title; return list.title;
}, },
{ {
@ -169,7 +169,7 @@ export const SHORTCUTS_META = {
id: 'account-statuses', id: 'account-statuses',
title: mem( title: mem(
async ({ id }) => { async ({ id }) => {
const account = await api().masto.v1.accounts.fetch(id); const account = await api().masto.v1.accounts.$select(id).fetch();
return account.username || account.acct || account.displayName; return account.username || account.acct || account.displayName;
}, },
{ {

View file

@ -68,7 +68,7 @@ const throttle = pThrottle({
function fetchAccount(id, masto) { function fetchAccount(id, masto) {
try { try {
return masto.v1.accounts.fetch(id); return masto.v1.accounts.$select(id).fetch();
} catch (e) { } catch (e) {
return Promise.reject(e); return Promise.reject(e);
} }
@ -390,11 +390,11 @@ function Status({
reblogsCount: reblogsCount + (reblogged ? -1 : 1), reblogsCount: reblogsCount + (reblogged ? -1 : 1),
}; };
if (reblogged) { if (reblogged) {
const newStatus = await masto.v1.statuses.unreblog(id); const newStatus = await masto.v1.statuses.$select(id).unreblog();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
return true; return true;
} else { } else {
const newStatus = await masto.v1.statuses.reblog(id); const newStatus = await masto.v1.statuses.$select(id).reblog();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
return true; return true;
} }
@ -418,11 +418,11 @@ function Status({
reblogsCount: reblogsCount + (reblogged ? -1 : 1), reblogsCount: reblogsCount + (reblogged ? -1 : 1),
}; };
if (reblogged) { if (reblogged) {
const newStatus = await masto.v1.statuses.unreblog(id); const newStatus = await masto.v1.statuses.$select(id).unreblog();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
return true; return true;
} else { } else {
const newStatus = await masto.v1.statuses.reblog(id); const newStatus = await masto.v1.statuses.$select(id).reblog();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
return true; return true;
} }
@ -446,10 +446,10 @@ function Status({
favouritesCount: favouritesCount + (favourited ? -1 : 1), favouritesCount: favouritesCount + (favourited ? -1 : 1),
}; };
if (favourited) { if (favourited) {
const newStatus = await masto.v1.statuses.unfavourite(id); const newStatus = await masto.v1.statuses.$select(id).unfavourite();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
} else { } else {
const newStatus = await masto.v1.statuses.favourite(id); const newStatus = await masto.v1.statuses.$select(id).favourite();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
} }
} catch (e) { } catch (e) {
@ -470,10 +470,10 @@ function Status({
bookmarked: !bookmarked, bookmarked: !bookmarked,
}; };
if (bookmarked) { if (bookmarked) {
const newStatus = await masto.v1.statuses.unbookmark(id); const newStatus = await masto.v1.statuses.$select(id).unbookmark();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
} else { } else {
const newStatus = await masto.v1.statuses.bookmark(id); const newStatus = await masto.v1.statuses.$select(id).bookmark();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
} }
} catch (e) { } catch (e) {
@ -708,9 +708,9 @@ function Status({
<MenuItem <MenuItem
onClick={async () => { onClick={async () => {
try { try {
const newStatus = await masto.v1.statuses[ const newStatus = await masto.v1.statuses
muted ? 'unmute' : 'mute' .$select(id)
](id); [muted ? 'unmute' : 'mute']();
saveStatus(newStatus, instance); saveStatus(newStatus, instance);
showToast(muted ? 'Conversation unmuted' : 'Conversation muted'); showToast(muted ? 'Conversation unmuted' : 'Conversation muted');
} catch (e) { } catch (e) {
@ -763,7 +763,7 @@ function Status({
// if (yes) { // if (yes) {
(async () => { (async () => {
try { try {
await masto.v1.statuses.remove(id); await masto.v1.statuses.$select(id).remove();
const cachedStatus = getStatus(id, instance); const cachedStatus = getStatus(id, instance);
cachedStatus._deleted = true; cachedStatus._deleted = true;
showToast('Deleted'); showToast('Deleted');
@ -1212,7 +1212,8 @@ function Status({
}} }}
refresh={() => { refresh={() => {
return masto.v1.polls return masto.v1.polls
.fetch(poll.id) .$select(poll.id)
.fetch()
.then((pollResponse) => { .then((pollResponse) => {
states.statuses[sKey].poll = pollResponse; states.statuses[sKey].poll = pollResponse;
}) })
@ -1220,7 +1221,8 @@ function Status({
}} }}
votePoll={(choices) => { votePoll={(choices) => {
return masto.v1.polls return masto.v1.polls
.vote(poll.id, { .$select(poll.id)
.votes.create({
choices, choices,
}) })
.then((pollResponse) => { .then((pollResponse) => {
@ -1498,7 +1500,7 @@ function Status({
statusID={showEdited} statusID={showEdited}
instance={instance} instance={instance}
fetchStatusHistory={() => { fetchStatusHistory={() => {
return masto.v1.statuses.listHistory(showEdited); return masto.v1.statuses.$select(showEdited).history.list();
}} }}
onClose={() => { onClose={() => {
setShowEdited(false); setShowEdited(false);
@ -1585,7 +1587,7 @@ function Card({ card, instance }) {
// NOTE: This is for quote post // NOTE: This is for quote post
// (async () => { // (async () => {
// const { masto } = api({ instance }); // const { masto } = api({ instance });
// const status = await masto.v1.statuses.fetch(id); // const status = await masto.v1.statuses.$select(id).fetch();
// saveStatus(status, instance); // saveStatus(status, instance);
// setCardStatusID(id); // setCardStatusID(id);
// })(); // })();
@ -1805,15 +1807,16 @@ function ReactionsModal({ statusID, instance, onClose }) {
(async () => { (async () => {
try { try {
if (firstLoad) { if (firstLoad) {
reblogIterator.current = masto.v1.statuses.listRebloggedBy(statusID, { reblogIterator.current = masto.v1.statuses
limit: REACTIONS_LIMIT, .$select(statusID)
}); .rebloggedBy.list({
favouriteIterator.current = masto.v1.statuses.listFavouritedBy(
statusID,
{
limit: REACTIONS_LIMIT, limit: REACTIONS_LIMIT,
}, });
); favouriteIterator.current = masto.v1.statuses
.$select(statusID)
.favouritedBy.list({
limit: REACTIONS_LIMIT,
});
} }
const [{ value: reblogResults }, { value: favouriteResults }] = const [{ value: reblogResults }, { value: favouriteResults }] =
await Promise.allSettled([ await Promise.allSettled([
@ -2043,21 +2046,24 @@ function _unfurlMastodonLink(instance, url) {
if (statusMatch) { if (statusMatch) {
const id = statusMatch[3]; const id = statusMatch[3];
const { masto } = api({ instance: domain }); const { masto } = api({ instance: domain });
remoteInstanceFetch = masto.v1.statuses.fetch(id).then((status) => { remoteInstanceFetch = masto.v1.statuses
if (status?.id) { .$select(id)
return { .fetch()
status, .then((status) => {
instance: domain, if (status?.id) {
}; return {
} else { status,
throw new Error('No results'); instance: domain,
} };
}); } else {
throw new Error('No results');
}
});
} }
const { masto } = api({ instance }); const { masto } = api({ instance });
const mastoSearchFetch = masto.v2 const mastoSearchFetch = masto.v2.search
.search({ .fetch({
q: url, q: url,
type: 'statuses', type: 'statuses',
resolve: true, resolve: true,

View file

@ -55,7 +55,7 @@ function lingvaTranslate(text, source, target) {
); );
}, },
}); });
// return masto.v1.statuses.translate(id, { // return masto.v1.statuses.$select(id).translate({
// lang: DEFAULT_LANG, // lang: DEFAULT_LANG,
// }); // });
} }

View file

@ -31,7 +31,8 @@ function AccountStatuses() {
const results = []; const results = [];
if (firstLoad) { if (firstLoad) {
const { value: pinnedStatuses } = await masto.v1.accounts const { value: pinnedStatuses } = await masto.v1.accounts
.listStatuses(id, { .$select(id)
.statuses.list({
pinned: true, pinned: true,
}) })
.next(); .next();
@ -53,13 +54,15 @@ function AccountStatuses() {
} }
} }
if (firstLoad || !accountStatusesIterator.current) { if (firstLoad || !accountStatusesIterator.current) {
accountStatusesIterator.current = masto.v1.accounts.listStatuses(id, { accountStatusesIterator.current = masto.v1.accounts
limit: LIMIT, .$select(id)
exclude_replies: excludeReplies, .statuses.list({
exclude_reblogs: excludeBoosts, limit: LIMIT,
only_media: media, exclude_replies: excludeReplies,
tagged, exclude_reblogs: excludeBoosts,
}); only_media: media,
tagged,
});
} }
const { value, done } = await accountStatusesIterator.current.next(); const { value, done } = await accountStatusesIterator.current.next();
if (value?.length) { if (value?.length) {
@ -86,14 +89,16 @@ function AccountStatuses() {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
try { try {
const acc = await masto.v1.accounts.fetch(id); const acc = await masto.v1.accounts.$select(id).fetch();
console.log(acc); console.log(acc);
setAccount(acc); setAccount(acc);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
try { try {
const featuredTags = await masto.v1.accounts.listFeaturedTags(id); const featuredTags = await masto.v1.accounts
.$select(id)
.featuredTags.list(id);
console.log({ featuredTags }); console.log({ featuredTags });
setFeaturedTags(featuredTags); setFeaturedTags(featuredTags);
} catch (e) { } catch (e) {
@ -113,7 +118,7 @@ function AccountStatuses() {
<AccountInfo <AccountInfo
instance={instance} instance={instance}
account={cachedAccount || id} account={cachedAccount || id}
fetchAccount={() => masto.v1.accounts.fetch(id)} fetchAccount={() => masto.v1.accounts.$select(id).fetch()}
authenticated={authenticated} authenticated={authenticated}
standalone standalone
/> />

View file

@ -52,9 +52,9 @@ function Accounts({ onClose }) {
onDblClick={async () => { onDblClick={async () => {
if (isCurrent) { if (isCurrent) {
try { try {
const info = await masto.v1.accounts.fetch( const info = await masto.v1.accounts
account.info.id, .$select(account.info.id)
); .fetch();
console.log('fetched account info', info); console.log('fetched account info', info);
account.info = info; account.info = info;
store.local.setJSON('accounts', accounts); store.local.setJSON('accounts', accounts);

View file

@ -13,7 +13,7 @@ const LIMIT = 20;
function Following({ title, path, id, ...props }) { function Following({ title, path, id, ...props }) {
useTitle(title || 'Following', path || '/following'); useTitle(title || 'Following', path || '/following');
const { masto, instance } = api(); const { masto, streaming, instance } = api();
const snapStates = useSnapshot(states); const snapStates = useSnapshot(states);
const homeIterator = useRef(); const homeIterator = useRef();
const latestItem = useRef(); const latestItem = useRef();
@ -22,7 +22,7 @@ function Following({ title, path, id, ...props }) {
async function fetchHome(firstLoad) { async function fetchHome(firstLoad) {
if (firstLoad || !homeIterator.current) { if (firstLoad || !homeIterator.current) {
homeIterator.current = masto.v1.timelines.listHome({ limit: LIMIT }); homeIterator.current = masto.v1.timelines.home.list({ limit: LIMIT });
} }
const results = await homeIterator.current.next(); const results = await homeIterator.current.next();
let { value } = results; let { value } = results;
@ -53,8 +53,8 @@ function Following({ title, path, id, ...props }) {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const results = await masto.v1.timelines const results = await masto.v1.timelines.home
.listHome({ .list({
limit: 5, limit: 5,
since_id: latestItem.current, since_id: latestItem.current,
}) })
@ -75,52 +75,33 @@ function Following({ title, path, id, ...props }) {
} }
} }
const ws = useRef();
const streamUser = async () => {
console.log('🎏 Start streaming user', ws.current);
if (
ws.current &&
(ws.current.readyState === WebSocket.CONNECTING ||
ws.current.readyState === WebSocket.OPEN)
) {
console.log('🎏 Streaming user already open');
return;
}
const stream = await masto.v1.stream.streamUser();
ws.current = stream.ws;
ws.current.__id = Math.random();
console.log('🎏 Streaming user', ws.current);
stream.on('status.update', (status) => {
console.log(`🔄 Status ${status.id} updated`);
saveStatus(status, instance);
});
stream.on('delete', (statusID) => {
console.log(`❌ Status ${statusID} deleted`);
// delete states.statuses[statusID];
const s = getStatus(statusID, instance);
if (s) s._deleted = true;
});
stream.ws.onclose = () => {
console.log('🎏 Streaming user closed');
};
return stream;
};
useEffect(() => { useEffect(() => {
let stream; let sub;
(async () => { (async () => {
stream = await streamUser(); if (streaming) {
sub = streaming.user.subscribe();
console.log('🎏 Streaming user', sub);
for await (const entry of sub) {
if (!sub) break;
if (entry.event === 'status.update') {
const status = entry.payload;
console.log(`🔄 Status ${status.id} updated`);
saveStatus(status, instance);
} else if (entry.event === 'delete') {
const statusID = entry.payload;
console.log(`❌ Status ${statusID} deleted`);
// delete states.statuses[statusID];
const s = getStatus(statusID, instance);
if (s) s._deleted = true;
}
}
}
})(); })();
return () => { return () => {
if (stream) { sub?.unsubscribe?.();
stream.ws.close(); sub = null;
ws.current = null;
}
}; };
}, []); }, [streaming]);
return ( return (
<Timeline <Timeline

View file

@ -46,7 +46,7 @@ function Hashtags({ columnMode, ...props }) {
const maxID = useRef(undefined); const maxID = useRef(undefined);
async function fetchHashtags(firstLoad) { async function fetchHashtags(firstLoad) {
// if (firstLoad || !hashtagsIterator.current) { // if (firstLoad || !hashtagsIterator.current) {
// hashtagsIterator.current = masto.v1.timelines.listHashtag(hashtag, { // hashtagsIterator.current = masto.v1.timelines.tag.$select(hashtag).list({
// limit: LIMIT, // limit: LIMIT,
// any: hashtags.slice(1), // any: hashtags.slice(1),
// }); // });
@ -54,8 +54,9 @@ function Hashtags({ columnMode, ...props }) {
// const results = await hashtagsIterator.current.next(); // const results = await hashtagsIterator.current.next();
// NOTE: Temporary fix for listHashtag not persisting `any` in subsequent calls. // NOTE: Temporary fix for listHashtag not persisting `any` in subsequent calls.
const results = await masto.v1.timelines const results = await masto.v1.timelines.tag
.listHashtag(hashtag, { .$select(hashtag)
.list({
limit: LIMIT, limit: LIMIT,
any: hashtags.slice(1), any: hashtags.slice(1),
maxId: firstLoad ? undefined : maxID.current, maxId: firstLoad ? undefined : maxID.current,
@ -81,8 +82,9 @@ function Hashtags({ columnMode, ...props }) {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const results = await masto.v1.timelines const results = await masto.v1.timelines.tag
.listHashtag(hashtag, { .$select(hashtag)
.list({
limit: 1, limit: 1,
any: hashtags.slice(1), any: hashtags.slice(1),
since_id: latestItem.current, since_id: latestItem.current,
@ -104,7 +106,7 @@ function Hashtags({ columnMode, ...props }) {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
try { try {
const info = await masto.v1.tags.fetch(hashtag); const info = await masto.v1.tags.$select(hashtag).fetch();
console.log(info); console.log(info);
setInfo(info); setInfo(info);
} catch (e) { } catch (e) {
@ -163,7 +165,8 @@ function Hashtags({ columnMode, ...props }) {
// return; // return;
// } // }
masto.v1.tags masto.v1.tags
.unfollow(hashtag) .$select(hashtag)
.unfollow()
.then(() => { .then(() => {
setInfo({ ...info, following: false }); setInfo({ ...info, following: false });
showToast(`Unfollowed #${hashtag}`); showToast(`Unfollowed #${hashtag}`);
@ -177,7 +180,8 @@ function Hashtags({ columnMode, ...props }) {
}); });
} else { } else {
masto.v1.tags masto.v1.tags
.follow(hashtag) .$select(hashtag)
.follow()
.then(() => { .then(() => {
setInfo({ ...info, following: true }); setInfo({ ...info, following: true });
showToast(`Followed #${hashtag}`); showToast(`Followed #${hashtag}`);

View file

@ -32,7 +32,7 @@ function List(props) {
const listIterator = useRef(); const listIterator = useRef();
async function fetchList(firstLoad) { async function fetchList(firstLoad) {
if (firstLoad || !listIterator.current) { if (firstLoad || !listIterator.current) {
listIterator.current = masto.v1.timelines.listList(id, { listIterator.current = masto.v1.timelines.list.$select(id).list({
limit: LIMIT, limit: LIMIT,
}); });
} }
@ -56,7 +56,7 @@ function List(props) {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const results = await masto.v1.timelines.listList(id, { const results = await masto.v1.timelines.list.$select(id).list({
limit: 1, limit: 1,
since_id: latestItem.current, since_id: latestItem.current,
}); });
@ -77,7 +77,7 @@ function List(props) {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
try { try {
const list = await masto.v1.lists.fetch(id); const list = await masto.v1.lists.$select(id).fetch();
setList(list); setList(list);
// setTitle(list.title); // setTitle(list.title);
} catch (e) { } catch (e) {
@ -200,9 +200,11 @@ function ListManageMembers({ listID, onClose }) {
(async () => { (async () => {
try { try {
if (firstLoad || !membersIterator.current) { if (firstLoad || !membersIterator.current) {
membersIterator.current = masto.v1.lists.listAccounts(listID, { membersIterator.current = masto.v1.lists
limit: MEMBERS_LIMIT, .$select(listID)
}); .accounts.list({
limit: MEMBERS_LIMIT,
});
} }
const results = await membersIterator.current.next(); const results = await membersIterator.current.next();
let { done, value } = results; let { done, value } = results;
@ -274,7 +276,7 @@ function RemoveAddButton({ account, listID }) {
setUIState('loading'); setUIState('loading');
(async () => { (async () => {
try { try {
await masto.v1.lists.addAccount(listID, { await masto.v1.lists.$select(listID).accounts.create({
accountIds: [account.id], accountIds: [account.id],
}); });
setUIState('default'); setUIState('default');
@ -290,7 +292,7 @@ function RemoveAddButton({ account, listID }) {
(async () => { (async () => {
try { try {
await masto.v1.lists.removeAccount(listID, { await masto.v1.lists.$select(listID).accounts.remove({
accountIds: [account.id], accountIds: [account.id],
}); });
setUIState('default'); setUIState('default');

View file

@ -29,7 +29,7 @@ function Public({ local, columnMode, ...props }) {
const publicIterator = useRef(); const publicIterator = useRef();
async function fetchPublic(firstLoad) { async function fetchPublic(firstLoad) {
if (firstLoad || !publicIterator.current) { if (firstLoad || !publicIterator.current) {
publicIterator.current = masto.v1.timelines.listPublic({ publicIterator.current = masto.v1.timelines.public.list({
limit: LIMIT, limit: LIMIT,
local: isLocal, local: isLocal,
}); });
@ -54,8 +54,8 @@ function Public({ local, columnMode, ...props }) {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const results = await masto.v1.timelines const results = await masto.v1.timelines.public
.listPublic({ .list({
limit: 1, limit: 1,
local: isLocal, local: isLocal,
since_id: latestItem.current, since_id: latestItem.current,

View file

@ -90,7 +90,7 @@ function Search(props) {
if (authenticated) params.offset = offsetRef.current; if (authenticated) params.offset = offsetRef.current;
} }
try { try {
const results = await masto.v2.search(params); const results = await masto.v2.search.fetch(params);
console.log(results); console.log(results);
if (type) { if (type) {
if (firstLoad) { if (firstLoad) {

View file

@ -100,7 +100,7 @@ function StatusPage(params) {
if (!heroStatus && showMedia) { if (!heroStatus && showMedia) {
(async () => { (async () => {
try { try {
const status = await masto.v1.statuses.fetch(id); const status = await masto.v1.statuses.$select(id).fetch();
saveStatus(status, instance); saveStatus(status, instance);
setHeroStatus(status); setHeroStatus(status);
} catch (err) { } catch (err) {
@ -235,12 +235,15 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
(async () => { (async () => {
const heroFetch = () => const heroFetch = () =>
pRetry(() => masto.v1.statuses.fetch(id), { pRetry(() => masto.v1.statuses.$select(id).fetch(), {
retries: 4, retries: 4,
}); });
const contextFetch = pRetry(() => masto.v1.statuses.fetchContext(id), { const contextFetch = pRetry(
retries: 8, () => masto.v1.statuses.$select(id).context.fetch(),
}); {
retries: 8,
},
);
const hasStatus = !!snapStates.statuses[sKey]; const hasStatus = !!snapStates.statuses[sKey];
let heroStatus = snapStates.statuses[sKey]; let heroStatus = snapStates.statuses[sKey];
@ -946,12 +949,13 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
setUIState('loading'); setUIState('loading');
(async () => { (async () => {
try { try {
const results = await currentMasto.v2.search({ const results =
q: heroStatus.url, await currentMasto.v2.search.fetch({
type: 'statuses', q: heroStatus.url,
resolve: true, type: 'statuses',
limit: 1, resolve: true,
}); limit: 1,
});
if (results.statuses.length) { if (results.statuses.length) {
const status = results.statuses[0]; const status = results.statuses[0];
location.hash = currentInstance location.hash = currentInstance

View file

@ -30,13 +30,13 @@ function Trending({ columnMode, ...props }) {
const trendIterator = useRef(); const trendIterator = useRef();
async function fetchTrend(firstLoad) { async function fetchTrend(firstLoad) {
if (firstLoad || !trendIterator.current) { if (firstLoad || !trendIterator.current) {
trendIterator.current = masto.v1.trends.listStatuses({ trendIterator.current = masto.v1.trends.statuses.list({
limit: LIMIT, limit: LIMIT,
}); });
// Get hashtags // Get hashtags
try { try {
const iterator = masto.v1.trends.listTags(); const iterator = masto.v1.trends.tags.list();
const { value: tags } = await iterator.next(); const { value: tags } = await iterator.next();
console.log(tags); console.log(tags);
setHashtags(tags); setHashtags(tags);
@ -64,8 +64,8 @@ function Trending({ columnMode, ...props }) {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const results = await masto.v1.trends const results = await masto.v1.trends.statuses
.listStatuses({ .list({
limit: 1, limit: 1,
// NOT SUPPORTED // NOT SUPPORTED
// since_id: latestItem.current, // since_id: latestItem.current,

View file

@ -1,4 +1,4 @@
import { createClient } from 'masto'; import { createRestAPIClient, createStreamingAPIClient } from 'masto';
import store from './store'; import store from './store';
import { import {
@ -37,14 +37,17 @@ export function initClient({ instance, accessToken }) {
} }
const url = instance ? `https://${instance}` : `https://${DEFAULT_INSTANCE}`; const url = instance ? `https://${instance}` : `https://${DEFAULT_INSTANCE}`;
const client = createClient({ const masto = createRestAPIClient({
url, url,
accessToken, // Can be null accessToken, // Can be null
disableVersionCheck: true, // Allow non-Mastodon instances
timeout: 30_000, // Unfortunatly this is global instead of per-request timeout: 30_000, // Unfortunatly this is global instead of per-request
}); });
client.__instance__ = instance;
const client = {
masto,
instance,
accessToken,
};
apis[instance] = client; apis[instance] = client;
if (!accountApis[instance]) accountApis[instance] = {}; if (!accountApis[instance]) accountApis[instance] = {};
if (accessToken) accountApis[instance][accessToken] = client; if (accessToken) accountApis[instance][accessToken] = client;
@ -55,7 +58,8 @@ export function initClient({ instance, accessToken }) {
// Get the instance information // Get the instance information
// The config is needed for composing // The config is needed for composing
export async function initInstance(client, instance) { export async function initInstance(client, instance) {
const masto = client; console.log('INIT INSTANCE', client, instance);
const { masto, accessToken } = client;
// Request v2, fallback to v1 if fail // Request v2, fallback to v1 if fail
let info; let info;
try { try {
@ -63,7 +67,7 @@ export async function initInstance(client, instance) {
} catch (e) {} } catch (e) {}
if (!info) { if (!info) {
try { try {
info = await masto.v1.instances.fetch(); info = await masto.v1.instance.fetch();
} catch (e) {} } catch (e) {}
} }
if (!info) return; if (!info) return;
@ -91,17 +95,28 @@ export async function initInstance(client, instance) {
store.local.setJSON('instances', instances); store.local.setJSON('instances', instances);
// This is a weird place to put this but here's updating the masto instance with the streaming API URL set in the configuration // This is a weird place to put this but here's updating the masto instance with the streaming API URL set in the configuration
// Reason: Streaming WebSocket URL may change, unlike the standard API REST URLs // Reason: Streaming WebSocket URL may change, unlike the standard API REST URLs
if (streamingApi || streaming) { const supportsWebSocket = 'WebSocket' in window;
if (supportsWebSocket && (streamingApi || streaming)) {
console.log('🎏 Streaming API URL:', streaming || streamingApi); console.log('🎏 Streaming API URL:', streaming || streamingApi);
masto.config.props.streamingApiUrl = streaming || streamingApi; // masto.config.props.streamingApiUrl = streaming || streamingApi;
// Legacy masto.ws
const streamClient = createStreamingAPIClient({
streamingApiUrl: streaming || streamingApi,
accessToken,
implementation: WebSocket,
});
client.streaming = streamClient;
// masto.ws = streamClient;
console.log('🎏 Streaming API client:', client);
} }
} }
// Get the account information and store it // Get the account information and store it
export async function initAccount(client, instance, accessToken, vapidKey) { export async function initAccount(client, instance, accessToken, vapidKey) {
const masto = client; const { masto } = client;
const mastoAccount = await masto.v1.accounts.verifyCredentials(); const mastoAccount = await masto.v1.accounts.verifyCredentials();
console.log('CURRENTACCOUNT SET', mastoAccount.id);
store.session.set('currentAccount', mastoAccount.id); store.session.set('currentAccount', mastoAccount.id);
saveAccount({ saveAccount({
@ -115,7 +130,7 @@ export async function initAccount(client, instance, accessToken, vapidKey) {
// Get preferences // Get preferences
export async function initPreferences(client) { export async function initPreferences(client) {
try { try {
const masto = client; const { masto } = client;
const preferences = await masto.v1.preferences.fetch(); const preferences = await masto.v1.preferences.fetch();
store.account.set('preferences', preferences); store.account.set('preferences', preferences);
} catch (e) { } catch (e) {
@ -134,10 +149,14 @@ export function api({ instance, accessToken, accountID, account } = {}) {
// If instance and accessToken are provided, get the masto instance for that account // If instance and accessToken are provided, get the masto instance for that account
if (instance && accessToken) { if (instance && accessToken) {
const client =
accountApis[instance]?.[accessToken] ||
initClient({ instance, accessToken });
const { masto, streaming } = client;
return { return {
masto: masto,
accountApis[instance]?.[accessToken] || streaming,
initClient({ instance, accessToken }), client,
authenticated: true, authenticated: true,
instance, instance,
}; };
@ -149,8 +168,12 @@ export function api({ instance, accessToken, accountID, account } = {}) {
for (const instance in accountApis) { for (const instance in accountApis) {
if (accountApis[instance][accessToken]) { if (accountApis[instance][accessToken]) {
console.log('X 2', accountApis, instance, accessToken); console.log('X 2', accountApis, instance, accessToken);
const client = accountApis[instance][accessToken];
const { masto, streaming } = client;
return { return {
masto: accountApis[instance][accessToken], masto,
streaming,
client,
authenticated: true, authenticated: true,
instance, instance,
}; };
@ -160,8 +183,12 @@ export function api({ instance, accessToken, accountID, account } = {}) {
if (account) { if (account) {
const accessToken = account.accessToken; const accessToken = account.accessToken;
const instance = account.instanceURL.toLowerCase().trim(); const instance = account.instanceURL.toLowerCase().trim();
const client = initClient({ instance, accessToken });
const { masto, streaming } = client;
return { return {
masto: initClient({ instance, accessToken }), masto,
streaming,
client,
authenticated: true, authenticated: true,
instance, instance,
}; };
@ -178,10 +205,14 @@ export function api({ instance, accessToken, accountID, account } = {}) {
if (account) { if (account) {
const accessToken = account.accessToken; const accessToken = account.accessToken;
const instance = account.instanceURL.toLowerCase().trim(); const instance = account.instanceURL.toLowerCase().trim();
const client =
accountApis[instance]?.[accessToken] ||
initClient({ instance, accessToken });
const { masto, streaming } = client;
return { return {
masto: masto,
accountApis[instance]?.[accessToken] || streaming,
initClient({ instance, accessToken }), client,
authenticated: true, authenticated: true,
instance, instance,
}; };
@ -192,10 +223,13 @@ export function api({ instance, accessToken, accountID, account } = {}) {
// If only instance is provided, get the masto instance for that instance // If only instance is provided, get the masto instance for that instance
if (instance) { if (instance) {
const masto = apis[instance] || initClient({ instance }); const client = apis[instance] || initClient({ instance });
const { masto, streaming, accessToken } = client;
return { return {
masto, masto,
authenticated: !!masto.config.props.accessToken, streaming,
client,
authenticated: !!accessToken,
instance, instance,
}; };
} }
@ -203,9 +237,11 @@ export function api({ instance, accessToken, accountID, account } = {}) {
// If no instance is provided, get the masto instance for the current account // If no instance is provided, get the masto instance for the current account
if (currentAccountApi) { if (currentAccountApi) {
return { return {
masto: currentAccountApi, masto: currentAccountApi.masto,
streaming: currentAccountApi.streaming,
client: currentAccountApi,
authenticated: true, authenticated: true,
instance: currentAccountApi.__instance__, instance: currentAccountApi.instance,
}; };
} }
const currentAccount = getCurrentAccount(); const currentAccount = getCurrentAccount();
@ -215,15 +251,22 @@ export function api({ instance, accessToken, accountID, account } = {}) {
accountApis[instance]?.[accessToken] || accountApis[instance]?.[accessToken] ||
initClient({ instance, accessToken }); initClient({ instance, accessToken });
return { return {
masto: currentAccountApi, masto: currentAccountApi.masto,
streaming: currentAccountApi.streaming,
client: currentAccountApi,
authenticated: true, authenticated: true,
instance, instance,
}; };
} }
// If no instance is provided and no account is logged in, get the masto instance for DEFAULT_INSTANCE // If no instance is provided and no account is logged in, get the masto instance for DEFAULT_INSTANCE
const client =
apis[DEFAULT_INSTANCE] || initClient({ instance: DEFAULT_INSTANCE });
const { masto, streaming } = client;
return { return {
masto: apis[DEFAULT_INSTANCE] || initClient({ instance: DEFAULT_INSTANCE }), masto,
streaming,
client,
authenticated: false, authenticated: false,
instance: DEFAULT_INSTANCE, instance: DEFAULT_INSTANCE,
}; };

View file

@ -34,22 +34,22 @@ import { getCurrentAccount } from './store-utils';
function createBackendPushSubscription(subscription) { function createBackendPushSubscription(subscription) {
const { masto } = api(); const { masto } = api();
return masto.v1.webPushSubscriptions.create(subscription); return masto.v1.push.subscription.create(subscription);
} }
function fetchBackendPushSubscription() { function fetchBackendPushSubscription() {
const { masto } = api(); const { masto } = api();
return masto.v1.webPushSubscriptions.fetch(); return masto.v1.push.subscription.fetch();
} }
function updateBackendPushSubscription(subscription) { function updateBackendPushSubscription(subscription) {
const { masto } = api(); const { masto } = api();
return masto.v1.webPushSubscriptions.update(subscription); return masto.v1.push.subscription.update(subscription);
} }
function removeBackendPushSubscription() { function removeBackendPushSubscription() {
const { masto } = api(); const { masto } = api();
return masto.v1.webPushSubscriptions.remove(); return masto.v1.push.subscription.remove();
} }
// Front-end // Front-end

View file

@ -207,7 +207,7 @@ export function threadifyStatus(status, propInstance) {
if (!prevStatus) { if (!prevStatus) {
if (fetchIndex++ > 3) throw 'Too many fetches for thread'; // Some people revive old threads if (fetchIndex++ > 3) throw 'Too many fetches for thread'; // Some people revive old threads
await new Promise((r) => setTimeout(r, 500 * fetchIndex)); // Be nice to rate limits await new Promise((r) => setTimeout(r, 500 * fetchIndex)); // Be nice to rate limits
// prevStatus = await masto.v1.statuses.fetch(inReplyToId); // prevStatus = await masto.v1.statuses.$.select(inReplyToId).fetch();
prevStatus = await fetchStatus(inReplyToId, masto); prevStatus = await fetchStatus(inReplyToId, masto);
saveStatus(prevStatus, instance, { skipThreading: true }); saveStatus(prevStatus, instance, { skipThreading: true });
} }
@ -230,5 +230,5 @@ export function threadifyStatus(status, propInstance) {
} }
const fetchStatus = mem((statusID, masto) => { const fetchStatus = mem((statusID, masto) => {
return masto.v1.statuses.fetch(statusID); return masto.v1.statuses.$select(statusID).fetch();
}); });