浏览代码

fix: Updated setup wizard to use new git author options

NGPixel 8 年之前
父节点
当前提交
b90884fd69
共有 3 个文件被更改,包括 15 次插入19 次删除
  1. 4 6
      client/js/configure.js
  2. 4 6
      server/configure.js
  3. 7 7
      server/views/configure/index.pug

+ 4 - 6
client/js/configure.js

@@ -61,8 +61,8 @@ jQuery(document).ready(function ($) {
         gitAuthUser: '',
         gitAuthUser: '',
         gitAuthPass: '',
         gitAuthPass: '',
         gitAuthSSL: true,
         gitAuthSSL: true,
-        gitSignatureName: '',
-        gitSignatureEmail: '',
+        gitShowUserEmail: true,
+        gitServerEmail: '',
         adminEmail: '',
         adminEmail: '',
         adminPassword: '',
         adminPassword: '',
         adminPasswordConfirm: ''
         adminPasswordConfirm: ''
@@ -119,6 +119,8 @@ jQuery(document).ready(function ($) {
       if (appconfig.git !== false && _.isPlainObject(appconfig.git)) {
       if (appconfig.git !== false && _.isPlainObject(appconfig.git)) {
         this.conf.gitUrl = appconfig.git.url || ''
         this.conf.gitUrl = appconfig.git.url || ''
         this.conf.gitBranch = appconfig.git.branch || 'master'
         this.conf.gitBranch = appconfig.git.branch || 'master'
+        this.conf.gitShowUserEmail = (appconfig.git.showUserEmail !== false)
+        this.conf.gitServerEmail = appconfig.git.serverEmail || ''
         if (_.isPlainObject(appconfig.git.auth)) {
         if (_.isPlainObject(appconfig.git.auth)) {
           this.conf.gitAuthType = appconfig.git.auth.type || 'ssh'
           this.conf.gitAuthType = appconfig.git.auth.type || 'ssh'
           this.conf.gitAuthSSHKey = appconfig.git.auth.privateKey || ''
           this.conf.gitAuthSSHKey = appconfig.git.auth.privateKey || ''
@@ -126,10 +128,6 @@ jQuery(document).ready(function ($) {
           this.conf.gitAuthPass = appconfig.git.auth.password || ''
           this.conf.gitAuthPass = appconfig.git.auth.password || ''
           this.conf.gitAuthSSL = (appconfig.git.auth.sslVerify !== false)
           this.conf.gitAuthSSL = (appconfig.git.auth.sslVerify !== false)
         }
         }
-        if (_.isPlainObject(appconfig.git.signature)) {
-          this.conf.gitSignatureName = appconfig.git.signature.name || ''
-          this.conf.gitSignatureEmail = appconfig.git.signature.email || ''
-        }
       }
       }
     },
     },
     methods: {
     methods: {

+ 4 - 6
server/configure.js

@@ -193,13 +193,13 @@ module.exports = (port, spinner) => {
       },
       },
       () => {
       () => {
         if (req.body.gitUseRemote === false) { return false }
         if (req.body.gitUseRemote === false) { return false }
-        return exec.stdout('git', ['config', '--local', 'user.name', req.body.gitSignatureName], { cwd: gitDir }).then(result => {
+        return exec.stdout('git', ['config', '--local', 'user.name', 'Wiki'], { cwd: gitDir }).then(result => {
           return 'Git Signature Name has been set successfully.'
           return 'Git Signature Name has been set successfully.'
         })
         })
       },
       },
       () => {
       () => {
         if (req.body.gitUseRemote === false) { return false }
         if (req.body.gitUseRemote === false) { return false }
-        return exec.stdout('git', ['config', '--local', 'user.email', req.body.gitSignatureEmail], { cwd: gitDir }).then(result => {
+        return exec.stdout('git', ['config', '--local', 'user.email', req.body.gitServerEmail], { cwd: gitDir }).then(result => {
           return 'Git Signature Name has been set successfully.'
           return 'Git Signature Name has been set successfully.'
         })
         })
       },
       },
@@ -340,10 +340,8 @@ module.exports = (port, spinner) => {
               privateKey: req.body.gitAuthSSHKey,
               privateKey: req.body.gitAuthSSHKey,
               sslVerify: (req.body.gitAuthSSL === true)
               sslVerify: (req.body.gitAuthSSL === true)
             },
             },
-            signature: {
-              name: req.body.gitSignatureName,
-              email: req.body.gitSignatureEmail
-            }
+            showUserEmail: (req.body.gitShowUserEmail === true),
+            serverEmail: req.body.gitServerEmail
           }
           }
         }
         }
         return crypto.randomBytesAsync(32).then(buf => {
         return crypto.randomBytesAsync(32).then(buf => {

+ 7 - 7
server/views/configure/index.pug

@@ -264,16 +264,16 @@ html(data-logic='configure')
                         input(type='text', placeholder='e.g. /etc/wiki/keys/git.pem', v-model='conf.gitAuthSSHKey')
                         input(type='text', placeholder='e.g. /etc/wiki/keys/git.pem', v-model='conf.gitAuthSSHKey')
                         span.desc The full path to the private key on disk.
                         span.desc The full path to the private key on disk.
                   section.columns
                   section.columns
-                    .column
+                    .column.is-one-third
                       p.control.is-fullwidth
                       p.control.is-fullwidth
-                        label.label Sync User Name
-                        input(type='text', placeholder='e.g. John Smith', v-model.number='conf.gitSignatureName', data-vv-scope='git', name='ipt-gitsigname', v-validate='{ required: true }')
-                        span.desc The name to use when pushing commits to the git repository.
+                        input#ipt-git-show-user-email(type='checkbox', v-model='conf.gitShowUserEmail')
+                        label.label(for='ipt-git-show-user-email') Commit using User Email
+                        span.desc When enabled, commits are made as the current user name and email. If unchecked, the current user name will still be used but the default commit author email will be used instead.
                     .column
                     .column
                       p.control.is-fullwidth
                       p.control.is-fullwidth
-                        label.label Sync User Email
-                        input(type='text', placeholder='e.g. user@example.com', v-model.number='conf.gitSignatureEmail', data-vv-scope='git', name='ipt-gitsigemail', v-validate='{ required: true, email: true }')
-                        span.desc The email to use when pushing commits to the git repository.
+                        label.label Default Commit Author Email
+                        input(type='text', placeholder='e.g. user@example.com', v-model.number='conf.gitServerEmail', data-vv-scope='git', name='ipt-gitsrvemail', v-validate='{ required: true, email: true }')
+                        span.desc The default/fallback email to use when creating commits to the git repository.
                 .panel-footer
                 .panel-footer
                   .progress-bar: div(v-bind:style='{width: currentProgress}')
                   .progress-bar: div(v-bind:style='{width: currentProgress}')
                   button.button.is-light-blue.is-outlined(v-on:click='proceedToPaths', v-bind:disabled='loading') Back
                   button.button.is-light-blue.is-outlined(v-on:click='proceedToPaths', v-bind:disabled='loading') Back