mirror of
https://github.com/usememos/memos.git
synced 2025-02-01 01:58:14 +08:00
chore: remove {filetype} in path template (#1377)
* chore: remove {filetype} in path template * fix go-static-check * update
This commit is contained in:
parent
7f44a73fd0
commit
7529296dd5
4 changed files with 30 additions and 6 deletions
|
@ -147,8 +147,6 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
|
|||
switch s {
|
||||
case "{filename}":
|
||||
return filename
|
||||
case "{filetype}":
|
||||
return filetype
|
||||
case "{timestamp}":
|
||||
return fmt.Sprintf("%d", t.Unix())
|
||||
case "{year}":
|
||||
|
|
|
@ -289,6 +289,8 @@ func listIdentityProviders(ctx context.Context, tx *sql.Tx, find *FindIdentityPr
|
|||
}
|
||||
identityProviderMessages = append(identityProviderMessages, &identityProviderMessage)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, FormatError(err)
|
||||
}
|
||||
return identityProviderMessages, nil
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Button, Input, Typography } from "@mui/joy";
|
|||
import * as api from "../helpers/api";
|
||||
import { generateDialog } from "./Dialog";
|
||||
import Icon from "./Icon";
|
||||
import RequiredBadge from "./RequiredBadge";
|
||||
|
||||
interface Props extends DialogProps {
|
||||
storage?: ObjectStorage;
|
||||
|
@ -48,7 +49,13 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
return false;
|
||||
}
|
||||
if (type === "S3") {
|
||||
if (s3Config.endPoint === "" || s3Config.region === "" || s3Config.accessKey === "" || s3Config.bucket === "") {
|
||||
if (
|
||||
s3Config.endPoint === "" ||
|
||||
s3Config.region === "" ||
|
||||
s3Config.accessKey === "" ||
|
||||
s3Config.secretKey === "" ||
|
||||
s3Config.bucket === ""
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +120,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
<div className="dialog-content-container">
|
||||
<Typography className="!mb-1" level="body2">
|
||||
Name
|
||||
<RequiredBadge />
|
||||
</Typography>
|
||||
<Input
|
||||
className="mb-2"
|
||||
|
@ -128,6 +136,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
EndPoint
|
||||
<RequiredBadge />
|
||||
<span className="text-sm text-gray-400 ml-1">(S3-compatible server URL)</span>
|
||||
</Typography>
|
||||
<Input
|
||||
|
@ -139,6 +148,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
Region
|
||||
<RequiredBadge />
|
||||
<span className="text-sm text-gray-400 ml-1">(Region name)</span>
|
||||
</Typography>
|
||||
<Input
|
||||
|
@ -150,6 +160,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
AccessKey
|
||||
<RequiredBadge />
|
||||
<span className="text-sm text-gray-400 ml-1">(Access Key / Access ID)</span>
|
||||
</Typography>
|
||||
<Input
|
||||
|
@ -161,6 +172,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
SecretKey
|
||||
<RequiredBadge />
|
||||
<span className="text-sm text-gray-400 ml-1">(Secret Key / Secret Access Key)</span>
|
||||
</Typography>
|
||||
<Input
|
||||
|
@ -172,6 +184,7 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
Bucket
|
||||
<RequiredBadge />
|
||||
<span className="text-sm text-gray-400 ml-1">(Bucket name)</span>
|
||||
</Typography>
|
||||
<Input
|
||||
|
@ -187,8 +200,8 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
|
|||
</Typography>
|
||||
<Typography className="!mb-1" level="body2">
|
||||
<p className="text-sm text-gray-400 ml-1">{"You can use {year}, {month}, {day}, {hour}, {minute}, {second},"}</p>
|
||||
<p className="text-sm text-gray-400 ml-1">{"{filetype}, {filename}, {timestamp} and any other words."}</p>
|
||||
<p className="text-sm text-gray-400 ml-1">{"e.g., {year}/{month}/{day}/your/path/{filename}.{filetype}"}</p>
|
||||
<p className="text-sm text-gray-400 ml-1">{"{filename}, {timestamp} and any other words."}</p>
|
||||
<p className="text-sm text-gray-400 ml-1">{"e.g., {year}/{month}/{day}/your/path/{filename}"}</p>
|
||||
</Typography>
|
||||
<Input
|
||||
className="mb-2"
|
||||
|
|
11
web/src/components/RequiredBadge.tsx
Normal file
11
web/src/components/RequiredBadge.tsx
Normal file
|
@ -0,0 +1,11 @@
|
|||
interface Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const RequiredBadge: React.FC<Props> = (props: Props) => {
|
||||
const { className } = props;
|
||||
|
||||
return <span className={`mx-0.5 text-red-500 font-bold ${className ?? ""}`}>*</span>;
|
||||
};
|
||||
|
||||
export default RequiredBadge;
|
Loading…
Reference in a new issue