2022-09-29 10:02:41 +00:00
|
|
|
/*
|
|
|
|
GoToSocial
|
2023-03-12 17:49:06 +00:00
|
|
|
Copyright (C) GoToSocial Authors admin@gotosocial.org
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
2022-09-29 10:02:41 +00:00
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const React = require("react");
|
|
|
|
const ReactDom = require("react-dom/client");
|
|
|
|
const { Provider } = require("react-redux");
|
|
|
|
const { PersistGate } = require("redux-persist/integration/react");
|
|
|
|
|
2023-10-05 14:06:19 +00:00
|
|
|
const { store, persistor } = require("./redux/store");
|
2023-03-29 10:18:45 +00:00
|
|
|
const { createNavigation, Menu, Item } = require("./lib/navigation");
|
|
|
|
|
2023-10-05 14:06:19 +00:00
|
|
|
const { Authorization } = require("./components/authorization");
|
2022-12-11 15:00:23 +00:00
|
|
|
const Loading = require("./components/loading");
|
2023-03-29 10:18:45 +00:00
|
|
|
const UserLogoutCard = require("./components/user-logout-card");
|
|
|
|
const { RoleContext } = require("./lib/navigation/util");
|
2022-09-29 10:02:41 +00:00
|
|
|
|
2024-01-16 17:28:56 +00:00
|
|
|
const UserProfile = require("./user/profile").default;
|
|
|
|
const UserSettings = require("./user/settings").default;
|
|
|
|
const UserMigration = require("./user/migration").default;
|
|
|
|
|
2024-04-13 11:25:10 +00:00
|
|
|
const Reports = require("./admin/reports").default;
|
|
|
|
|
|
|
|
const Accounts = require("./admin/accounts").default;
|
|
|
|
const AccountsPending = require("./admin/accounts/pending").default;
|
|
|
|
|
2023-10-17 10:46:06 +00:00
|
|
|
const DomainPerms = require("./admin/domain-permissions").default;
|
|
|
|
const DomainPermsImportExport = require("./admin/domain-permissions/import-export").default;
|
|
|
|
|
2024-04-13 11:25:10 +00:00
|
|
|
const AdminMedia = require("./admin/actions/media").default;
|
|
|
|
const AdminKeys = require("./admin/actions/keys").default;
|
|
|
|
|
|
|
|
const LocalEmoji = require("./admin/emoji/local").default;
|
|
|
|
const RemoteEmoji = require("./admin/emoji/remote").default;
|
|
|
|
|
2024-01-05 12:39:31 +00:00
|
|
|
const InstanceSettings = require("./admin/settings").default;
|
2024-04-13 11:25:10 +00:00
|
|
|
const InstanceRules = require("./admin/settings/rules").default;
|
2024-01-05 12:39:31 +00:00
|
|
|
|
2022-09-29 10:02:41 +00:00
|
|
|
require("./style.css");
|
|
|
|
|
2023-03-29 10:18:45 +00:00
|
|
|
const { Sidebar, ViewRouter } = createNavigation("/settings", [
|
|
|
|
Menu("User", [
|
2024-01-16 17:28:56 +00:00
|
|
|
Item("Profile", { icon: "fa-user" }, UserProfile),
|
|
|
|
Item("Settings", { icon: "fa-cogs" }, UserSettings),
|
|
|
|
Item("Migration", { icon: "fa-exchange" }, UserMigration),
|
2023-03-29 10:18:45 +00:00
|
|
|
]),
|
|
|
|
Menu("Moderation", {
|
|
|
|
url: "admin",
|
|
|
|
permissions: ["admin"]
|
|
|
|
}, [
|
2024-04-13 11:25:10 +00:00
|
|
|
Item("Reports", { icon: "fa-flag", wildcard: true }, Reports),
|
|
|
|
Item("Accounts", { icon: "fa-users", wildcard: true }, [
|
|
|
|
Item("Overview", { icon: "fa-list", url: "", wildcard: true }, Accounts),
|
|
|
|
Item("Pending", { icon: "fa-question", url: "pending", wildcard: true }, AccountsPending),
|
|
|
|
]),
|
2023-10-17 10:46:06 +00:00
|
|
|
Menu("Domain Permissions", { icon: "fa-hubzilla" }, [
|
|
|
|
Item("Blocks", { icon: "fa-close", url: "block", wildcard: true }, DomainPerms),
|
|
|
|
Item("Allows", { icon: "fa-check", url: "allow", wildcard: true }, DomainPerms),
|
|
|
|
Item("Import/Export", { icon: "fa-floppy-o", url: "import-export", wildcard: true }, DomainPermsImportExport),
|
|
|
|
]),
|
2023-03-29 10:18:45 +00:00
|
|
|
]),
|
|
|
|
Menu("Administration", {
|
|
|
|
url: "admin",
|
|
|
|
defaultUrl: "/settings/admin/settings",
|
|
|
|
permissions: ["admin"]
|
|
|
|
}, [
|
2023-09-12 09:43:12 +00:00
|
|
|
Menu("Actions", { icon: "fa-bolt" }, [
|
2024-04-13 11:25:10 +00:00
|
|
|
Item("Media", { icon: "fa-photo" }, AdminMedia),
|
|
|
|
Item("Keys", { icon: "fa-key-modern" }, AdminKeys),
|
2023-09-12 09:43:12 +00:00
|
|
|
]),
|
2023-03-29 10:18:45 +00:00
|
|
|
Menu("Custom Emoji", { icon: "fa-smile-o" }, [
|
2024-04-13 11:25:10 +00:00
|
|
|
Item("Local", { icon: "fa-home", wildcard: true }, LocalEmoji),
|
|
|
|
Item("Remote", { icon: "fa-cloud" }, RemoteEmoji),
|
2023-03-29 10:18:45 +00:00
|
|
|
]),
|
2023-08-19 12:33:15 +00:00
|
|
|
Menu("Settings", { icon: "fa-sliders" }, [
|
2024-01-05 12:39:31 +00:00
|
|
|
Item("Settings", { icon: "fa-sliders", url: "" }, InstanceSettings),
|
2024-04-13 11:25:10 +00:00
|
|
|
Item("Rules", { icon: "fa-dot-circle-o", wildcard: true }, InstanceRules),
|
2023-09-12 09:43:12 +00:00
|
|
|
]),
|
2023-03-29 10:18:45 +00:00
|
|
|
])
|
|
|
|
]);
|
2022-09-29 10:02:41 +00:00
|
|
|
|
2023-01-18 13:45:14 +00:00
|
|
|
function App({ account }) {
|
2023-03-29 10:18:45 +00:00
|
|
|
const permissions = [account.role.name];
|
2022-09-29 10:02:41 +00:00
|
|
|
|
2023-01-18 13:45:14 +00:00
|
|
|
return (
|
2023-03-29 10:18:45 +00:00
|
|
|
<RoleContext.Provider value={permissions}>
|
2023-01-18 13:45:14 +00:00
|
|
|
<div className="sidebar">
|
2023-03-29 10:18:45 +00:00
|
|
|
<UserLogoutCard />
|
|
|
|
<Sidebar />
|
2022-09-29 10:02:41 +00:00
|
|
|
</div>
|
2023-01-18 13:45:14 +00:00
|
|
|
<section className="with-sidebar">
|
2023-03-29 10:18:45 +00:00
|
|
|
<ViewRouter />
|
2022-09-29 10:02:41 +00:00
|
|
|
</section>
|
2023-03-29 10:18:45 +00:00
|
|
|
</RoleContext.Provider>
|
2023-01-18 13:45:14 +00:00
|
|
|
);
|
2022-09-29 10:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function Main() {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
2023-01-18 13:45:14 +00:00
|
|
|
<PersistGate loading={<section><Loading /></section>} persistor={persistor}>
|
2023-10-05 14:06:19 +00:00
|
|
|
<Authorization App={App} />
|
2022-09-29 10:02:41 +00:00
|
|
|
</PersistGate>
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const root = ReactDom.createRoot(document.getElementById("root"));
|
|
|
|
root.render(<React.StrictMode><Main /></React.StrictMode>);
|