diff --git a/web/source/settings/admin/actions.js b/web/source/settings/admin/actions.js
index d4980d021..915b8aee1 100644
--- a/web/source/settings/admin/actions.js
+++ b/web/source/settings/admin/actions.js
@@ -18,7 +18,6 @@
"use strict";
-const Promise = require("bluebird");
const React = require("react");
const Redux = require("react-redux");
diff --git a/web/source/settings/admin/emoji/detail.js b/web/source/settings/admin/emoji/detail.js
index 0377bc76e..cc0f8e73c 100644
--- a/web/source/settings/admin/emoji/detail.js
+++ b/web/source/settings/admin/emoji/detail.js
@@ -45,7 +45,7 @@ module.exports = function EmojiDetailWrapped() {
>);
};
-function EmojiDetail({emoji, Form}) {
+function EmojiDetail({emoji}) {
if (emoji == undefined) {
return (<>
diff --git a/web/source/settings/admin/federation.js b/web/source/settings/admin/federation.js
index 99f10e69e..449d2156f 100644
--- a/web/source/settings/admin/federation.js
+++ b/web/source/settings/admin/federation.js
@@ -50,7 +50,7 @@ module.exports = function AdminSettings() {
return dispatch(api.admin.fetchDomainBlocks());
});
}
- }, []);
+ }, [dispatch, loadedBlockedInstances]);
if (!loadedBlockedInstances) {
return (
@@ -315,7 +315,7 @@ function InstancePage({domain, Form}) {
if (entry == undefined) {
dispatch(api.admin.getEditableDomainBlock(domain));
}
- }, []);
+ }, [dispatch, domain, entry]);
const [errorMsg, setError] = React.useState("");
const [statusMsg, setStatus] = React.useState("");
diff --git a/web/source/settings/admin/settings.js b/web/source/settings/admin/settings.js
index 845a1f924..dde631025 100644
--- a/web/source/settings/admin/settings.js
+++ b/web/source/settings/admin/settings.js
@@ -18,7 +18,6 @@
"use strict";
-const Promise = require("bluebird");
const React = require("react");
const Redux = require("react-redux");
diff --git a/web/source/settings/index.js b/web/source/settings/index.js
index 6a72dabe0..58afe5d28 100644
--- a/web/source/settings/index.js
+++ b/web/source/settings/index.js
@@ -94,7 +94,7 @@ function App() {
console.error(e);
});
}
- }, []);
+ }, [loginState, dispatch]);
let ErrorElement = null;
if (errorMsg != undefined) {
diff --git a/web/source/settings/lib/api/index.js b/web/source/settings/lib/api/index.js
index 92c54dc0e..e4b02ce14 100644
--- a/web/source/settings/lib/api/index.js
+++ b/web/source/settings/lib/api/index.js
@@ -24,14 +24,12 @@ const d = require("dotty");
const { APIError, AuthenticationError } = require("../errors");
const { setInstanceInfo, setNamedInstanceInfo } = require("../../redux/reducers/instances").actions;
-const oauth = require("../../redux/reducers/oauth").actions;
function apiCall(method, route, payload, type = "json") {
return function (dispatch, getState) {
const state = getState();
let base = state.oauth.instance;
let auth = state.oauth.token;
- console.log(method, base, route, "auth:", auth != undefined);
return Promise.try(() => {
let url = new URL(base);
diff --git a/web/source/settings/lib/get-views.js b/web/source/settings/lib/get-views.js
index 39f627435..96ab17404 100644
--- a/web/source/settings/lib/get-views.js
+++ b/web/source/settings/lib/get-views.js
@@ -19,8 +19,7 @@
"use strict";
const React = require("react");
-const Redux = require("react-redux");
-const { Link, Route, Switch, Redirect } = require("wouter");
+const { Link, Route, Redirect } = require("wouter");
const { ErrorBoundary } = require("react-error-boundary");
const ErrorFallback = require("../components/error");
diff --git a/web/source/settings/lib/panel.js b/web/source/settings/lib/panel.js
deleted file mode 100644
index df723bc74..000000000
--- a/web/source/settings/lib/panel.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- GoToSocial
- Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-*/
-
-"use strict";
-
-const Promise = require("bluebird");
-const React = require("react");
-const ReactDom = require("react-dom");
-
-const oauthLib = require("./oauth");
-
-module.exports = function createPanel(clientName, scope, Component) {
- ReactDom.render(, document.getElementById("root"));
-
- function Panel() {
- const [oauth, setOauth] = React.useState();
- const [hasAuth, setAuth] = React.useState(false);
- const [oauthState, setOauthState] = React.useState(localStorage.getItem("oauth"));
-
- React.useEffect(() => {
- let state = localStorage.getItem("oauth");
- if (state != undefined) {
- state = JSON.parse(state);
- let restoredOauth = oauthLib(state.config, state);
- Promise.try(() => {
- return restoredOauth.callback();
- }).then(() => {
- setAuth(true);
- });
- setOauth(restoredOauth);
- }
- }, [setAuth, setOauth]);
-
- if (!hasAuth && oauth && oauth.isAuthorized()) {
- setAuth(true);
- }
-
- if (oauth && oauth.isAuthorized()) {
- return ;
- } else if (oauthState != undefined) {
- return "processing oauth...";
- } else {
- return ;
- }
- }
-
- function Auth({setOauth}) {
- const [ instance, setInstance ] = React.useState("");
-
- React.useEffect(() => {
- let isStillMounted = true;
- // check if current domain runs an instance
- let thisUrl = new URL(window.location.origin);
- thisUrl.pathname = "/api/v1/instance";
- Promise.try(() => {
- return fetch(thisUrl.href);
- }).then((res) => {
- if (res.status == 200) {
- return res.json();
- }
- }).then((json) => {
- if (json && json.uri && isStillMounted) {
- setInstance(json.uri);
- }
- }).catch((e) => {
- console.log("error checking instance response:", e);
- });
-
- return () => {
- // cleanup function
- isStillMounted = false;
- };
- }, []);
-
- function doAuth() {
- return Promise.try(() => {
- return new URL(instance);
- }).catch(TypeError, () => {
- return new URL(`https://${instance}`);
- }).then((parsedURL) => {
- let url = parsedURL.toString();
- let oauth = oauthLib({
- instance: url,
- client_name: clientName,
- scope: scope,
- website: window.location.href
- });
- setOauth(oauth);
- setInstance(url);
- return oauth.register().then(() => {
- return oauth;
- });
- }).then((oauth) => {
- return oauth.authorize();
- }).catch((e) => {
- console.log("error authenticating:", e);
- });
- }
-
- function updateInstance(e) {
- if (e.key == "Enter") {
- doAuth();
- } else {
- setInstance(e.target.value);
- }
- }
-
- return (
-
- );
- }
-};
\ No newline at end of file
diff --git a/web/source/settings/lib/query/custom-emoji.js b/web/source/settings/lib/query/custom-emoji.js
index a13fa60fd..a26da75ca 100644
--- a/web/source/settings/lib/query/custom-emoji.js
+++ b/web/source/settings/lib/query/custom-emoji.js
@@ -18,8 +18,6 @@
"use strict";
-const Promise = require("bluebird");
-
const base = require("./base");
const endpoints = (build) => ({
diff --git a/web/source/settings/redux/reducers/admin.js b/web/source/settings/redux/reducers/admin.js
index c31828db7..57ca83d7e 100644
--- a/web/source/settings/redux/reducers/admin.js
+++ b/web/source/settings/redux/reducers/admin.js
@@ -19,7 +19,6 @@
"use strict";
const { createSlice } = require("@reduxjs/toolkit");
-const defaultValue = require("default-value");
function sortBlocks(blocks) {
return blocks.sort((a, b) => { // alphabetical sort
diff --git a/web/source/settings/user/profile.js b/web/source/settings/user/profile.js
index 3162fa0dd..21e86ce66 100644
--- a/web/source/settings/user/profile.js
+++ b/web/source/settings/user/profile.js
@@ -18,7 +18,6 @@
"use strict";
-const Promise = require("bluebird");
const React = require("react");
const Redux = require("react-redux");