6 Commits

Author SHA1 Message Date
cdfb015638 chore: bump version 2024-02-06 21:19:15 +08:00
435fe04ab3 chore: fix shortcut space checks 2024-02-06 21:15:58 +08:00
4e73882bf1 chore: add postinstall script 2024-02-06 21:10:34 +08:00
f2d9b29baa fix: delete user 2024-02-06 21:10:31 +08:00
eaf9113c92 fix: public shortcuts not showing up in public collections (#63) 2024-02-04 09:48:13 +08:00
194571e132 chore: remove debug code 2024-01-28 15:45:18 +08:00
10 changed files with 16 additions and 28 deletions

View File

@ -25,8 +25,6 @@ jobs:
cache-dependency-path: "frontend/extension/pnpm-lock.yaml" cache-dependency-path: "frontend/extension/pnpm-lock.yaml"
- run: pnpm install - run: pnpm install
working-directory: frontend/extension working-directory: frontend/extension
- run: pnpm type-gen
working-directory: frontend/extension
- name: Run eslint check - name: Run eslint check
run: pnpm lint run: pnpm lint
working-directory: frontend/extension working-directory: frontend/extension
@ -45,8 +43,6 @@ jobs:
cache-dependency-path: "frontend/extension/pnpm-lock.yaml" cache-dependency-path: "frontend/extension/pnpm-lock.yaml"
- run: pnpm install - run: pnpm install
working-directory: frontend/extension working-directory: frontend/extension
- run: pnpm type-gen
working-directory: frontend/extension
- name: Run extension build - name: Run extension build
run: pnpm build run: pnpm build
working-directory: frontend/extension working-directory: frontend/extension

View File

@ -25,8 +25,6 @@ jobs:
cache-dependency-path: "frontend/web/pnpm-lock.yaml" cache-dependency-path: "frontend/web/pnpm-lock.yaml"
- run: pnpm install - run: pnpm install
working-directory: frontend/web working-directory: frontend/web
- run: pnpm type-gen
working-directory: frontend/web
- name: Run eslint check - name: Run eslint check
run: pnpm lint run: pnpm lint
working-directory: frontend/web working-directory: frontend/web
@ -45,8 +43,6 @@ jobs:
cache-dependency-path: "frontend/web/pnpm-lock.yaml" cache-dependency-path: "frontend/web/pnpm-lock.yaml"
- run: pnpm install - run: pnpm install
working-directory: frontend/web working-directory: frontend/web
- run: pnpm type-gen
working-directory: frontend/web
- name: Run frontend build - name: Run frontend build
run: pnpm build run: pnpm build
working-directory: frontend/web working-directory: frontend/web

View File

@ -6,7 +6,7 @@ COPY . .
WORKDIR /frontend-build/frontend/web WORKDIR /frontend-build/frontend/web
RUN corepack enable && pnpm i --frozen-lockfile && pnpm type-gen RUN corepack enable && pnpm i --frozen-lockfile
RUN pnpm build RUN pnpm build

View File

@ -10,6 +10,7 @@ var allowedMethodsWhenUnauthorized = map[string]bool{
"/slash.api.v2.AuthService/SignOut": true, "/slash.api.v2.AuthService/SignOut": true,
"/memos.api.v2.AuthService/GetAuthStatus": true, "/memos.api.v2.AuthService/GetAuthStatus": true,
"/slash.api.v2.ShortcutService/GetShortcutByName": true, "/slash.api.v2.ShortcutService/GetShortcutByName": true,
"/slash.api.v2.ShortcutService/GetShortcut": true,
"/slash.api.v2.CollectionService/GetCollectionByName": true, "/slash.api.v2.CollectionService/GetCollectionByName": true,
} }

View File

@ -9,7 +9,7 @@
"package": "plasmo package", "package": "plasmo package",
"lint": "eslint --ext .js,.ts,.tsx, src", "lint": "eslint --ext .js,.ts,.tsx, src",
"lint-fix": "eslint --ext .js,.ts,.tsx, src --fix", "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix",
"type-gen": "cd ../../proto && buf generate" "postinstall": "cd ../../proto && buf generate"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.3", "@emotion/react": "^11.11.3",

View File

@ -6,7 +6,7 @@
"serve": "vite preview", "serve": "vite preview",
"lint": "eslint --ext .js,.ts,.tsx, src", "lint": "eslint --ext .js,.ts,.tsx, src",
"lint-fix": "eslint --ext .js,.ts,.tsx, src --fix", "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix",
"type-gen": "cd ../../proto && buf generate" "postinstall": "cd ../../proto && buf generate"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.3", "@emotion/react": "^11.11.3",

View File

@ -17,6 +17,7 @@ const ShortcutSpace = () => {
const currentUser = userStore.getCurrentUser(); const currentUser = userStore.getCurrentUser();
const shortcutStore = useShortcutStore(); const shortcutStore = useShortcutStore();
const [shortcut, setShortcut] = useState<Shortcut>(); const [shortcut, setShortcut] = useState<Shortcut>();
const [loading, setLoading] = useState(true);
const [showCreateShortcutDrawer, setShowCreateShortcutDrawer] = useState(false); const [showCreateShortcutDrawer, setShowCreateShortcutDrawer] = useState(false);
useEffect(() => { useEffect(() => {
@ -28,15 +29,21 @@ const ShortcutSpace = () => {
console.error(error); console.error(error);
toast.error(error.details); toast.error(error.details);
} }
setLoading(false);
})(); })();
}, [shortcutName]); }, [shortcutName]);
if (loading) {
return null;
}
if (!shortcut) { if (!shortcut) {
if (!currentUser) { if (!currentUser) {
navigateTo("/404"); navigateTo("/404");
return null; return null;
} }
console.log("currentUser", currentUser);
// If shortcut is not found, prompt user to create it.
return ( return (
<> <>
<div className="w-full h-[100svh] flex flex-col justify-center items-center p-4"> <div className="w-full h-[100svh] flex flex-col justify-center items-center p-4">
@ -59,12 +66,14 @@ const ShortcutSpace = () => {
</> </>
); );
} }
// If shortcut is a URL, redirect to it directly. // If shortcut is a URL, redirect to it directly.
if (isURL(shortcut.link)) { if (isURL(shortcut.link)) {
window.document.title = "Redirecting..."; window.document.title = "Redirecting...";
window.location.href = shortcut.link; window.location.href = shortcut.link;
return null; return null;
} }
// Otherwise, render the shortcut link as plain text. // Otherwise, render the shortcut link as plain text.
return <div>{shortcut.link}</div>; return <div>{shortcut.link}</div>;
}; };

View File

@ -9,10 +9,10 @@ import (
// Version is the service current released version. // Version is the service current released version.
// Semantic versioning: https://semver.org/ // Semantic versioning: https://semver.org/
var Version = "0.5.2" var Version = "0.5.3"
// DevVersion is the service current development version. // DevVersion is the service current development version.
var DevVersion = "0.5.2" var DevVersion = "0.5.3"
func GetCurrentVersion(mode string) string { func GetCurrentVersion(mode string) string {
if mode == "dev" || mode == "demo" { if mode == "dev" || mode == "demo" {

View File

@ -2,7 +2,6 @@ package sqlite
import ( import (
"context" "context"
"database/sql"
"fmt" "fmt"
"strings" "strings"
@ -178,16 +177,6 @@ func (d *DB) DeleteMemo(ctx context.Context, delete *store.DeleteMemo) error {
return nil return nil
} }
func vacuumMemo(ctx context.Context, tx *sql.Tx) error {
stmt := `DELETE FROM memo WHERE creator_id NOT IN (SELECT id FROM user)`
_, err := tx.ExecContext(ctx, stmt)
if err != nil {
return err
}
return nil
}
func placeholders(n int) string { func placeholders(n int) string {
return strings.Repeat("?,", n-1) + "?" return strings.Repeat("?,", n-1) + "?"
} }

View File

@ -166,9 +166,6 @@ func (d *DB) DeleteUser(ctx context.Context, delete *store.DeleteUser) error {
if err := vacuumShortcut(ctx, tx); err != nil { if err := vacuumShortcut(ctx, tx); err != nil {
return err return err
} }
if err := vacuumMemo(ctx, tx); err != nil {
return err
}
if err := vacuumCollection(ctx, tx); err != nil { if err := vacuumCollection(ctx, tx); err != nil {
return err return err
} }