Skip to content

Commit bac7db9

Browse files
author
reco_luan
committed
feat: add encryption mode
If you choose absoluteSecrecy, SSR and anchor point jumps will be bad.
1 parent b761fe0 commit bac7db9

File tree

1 file changed

+65
-27
lines changed

1 file changed

+65
-27
lines changed

components/Common.vue

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,70 @@
44
:class="pageClasses"
55
@touchstart="onTouchStart"
66
@touchend="onTouchEnd">
7-
<transition name="fade">
8-
<LoadingPage v-show="firstLoad" class="loading-wrapper" />
9-
</transition>
10-
<transition name="fade">
11-
<Password v-show="!isHasKey" class="password-wrapper-out" key="out" />
12-
</transition>
13-
<div :class="{ 'hide': firstLoad || !isHasKey }">
14-
<Navbar
15-
v-if="shouldShowNavbar"
16-
@toggle-sidebar="toggleSidebar"/>
7+
<div v-if="absoluteSecrecy">
8+
<transition name="fade">
9+
<LoadingPage v-if="firstLoad" />
10+
<Password v-else-if="!isHasKey" />
11+
<div v-else>
12+
<Navbar
13+
v-if="shouldShowNavbar"
14+
@toggle-sidebar="toggleSidebar"/>
1715

18-
<div
19-
class="sidebar-mask"
20-
@click="toggleSidebar(false)"></div>
16+
<div
17+
class="sidebar-mask"
18+
@click="toggleSidebar(false)"></div>
2119

22-
<Sidebar
23-
:items="sidebarItems"
24-
@toggle-sidebar="toggleSidebar">
25-
<slot
26-
name="sidebar-top"
27-
slot="top"/>
28-
<slot
29-
name="sidebar-bottom"
30-
slot="bottom"/>
31-
</Sidebar>
20+
<Sidebar
21+
:items="sidebarItems"
22+
@toggle-sidebar="toggleSidebar">
23+
<slot
24+
name="sidebar-top"
25+
slot="top"/>
26+
<slot
27+
name="sidebar-bottom"
28+
slot="bottom"/>
29+
</Sidebar>
3230

33-
<Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password>
34-
<div :class="{ 'hide': !isHasPageKey }">
35-
<slot></slot>
36-
<Comments :isShowComments="shouldShowComments"/>
31+
<Password v-if="!isHasPageKey" :isPage="true"></Password>
32+
<div v-else>
33+
<slot></slot>
34+
<Comments :isShowComments="shouldShowComments"/>
35+
</div>
36+
</div>
37+
</transition>
38+
</div>
39+
<div v-else>
40+
<transition name="fade">
41+
<LoadingPage v-show="firstLoad" class="loading-wrapper" />
42+
</transition>
43+
<transition name="fade">
44+
<Password v-show="!isHasKey" class="password-wrapper-out" key="out" />
45+
</transition>
46+
<div :class="{ 'hide': firstLoad || !isHasKey }">
47+
<Navbar
48+
v-if="shouldShowNavbar"
49+
@toggle-sidebar="toggleSidebar"/>
50+
51+
<div
52+
class="sidebar-mask"
53+
@click="toggleSidebar(false)"></div>
54+
55+
<Sidebar
56+
:items="sidebarItems"
57+
@toggle-sidebar="toggleSidebar">
58+
<slot
59+
name="sidebar-top"
60+
slot="top"/>
61+
<slot
62+
name="sidebar-bottom"
63+
slot="bottom"/>
64+
</Sidebar>
65+
66+
<Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password>
67+
<div :class="{ 'hide': !isHasPageKey }">
68+
<slot></slot>
69+
<Comments :isShowComments="shouldShowComments"/>
70+
</div>
3771
</div>
3872
</div>
3973
</div>
@@ -70,6 +104,10 @@ export default {
70104
},
71105
72106
computed: {
107+
absoluteSecrecy () {
108+
console.log(this.$themeConfig.keyPage.absoluteSecrecy)
109+
return this.$themeConfig.keyPage && this.$themeConfig.keyPage.absoluteSecrecy === true
110+
},
73111
// 是否显示评论
74112
shouldShowComments () {
75113
const { isShowComments, home } = this.$frontmatter

0 commit comments

Comments
 (0)