Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update resource base url

Stevenfbce43870f0b
diff --git a/server/server.go b/server/server.go
index 766934b09..ed17905e7 100644
--- a/server/server.go
+++ b/server/server.go
@@ -56,8 +56,11 @@ func NewServer(profile *profile.Profile) *Server {
Profile: profile,
}
- publicRouteGroup := e.Group("/h")
- s.registerResourcePublicRoutes(publicRouteGroup)
+ webhookGroup := e.Group("/h")
+ s.registerResourcePublicRoutes(webhookGroup)
+
+ publicGroup := e.Group("/o")
+ s.registerResourcePublicRoutes(publicGroup)
apiGroup := e.Group("/api")
apiGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx
index 7c12810f6..a6edbaa36 100644
--- a/web/src/components/MemoEditor.tsx
+++ b/web/src/components/MemoEditor.tsx
@@ -116,7 +116,7 @@ const MemoEditor = () => {
try {
const image = await resourceService.upload(file);
- const url = `/h/r/${image.id}/${image.filename}`;
+ const url = `/o/r/${image.id}/${image.filename}`;
return url;
} catch (error: any) {
console.error(error);
diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsx
index 4978cb2d9..4c4ea71a5 100644
--- a/web/src/components/ResourcesDialog.tsx
+++ b/web/src/components/ResourcesDialog.tsx
@@ -90,11 +90,11 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
};
const handlPreviewBtnClick = (resource: Resource) => {
- showPreviewImageDialog(`${window.location.origin}/h/r/${resource.id}/${resource.filename}`);
+ showPreviewImageDialog(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
};
const handleCopyResourceLinkBtnClick = (resource: Resource) => {
- utils.copyTextToClipboard(`${window.location.origin}/h/r/${resource.id}/${resource.filename}`);
+ utils.copyTextToClipboard(`${window.location.origin}/o/r/${resource.id}/${resource.filename}`);
toastHelper.success("Succeed to copy resource link to clipboard");
};
diff --git a/web/vite.config.ts b/web/vite.config.ts
index ed99b8bd5..3f640eee6 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -6,13 +6,17 @@ import { resolve } from "path";
export default defineConfig({
plugins: [react()],
server: {
- cors: true,
+ host: "0.0.0.0",
port: 3000,
proxy: {
"/api": {
target: "http://localhost:8080/",
changeOrigin: true,
},
+ "/o/": {
+ target: "http://localhost:8080/",
+ changeOrigin: true,
+ },
"/h/": {
target: "http://localhost:8080/",
changeOrigin: true,