From 3b97ba3dcfd7dbc83c6eb218456427b41f8a6fb0 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 14 Jun 2022 20:24:06 +0800 Subject: [PATCH] feat: add local storage policy --- public/locales/en-US/dashboard.json | 87 +++++++++- public/locales/zh-CN/dashboard.json | 70 ++++++++ src/component/Admin/Dialogs/AddPolicy.js | 33 ++-- src/component/Admin/Policy/Guid/LocalGuide.js | 159 +++++++++--------- src/component/Admin/Policy/Policy.js | 63 +++---- src/config.ts | 10 -- 6 files changed, 281 insertions(+), 141 deletions(-) diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index a517f2e..af33533 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -5,7 +5,7 @@ "basicSetting": "Basic", "publicAccess": "Public Access", "email": "Email", - "transportation": "Transportation", + "transportation": "Transmission", "appearance": "Appearance", "image": "Images", "captcha": "Captcha", @@ -48,7 +48,7 @@ "settings": { "saved": "Settings saved.", "save": "Save", - "basicInformation": "Basic information", + "basicInformation": "Basic Information", "mainTitle": "Main title", "mainTitleDes": "Main title of the website.", "subTitle": "Subtitle", @@ -113,13 +113,13 @@ "enforceSSLDes": "Whether to enforce an SSL encrypted connection. If you cannot send emails, you can turn this off and Cloudreve will try to use STARTTLS and decide whether to use encrypted connections.", "smtpTTL": "SMTP connection TTL (seconds)", "smtpTTLDes": "SMTP connections established during the TTL period will be reused by new mail delivery requests.", - "emailTemplates": "Email templates", + "emailTemplates": "Email Templates", "activateNewUser": "Activate new user", "activateNewUserDes": "Template for activation email after new user registration.", "resetPassword": "Reset password", "resetPasswordDes": "Template reset password.", "sendTestEmail": "Send test email", - "transportation": "Transportation", + "transportation": "Transmission", "workerNum": "Number of worker", "workerNumDes": "The maximum number of tasks to be executed in parallel by the master node task queue, restarting Cloudreve is needed to take effect.", "transitParallelNum": "Number of transfer in parallel", @@ -134,7 +134,7 @@ "cacheChunksDes": "If enabled, streaming chunk uploads will cache chunk data in a temporary directory for retrying after failed uploads.\n If disabled, streaming chunk uploads do not take up additional hard disk space, but the entire upload will fail immediately after a single chunk failure.", "resetConnection": "Reset connection after failed upload", "resetConnectionDes": "If enabled, the server will force to reset the connection if upload verification fails.", - "expirationDuration": "Expire durations (seconds)", + "expirationDuration": "Expire Durations (seconds)", "batchDownload": "Batch download", "downloadSession": "Download session", "previewURL": "Preview URL", @@ -159,7 +159,7 @@ "heartbeatRecoverModeIntervalDes": "Interval between master attempts to reconnect to a node after the node has been marked as recovery mode.", "slaveTransitExpiration": "Slave transfer timeout (seconds)", "slaveTransitExpirationDes": "Maximum time that can be consumed by a slave to execute a file transfer task.", - "nodesCommunication": "Node communication", + "nodesCommunication": "Node Communication", "cannotDeleteDefaultTheme": "Cannot delete default theme.", "keepAtLeastOneTheme": "Please reserve at least one theme.", "duplicatedThemePrimaryColor": "Duplicated primart color.", @@ -192,7 +192,7 @@ "smallAvatarSize": "Small avatar width", "mediumAvatarSize": "Medium avatar width", "largeAvatarSize": "Large avatar width", - "filePreview": "File preview", + "filePreview": "File Preview", "officePreviewService": "Office preview service", "officePreviewServiceDes": "You can use following magic variables:", "officePreviewServiceSrcDes": "File URL", @@ -215,7 +215,7 @@ "reCaptchaV2": "reCAPTCHA V2", "tencentCloudCaptcha": "Tencent Cloud Captcha", "captchaProvider": "Provider of the captcha service.", - "plainCaptchaTitle": "Plain captcha", + "plainCaptchaTitle": "Plain Captcha", "captchaWidth": "Width", "captchaHeight": "Height", "captchaLength": "Length", @@ -244,5 +244,76 @@ "tCaptchaAppIDDes": "You can find it at <0>Captcha Management Page.", "tCaptchaSecretKey": "App Secret Key", "tCaptchaSecretKeyDes": "You can find it at <0>Captcha Management Page." + }, + "policy": { + "sharp": "#", + "name": "Name", + "type": "Type", + "childFiles": "Chile files", + "totalSize": "Total size", + "actions": "Actions", + "authSuccess": "Authorization granted.", + "policyDeleted": "Policy deleted.", + "newStoragePolicy": "New storage policy", + "all": "All", + "local": "Local", + "remote": "Remote Node", + "qiniu": "Qiniu", + "upyun": "Upyun", + "oss": "Alibaba Cloud OSS", + "cos": "Tencent Cloud COS", + "onedrive": "OneDrive", + "s3": "AWS S3", + "refresh": "Refresh", + "delete": "Delete", + "edit": "Edit", + "editInProMode": "Edit in pro mode", + "editInWizardMode": "Edit in wizard mode", + "selectAStorageProvider": "Select a storage provider", + "comparesStoragePolicies": "Compare storage policies", + "comparesStoragePoliciesLink": "https://docs.cloudreve.org/v/en/use/policy/compare", + "storagePathStep": "Storage path", + "sourceLinkStep": "Source links", + "uploadSettingStep": "Uploading", + "finishStep": "Finish", + "policyAdded": "Storage policy added.", + "policySaved": "Storage policy saved.", + "editLocalStoragePolicy": "Edit local storage policy", + "addLocalStoragePolicy": "Add local storage policy", + "optional": "Optional", + "pathMagicVarDes": "Enter the physical path to the folder you want to store files. Either absolute or relative (relative to Cloudreve executable) path is supported. You can use magic variables in the path, which will be automatically replaced with the corresponding values when the file is uploaded; see <0>List of path magic variables for available magic variables.", + "pathOfFolderToStoreFiles": "Path of the folder", + "filePathMagicVarDes": "Do you want to rename the physical files that are uploaded? The renaming here will not affect the final file name presented to the user. Magic variables can also be used for file names, see <0>List of Magic Variables for file names for available magic variables.", + "autoRenameStoredFile": "Enable auto-renaming", + "keepOriginalFileName": "Use original file name", + "renameRule": "Rename rule", + "next": "Next", + "enableGettingPermanentSourceLink": "Allow user to get permanent file source link?", + "enableGettingPermanentSourceLinkDes": "When enabled, users can obtain a direct link to the contents of the file, for use in the Image Bed application or for your own use. You may also need to enable this feature in the user group settings to make it available for users.", + "allowed": "Enable", + "forbidden": "Disable", + "useCDN": "Do you want to use CDN for download and source links?", + "useCDNDes": "When enabled, the domain part of the URL which user uses to access files will be replaced with the CDN domain.", + "use": "Enable", + "notUse": "Disable", + "cdnDomain": "Select a protocol and enter the CDN domain:", + "cdnPrefix": "CDN domain", + "back": "Back", + "limitFileSize": "Do you want to limit the max size of one single file that can be uploaded?", + "limit": "Yes", + "notLimit": "No", + "enterSizeLimit": "Enter the max file size:", + "maxSizeOfSingleFile": "Max single file size", + "limitFileExt": "Do you want to limit file extensions?", + "enterFileExt": "Enter the file extensions allowed to be uploaded, separated by semi-colon commas:", + "extList": "File extension list", + "chunkSizeLabel": "Specify the chunk size for resumable uploads. A value of 0 means no resumable uploads are used.", + "chunkSizeDes": "After enabling resumable upload, the files uploaded by users will be sliced into chunks and uploaded to the storage side one by one. After the upload is interrupted, users can choose to continue uploading from the last uploaded chunk.", + "chunkSize": "Chunk size", + "nameThePolicy": "Last step, name the storage policy:", + "policyName": "Storage policy name", + "finish": "Finish", + "furtherActions": "To use this storage policy, go to the user group setting page and bind this storage policy for the appropriate user group.", + "backToList": "Back to storage policy list" } } \ No newline at end of file diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index d2ade7d..06790e2 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -244,5 +244,75 @@ "tCaptchaAppIDDes": "<0>图形验证页面 获取到的的 APPID", "tCaptchaSecretKey": "App Secret Key", "tCaptchaSecretKeyDes": "<0>图形验证页面 获取到的的 App Secret Key" + }, + "policy": { + "name": "名称", + "type": "类型", + "childFiles": "下属文件数", + "totalSize": "数据量", + "actions": "操作", + "authSuccess": "授权成功", + "policyDeleted": "存储策略已删除", + "newStoragePolicy": "添加存储策略", + "all": "全部", + "local": "本机存储", + "remote": "从机存储", + "qiniu": "七牛", + "upyun": "又拍云", + "oss": "阿里云 OSS", + "cos": "腾讯云 COS", + "onedrive": "OneDrive", + "s3": "AWS S3", + "refresh": "刷新", + "delete": "删除", + "edit": "编辑", + "editInProMode": "专家模式编辑", + "editInWizardMode": "向导模式编辑", + "selectAStorageProvider": "选择存储方式", + "comparesStoragePolicies": "存储策略对比", + "comparesStoragePoliciesLink": "https://docs.cloudreve.org/use/policy/compare", + "storagePathStep": "上传路径", + "sourceLinkStep": "直链设置", + "uploadSettingStep": "上传设置", + "finishStep": "完成", + "policyAdded": "存储策略已添加", + "policySaved": "存储策略已保存", + "editLocalStoragePolicy": "修改本机存储策略", + "addLocalStoragePolicy": "添加存储策略", + "optional": "可选", + "pathMagicVarDes": "请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; 可用魔法变量可参考 <0>路径魔法变量列表。", + "pathOfFolderToStoreFiles": "存储目录", + "filePathMagicVarDes": "是否需要对存储的物理文件进行重命名?此处的重命名不会影响最终呈现给用户的 文件名。文件名也可使用魔法变量, 可用魔法变量可参考 <0>文件名魔法变量列表。", + "autoRenameStoredFile": "开启重命名", + "keepOriginalFileName": "不开启", + "renameRule": "命名规则", + "next": "下一步", + "enableGettingPermanentSourceLink": "是否允许获取文件永久直链?", + "enableGettingPermanentSourceLinkDes": "开启后,用户可以请求获得能直接访问到文件内容的直链,适用于图床应用或自用。您可能还需要在用户组设置中开启此功能,用户才可以获取直链。", + "allowed": "允许", + "forbidden": "禁止", + "useCDN": "是否要对下载/直链使用 CDN?", + "useCDNDes": "开启后,用户访问文件时的 URL 中的域名部分会被替换为 CDN 域名。", + "use": "使用", + "notUse": "不使用", + "cdnDomain": "选择协议并填写 CDN 域名", + "cdnPrefix": "CDN 前缀", + "back": "上一步", + "limitFileSize": "是否限制上传的单文件大小?", + "limit": "限制", + "notLimit": "不限制", + "enterSizeLimit": "输入限制:", + "maxSizeOfSingleFile": "单文件大小限制", + "limitFileExt": "是否限制上传文件扩展名?", + "enterFileExt": "输入允许上传的文件扩展名,多个请以半角逗号 , 隔开", + "extList": "扩展名列表", + "chunkSizeLabel": "请指定分片上传时的分片大小,填写为 0 表示不使用分片上传。", + "chunkSizeDes": "启用分片上传后,用户上传的文件将会被切分成分片逐个上传到存储端,当上传中断后,用户可以选择从上次上传的分片后继续开始上传。", + "chunkSize": "分片上传大小", + "nameThePolicy": "最后一步,为此存储策略命名:", + "policyName": "存储策略名", + "finish": "完成", + "furtherActions": "要使用此存储策略,请到用户组管理页面,为相应用户组绑定此存储策略。", + "backToList": "返回存储策略列表" } } \ No newline at end of file diff --git a/src/component/Admin/Dialogs/AddPolicy.js b/src/component/Admin/Dialogs/AddPolicy.js index 1d40e26..5d7fe05 100644 --- a/src/component/Admin/Dialogs/AddPolicy.js +++ b/src/component/Admin/Dialogs/AddPolicy.js @@ -12,6 +12,7 @@ import { makeStyles } from "@material-ui/core/styles"; import Typography from "@material-ui/core/Typography"; import React from "react"; import { useHistory } from "react-router"; +import { useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ cardContainer: { @@ -36,48 +37,50 @@ const useStyles = makeStyles((theme) => ({ const policies = [ { - name: "本机存储", + name: "local", img: "local.png", path: "/admin/policy/add/local", }, { - name: "从机存储", + name: "remote", img: "remote.png", path: "/admin/policy/add/remote", }, { - name: "七牛", + name: "qiniu", img: "qiniu.png", path: "/admin/policy/add/qiniu", }, { - name: "阿里云 OSS", + name: "oss", img: "oss.png", path: "/admin/policy/add/oss", }, { - name: "又拍云", + name: "upyun", img: "upyun.png", path: "/admin/policy/add/upyun", }, { - name: "腾讯云 COS", + name: "cos", img: "cos.png", path: "/admin/policy/add/cos", }, { - name: "OneDrive", + name: "onedrive", img: "onedrive.png", path: "/admin/policy/add/onedrive", }, { - name: "Amazon S3", + name: "s3", img: "s3.png", path: "/admin/policy/add/s3", }, ]; export default function AddPolicy({ open, onClose }) { + const { t } = useTranslation("dashboard", { keyPrefix: "policy" }); + const { t: tCommon } = useTranslation("common"); const classes = useStyles(); const location = useHistory(); @@ -91,7 +94,9 @@ export default function AddPolicy({ open, onClose }) { maxWidth={"sm"} fullWidth > - 选择存储方式 + + {t("selectAStorageProvider")} + {policies.map((v) => ( @@ -113,7 +118,7 @@ export default function AddPolicy({ open, onClose }) { variant="subtitle1" color="textSecondary" > - {v.name} + {t(v.name)} @@ -125,16 +130,14 @@ export default function AddPolicy({ open, onClose }) { diff --git a/src/component/Admin/Policy/Guid/LocalGuide.js b/src/component/Admin/Policy/Guid/LocalGuide.js index 9742256..18a5696 100644 --- a/src/component/Admin/Policy/Guid/LocalGuide.js +++ b/src/component/Admin/Policy/Guid/LocalGuide.js @@ -21,6 +21,7 @@ import DomainInput from "../../Common/DomainInput"; import SizeInput from "../../Common/SizeInput"; import MagicVar from "../../Dialogs/MagicVar"; import { getNumber } from "../../../../utils"; +import { Trans, useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ stepContent: { @@ -68,24 +69,25 @@ const useStyles = makeStyles((theme) => ({ const steps = [ { - title: "上传路径", + title: "storagePathStep", optional: false, }, { - title: "直链设置", + title: "sourceLinkStep", optional: false, }, { - title: "上传设置", + title: "uploadSettingStep", optional: false, }, { - title: "完成", + title: "finishStep", optional: false, }, ]; export default function LocalGuide(props) { + const { t } = useTranslation("dashboard", { keyPrefix: "policy" }); const classes = useStyles(); const history = useHistory(); @@ -201,7 +203,7 @@ export default function LocalGuide(props) { ToggleSnackbar( "top", "right", - "存储策略已" + (props.policy ? "保存" : "添加"), + props.policy ? t("policySaved") : t("policyAdded"), "success" ); setActiveStep(4); @@ -219,7 +221,9 @@ export default function LocalGuide(props) { return (
- {props.policy ? "修改" : "添加"}本机存储策略 + {props.policy + ? t("editLocalStoragePolicy") + : t("addLocalStoragePolicy")} {steps.map((label, index) => { @@ -227,15 +231,19 @@ export default function LocalGuide(props) { const labelProps = {}; if (label.optional) { labelProps.optional = ( - 可选 + + {t("optional")} + ); } if (isStepSkipped(index)) { stepProps.completed = false; } return ( - - {label.title} + + + {t(label.title)} + ); })} @@ -251,24 +259,23 @@ export default function LocalGuide(props) {
- 请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 - Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; - 可用魔法变量可参考{" "} - { - e.preventDefault(); - setMagicVar("path"); - }} - > - 路径魔法变量列表 - {" "} - 。 + setMagicVar("path")} + />, + ]} + />
- 存储目录 + {t("pathOfFolderToStoreFiles")}
- 是否需要对存储的物理文件进行重命名?此处的重命名不会影响最终呈现给用户的 - 文件名。文件名也可使用魔法变量, - 可用魔法变量可参考{" "} - { - e.preventDefault(); - setMagicVar("file"); - }} - > - 文件名魔法变量列表 - {" "} - 。 + setMagicVar("file")} + />, + ]} + />
@@ -314,14 +320,14 @@ export default function LocalGuide(props) { control={ } - label="开启重命名" + label={t("autoRenameStoredFile")} /> } - label="不开启" + label={t("keepOriginalFileName")} /> @@ -331,7 +337,7 @@ export default function LocalGuide(props) {
- 命名规则 + {t("renameRule")} - 下一步 + {t("next")}
@@ -375,9 +381,9 @@ export default function LocalGuide(props) {
- 是否允许获取文件永久直链? + {t("enableGettingPermanentSourceLink")}
- 开启后,用户可以请求获得能直接访问到文件内容的直链,适用于图床应用或自用。 + {t("enableGettingPermanentSourceLinkDes")}
@@ -395,14 +401,14 @@ export default function LocalGuide(props) { control={ } - label="允许" + label={t("allowed")} /> } - label="禁止" + label={t("forbidden")} /> @@ -417,10 +423,9 @@ export default function LocalGuide(props) {
- 是否要对下载/直链使用 CDN? + {t("useCDN")}
- 开启后,用户访问文件时的 URL - 中的域名部分会被替换为 CDN 域名。 + {t("useCDNDes")}
@@ -446,14 +451,14 @@ export default function LocalGuide(props) { control={ } - label="使用" + label={t("use")} /> } - label="不使用" + label={t("notUse")} /> @@ -468,7 +473,7 @@ export default function LocalGuide(props) {
- 选择协议并填写 CDN 域名 + {t("cdnDomain")}
@@ -479,7 +484,7 @@ export default function LocalGuide(props) { policy.IsOriginLinkEnable === "true" && useCDN === "true" } - label={"CDN 前缀"} + label={t("cdnPrefix")} />
@@ -493,7 +498,7 @@ export default function LocalGuide(props) { className={classes.button} onClick={() => setActiveStep(0)} > - 上一步 + {t("back")} {" "}
@@ -521,7 +526,7 @@ export default function LocalGuide(props) {
- 是否限制上传的单文件大小? + {t("limitFileSize")}
@@ -553,14 +558,14 @@ export default function LocalGuide(props) { control={ } - label="限制" + label={t("limit")} /> } - label="不限制" + label={t("notLimit")} /> @@ -575,7 +580,7 @@ export default function LocalGuide(props) {
- 输入限制: + {t("enterSizeLimit")}
@@ -598,7 +603,7 @@ export default function LocalGuide(props) {
- 是否限制上传文件扩展名? + {t("limitFileExt")}
@@ -638,14 +643,14 @@ export default function LocalGuide(props) { control={ } - label="限制" + label={t("limit")} /> } - label="不限制" + label={t("notLimit")} /> @@ -662,13 +667,12 @@ export default function LocalGuide(props) {
- 输入允许上传的文件扩展名,多个请以半角逗号 , - 隔开 + {t("enterFileExt")}
- 扩展名列表 + {t("extList")}
- 请指定分片上传时的分片大小,填写为 0 - 表示不使用分片上传。 + {t("chunkSizeLabel")}
- 启用分片上传后,用户上传的文件将会被切分成分片逐个上传到存储端,当上传中断后,用户可以选择从上次上传的分片后继续开始上传。 + {t("chunkSizeDes")}
@@ -719,7 +722,7 @@ export default function LocalGuide(props) { className={classes.button} onClick={() => setActiveStep(1)} > - 上一步 + {t("back")} {" "}
@@ -736,15 +739,15 @@ export default function LocalGuide(props) { {activeStep === 3 && (
-
+
- 最后一步,为此存储策略命名: + {t("nameThePolicy")}
- 存储策略名 + {t("policyName")} setActiveStep(2)} > - 上一步 + {t("back")} {" "}
@@ -779,10 +782,10 @@ export default function LocalGuide(props) { <>
- 存储策略已{props.policy ? "保存" : "添加"}! + {props.policy ? t("policySaved") : t("policyAdded")} - 要使用此存储策略,请到用户组管理页面,为相应用户组绑定此存储策略。 + {t("furtherActions")}
@@ -791,7 +794,7 @@ export default function LocalGuide(props) { className={classes.button} onClick={() => history.push("/admin/policy")} > - 返回存储策略列表 + {t("backToList")}
diff --git a/src/component/Admin/Policy/Policy.js b/src/component/Admin/Policy/Policy.js index 1840616..f0a78f6 100644 --- a/src/component/Admin/Policy/Policy.js +++ b/src/component/Admin/Policy/Policy.js @@ -18,10 +18,10 @@ import React, { useCallback, useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import { useHistory, useLocation } from "react-router"; import { toggleSnackbar } from "../../../redux/explorer"; -import { policyTypeMap } from "../../../config"; import API from "../../../middleware/Api"; import { sizeToString } from "../../../utils"; import AddPolicy from "../Dialogs/AddPolicy"; +import { useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ root: { @@ -47,24 +47,24 @@ const useStyles = makeStyles((theme) => ({ })); const columns = [ - { id: "#", label: "#", minWidth: 50 }, - { id: "name", label: "名称", minWidth: 170 }, - { id: "type", label: "类型", minWidth: 170 }, + { id: "#", label: "sharp", minWidth: 50 }, + { id: "name", label: "name", minWidth: 170 }, + { id: "type", label: "type", minWidth: 170 }, { id: "count", - label: "下属文件数", + label: "childFiles", minWidth: 50, align: "right", }, { id: "size", - label: "数据量", + label: "totalSize", minWidth: 100, align: "right", }, { id: "action", - label: "操作", + label: "actions", minWidth: 170, align: "right", }, @@ -75,6 +75,7 @@ function useQuery() { } export default function Policy() { + const { t } = useTranslation("dashboard", { keyPrefix: "policy" }); const classes = useStyles(); // const [loading, setLoading] = useState(false); // const [tab, setTab] = useState(0); @@ -109,7 +110,7 @@ export default function Policy() { useEffect(() => { if (query.get("code") === "0") { - ToggleSnackbar("top", "right", "授权成功", "success"); + ToggleSnackbar("top", "right", t("authSuccess"), "success"); } else if (query.get("msg") && query.get("msg") !== "") { ToggleSnackbar( "top", @@ -145,7 +146,7 @@ export default function Policy() { API.delete("/admin/policy/" + id) .then(() => { loadList(); - ToggleSnackbar("top", "right", "存储策略已删除", "success"); + ToggleSnackbar("top", "right", t("policyDeleted"), "success"); }) .catch((error) => { ToggleSnackbar("top", "right", error.message, "error"); @@ -163,7 +164,7 @@ export default function Policy() { onClick={() => setAddDialog(true)} variant={"contained"} > - 添加存储策略 + {t("newStoragePolicy")}
@@ -204,7 +211,7 @@ export default function Policy() { align={column.align} style={{ minWidth: column.minWidth }} > - {column.label} + {t(column.label)} ))} @@ -214,11 +221,7 @@ export default function Policy() { {row.ID} {row.Name} - - {policyTypeMap[row.Type] !== - undefined && - policyTypeMap[row.Type]} - + {t(row.Type)} {statics[row.ID] !== undefined && statics[row.ID][0].toLocaleString()} @@ -228,7 +231,7 @@ export default function Policy() { sizeToString(statics[row.ID][1])} - + deletePolicy(row.ID) @@ -238,7 +241,7 @@ export default function Policy() { - + { setEditID(row.ID); @@ -280,7 +283,7 @@ export default function Policy() { history.push("/admin/policy/edit/pro/" + editID); }} > - 专家模式编辑 + {t("editInProMode")} { @@ -288,7 +291,7 @@ export default function Policy() { history.push("/admin/policy/edit/guide/" + editID); }} > - 向导模式编辑 + {t("editInWizardMode")}
diff --git a/src/config.ts b/src/config.ts index c59a5b6..ec49d80 100644 --- a/src/config.ts +++ b/src/config.ts @@ -69,16 +69,6 @@ export const mediaType = { js: ["js", "jsx"], epub: epubSuffix, }; -export const policyTypeMap = { - local: "本机", - remote: "从机", - qiniu: "七牛", - upyun: "又拍云", - oss: "阿里云 OSS", - cos: "腾讯云", - onedrive: "OneDrive", - s3: "Amazon S3", -}; export const isPreviewable = (name: any) => { const suffix = name.split(".").pop().toLowerCase(); if (imgPreviewSuffix.indexOf(suffix) !== -1) {