(props)
| 26 | } |
| 27 | |
| 28 | export default function ValidateContent(props) { |
| 29 | const [validTime, setValidTime] = useStorage("app-validTime", "1730390400") |
| 30 | const [activationCode, setActivationCode] = useState("") |
| 31 | const [isValid, setIsValid] = useState(true) |
| 32 | |
| 33 | const handleChange = (event) => { |
| 34 | const code = event.target.value |
| 35 | setActivationCode(code) |
| 36 | } |
| 37 | |
| 38 | function handleSubmit() { |
| 39 | if (Number(validTime) > dayjs().unix()) { |
| 40 | props.handleOk() |
| 41 | } else if (process.env.PLASMO_PUBLIC_CODEBOX_SECRET3 == activationCode) { |
| 42 | let time = dayjs().add(7, "day").unix() |
| 43 | setValidTime(String(time)) |
| 44 | setIsValid(true) |
| 45 | props.handleOk() |
| 46 | } else { |
| 47 | setIsValid(false) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | function handleCancel() { |
| 52 | props.handleCancel() |
| 53 | } |
| 54 | |
| 55 | function help() { |
| 56 | sendToBackground({ |
| 57 | name: "tab", |
| 58 | body: { |
| 59 | url: "feed.html" |
| 60 | } |
| 61 | }) |
| 62 | } |
| 63 | |
| 64 | const typeMap = { |
| 65 | downloadHtml: "下载HTML", |
| 66 | downloadMarkdown: "下载markdown", |
| 67 | editMarkdown: "编辑markdown", |
| 68 | parseMarkdown: "解析markdown", |
| 69 | downloadPdf: "下载PDF" |
| 70 | } |
| 71 | |
| 72 | return ( |
| 73 | <div |
| 74 | style={{ |
| 75 | width: "350px", |
| 76 | padding: "10px", |
| 77 | position: "absolute", |
| 78 | top: "50%", |
| 79 | left: "50%", |
| 80 | transform: "translate(-50%, -50%)", |
| 81 | backgroundColor: "white", |
| 82 | borderRadius: "5px", |
| 83 | textAlign: "center" |
| 84 | }}> |
| 85 | {Number(validTime) > dayjs().unix() ? ( |
nothing calls this directly
no outgoing calls
no test coverage detected