Skip to content

Commit

Permalink
fix: encrypt post with code <template />
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Feb 14, 2024
1 parent 09a6c27 commit 6c74aaa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/valaxy/node/plugins/markdown/transform/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export function createTransformEncrypt(options: ResolvedValaxyOptions) {

// encrypt the entire article
if (frontmatter.password) {
const content = code.match(/<template>([\s\S]*?)<\/template>/)?.[1] || ''
const templateStart = code.indexOf('<template>')
const templateEnd = code.lastIndexOf('</template>')
const content = code.slice(templateStart + 10, templateEnd)
const encryptedContent = await encryptContent(content, {
password: frontmatter.password,
iv: encrypt.iv,
Expand Down

0 comments on commit 6c74aaa

Please sign in to comment.