Compare commits
No commits in common. "dee65f247b668a8d619b7d95829f65e06a238aba" and "93fb60724ca6ea6bc455e0fd49ed016aade4a04c" have entirely different histories.
dee65f247b
...
93fb60724c
3 changed files with 18 additions and 59 deletions
|
@ -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;
|
||||
const password = (pwEnv ? import.meta.env[pwEnv] : propPassword) || siteConfig.contentPassword || import.meta.env.CONTENT_PASSWORD || Math.random().toString();
|
||||
|
||||
// Get the slot content
|
||||
const content = await Astro.slots.render('default');
|
||||
|
@ -21,30 +21,28 @@ const { encryptedData, iv } = encrypt(content, password);
|
|||
<div class="encrypted-content" data-encrypted={encryptedData} data-iv={iv}>
|
||||
<div class="password-form">
|
||||
<p>This content is protected. Enter the password to view it:</p>
|
||||
<div>
|
||||
<form>
|
||||
<input type="password" class="decrypt-password" title="password" />
|
||||
<button class="decrypt-button">Decrypt</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="content-container hidden"></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
div.password-form {
|
||||
margin: 0.25rem auto;
|
||||
div.encrypted-content {
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
div.password-form div {
|
||||
margin: 0.25rem auto;
|
||||
div.password-form {
|
||||
margin: 0.5rem auto;
|
||||
}
|
||||
input[type="password"] {
|
||||
background: var(--accent-color);
|
||||
color: var(--bg-color);
|
||||
border: none;
|
||||
padding: 0.25rem;
|
||||
}
|
||||
button {
|
||||
background-color: var(--accent-color);
|
||||
color: var(--bg-color);
|
||||
border: none;
|
||||
padding: 0.25rem;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ export const siteConfig = {
|
|||
},
|
||||
// features
|
||||
noClientJavaScript: false, // disable client-side javascript, this will:
|
||||
// 1. disable most built-in client-side javascript from rendering (protected content component and umami still needs javascript to function, sorry)
|
||||
// 1. disable all built-in client-side javascript from rendering
|
||||
// 2. the full text search will be redirected to a search engine
|
||||
// 3. the comments will be globally disabled
|
||||
// 4. the night mode & back to top will not use Javascript to function
|
||||
|
@ -25,14 +25,13 @@ export const siteConfig = {
|
|||
],
|
||||
// search
|
||||
// This only works when noClientJavaScript is enabled
|
||||
searchEngine: 'duckduckgo', // 'google', 'duckduckgo', 'bing' (broken until M1cr0$0ft get support for it), defaults to 'google'
|
||||
searchEngine: 'bing', // 'google', 'duckduckgo', 'bing'(broken until M1cr0$0ft get support for it), defaults to 'google'
|
||||
// content
|
||||
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
|
||||
// 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!',
|
||||
// you can use a different environment variable to set the password.
|
||||
contentPassword: import.meta.env.CONTENT_PASSWORD,
|
||||
// footer
|
||||
// yes you can write html safely here
|
||||
customFooter: '<i>I have no mouth, and I must SCREAM</i>',
|
||||
|
@ -85,17 +84,10 @@ export const siteConfig = {
|
|||
},
|
||||
// umami analytics
|
||||
// by enabling this, you can track the visitors of your site
|
||||
siteAnalytics: {
|
||||
enabled: false, // enable analytics
|
||||
type: 'umami', // 'umami', 'goatcounter'
|
||||
umami: {
|
||||
instanceDomain: 'cloud.umami.is', // the domain of the umami instance, usually your-umami-instance.com (default: official cloud.umami.is)
|
||||
websiteId: 'your-website-id', // the id of your website in umami, get it from your umami dashboard
|
||||
},
|
||||
goatcounter: {
|
||||
// provide solutions for tracking visitors without Javascript
|
||||
instanceDomain: 'yourcodehere.goatcounter.com', // the domain of the goatcounter instance, usually your-goatcounter-instance.com
|
||||
},
|
||||
umami: {
|
||||
enabled: false, // enable umami analytics
|
||||
instanceDomain: 'cloud.umami.is', // the url of the umami script, usually your-umami-instance.com (default: official cloud.umami.is)
|
||||
websiteId: 'your-website-id', // the id of your website in umami, get it from your umami dashboard
|
||||
},
|
||||
// neko
|
||||
// by enabling this, you can add a neko that follows cursor to your site
|
||||
|
|
|
@ -18,11 +18,7 @@ interface Props {
|
|||
}
|
||||
|
||||
const noscript = siteConfig.noClientJavaScript
|
||||
|
||||
const statisticsEnabled = siteConfig.siteAnalytics.enabled
|
||||
const statisticsType = siteConfig.siteAnalytics.type
|
||||
const umamiConfig = siteConfig.siteAnalytics.umami
|
||||
const goatCounterConfig = siteConfig.siteAnalytics.goatcounter
|
||||
const umami = siteConfig.umami
|
||||
|
||||
const defaultTitle = siteConfig.title
|
||||
const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-');
|
||||
|
@ -72,7 +68,6 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description =
|
|||
<footer class="footer">
|
||||
<div class="floating">
|
||||
<BackToTop/>
|
||||
|
||||
{noscript ? <ThemeSwitcher_CSSOnly/> : <ThemeSwitcher/>}
|
||||
</div>
|
||||
<div class="container">
|
||||
|
@ -80,36 +75,10 @@ const { title = pageTitle, author = siteConfig.defaultAuthor.name,description =
|
|||
<p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a></p>
|
||||
</div>
|
||||
</footer>
|
||||
{statisticsEnabled && statisticsType === 'umami' && (
|
||||
<script
|
||||
is:inline
|
||||
defer
|
||||
src={`https://${umamiConfig.instanceDomain}/script.js`}
|
||||
data-website-id={umamiConfig.websiteId}
|
||||
></script>
|
||||
)}
|
||||
{statisticsEnabled && statisticsType === 'goatcounter' && (
|
||||
<>
|
||||
{noscript ? (
|
||||
<img src={`https://${goatCounterConfig.instanceDomain}/count?p=/${Astro.url.pathname}`} alt="Analytics" />
|
||||
) : (
|
||||
<>
|
||||
<script
|
||||
is:inline
|
||||
async
|
||||
data-goatcounter={`https://${goatCounterConfig.instanceDomain}/count`}
|
||||
src={`https://${goatCounterConfig.instanceDomain}/count.js`}
|
||||
></script>
|
||||
<noscript>
|
||||
<img src={`https://${goatCounterConfig.instanceDomain}/count?p=/${Astro.url.pathname}`} alt="Analytics" />
|
||||
</noscript>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{umami.enabled && <script defer src=`https://${umami.instanceDomain}/script.js` data-website-id={umami.websiteId}></script>}
|
||||
{ (siteConfig.neko.enabled && !noscript) &&
|
||||
<>
|
||||
<script is:inline define:vars={{ nekoType }}>
|
||||
<script is:inline define:vars={{ nekoType }}>
|
||||
window.NekoType = nekoType;
|
||||
</script>
|
||||
<script is:inline src="https://webneko.net/n20171213.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue