chore: update resource base url

This commit is contained in:
Steven
2022-09-09 07:40:21 +08:00
parent b1e6956441
commit fbce43870f
4 changed files with 13 additions and 6 deletions

View File

@@ -56,8 +56,11 @@ func NewServer(profile *profile.Profile) *Server {
Profile: profile, Profile: profile,
} }
publicRouteGroup := e.Group("/h") webhookGroup := e.Group("/h")
s.registerResourcePublicRoutes(publicRouteGroup) s.registerResourcePublicRoutes(webhookGroup)
publicGroup := e.Group("/o")
s.registerResourcePublicRoutes(publicGroup)
apiGroup := e.Group("/api") apiGroup := e.Group("/api")
apiGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc { apiGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {

View File

@@ -116,7 +116,7 @@ const MemoEditor = () => {
try { try {
const image = await resourceService.upload(file); const image = await resourceService.upload(file);
const url = `/h/r/${image.id}/${image.filename}`; const url = `/o/r/${image.id}/${image.filename}`;
return url; return url;
} catch (error: any) { } catch (error: any) {
console.error(error); console.error(error);

View File

@@ -90,11 +90,11 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
}; };
const handlPreviewBtnClick = (resource: Resource) => { 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) => { 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"); toastHelper.success("Succeed to copy resource link to clipboard");
}; };

View File

@@ -6,13 +6,17 @@ import { resolve } from "path";
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
cors: true, host: "0.0.0.0",
port: 3000, port: 3000,
proxy: { proxy: {
"/api": { "/api": {
target: "http://localhost:8080/", target: "http://localhost:8080/",
changeOrigin: true, changeOrigin: true,
}, },
"/o/": {
target: "http://localhost:8080/",
changeOrigin: true,
},
"/h/": { "/h/": {
target: "http://localhost:8080/", target: "http://localhost:8080/",
changeOrigin: true, changeOrigin: true,