From 086e5391558a4d31821e6c1e2f412acaef6b76c0 Mon Sep 17 00:00:00 2001 From: Korbs Date: Thu, 20 Feb 2025 01:47:01 -0500 Subject: [PATCH] update --- .env.sample | 9 ++ .gitignore | 3 +- README.md | 18 +++ src/assets/Templates/Register.html | 2 +- src/tsconfig.node.json | 1 + src/webapp/components/Page.tsx | 2 +- src/webapp/features/apps/AppSharing.tsx | 2 +- src/webapp/features/auth/LoginPage.backup.tsx | 130 ++++++++++++++++++ src/webapp/features/auth/LoginPage.tsx | 81 +++++------ src/webapp/features/export/ToolsList.tsx | 2 +- src/webapp/styles/index.css | 94 +++++++++++++ 11 files changed, 289 insertions(+), 55 deletions(-) create mode 100755 .env.sample create mode 100755 src/webapp/features/auth/LoginPage.backup.tsx diff --git a/.env.sample b/.env.sample new file mode 100755 index 0000000..9a41187 --- /dev/null +++ b/.env.sample @@ -0,0 +1,9 @@ +BASE_URL="https://zv.example.org" +AUTH_SECRET="Ah6Lm3h8Qmnhm8oDfw09AOUYEOMKpzfqIFPjBA2waLPm9SD65BA1eSXde9OS80nE" +DATABASE_URL="Server=aptabase_db;Port=5432;User Id=aptabase;Password=0000000000000000000000000000000000000000000000000000000000000000;Database=aptabase" +CLICKHOUSE_URL="Host=aptabase_events_db;Port=8123;Username=aptabase;Password=0000000000000000000000000000000000000000000000000000000000000000" +SMTP_HOST="smtp.resend.com" +SMTP_PORT="465" +SMTP_USERNAME="resend" +SMTP_PASSWORD="" +SMTP_FROM_ADDRESS="no-reply@example.org" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3e3d800..9321c15 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env src/node_modules -src/wwwroot/ \ No newline at end of file +src/wwwroot/ +tmp/ \ No newline at end of file diff --git a/README.md b/README.md index cdf4897..c5c919e 100755 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A fork of Aptabase Server software, modified to only work with projects using Za ## Changes - Updated app key generation to use `ZV` instead of `SH` + - Updated the name "Aptabase" to "Zalvena" in some sections - Updated browserslist - Updated `node:18` to `over/bun:1` in `Dockerfile` - Updated the pacakge `@types/node` from `20.8.7` to `22.13.4` @@ -41,6 +42,8 @@ A fork of Aptabase Server software, modified to only work with projects using Za - Updated the pacakge `rehype-highlight` from `7.0.0` to `7.0.2` - Updated the pacakge `remark-gfm` from `4.0.0` to `4.0.1` - Updated the pacakge `sonner` from `1.0.3` to `2.0.0` + - Added `.env.sample` + - Redesigned login screen - Remote sources removed to make this fork comply with SudoVanilla Umbrella Policy - Default avatar points to https://md.sudovanilla.org/images/icons/Aptabase.jpg - Flags point to https://md.sudovanilla.org/images/flags/ @@ -51,6 +54,21 @@ A fork of Aptabase Server software, modified to only work with projects using Za - Removed `/tests/` - Removed `/tools/` +## Planned Changes + - Revamp emails + - Use SudoVanilla Gateway email template + - Revamp design + - Use Mona Font + - Replace sidebar layout with header + - Replace Tabler icons with Iconoir + - Add SudoVanilla Gateway OpenID Login + - Add new instruction screens + - Remove all traces of Aptabase trademarks, branding, and name to differentiate Zalvena from Aptabase + - Remove all Aptabase Cloud functions including Billing, US/EU Regions, and more + +**Maybe** + - Replace usage of React with Astro? 🤔 + ## License Aptabase and Zalvena Service is open-source under the [AGPLv3 license](./LICENSE). You can use it for free, but you must share any changes you make to the code. \ No newline at end of file diff --git a/src/assets/Templates/Register.html b/src/assets/Templates/Register.html index d96d7ee..429e59a 100755 --- a/src/assets/Templates/Register.html +++ b/src/assets/Templates/Register.html @@ -1,5 +1,5 @@

Hi ##NAME##,

-

You asked for a magic link to Aptabase and here it is.

+

You asked for a magic link to Zalvena and here it is.

Confirm your registration

diff --git a/src/tsconfig.node.json b/src/tsconfig.node.json index 0cd46a7..7f2930a 100755 --- a/src/tsconfig.node.json +++ b/src/tsconfig.node.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "jsx": "react", "composite": true, "module": "ES2022", "moduleResolution": "Node", diff --git a/src/webapp/components/Page.tsx b/src/webapp/components/Page.tsx index a4b9b14..f8c7d62 100755 --- a/src/webapp/components/Page.tsx +++ b/src/webapp/components/Page.tsx @@ -12,7 +12,7 @@ export function Page(props: Props) { const location = useLocation(); useEffect(() => { - document.title = `${props.title} · Aptabase`; + document.title = `${props.title} · Zalvena`; }, [props.title]); return ( diff --git a/src/webapp/features/apps/AppSharing.tsx b/src/webapp/features/apps/AppSharing.tsx index 7b385c6..883305d 100755 --- a/src/webapp/features/apps/AppSharing.tsx +++ b/src/webapp/features/apps/AppSharing.tsx @@ -80,7 +80,7 @@ export function AppSharing(props: Props) {

- Note: Aptabase won't send an email as part of the sharing process. We + Note: Zalvena won't send an email as part of the sharing process. We recommend you getting in contact with them directly and asking them to sign up.

diff --git a/src/webapp/features/auth/LoginPage.backup.tsx b/src/webapp/features/auth/LoginPage.backup.tsx new file mode 100755 index 0000000..f5c36ef --- /dev/null +++ b/src/webapp/features/auth/LoginPage.backup.tsx @@ -0,0 +1,130 @@ +import { requestSignInLink } from "@features/auth"; +import { Page } from "@components/Page"; +import { useState } from "react"; +import { Link, useSearchParams } from "react-router-dom"; +import { DataResidency } from "./DataResidency"; +import { LegalNotice } from "./LegalNotice"; +import { RegionSwitch } from "./RegionSwitch"; +import { SignInWithGitHub } from "./SignInWithGitHub"; +import { SignInWithGoogle } from "./SignInWithGoogle"; +import { isOAuthEnabled } from "@features/env"; +import { Logo } from "./Logo"; +import { Button } from "@components/Button"; +import { TextInput } from "@components/TextInput"; + +type FormStatus = "idle" | "loading" | "success" | "notfound"; + +type StatusMessageProps = { + status: FormStatus; +}; + +const SignUpMessage = () => ( + + Don't have an account?{" "} + + Sign up + {" "} + for free. + +); + +const StatusMessage = (props: StatusMessageProps) => { + if (props.status === "success") { + return Woo-hoo! Email sent, go check your inbox!; + } + + if (props.status === "notfound") { + return ( + <> + Could not find an account with that email. + + + ); + } + + return ; +}; + +const RedirectErrorMessage = () => { + const [params] = useSearchParams(); + + const error = params.get("error"); + if (!error) { + return null; + } + const message = error === "expired" ? "This link has expired." : "This link is invalid."; + + return ( +

+ {message} Please request a new one. +

+ ); +}; + +Component.displayName = "LoginPage"; +export function Component() { + const [email, setEmail] = useState(""); + const [status, setStatus] = useState("idle"); + + const handleSubmit = async (event: React.FormEvent) => { + event.preventDefault(); + setStatus("loading"); + + const found = await requestSignInLink(email); + setStatus(found ? "success" : "notfound"); + }; + + return ( + +
+ +
+ +
+ +

Sign in to your account

+ +
+
+
+ {isOAuthEnabled && ( + <> +
+ + +
+ +
+ + + )} + +
+ setEmail(e.target.value)} + /> + +

+ +

+ +
+ + +
+ + ); +} diff --git a/src/webapp/features/auth/LoginPage.tsx b/src/webapp/features/auth/LoginPage.tsx index f5c36ef..59d6720 100755 --- a/src/webapp/features/auth/LoginPage.tsx +++ b/src/webapp/features/auth/LoginPage.tsx @@ -1,14 +1,7 @@ import { requestSignInLink } from "@features/auth"; import { Page } from "@components/Page"; -import { useState } from "react"; +import React, { useState } from "react"; import { Link, useSearchParams } from "react-router-dom"; -import { DataResidency } from "./DataResidency"; -import { LegalNotice } from "./LegalNotice"; -import { RegionSwitch } from "./RegionSwitch"; -import { SignInWithGitHub } from "./SignInWithGitHub"; -import { SignInWithGoogle } from "./SignInWithGoogle"; -import { isOAuthEnabled } from "@features/env"; -import { Logo } from "./Logo"; import { Button } from "@components/Button"; import { TextInput } from "@components/TextInput"; @@ -30,13 +23,13 @@ const SignUpMessage = () => ( const StatusMessage = (props: StatusMessageProps) => { if (props.status === "success") { - return Woo-hoo! Email sent, go check your inbox!; + return The link has been sent to your inbox, check it now.; } if (props.status === "notfound") { return ( <> - Could not find an account with that email. + An account with that email was not found, try again. ); @@ -56,7 +49,7 @@ const RedirectErrorMessage = () => { return (

- {message} Please request a new one. + {message} Link invalid, try again. Links only last 15 minutes.

); }; @@ -75,56 +68,44 @@ export function Component() { }; return ( - -
- -
+
+
+
+ +

Zalvena

+
+
+

+

Login to your account

+ -
- -

Sign in to your account

- -
-
-
- {isOAuthEnabled && ( - <> -
- - -
+
+ -
- - - )} - -
+ setEmail(e.target.value)} /> - -

- -

+ +

+
+

By signing in, you agree to the Privacy Policy.

- -
- - ); +
+ ) } diff --git a/src/webapp/features/export/ToolsList.tsx b/src/webapp/features/export/ToolsList.tsx index 3ed7c19..7d1b335 100755 --- a/src/webapp/features/export/ToolsList.tsx +++ b/src/webapp/features/export/ToolsList.tsx @@ -48,7 +48,7 @@ export function ToolsList() { icon="excel" name="Microsoft Excel" href="https://www.microsoft.com/en-ie/microsoft-365" - description="The most popular spreadsheet works great with Aptabase CSV files. Open it on Excel and start exploring your data with Pivot Tables and Charts." + description="The most popular spreadsheet works great with Zalvena CSV files. Open it on Excel and start exploring your data with Pivot Tables and Charts." />