diff --git a/Dockerfile b/Dockerfile index aca1f9d..8c359b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,6 @@ FROM golang:1.21-alpine AS backend WORKDIR /backend-build COPY . . -COPY --from=frontend /frontend-build/frontend/web/dist ./server/dist RUN CGO_ENABLED=0 go build -o slash ./bin/slash/main.go @@ -26,6 +25,7 @@ WORKDIR /usr/local/slash RUN apk add --no-cache tzdata ENV TZ="UTC" +COPY --from=frontend /frontend-build/frontend/web/dist /usr/local/slash/dist COPY --from=backend /backend-build/slash /usr/local/slash/ EXPOSE 5231 diff --git a/api/v2/acl_config.go b/api/v2/acl_config.go index 54f7ca6..ec984e2 100644 --- a/api/v2/acl_config.go +++ b/api/v2/acl_config.go @@ -8,8 +8,9 @@ var allowedMethodsWhenUnauthorized = map[string]bool{ "/slash.api.v2.AuthService/SignIn": true, "/slash.api.v2.AuthService/SignUp": true, "/slash.api.v2.AuthService/SignOut": true, + "/memos.api.v2.AuthService/GetAuthStatus": true, "/slash.api.v2.ShortcutService/GetShortcut": true, - "/slash.api.v2.ShortcutService/GetShortcutById": true, + "/slash.api.v2.ShortcutService/GetShortcutByName": true, "/slash.api.v2.CollectionService/GetCollectionByName": true, } diff --git a/api/v2/workspace_service.go b/api/v2/workspace_service.go index 986bc8e..27d20f2 100644 --- a/api/v2/workspace_service.go +++ b/api/v2/workspace_service.go @@ -62,6 +62,8 @@ func (s *APIV2Service) GetWorkspaceSetting(ctx context.Context, _ *apiv2pb.GetWo for _, v := range workspaceSettings { if v.Key == storepb.WorkspaceSettingKey_WORKSAPCE_SETTING_ENABLE_SIGNUP { workspaceSetting.EnableSignup = v.GetEnableSignup() + } else if v.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_INSTANCE_URL { + workspaceSetting.InstanceUrl = v.GetInstanceUrl() } else if v.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_CUSTOM_STYLE { workspaceSetting.CustomStyle = v.GetCustomStyle() } else if v.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_CUSTOM_SCRIPT { @@ -102,6 +104,15 @@ func (s *APIV2Service) UpdateWorkspaceSetting(ctx context.Context, request *apiv }); err != nil { return nil, status.Errorf(codes.Internal, "failed to update workspace setting: %v", err) } + } else if path == "instance_url" { + if _, err := s.Store.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{ + Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_INSTANCE_URL, + Value: &storepb.WorkspaceSetting_InstanceUrl{ + InstanceUrl: request.Setting.InstanceUrl, + }, + }); err != nil { + return nil, status.Errorf(codes.Internal, "failed to update workspace setting: %v", err) + } } else if path == "custom_style" { if _, err := s.Store.UpsertWorkspaceSetting(ctx, &storepb.WorkspaceSetting{ Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_CUSTOM_STYLE, diff --git a/frontend/web/src/components/setting/WorkspaceSection.tsx b/frontend/web/src/components/setting/WorkspaceSection.tsx index 86253a2..b53a214 100644 --- a/frontend/web/src/components/setting/WorkspaceSection.tsx +++ b/frontend/web/src/components/setting/WorkspaceSection.tsx @@ -1,4 +1,4 @@ -import { Button, Checkbox, Textarea } from "@mui/joy"; +import { Button, Checkbox, Input, Textarea } from "@mui/joy"; import { isEqual } from "lodash-es"; import { useRef, useState } from "react"; import toast from "react-hot-toast"; @@ -21,6 +21,13 @@ const WorkspaceSection: React.FC = () => { }); }; + const handleInstanceUrlChange = async (value: string) => { + setWorkspaceSetting({ + ...workspaceSetting, + instanceUrl: value, + }); + }; + const handleCustomStyleChange = async (value: string) => { setWorkspaceSetting({ ...workspaceSetting, @@ -33,6 +40,9 @@ const WorkspaceSection: React.FC = () => { if (!isEqual(originalWorkspaceSetting.current.enableSignup, workspaceSetting.enableSignup)) { updateMask.push("enable_signup"); } + if (!isEqual(originalWorkspaceSetting.current.instanceUrl, workspaceSetting.instanceUrl)) { + updateMask.push("instance_url"); + } if (!isEqual(originalWorkspaceSetting.current.customStyle, workspaceSetting.customStyle)) { updateMask.push("custom_style"); } @@ -59,6 +69,15 @@ const WorkspaceSection: React.FC = () => { return (

{t("settings.workspace.self")}

+
+

Instance URL

+ handleInstanceUrlChange(event.target.value)} + /> +

{t("settings.workspace.custom-style")}