feat: do not randomly generate a random number as password in case of locking out

This commit is contained in:
草师傅 2025-06-13 10:43:01 +08:00
parent 4b603b74d2
commit f1f40c0578
2 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ interface Props {
const { password: propPassword, pwEnv } = Astro.props;
// Get password from props, environment variable, or site config
const password = (pwEnv ? import.meta.env[pwEnv] : propPassword) || siteConfig.contentPassword || import.meta.env.CONTENT_PASSWORD || Math.random().toString();
const password = (pwEnv ? import.meta.env[pwEnv] : propPassword) || siteConfig.contentPassword || import.meta.env.CONTENT_PASSWORD;
// Get the slot content
const content = await Astro.slots.render('default');

View file

@ -30,8 +30,9 @@ export const siteConfig = {
displayAvatar: true, // display author avatar in the article list and info line of article page
// encryption
// the global password to encrypt/decrypt the content, if set, all <ProtectedContent/> without specifying a password will be encrypted with this password
// you can use a different environment variable to set the password.
contentPassword: import.meta.env.CONTENT_PASSWORD,
// To use an environment variable to set the password, replace the value with `import.meta.env.CONTENT_PASSWORD`
// (or process.env.CONTENT_PASSWORD, CONTENT_PASSWORD can be any string) and set the environment variable in your deployment service.
contentPassword: 'p1easeChangeMe!',
// footer
// yes you can write html safely here
customFooter: '<i>I have no mouth, and I must SCREAM</i>',