浏览代码

viewSource theme config

Bamieh 8 年之前
父节点
当前提交
4b33a83d4e
共有 4 个文件被更改,包括 7 次插入3 次删除
  1. 1 0
      config.sample.yml
  2. 1 0
      server/app/data.yml
  3. 1 0
      server/libs/config.js
  4. 4 3
      server/views/pages/view.pug

+ 1 - 0
config.sample.yml

@@ -162,6 +162,7 @@ externalLogging:
 theme:
   primary: indigo
   alt: blue-grey
+  viewSource: "all"
   footer: blue-grey
   code:
     dark: true

+ 1 - 0
server/app/data.yml

@@ -61,6 +61,7 @@ defaults:
       primary: indigo
       alt: blue-grey
       footer: blue-grey
+      viewSource: "none"
       code:
         dark: true
         colorize: true

+ 1 - 0
server/libs/config.js

@@ -28,6 +28,7 @@ module.exports = (confPaths) => {
         fs.readFileSync(confPaths.config, 'utf8')
       )
     )
+
     appdata = yaml.safeLoad(fs.readFileSync(confPaths.data, 'utf8'))
     appdata.regex = require(confPaths.dataRegex)
   } catch (ex) {

+ 4 - 3
server/views/pages/view.pug

@@ -15,9 +15,10 @@ block rootNavRight
       a.button.is-outlined(v-on:click='$store.dispatch("modalMovePage/open")')
         i.nc-icon-outline.arrows-1_shuffle-98
         span= t('nav.move')
-    a.button.is-outlined(href='/source/' + pageData.meta.path)
-      i.nc-icon-outline.education_paper
-      span= t('nav.source')
+    if appconfig.theme.viewSource == "all" || rights.write && appconfig.theme.viewSource == "write"
+      a.button.is-outlined(href='/source/' + pageData.meta.path)
+        i.nc-icon-outline.education_paper
+        span= t('nav.source')
     //-a.button.is-outlined(href='/hist/' + pageData.meta.path)
       i.nc-icon-outline.ui-2_time
       span= t('nav.history')