Add option to app.ini to enable local import paths (#724)
This commit is contained in:
parent
1257d43e14
commit
74ed6dc3ad
6 changed files with 14 additions and 5 deletions
2
conf/app.ini
vendored
2
conf/app.ini
vendored
|
@ -173,6 +173,8 @@ COOKIE_REMEMBER_NAME = gitea_incredible
|
||||||
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
|
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
|
||||||
; Sets the minimum password length for new Users
|
; Sets the minimum password length for new Users
|
||||||
MIN_PASSWORD_LENGTH = 6
|
MIN_PASSWORD_LENGTH = 6
|
||||||
|
; True when users are allowed to import local server paths
|
||||||
|
IMPORT_LOCAL_PATHS = false
|
||||||
|
|
||||||
[service]
|
[service]
|
||||||
ACTIVE_CODE_LIVE_MINUTES = 180
|
ACTIVE_CODE_LIVE_MINUTES = 180
|
||||||
|
|
|
@ -233,6 +233,9 @@ func (u *User) CanEditGitHook() bool {
|
||||||
|
|
||||||
// CanImportLocal returns true if user can migrate repository by local path.
|
// CanImportLocal returns true if user can migrate repository by local path.
|
||||||
func (u *User) CanImportLocal() bool {
|
func (u *User) CanImportLocal() bool {
|
||||||
|
if !setting.ImportLocalPaths {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return u.IsAdmin || u.AllowImportLocal
|
return u.IsAdmin || u.AllowImportLocal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ var (
|
||||||
CookieRememberName string
|
CookieRememberName string
|
||||||
ReverseProxyAuthUser string
|
ReverseProxyAuthUser string
|
||||||
MinPasswordLength int
|
MinPasswordLength int
|
||||||
|
ImportLocalPaths bool
|
||||||
|
|
||||||
// Database settings
|
// Database settings
|
||||||
UseSQLite3 bool
|
UseSQLite3 bool
|
||||||
|
@ -712,6 +713,7 @@ please consider changing to GITEA_CUSTOM`)
|
||||||
CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")
|
CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")
|
||||||
ReverseProxyAuthUser = sec.Key("REVERSE_PROXY_AUTHENTICATION_USER").MustString("X-WEBAUTH-USER")
|
ReverseProxyAuthUser = sec.Key("REVERSE_PROXY_AUTHENTICATION_USER").MustString("X-WEBAUTH-USER")
|
||||||
MinPasswordLength = sec.Key("MIN_PASSWORD_LENGTH").MustInt(6)
|
MinPasswordLength = sec.Key("MIN_PASSWORD_LENGTH").MustInt(6)
|
||||||
|
ImportLocalPaths = sec.Key("IMPORT_LOCAL_PATHS").MustBool(false)
|
||||||
|
|
||||||
sec = Cfg.Section("attachment")
|
sec = Cfg.Section("attachment")
|
||||||
AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
|
AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
|
||||||
|
@ -897,11 +899,11 @@ func newLogService() {
|
||||||
|
|
||||||
useConsole := false
|
useConsole := false
|
||||||
for _, mode := range LogModes {
|
for _, mode := range LogModes {
|
||||||
if mode == "console" {
|
if mode == "console" {
|
||||||
useConsole = true
|
useConsole = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!useConsole) {
|
if !useConsole {
|
||||||
log.DelLogger("console")
|
log.DelLogger("console")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,7 +425,8 @@ migrate_type = Migration Type
|
||||||
migrate_type_helper = This repository will be a <span class="text blue">mirror</span>
|
migrate_type_helper = This repository will be a <span class="text blue">mirror</span>
|
||||||
migrate_repo = Migrate Repository
|
migrate_repo = Migrate Repository
|
||||||
migrate.clone_address = Clone Address
|
migrate.clone_address = Clone Address
|
||||||
migrate.clone_address_desc = This can be a HTTP/HTTPS/GIT URL or local server path.
|
migrate.clone_address_desc = This can be a HTTP/HTTPS/GIT URL
|
||||||
|
migrate.clone_local_path = or local server path
|
||||||
migrate.permission_denied = You are not allowed to import local repositories.
|
migrate.permission_denied = You are not allowed to import local repositories.
|
||||||
migrate.invalid_local_path = Invalid local path, it does not exist or not a directory.
|
migrate.invalid_local_path = Invalid local path, it does not exist or not a directory.
|
||||||
migrate.failed = Migration failed: %v
|
migrate.failed = Migration failed: %v
|
||||||
|
|
|
@ -384,7 +384,8 @@ migrate_type=Migratie type
|
||||||
migrate_type_helper=Deze repository zal een <span class="text blue">kopie</span> zijn
|
migrate_type_helper=Deze repository zal een <span class="text blue">kopie</span> zijn
|
||||||
migrate_repo=Migreer repository
|
migrate_repo=Migreer repository
|
||||||
migrate.clone_address=Kloon adres
|
migrate.clone_address=Kloon adres
|
||||||
migrate.clone_address_desc=Dit kan een HTTP/HTTPS/GIT URL zijn of een lokaal pad.
|
migrate.clone_address_desc=Dit kan een HTTP/HTTPS/GIT URL zijn
|
||||||
|
migrate.clone_local_path =of een lokaal pad
|
||||||
migrate.permission_denied=U bent niet gemachtigd om deze lokale repositories te importeren.
|
migrate.permission_denied=U bent niet gemachtigd om deze lokale repositories te importeren.
|
||||||
migrate.invalid_local_path=Ongeldig lokaal pad, het pad bestaat niet of het is geen map.
|
migrate.invalid_local_path=Ongeldig lokaal pad, het pad bestaat niet of het is geen map.
|
||||||
migrate.failed=Migratie is mislukt: %v
|
migrate.failed=Migratie is mislukt: %v
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{.i18n.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{.i18n.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
<span class="help">{{.i18n.Tr "repo.migrate.clone_address_desc"}}</span>
|
<span class="help">{{.i18n.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{.i18n.Tr "repo.migrate.clone_local_path"}}{{end}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui accordion optional field">
|
<div class="ui accordion optional field">
|
||||||
<div class="title {{if .Err_Auth}}text red active{{end}}">
|
<div class="title {{if .Err_Auth}}text red active{{end}}">
|
||||||
|
|
Loading…
Reference in a new issue