mirror of
https://github.com/gogs/gogs.git
synced 2025-12-20 15:20:01 +01:00
install: able to enable builtin SSH server (#3773)
This commit is contained in:
@@ -48,7 +48,7 @@ cancel = Cancel
|
|||||||
install = Installation
|
install = Installation
|
||||||
title = Install Steps For First-time Run
|
title = Install Steps For First-time Run
|
||||||
docker_helper = If you're running Gogs inside Docker, please read <a target="_blank" href="%s">Guidelines</a> carefully before you change anything in this page!
|
docker_helper = If you're running Gogs inside Docker, please read <a target="_blank" href="%s">Guidelines</a> carefully before you change anything in this page!
|
||||||
requite_db_desc = Gogs requires MySQL, PostgreSQL, SQLite3 or TiDB.
|
requite_db_desc = Gogs requires MySQL, PostgreSQL, SQLite3, MSSQL or TiDB.
|
||||||
db_title = Database Settings
|
db_title = Database Settings
|
||||||
db_type = Database Type
|
db_type = Database Type
|
||||||
host = Host
|
host = Host
|
||||||
@@ -58,9 +58,8 @@ db_name = Database Name
|
|||||||
db_helper = Please use INNODB engine with utf8_general_ci charset for MySQL.
|
db_helper = Please use INNODB engine with utf8_general_ci charset for MySQL.
|
||||||
ssl_mode = SSL Mode
|
ssl_mode = SSL Mode
|
||||||
path = Path
|
path = Path
|
||||||
sqlite_helper = The file path of SQLite3 or TiDB database. <br>Please use absolute path when you start as service.
|
sqlite_helper = The file path of SQLite3 database. <br>Please use absolute path when you start as service.
|
||||||
err_empty_db_path = SQLite3 or TiDB database path cannot be empty.
|
err_empty_db_path = SQLite3 database path cannot be empty.
|
||||||
err_invalid_tidb_name = TiDB database name does not allow characters "." and "-".
|
|
||||||
no_admin_and_disable_registration = You cannot disable registration without creating an admin account.
|
no_admin_and_disable_registration = You cannot disable registration without creating an admin account.
|
||||||
err_empty_admin_password = Admin password cannot be empty.
|
err_empty_admin_password = Admin password cannot be empty.
|
||||||
|
|
||||||
@@ -75,6 +74,8 @@ domain = Domain
|
|||||||
domain_helper = This affects SSH clone URLs.
|
domain_helper = This affects SSH clone URLs.
|
||||||
ssh_port = SSH Port
|
ssh_port = SSH Port
|
||||||
ssh_port_helper = Port number which your SSH server is using, leave it empty to disable SSH feature.
|
ssh_port_helper = Port number which your SSH server is using, leave it empty to disable SSH feature.
|
||||||
|
use_builtin_ssh_server = Use Builtin SSH Server
|
||||||
|
use_builtin_ssh_server_popup = Start builtin SSH server for Git operations to distinguish from system SSH daemon.
|
||||||
http_port = HTTP Port
|
http_port = HTTP Port
|
||||||
http_port_helper = Port number which application will listen on.
|
http_port_helper = Port number which application will listen on.
|
||||||
app_url = Application URL
|
app_url = Application URL
|
||||||
|
|||||||
2
gogs.go
2
gogs.go
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.9.157.0218"
|
const APP_VER = "0.9.158.0218"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
|
|||||||
@@ -20,14 +20,15 @@ type InstallForm struct {
|
|||||||
SSLMode string
|
SSLMode string
|
||||||
DbPath string
|
DbPath string
|
||||||
|
|
||||||
AppName string `binding:"Required" locale:"install.app_name"`
|
AppName string `binding:"Required" locale:"install.app_name"`
|
||||||
RepoRootPath string `binding:"Required"`
|
RepoRootPath string `binding:"Required"`
|
||||||
RunUser string `binding:"Required"`
|
RunUser string `binding:"Required"`
|
||||||
Domain string `binding:"Required"`
|
Domain string `binding:"Required"`
|
||||||
SSHPort int
|
SSHPort int
|
||||||
HTTPPort string `binding:"Required"`
|
UseBuiltinSSHServer bool
|
||||||
AppUrl string `binding:"Required"`
|
HTTPPort string `binding:"Required"`
|
||||||
LogRootPath string `binding:"Required"`
|
AppUrl string `binding:"Required"`
|
||||||
|
LogRootPath string `binding:"Required"`
|
||||||
|
|
||||||
SMTPHost string
|
SMTPHost string
|
||||||
SMTPFrom string
|
SMTPFrom string
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -900,6 +900,11 @@ footer .ui.language .menu {
|
|||||||
.install .ui .checkbox label {
|
.install .ui .checkbox label {
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
|
.install #use-builtin-ssh-server {
|
||||||
|
margin-top: -1em;
|
||||||
|
margin-left: -15px !important;
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
.form .help {
|
.form .help {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
padding-top: .6em;
|
padding-top: .6em;
|
||||||
|
|||||||
@@ -212,18 +212,15 @@ function initInstall() {
|
|||||||
// Database type change detection.
|
// Database type change detection.
|
||||||
$("#db_type").change(function () {
|
$("#db_type").change(function () {
|
||||||
var sqliteDefault = 'data/gogs.db';
|
var sqliteDefault = 'data/gogs.db';
|
||||||
var tidbDefault = 'data/gogs_tidb';
|
|
||||||
|
|
||||||
var dbType = $(this).val();
|
var dbType = $(this).val();
|
||||||
if (dbType === "SQLite3" || dbType === "TiDB") {
|
if (dbType === "SQLite3") {
|
||||||
$('#sql_settings').hide();
|
$('#sql_settings').hide();
|
||||||
$('#pgsql_settings').hide();
|
$('#pgsql_settings').hide();
|
||||||
$('#sqlite_settings').show();
|
$('#sqlite_settings').show();
|
||||||
|
|
||||||
if (dbType === "SQLite3" && $('#db_path').val() == tidbDefault) {
|
if (dbType === "SQLite3") {
|
||||||
$('#db_path').val(sqliteDefault);
|
$('#db_path').val(sqliteDefault);
|
||||||
} else if (dbType === "TiDB" && $('#db_path').val() == sqliteDefault) {
|
|
||||||
$('#db_path').val(tidbDefault);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#use-builtin-ssh-server {
|
||||||
|
margin-top: -1em;
|
||||||
|
margin-left: -15px !important;
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"net/mail"
|
"net/mail"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -144,6 +143,7 @@ func Install(ctx *context.Context) {
|
|||||||
|
|
||||||
form.Domain = setting.Domain
|
form.Domain = setting.Domain
|
||||||
form.SSHPort = setting.SSH.Port
|
form.SSHPort = setting.SSH.Port
|
||||||
|
form.UseBuiltinSSHServer = setting.SSH.StartBuiltinServer
|
||||||
form.HTTPPort = setting.HTTPPort
|
form.HTTPPort = setting.HTTPPort
|
||||||
form.AppUrl = setting.AppUrl
|
form.AppUrl = setting.AppUrl
|
||||||
form.LogRootPath = setting.LogRootPath
|
form.LogRootPath = setting.LogRootPath
|
||||||
@@ -202,16 +202,10 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
|||||||
models.DbCfg.SSLMode = form.SSLMode
|
models.DbCfg.SSLMode = form.SSLMode
|
||||||
models.DbCfg.Path = form.DbPath
|
models.DbCfg.Path = form.DbPath
|
||||||
|
|
||||||
if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") &&
|
if models.DbCfg.Type == "sqlite3" && len(models.DbCfg.Path) == 0 {
|
||||||
len(models.DbCfg.Path) == 0 {
|
|
||||||
ctx.Data["Err_DbPath"] = true
|
ctx.Data["Err_DbPath"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), INSTALL, &form)
|
||||||
return
|
return
|
||||||
} else if models.DbCfg.Type == "tidb" &&
|
|
||||||
strings.ContainsAny(path.Base(models.DbCfg.Path), ".-") {
|
|
||||||
ctx.Data["Err_DbPath"] = true
|
|
||||||
ctx.RenderWithErr(ctx.Tr("install.err_invalid_tidb_name"), INSTALL, &form)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set test engine.
|
// Set test engine.
|
||||||
@@ -315,6 +309,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
|||||||
} else {
|
} else {
|
||||||
cfg.Section("server").Key("DISABLE_SSH").SetValue("false")
|
cfg.Section("server").Key("DISABLE_SSH").SetValue("false")
|
||||||
cfg.Section("server").Key("SSH_PORT").SetValue(com.ToStr(form.SSHPort))
|
cfg.Section("server").Key("SSH_PORT").SetValue(com.ToStr(form.SSHPort))
|
||||||
|
cfg.Section("server").Key("START_SSH_SERVER").SetValue(com.ToStr(form.UseBuiltinSSHServer))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(strings.TrimSpace(form.SMTPHost)) > 0 {
|
if len(strings.TrimSpace(form.SMTPHost)) > 0 {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0.9.157.0218
|
0.9.158.0218
|
||||||
@@ -99,6 +99,12 @@
|
|||||||
<input id="ssh_port" name="ssh_port" value="{{.ssh_port}}">
|
<input id="ssh_port" name="ssh_port" value="{{.ssh_port}}">
|
||||||
<span class="help">{{.i18n.Tr "install.ssh_port_helper"}}</span>
|
<span class="help">{{.i18n.Tr "install.ssh_port_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline field" id="use-builtin-ssh-server">
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<label class="poping up" data-content="{{.i18n.Tr "install.use_builtin_ssh_server_popup"}}"><strong>{{.i18n.Tr "install.use_builtin_ssh_server"}}</strong></label>
|
||||||
|
<input name="use_builtin_ssh_server" type="checkbox" {{if .use_builtin_ssh_server}}checked{{end}}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="inline required field">
|
<div class="inline required field">
|
||||||
<label for="http_port">{{.i18n.Tr "install.http_port"}}</label>
|
<label for="http_port">{{.i18n.Tr "install.http_port"}}</label>
|
||||||
<input id="http_port" name="http_port" value="{{.http_port}}" required>
|
<input id="http_port" name="http_port" value="{{.http_port}}" required>
|
||||||
|
|||||||
Reference in New Issue
Block a user