Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Upstream
Gitea
Commits
99385db0
Commit
99385db0
authored
8 years ago
by
Unknwon
Browse files
Options
Download
Email Patches
Plain Diff
#3320 code cleanup
parent
90dd0657
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
README.md
+3
-2
README.md
README_ZH.md
+1
-1
README_ZH.md
conf/app.ini
+2
-0
conf/app.ini
conf/locale/locale_en-US.ini
+1
-0
conf/locale/locale_en-US.ini
gogs.go
+1
-1
gogs.go
modules/base/tool.go
+11
-14
modules/base/tool.go
modules/bindata/bindata.go
+4
-4
modules/bindata/bindata.go
modules/setting/setting.go
+10
-7
modules/setting/setting.go
public/js/gogs.js
+15
-0
public/js/gogs.js
templates/.VERSION
+1
-1
templates/.VERSION
templates/install.tmpl
+1
-1
templates/install.tmpl
templates/user/settings/avatar.tmpl
+2
-2
templates/user/settings/avatar.tmpl
with
52 additions
and
33 deletions
+52
-33
README.md
View file @
99385db0
...
...
@@ -3,7 +3,7 @@ Gogs - Go Git Service [
##### Current tip version: 0.9.6
5
(see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
##### Current tip version: 0.9.6
6
(see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
| Web | UI | Preview |
|:-------------:|:-------:|:-------:|
...
...
@@ -45,7 +45,7 @@ The goal of this project is to make the easiest, fastest, and most painless way
-
Repository Git hooks/deploy keys
-
Repository issues, pull requests and wiki
-
Add/Remove repository collaborators
-
Gravatar and custom source
-
Gravatar and
Federated avatar with
custom source
-
Mail service
-
Administration panel
-
Supports MySQL, PostgreSQL, SQLite3 and
[
TiDB
](
https://github.com/pingcap/tidb
)
(
experimental
)
...
...
@@ -87,6 +87,7 @@ There are 5 ways to install Gogs:
### Screencasts
-
[
How to install Gogs on a Linux Server (DigitalOcean)
](
https://www.youtube.com/watch?v=deSfX0gqefE
)
-
[
Instalando Gogs no Ubuntu
](
https://www.youtube.com/watch?v=4UkHAR1F7ZA
)
(
Português
)
### Deploy to Cloud
...
...
This diff is collapsed.
Click to expand it.
README_ZH.md
View file @
99385db0
...
...
@@ -26,7 +26,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
-
支持仓库 Git 钩子和部署密钥
-
支持仓库工单(Issue)、合并请求(Pull Request)以及 Wiki
-
支持添加和删除仓库协作者
-
支持 Gravatar
以及自定义源
-
支持
自定义源的
Gravatar
和 Federated Avatar
-
支持邮件服务
-
支持后台管理面板
-
支持 MySQL、PostgreSQL、SQLite3 和
[
TiDB
](
https://github.com/pingcap/tidb
)
(实验性支持) 数据库
...
...
This diff is collapsed.
Click to expand it.
conf/app.ini
View file @
99385db0
...
...
@@ -229,9 +229,11 @@ AVATAR_UPLOAD_PATH = data/avatars
; Chinese users can choose "duoshuo"
; or a custom avatar source, like: http://cn.gravatar.com/avatar/
GRAVATAR_SOURCE
=
gravatar
; This value will be forced to be true in offline mode.
DISABLE_GRAVATAR
=
false
; Federated avatar lookup uses DNS to discover avatar associated
; with emails, see http://www.libravatar.org
; This value will be forced to be false in offline mode or Gravatar is disbaled.
ENABLE_FEDERATED_AVATAR
=
false
[attachment]
...
...
This diff is collapsed.
Click to expand it.
conf/locale/locale_en-US.ini
View file @
99385db0
...
...
@@ -97,6 +97,7 @@ offline_mode_popup = Disable CDN even in production mode, all resource files wil
disable_gravatar
=
Disable Gravatar Service
disable_gravatar_popup
=
Disable Gravatar and custom sources, all avatars are uploaded by users or default.
federated_avatar_lookup
=
Enable Federated Avatars Lookup
federated_avatar_lookup_popup
=
Enable federated avatars lookup to use federated open source service based on libravatar.
disable_registration
=
Disable Self-registration
disable_registration_popup
=
Disable user self-registration, only admin can create accounts.
enable_captcha
=
Enable Captcha
...
...
This diff is collapsed.
Click to expand it.
gogs.go
View file @
99385db0
...
...
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const
APP_VER
=
"0.9.6
5
.0806"
const
APP_VER
=
"0.9.6
6
.0806"
func
init
()
{
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
...
...
This diff is collapsed.
Click to expand it.
modules/base/tool.go
View file @
99385db0
...
...
@@ -204,26 +204,23 @@ func HashEmail(email string) string {
return
hex
.
EncodeToString
(
h
.
Sum
(
nil
))
}
// AvatarLink returns avatar link by given email.
// AvatarLink returns relative avatar link to the site domain by given email,
// which includes app sub-url as prefix. However, it is possible
// to return full URL if user enables Gravatar-like service.
func
AvatarLink
(
email
string
)
(
url
string
)
{
if
!
setting
.
OfflineMode
{
if
setting
.
EnableFederatedAvatar
&&
setting
.
LibravatarService
!=
nil
{
var
err
error
url
,
err
=
setting
.
LibravatarService
.
FromEmail
(
email
)
if
err
!=
nil
{
log
.
Error
(
1
,
"LibravatarService.FromEmail:: %v"
,
err
)
}
}
if
len
(
url
)
==
0
&&
!
setting
.
DisableGravatar
{
url
=
setting
.
GravatarSource
+
HashEmail
(
email
)
if
setting
.
EnableFederatedAvatar
&&
setting
.
LibravatarService
!=
nil
{
var
err
error
url
,
err
=
setting
.
LibravatarService
.
FromEmail
(
email
)
if
err
!=
nil
{
log
.
Error
(
1
,
"LibravatarService.FromEmail: %v"
,
err
)
}
}
if
len
(
url
)
==
0
&&
!
setting
.
DisableGravatar
{
url
=
setting
.
GravatarSource
+
HashEmail
(
email
)
}
if
len
(
url
)
==
0
{
url
=
setting
.
AppSubUrl
+
"/img/avatar_default.png"
}
return
url
}
...
...
This diff is collapsed.
Click to expand it.
modules/bindata/bindata.go
View file @
99385db0
This diff is collapsed.
Click to expand it.
modules/setting/setting.go
View file @
99385db0
...
...
@@ -20,8 +20,8 @@ import (
_
"github.com/go-macaron/cache/redis"
"github.com/go-macaron/session"
_
"github.com/go-macaron/session/redis"
"gopkg.in/ini.v1"
"github.com/strk/go-libravatar"
"gopkg.in/ini.v1"
"github.com/gogits/gogs/modules/bindata"
"github.com/gogits/gogs/modules/log"
...
...
@@ -141,11 +141,11 @@ var (
}
// Picture settings
AvatarUploadPath
string
GravatarSource
string
DisableGravatar
bool
EnableFederatedAvatar
bool
LibravatarService
*
libravatar
.
Libravatar
AvatarUploadPath
string
GravatarSource
string
DisableGravatar
bool
EnableFederatedAvatar
bool
LibravatarService
*
libravatar
.
Libravatar
// Log settings
LogRootPath
string
...
...
@@ -470,8 +470,11 @@ func NewContext() {
DisableGravatar
=
true
EnableFederatedAvatar
=
false
}
if
DisableGravatar
{
EnableFederatedAvatar
=
false
}
if
!
DisableGravatar
&&
EnableFederatedAvatar
{
if
EnableFederatedAvatar
{
LibravatarService
=
libravatar
.
New
()
parts
:=
strings
.
Split
(
GravatarSource
,
"/"
)
if
len
(
parts
)
>=
3
{
...
...
This diff is collapsed.
Click to expand it.
public/js/gogs.js
View file @
99385db0
...
...
@@ -187,9 +187,24 @@ function initInstall() {
}
});
// TODO: better handling of exclusive relations.
$
(
'
#offline-mode input
'
).
change
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
#disable-gravatar
'
).
checkbox
(
'
check
'
);
$
(
'
#federated-avatar-lookup
'
).
checkbox
(
'
uncheck
'
);
}
});
$
(
'
#disable-gravatar input
'
).
change
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
#federated-avatar-lookup
'
).
checkbox
(
'
uncheck
'
);
}
else
{
$
(
'
#offline-mode
'
).
checkbox
(
'
uncheck
'
);
}
});
$
(
'
#federated-avatar-lookup input
'
).
change
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
#disable-gravatar
'
).
checkbox
(
'
uncheck
'
);
$
(
'
#offline-mode
'
).
checkbox
(
'
uncheck
'
);
}
});
$
(
'
#disable-registration input
'
).
change
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
templates/.VERSION
View file @
99385db0
0.9.65.0806
\ No newline at end of file
0.9.66.0806
\ No newline at end of file
This diff is collapsed.
Click to expand it.
templates/install.tmpl
View file @
99385db0
...
...
@@ -179,7 +179,7 @@
</div>
<div class="inline field">
<div class="ui checkbox" id="federated-avatar-lookup">
<label class="poping up" data-content="{{.i18n.Tr "install.federated_avatar_lookup"}}"><strong>{{.i18n.Tr "install.federated_avatar_lookup"}}</strong></label>
<label class="poping up" data-content="{{.i18n.Tr "install.federated_avatar_lookup
_popup
"}}"><strong>{{.i18n.Tr "install.federated_avatar_lookup"}}</strong></label>
<input name="enable_federated_avatar" type="checkbox" {{if .enable_federated_avatar}}checked{{end}}>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
templates/user/settings/avatar.tmpl
View file @
99385db0
...
...
@@ -14,7 +14,7 @@
{{.CsrfTokenHtml}}
{{if not DisableGravatar}}
<div class="inline field">
<div class="ui radio">
<div class="ui radio
checkbox
">
<input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}>
<label>{{.i18n.Tr "settings.lookup_avatar_by_mail"}}</label>
</div>
...
...
@@ -26,7 +26,7 @@
{{end}}
<div class="inline field">
<div class="ui radio">
<div class="ui radio
checkbox
">
<input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}>
<label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label>
</div>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment