chore: rename prefix to /s

This commit is contained in:
Steven 2023-06-24 14:25:39 +08:00
parent 07814ef606
commit ffc546fa27
5 changed files with 6 additions and 6 deletions

View File

@ -84,7 +84,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
token := findAccessToken(c) token := findAccessToken(c)
if token == "" { if token == "" {
// When the request is not authenticated, we allow the user to access the shortcut endpoints for those public shortcuts. // When the request is not authenticated, we allow the user to access the shortcut endpoints for those public shortcuts.
if util.HasPrefixes(path, "/api/v1/status", "/o/*") && method == http.MethodGet { if util.HasPrefixes(path, "/api/v1/status", "/s/*") && method == http.MethodGet {
return next(c) return next(c)
} }
return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token") return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token")

View File

@ -30,7 +30,7 @@ func (s *APIV1Service) Start(apiGroup *echo.Group, secret string) {
s.registerUserRoutes(apiV1Group) s.registerUserRoutes(apiV1Group)
s.registerShortcutRoutes(apiV1Group) s.registerShortcutRoutes(apiV1Group)
redirectorGroup := apiGroup.Group("/o") redirectorGroup := apiGroup.Group("/s")
redirectorGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc { redirectorGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return JWTMiddleware(s, next, string(secret)) return JWTMiddleware(s, next, string(secret))
}) })

View File

@ -128,7 +128,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
Name <span className="text-red-600">*</span> Name <span className="text-red-600">*</span>
</span> </span>
<div className="relative w-full"> <div className="relative w-full">
<span className="absolute z-1 top-2 left-3 text-gray-400">o/</span> <span className="absolute z-1 top-2 left-3 text-gray-400">s/</span>
<Input <Input
className="w-full !pl-7" className="w-full !pl-7"
type="text" type="text"

View File

@ -24,7 +24,7 @@ const ShortcutListView: React.FC<Props> = (props: Props) => {
}; };
const handleCopyButtonClick = (shortcut: Shortcut) => { const handleCopyButtonClick = (shortcut: Shortcut) => {
copy(absolutifyLink(`/o/${shortcut.name}`)); copy(absolutifyLink(`/s/${shortcut.name}`));
toast.success("Shortcut link copied to clipboard."); toast.success("Shortcut link copied to clipboard.");
}; };

View File

@ -8,11 +8,11 @@ export default defineConfig({
host: "0.0.0.0", host: "0.0.0.0",
port: 3000, port: 3000,
proxy: { proxy: {
"/api": { "/api/": {
target: "http://localhost:8082/", target: "http://localhost:8082/",
changeOrigin: true, changeOrigin: true,
}, },
"/o": { "/s/": {
target: "http://localhost:8082/", target: "http://localhost:8082/",
changeOrigin: true, changeOrigin: true,
}, },