commit
b4a4615b9a
1873
package-lock.json
generated
1873
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -23,7 +23,7 @@
|
|||
"mem": "~9.0.2",
|
||||
"p-retry": "~5.1.2",
|
||||
"preact": "~10.12.1",
|
||||
"react-hotkeys-hook": "~4.3.6",
|
||||
"react-hotkeys-hook": "~4.3.7",
|
||||
"react-intersection-observer": "~9.4.2",
|
||||
"react-router-dom": "6.6.2",
|
||||
"string-length": "~5.0.1",
|
||||
|
@ -41,7 +41,7 @@
|
|||
"postcss-dark-theme-class": "~0.7.3",
|
||||
"postcss-preset-env": "~8.0.1",
|
||||
"twitter-text": "~3.1.0",
|
||||
"vite": "~4.1.3",
|
||||
"vite": "~4.1.4",
|
||||
"vite-plugin-html-config": "~1.0.11",
|
||||
"vite-plugin-html-env": "~1.2.7",
|
||||
"vite-plugin-pwa": "~0.14.4",
|
||||
|
|
|
@ -368,6 +368,9 @@ function ShortcutForm({ type, lists, followedHashtags, onSubmit, disabled }) {
|
|||
? 'followed-hashtags-datalist'
|
||||
: null
|
||||
}
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck={false}
|
||||
/>
|
||||
{currentType === 'hashtag' && followedHashtags.length > 0 && (
|
||||
<datalist id="followed-hashtags-datalist">
|
||||
|
|
|
@ -88,7 +88,7 @@ function Login() {
|
|||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
spellcheck={false}
|
||||
/>
|
||||
<datalist id="instances-list">
|
||||
{instancesList.map((instance) => (
|
||||
|
|
|
@ -79,7 +79,7 @@ function Public({ local, ...props }) {
|
|||
type="button"
|
||||
class="plain"
|
||||
onClick={() => {
|
||||
const newInstance = prompt(
|
||||
let newInstance = prompt(
|
||||
'Enter a new instance e.g. "mastodon.social"',
|
||||
);
|
||||
if (!/\./.test(newInstance)) {
|
||||
|
@ -87,6 +87,7 @@ function Public({ local, ...props }) {
|
|||
return;
|
||||
}
|
||||
if (newInstance) {
|
||||
newInstance = newInstance.toLowerCase().trim();
|
||||
navigate(isLocal ? `/${newInstance}/p/l` : `/${newInstance}/p`);
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -115,6 +115,11 @@ export async function initPreferences(client) {
|
|||
// Get the masto instance
|
||||
// If accountID is provided, get the masto instance for that account
|
||||
export function api({ instance, accessToken, accountID, account } = {}) {
|
||||
// Always lowercase and trim the instance
|
||||
if (instance) {
|
||||
instance = instance.toLowerCase().trim();
|
||||
}
|
||||
|
||||
// If instance and accessToken are provided, get the masto instance for that account
|
||||
if (instance && accessToken) {
|
||||
return {
|
||||
|
@ -131,7 +136,7 @@ export function api({ instance, accessToken, accountID, account } = {}) {
|
|||
account = account || getAccount(accountID);
|
||||
if (account) {
|
||||
const accessToken = account.accessToken;
|
||||
const instance = account.instanceURL;
|
||||
const instance = account.instanceURL.toLowerCase().trim();
|
||||
return {
|
||||
masto:
|
||||
accountApis[instance]?.[accessToken] ||
|
||||
|
@ -155,12 +160,13 @@ export function api({ instance, accessToken, accountID, account } = {}) {
|
|||
}
|
||||
|
||||
// If no instance is provided, get the masto instance for the current account
|
||||
if (currentAccountApi)
|
||||
if (currentAccountApi) {
|
||||
return {
|
||||
masto: currentAccountApi,
|
||||
authenticated: true,
|
||||
instance: currentAccountApi.__instance__,
|
||||
};
|
||||
}
|
||||
const currentAccount = getCurrentAccount();
|
||||
if (currentAccount) {
|
||||
const { accessToken, instanceURL: instance } = currentAccount;
|
||||
|
|
Loading…
Reference in a new issue