mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 01:05:34 +03: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);
|
||||
if (account) {
|
||||
account.info = mastoAccount;
|
||||
account.instanceURL = instanceURL;
|
||||
account.instanceURL = instanceURL.toLowerCase();
|
||||
account.accessToken = accessToken;
|
||||
} else {
|
||||
account = {
|
||||
|
@ -166,7 +166,7 @@ function App() {
|
|||
console.log(info);
|
||||
const { uri, domain } = info;
|
||||
const instances = store.local.getJSON('instances') || {};
|
||||
instances[domain || uri] = info;
|
||||
instances[(domain || uri).toLowerCase()] = info;
|
||||
store.local.setJSON('instances', instances);
|
||||
})();
|
||||
});
|
||||
|
|
|
@ -73,9 +73,9 @@ function Compose({
|
|||
const configuration = useMemo(() => {
|
||||
try {
|
||||
const instances = store.local.getJSON('instances');
|
||||
const currentInstance = accounts.find(
|
||||
(a) => a.info.id === currentAccount,
|
||||
).instanceURL;
|
||||
const currentInstance = accounts
|
||||
.find((a) => a.info.id === currentAccount)
|
||||
.instanceURL.toLowerCase();
|
||||
const config = instances[currentInstance].configuration;
|
||||
console.log(config);
|
||||
return config;
|
||||
|
|
|
@ -16,14 +16,14 @@ function Login() {
|
|||
|
||||
useEffect(() => {
|
||||
if (cachedInstanceURL) {
|
||||
instanceURLRef.current.value = cachedInstanceURL;
|
||||
instanceURLRef.current.value = cachedInstanceURL.toLowerCase();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const { elements } = e.target;
|
||||
let instanceURL = elements.instanceURL.value;
|
||||
let instanceURL = elements.instanceURL.value.toLowerCase();
|
||||
// Remove protocol from instance URL
|
||||
instanceURL = instanceURL.replace(/(^\w+:|^)\/\//, '');
|
||||
store.local.set('instanceURL', instanceURL);
|
||||
|
|
Loading…
Reference in a new issue