Skip to content

Commit cd01397

Browse files
authored
Merge branch 'master' into remove-local-clones
2 parents 74d95e4 + 6db3dc7 commit cd01397

File tree

302 files changed

+37058
-569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+37058
-569
lines changed

.drone.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ workspace:
22
base: /go
33
path: src/code.gitea.io/gitea
44

5-
clone:
6-
git:
7-
image: plugins/git:next
8-
depth: 50
9-
tags: true
10-
115
pipeline:
6+
fetch-tags:
7+
image: docker:git
8+
commands:
9+
- git fetch --tags --force
10+
1211
download_translations:
1312
image: jonasfranz/crowdin
1413
pull: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ coverage.all
6666
/integrations/mssql.ini
6767
/node_modules
6868
/modules/indexer/issues/indexers
69-
69+
routers/repo/authorized_keys
7070

7171
# Snapcraft
7272
snap/.snapcraft/

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.8.1](https://github.com/go-gitea/gitea/releases/tag/v1.8.1) - 2019-05-08
8+
* BUGFIXES
9+
* Fix 404 when sending pull requests in some situations (#6871) (#6873)
10+
* Enforce osusergo build tag for releases (#6862) (#6869)
11+
* Don't post process commit summary in templates (#6842) (#6868)
12+
* Fix 500 when reviewer is deleted (#6856) (#6860)
13+
* Fix v78 migration for MSSQL (#6823) (#6854)
14+
* Added tags pull step to drone config to show correct version hashes (#6836) (#6839)
15+
* Fix double-generation of scratch token (#6833) (#6835)
16+
* When mirroring we should set the remote to mirror (#6824) (#6834)
17+
* Show scrollbar only when needed (#6802) (#6803)
18+
* Service worker js is missing a comma (#6788) (#6795)
19+
* Set user search base field optional in LDAP (simple auth) edit page (#6779) (#6789)
20+
* Fix team edit API panic (#6780) (#6785)
21+
* Minor CSS cleanup for the navbar (#6553) (#6781)
22+
* Stricter domain name pattern in email regex (#6739) (#6768)
23+
* Detect and restore encoding and BOM in content (#6727) (#6765)
24+
* Fix org visibility bug when git cloning (#6743) (#6762)
25+
* OAuth2 token can be used in basic auth (#6747) (#6761)
26+
* Fix missing return (#6751) (#6756)
27+
* Fix sorting repos on org home page with non-admin login (#6741) (#6746)
28+
* Drop is_bare IDX only when it exists for MySQL and MariaDB (#6736) (#6744)
29+
* Fix team members API (#6714) (#6729)
30+
* Load issue attributes when editing an issue with API (#6723) (#6725)
31+
* Fix config ui error about cache ttl (#6861) (#6865)
32+
733
## [1.8.0](https://github.com/go-gitea/gitea/releases/tag/v1.8.0) - 2019-04-20
834
* SECURITY
935
* Prevent remote code execution vulnerability with mirror repo URL settings (#6593) (#6594)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ VOLUME ["/data"]
5656
ENTRYPOINT ["/usr/bin/entrypoint"]
5757
CMD ["/bin/s6-svscan", "/etc/s6"]
5858

59-
COPY docker /
59+
COPY docker/root /
6060
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
6161
RUN ln -s /app/gitea/gitea /usr/local/bin/gitea

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ release-windows:
325325
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
326326
$(GO) get -u src.techknowlogick.com/xgo; \
327327
fi
328-
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
328+
xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
329329
ifeq ($(CI),drone)
330330
cp /build/* $(DIST)/binaries
331331
endif
@@ -335,7 +335,7 @@ release-linux:
335335
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
336336
$(GO) get -u src.techknowlogick.com/xgo; \
337337
fi
338-
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
338+
xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
339339
ifeq ($(CI),drone)
340340
cp /build/* $(DIST)/binaries
341341
endif
@@ -345,7 +345,7 @@ release-darwin:
345345
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
346346
$(GO) get -u src.techknowlogick.com/xgo; \
347347
fi
348-
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
348+
xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
349349
ifeq ($(CI),drone)
350350
cp /build/* $(DIST)/binaries
351351
endif

README_ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg)](https://drone.gitea.io/go-gitea/gitea)
66
[![Join the chat at https://img.shields.io/discord/322538954119184384.svg](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/NsatcWJ)
77
[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
8-
[![Coverage Status](https://coverage.gitea.io/badges/go-gitea/gitea/coverage.svg)](https://coverage.gitea.io/go-gitea/gitea)
8+
[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea)
99
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
1010
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
1111
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)

cmd/admin.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ var (
7373
Usage: "Length of the random password to be generated",
7474
Value: 12,
7575
},
76+
cli.BoolFlag{
77+
Name: "access-token",
78+
Usage: "Generate access token for the user",
79+
},
7680
},
7781
}
7882

@@ -300,18 +304,33 @@ func runCreateUser(c *cli.Context) error {
300304
changePassword = c.Bool("must-change-password")
301305
}
302306

303-
if err := models.CreateUser(&models.User{
307+
u := &models.User{
304308
Name: username,
305309
Email: c.String("email"),
306310
Passwd: password,
307311
IsActive: true,
308312
IsAdmin: c.Bool("admin"),
309313
MustChangePassword: changePassword,
310314
Theme: setting.UI.DefaultTheme,
311-
}); err != nil {
315+
}
316+
317+
if err := models.CreateUser(u); err != nil {
312318
return fmt.Errorf("CreateUser: %v", err)
313319
}
314320

321+
if c.Bool("access-token") {
322+
t := &models.AccessToken{
323+
Name: "gitea-admin",
324+
UID: u.ID,
325+
}
326+
327+
if err := models.NewAccessToken(t); err != nil {
328+
return err
329+
}
330+
331+
fmt.Printf("Access token was successfully created... %s\n", t.Token)
332+
}
333+
315334
fmt.Printf("New user '%s' has been successfully created!\n", username)
316335
return nil
317336
}

custom/conf/app.ini.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ SHOW_USER_EMAIL = true
9797
DEFAULT_THEME = gitea
9898
; All available themes. Allow users select personalized themes regardless of the value of `DEFAULT_THEME`.
9999
THEMES = gitea,arc-green
100+
; Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
101+
DEFAULT_SHOW_FULL_NAME = false
100102

101103
[ui.admin]
102104
; Number of users that are displayed on one page
@@ -362,6 +364,8 @@ CAPTCHA_TYPE = image
362364
; Go to https://www.google.com/recaptcha/admin to sign up for a key
363365
RECAPTCHA_SECRET =
364366
RECAPTCHA_SITEKEY =
367+
; Change this to use recaptcha.net or other recaptcha service
368+
RECAPTCHA_URL = https://www.google.com/recaptcha/
365369
; Default value for KeepEmailPrivate
366370
; Each new user will get the value of this setting copied into their profile
367371
DEFAULT_KEEP_EMAIL_PRIVATE = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/content/doc/advanced/api-usage.en-us.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ $ curl --request GET --url https://yourusername:[email protected]/api
8282
[{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}]
8383
```
8484

85+
As of v1.8.0 of Gitea, if using basic authentication with the API and your user has two factor authentication enabled, you'll need to send an additional header that contains the one time password (6 digit rotating token). An example of the header is `X-Gitea-OTP: 123456` where `123456` is where you'd place the code from your authenticator. Here is how the request would look like in curl:
86+
87+
```
88+
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens
89+
```
90+
8591
## Sudo
8692

8793
The API allows admin users to sudo API requests as another user. Simply add either a `sudo=` parameter or `Sudo:` request header with the username of the user to sudo.

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
8585
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.
8686
- `THEMES`: **gitea,arc-green**: All available themes. Allow users select personalized themes
8787
regardless of the value of `DEFAULT_THEME`.
88+
- `DEFAULT_SHOW_FULL_NAME`: false: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
8889

8990
### UI - Admin (`ui.admin`)
9091

@@ -214,6 +215,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
214215
- `CAPTCHA_TYPE`: **image**: \[image, recaptcha\]
215216
- `RECAPTCHA_SECRET`: **""**: Go to https://www.google.com/recaptcha/admin to get a secret for recaptcha.
216217
- `RECAPTCHA_SITEKEY`: **""**: Go to https://www.google.com/recaptcha/admin to get a sitekey for recaptcha.
218+
- `RECAPTCHA_URL`: **https://www.google.com/recaptcha/**: Set the recaptcha url - allows the use of recaptcha net.
217219
- `DEFAULT_ENABLE_DEPENDENCIES`: **true**: Enable this to have dependencies enabled by default.
218220
- `ENABLE_USER_HEATMAP`: **true**: Enable this to display the heatmap on users profiles.
219221
- `EMAIL_DOMAIN_WHITELIST`: **\<empty\>**: If non-empty, list of domain names that can only be used to register
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
date: "2019-04-15T17:29:00+08:00"
3+
title: "Advanced: Migrations Interfaces"
4+
slug: "migrations-interfaces"
5+
weight: 30
6+
toc: true
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "advanced"
11+
name: "Migrations Interfaces"
12+
weight: 55
13+
identifier: "migrations-interfaces"
14+
---
15+
16+
# Migration Features
17+
18+
The new migration features were introduced in Gitea 1.9.0. It defines two interfaces to support migrating
19+
repositories data from other git host platforms to gitea or, in the future migrating gitea data to other
20+
git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented.
21+
22+
First of all, Gitea defines some standard objects in packages `modules/migrations/base`. They are
23+
`Repository`, `Milestone`, `Release`, `Label`, `Issue`, `Comment`, `PullRequest`.
24+
25+
## Downloader Interfaces
26+
27+
To migrate from a new git host platform, there are two steps to be updated.
28+
29+
- You should implement a `Downloader` which will get all kinds of repository informations.
30+
- You should implement a `DownloaderFactory` which is used to detect if the URL matches and
31+
create a Downloader.
32+
- You'll need to register the `DownloaderFactory` via `RegisterDownloaderFactory` on init.
33+
34+
```Go
35+
type Downloader interface {
36+
GetRepoInfo() (*Repository, error)
37+
GetMilestones() ([]*Milestone, error)
38+
GetReleases() ([]*Release, error)
39+
GetLabels() ([]*Label, error)
40+
GetIssues(start, limit int) ([]*Issue, error)
41+
GetComments(issueNumber int64) ([]*Comment, error)
42+
GetPullRequests(start, limit int) ([]*PullRequest, error)
43+
}
44+
```
45+
46+
```Go
47+
type DownloaderFactory interface {
48+
Match(opts MigrateOptions) (bool, error)
49+
New(opts MigrateOptions) (Downloader, error)
50+
}
51+
```
52+
53+
## Uploader Interface
54+
55+
Currently, only a `GiteaLocalUploader` is implemented, so we only save downloaded
56+
data via this `Uploader` on the local Gitea instance. Other uploaders are not supported
57+
and will be implemented in future.
58+
59+
```Go
60+
// Uploader uploads all the informations
61+
type Uploader interface {
62+
CreateRepo(repo *Repository, includeUncyclo bool) error
63+
CreateMilestone(milestone *Milestone) error
64+
CreateRelease(release *Release) error
65+
CreateLabel(label *Label) error
66+
CreateIssue(issue *Issue) error
67+
CreateComment(issueNumber int64, comment *Comment) error
68+
CreatePullRequest(pr *PullRequest) error
69+
Rollback() error
70+
}
71+
72+
```

go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module code.gitea.io/gitea
33
go 1.12
44

55
require (
6-
code.gitea.io/sdk v0.0.0-20190416172854-7d954d775498
6+
code.gitea.io/sdk v0.0.0-20190419065346-2858b80da5f7
77
github.com/BurntSushi/toml v0.3.1 // indirect
88
github.com/PuerkitoBio/goquery v0.0.0-20170324135448-ed7d758e9a34
99
github.com/RoaringBitmap/roaring v0.4.7 // indirect
@@ -62,6 +62,7 @@ require (
6262
github.com/gogits/chardet v0.0.0-20150115103509-2404f7772561
6363
github.com/gogits/cron v0.0.0-20160810035002-7f3990acf183
6464
github.com/gogo/protobuf v1.2.1 // indirect
65+
github.com/google/go-github/v24 v24.0.1
6566
github.com/gorilla/context v1.1.1
6667
github.com/issue9/assert v1.3.2 // indirect
6768
github.com/issue9/identicon v0.0.0-20160320065130-d36b54562f4c
@@ -109,13 +110,13 @@ require (
109110
github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481 // indirect
110111
github.com/tinylib/msgp v0.0.0-20180516164116-c8cf64dff200 // indirect
111112
github.com/tstranex/u2f v1.0.0
112-
github.com/urfave/cli v0.0.0-20161102131801-d86a009f5e13
113+
github.com/urfave/cli v1.20.0
113114
github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 // indirect
114115
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53
115116
go.etcd.io/bbolt v1.3.2 // indirect
116117
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
117118
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519
118-
golang.org/x/oauth2 v0.0.0-20181101160152-c453e0c75759 // indirect
119+
golang.org/x/oauth2 v0.0.0-20181101160152-c453e0c75759
119120
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
120121
golang.org/x/text v0.3.0
121122
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect

0 commit comments

Comments
 (0)