File tree Expand file tree Collapse file tree 5 files changed +19
-141
lines changed
Expand file tree Collapse file tree 5 files changed +19
-141
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 7474</template >
7575
7676<script >
77+ import md5 from ' md5'
7778import Navbar from ' @theme/components/Navbar'
7879import Sidebar from ' @theme/components/Sidebar'
7980import { resolveSidebarItems } from ' @theme/helpers/utils'
@@ -180,22 +181,25 @@ export default {
180181 methods: {
181182 hasKey () {
182183 const keyPage = this .$themeConfig .keyPage
183- if (! keyPage) {
184+ if (! keyPage || ! keyPage . keys || keyPage . keys . length === 0 ) {
184185 this .isHasKey = true
185186 return
186187 }
187188
188- const keys = keyPage .keys
189+ let { keys } = keyPage
190+ keys = keys .map (item => md5 (item))
189191 this .isHasKey = keys && keys .indexOf (sessionStorage .getItem (' key' )) > - 1
190192 },
191193 hasPageKey () {
192- const pageKeys = this .$frontmatter .keys
193- if (! pageKeys) {
194+ let pageKeys = this .$frontmatter .keys
195+ if (! pageKeys || pageKeys . length === 0 ) {
194196 this .isHasPageKey = true
195197 return
196198 }
197199
198- this .isHasPageKey = pageKeys && pageKeys .indexOf (sessionStorage .getItem (` pageKey${ window .location .pathname } ` )) > - 1
200+ pageKeys = pageKeys .map (item => md5 (item))
201+
202+ this .isHasPageKey = pageKeys .indexOf (sessionStorage .getItem (` pageKey${ window .location .pathname } ` )) > - 1
199203 },
200204 toggleSidebar (to ) {
201205 this .isSidebarOpen = typeof to === ' boolean' ? to : ! this .isSidebarOpen
Original file line number Diff line number Diff line change 4141</template >
4242
4343<script >
44+ import md5 from ' md5'
4445import ModuleTransition from ' @theme/components/ModuleTransition'
4546import moduleTransitonMixin from ' @theme/mixins/moduleTransiton'
4647
@@ -74,7 +75,7 @@ export default {
7475 isHasKey ,
7576 $refs: { passwordBtn }
7677 } = this
77- const keyVal = key .trim ()
78+ const keyVal = md5 ( key .trim () )
7879 const pageKey = ` pageKey${ window .location .pathname } `
7980 const keyName = isPage ? pageKey : ' key'
8081 sessionStorage .setItem (keyName, keyVal)
@@ -101,12 +102,12 @@ export default {
101102 this .warningText = ' Konck! Knock!'
102103 },
103104 isHasKey () {
104- const keyPage = this .$themeConfig .keyPage
105- const keys = keyPage . keys
106- return keys && keys .indexOf (sessionStorage .getItem (' key' )) > - 1
105+ let { keys } = this .$themeConfig .keyPage
106+ keys = keys . map ( item => md5 (item))
107+ return keys .indexOf (sessionStorage .getItem (' key' )) > - 1
107108 },
108109 isHasPageKey () {
109- const pageKeys = this .$frontmatter .keys
110+ const pageKeys = this .$frontmatter .keys . map ( item => md5 (item))
110111 const pageKey = ` pageKey${ window .location .pathname } `
111112
112113 return pageKeys && pageKeys .indexOf (sessionStorage .getItem (pageKey)) > - 1
Original file line number Diff line number Diff line change @@ -54,12 +54,9 @@ module.exports = {
5454 /**
5555 * 密钥 (if your blog is private)
5656 */
57-
58- // keyPage: {
59- // keys: ['your password'],
60- // color: '#42b983',
61- // lineColor: '#42b983'
62- // },
57+ keyPage : {
58+ keys : [ '123456' ]
59+ } ,
6360 friendLink : [
6461 {
6562 title : '午后南杂' ,
Original file line number Diff line number Diff line change 3131 "@vuepress-reco/vuepress-plugin-extract-code" : " 1.0.3" ,
3232 "@vuepress-reco/vuepress-plugin-loading-page" : " 1.0.5" ,
3333 "@vuepress-reco/vuepress-plugin-pagation" : " 1.0.6" ,
34- "@vuepress-reco/vuepress-plugin-comments" : " 1.0.12 " ,
34+ "@vuepress-reco/vuepress-plugin-comments" : " 1.0.13 " ,
3535 "@vuepress/plugin-medium-zoom" : " 1.2.0" ,
3636 "@vuepress/plugin-blog" : " 1.3.0" ,
3737 "docsearch.js" : " 2.5.2" ,
You can’t perform that action at this time.
0 commit comments