mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 22:14:42 +01:00
toLowerCase() all the instance URLs!
This commit is contained in:
parent
bfaefbe178
commit
727b944f3b
3 changed files with 7 additions and 7 deletions
|
@ -82,7 +82,7 @@ function App() {
|
||||||
let account = accounts.find((a) => a.info.id === mastoAccount.id);
|
let account = accounts.find((a) => a.info.id === mastoAccount.id);
|
||||||
if (account) {
|
if (account) {
|
||||||
account.info = mastoAccount;
|
account.info = mastoAccount;
|
||||||
account.instanceURL = instanceURL;
|
account.instanceURL = instanceURL.toLowerCase();
|
||||||
account.accessToken = accessToken;
|
account.accessToken = accessToken;
|
||||||
} else {
|
} else {
|
||||||
account = {
|
account = {
|
||||||
|
@ -166,7 +166,7 @@ function App() {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
const { uri, domain } = info;
|
const { uri, domain } = info;
|
||||||
const instances = store.local.getJSON('instances') || {};
|
const instances = store.local.getJSON('instances') || {};
|
||||||
instances[domain || uri] = info;
|
instances[(domain || uri).toLowerCase()] = info;
|
||||||
store.local.setJSON('instances', instances);
|
store.local.setJSON('instances', instances);
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,9 +73,9 @@ function Compose({
|
||||||
const configuration = useMemo(() => {
|
const configuration = useMemo(() => {
|
||||||
try {
|
try {
|
||||||
const instances = store.local.getJSON('instances');
|
const instances = store.local.getJSON('instances');
|
||||||
const currentInstance = accounts.find(
|
const currentInstance = accounts
|
||||||
(a) => a.info.id === currentAccount,
|
.find((a) => a.info.id === currentAccount)
|
||||||
).instanceURL;
|
.instanceURL.toLowerCase();
|
||||||
const config = instances[currentInstance].configuration;
|
const config = instances[currentInstance].configuration;
|
||||||
console.log(config);
|
console.log(config);
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -16,14 +16,14 @@ function Login() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (cachedInstanceURL) {
|
if (cachedInstanceURL) {
|
||||||
instanceURLRef.current.value = cachedInstanceURL;
|
instanceURLRef.current.value = cachedInstanceURL.toLowerCase();
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const { elements } = e.target;
|
const { elements } = e.target;
|
||||||
let instanceURL = elements.instanceURL.value;
|
let instanceURL = elements.instanceURL.value.toLowerCase();
|
||||||
// Remove protocol from instance URL
|
// Remove protocol from instance URL
|
||||||
instanceURL = instanceURL.replace(/(^\w+:|^)\/\//, '');
|
instanceURL = instanceURL.replace(/(^\w+:|^)\/\//, '');
|
||||||
store.local.set('instanceURL', instanceURL);
|
store.local.set('instanceURL', instanceURL);
|
||||||
|
|
Loading…
Add table
Reference in a new issue