Skip to content

Commit ca5222b

Browse files
authored
Merge branch 'master' into delete_releases_attachments_if_release_is_deleted
2 parents 65e882a + df25578 commit ca5222b

File tree

91 files changed

+1224
-2857
lines changed

Some content is hidden

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

91 files changed

+1224
-2857
lines changed

Diff for: .drone.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ pipeline:
5050
pull: true
5151
commands:
5252
- npm install
53-
- make stylesheets-check
53+
- make css
54+
- make js
5455
when:
5556
event: [ push, tag, pull_request ]
5657

Diff for: .eslintrc

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
root: true
2+
3+
extends:
4+
- eslint:recommended
5+
6+
parserOptions:
7+
ecmaVersion: 2015
8+
9+
env:
10+
browser: true
11+
jquery: true
12+
es6: true
13+
14+
globals:
15+
Clipboard: false
16+
CodeMirror: false
17+
emojify: false
18+
SimpleMDE: false
19+
Vue: false
20+
Dropzone: false
21+
u2fApi: false
22+
hljs: false
23+
24+
rules:
25+
no-unused-vars: [error, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, ignoreRestSiblings: true}]

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ coverage.all
6767
/node_modules
6868
/modules/indexer/issues/indexers
6969
routers/repo/authorized_keys
70+
/package-lock.json
71+
/yarn.lock
7072

7173
# Snapcraft
7274
snap/.snapcraft/

Diff for: .npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock=false
2+
save-exact=true

Diff for: CONTRIBUTING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ high-level discussions.
6565
## Testing redux
6666

6767
Before submitting a pull request, run all the tests for the whole tree
68-
to make sure your changes don't cause regression elsewhere.
68+
to make sure your changes don't cause regression elsewhere.
6969

70-
Here's how to run the test suite:
70+
Here's how to run the test suite:
7171

7272
- Install the correct version of the drone-cli package. As of this
7373
writing, the correct drone-cli version is
7474
[0.8.6](https://0-8-0.docs.drone.io/cli-installation/).
7575
- Ensure you have enough free disk space. You will need at least
7676
15-20 Gb of free disk space to hold all of the containers drone
7777
creates (a default AWS or GCE disk size won't work -- see
78-
[#6243](https://github.com/go-gitea/gitea/issues/6243)).
78+
[#6243](https://github.com/go-gitea/gitea/issues/6243)).
7979
- Change into the base directory of your copy of the gitea repository,
8080
and run `drone exec --local --build-event pull_request`.
8181

@@ -114,7 +114,7 @@ Generally, the go build tools are installed as-needed in the `Makefile`.
114114
An exception are the tools to build the CSS and images.
115115

116116
- To build CSS: Install [Node.js](https://nodejs.org/en/download/package-manager) at version 8.0 or above
117-
with `npm` and then run `npm install` and `make generate-stylesheets`.
117+
with `npm` and then run `npm install` and `make css`.
118118
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
119119
available in your `PATH` to run `make generate-images`.
120120

@@ -214,7 +214,7 @@ to the maintainers team. If a maintainer is inactive for more than 3
214214
months and forgets to leave the maintainers team, the owners may move
215215
him or her from the maintainers team to the advisors team.
216216
For security reasons, Maintainers should use 2FA for their accounts and
217-
if possible provide gpg signed commits.
217+
if possible provide gpg signed commits.
218218
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
219219
https://help.github.com/articles/signing-commits-with-gpg/
220220

@@ -281,7 +281,7 @@ be reviewed by two maintainers and must pass the automatic tests.
281281
* Create `-dev` tag as `git tag -s -F release.notes v$vmaj.$vmin.0-dev` and push the tag as `git push origin v$vmaj.$vmin.0-dev`.
282282
* When CI has finished building tag then you have to create a new branch named `release/v$vmaj.$vmin`
283283
* If it is bugfix version create PR for changelog on branch `release/v$vmaj.$vmin` and wait till it is reviewed and merged.
284-
* Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
284+
* Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
285285
* And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically created a release and upload all the compiled binary. (But currently it didn't add the release notes automatically. Maybe we should fix that.)
286286
* If needed send PR for changelog on branch `master`.
287287
* Send PR to [blog repository](https://github.com/go-gitea/blog) announcing the release.

Diff for: Makefile

+41-19
Original file line numberDiff line numberDiff line change
@@ -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 osusergo $(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/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION) .
339339
ifeq ($(CI),drone)
340340
cp /build/* $(DIST)/binaries
341341
endif
@@ -365,33 +365,55 @@ release-compress:
365365
fi
366366
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
367367

368-
.PHONY: javascripts
369-
javascripts: public/js/index.js
370-
371-
.IGNORE: public/js/index.js
372-
public/js/index.js: $(JAVASCRIPTS)
373-
cat $< >| $@
374-
375-
.PHONY: stylesheets-check
376-
stylesheets-check: generate-stylesheets
377-
@diff=$$(git diff public/css/*); \
378-
if [ -n "$$diff" ]; then \
379-
echo "Please run 'make generate-stylesheets' and commit the result:"; \
380-
echo "$${diff}"; \
368+
.PHONY: js
369+
js:
370+
@if ([ ! -d "$(PWD)/node_modules" ]); then \
371+
echo "node_modules directory is absent, please run 'npm install' first"; \
381372
exit 1; \
382373
fi;
374+
@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
375+
echo "Please install npm version 5.2+"; \
376+
exit 1; \
377+
fi;
378+
npx eslint public/js
383379

384-
.PHONY: generate-stylesheets
385-
generate-stylesheets:
380+
.PHONY: css
381+
css:
382+
@if ([ ! -d "$(PWD)/node_modules" ]); then \
383+
echo "node_modules directory is absent, please run 'npm install' first"; \
384+
exit 1; \
385+
fi;
386386
@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
387387
echo "Please install npm version 5.2+"; \
388388
exit 1; \
389389
fi;
390-
$(eval BROWSERS := "> 1%, last 2 firefox versions, last 2 safari versions, ie 11")
391-
npx lesshint public/less/
390+
391+
npx lesshint public/less/
392392
npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css
393393
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
394-
$(foreach file, $(wildcard public/css/*),npx postcss --use autoprefixer --autoprefixer.browsers $(BROWSERS) -o $(file) $(file);)
394+
npx postcss --use autoprefixer --no-map --replace public/css/*
395+
396+
@diff=$$(git diff public/css/*); \
397+
if ([ ! -z "$CI" ] && [ -n "$$diff" ]); then \
398+
echo "Generated files in public/css have changed, please commit the result:"; \
399+
echo "$${diff}"; \
400+
exit 1; \
401+
fi;
402+
403+
.PHONY: javascripts
404+
javascripts:
405+
echo "'make javascripts' is deprecated, please use 'make js'"
406+
$(MAKE) js
407+
408+
.PHONY: stylesheets-check
409+
stylesheets-check:
410+
echo "'make stylesheets-check' is deprecated, please use 'make css'"
411+
$(MAKE) css
412+
413+
.PHONY: generate-stylesheets
414+
generate-stylesheets:
415+
echo "'make generate-stylesheets' is deprecated, please use 'make css'"
416+
$(MAKE) css
395417

396418
.PHONY: swagger-ui
397419
swagger-ui:

Diff for: custom/conf/app.ini.sample

+4-1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ PASSWD =
260260
; For Postgres, either "disable" (default), "require", or "verify-full"
261261
; For MySQL, either "false" (default), "true", or "skip-verify"
262262
SSL_MODE = disable
263+
; For MySQL only, either "utf8" or "utf8mb4", default is "utf8".
264+
; NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
265+
CHARSET = utf8
263266
; For "sqlite3" and "tidb", use an absolute path when you start gitea as service
264267
PATH = data/gitea.db
265268
; For "sqlite3" only. Query timeout
@@ -698,7 +701,7 @@ DEFAULT_MAX_BLOB_SIZE = 10485760
698701

699702
[oauth2]
700703
; Enables OAuth2 provider
701-
ENABLED = true
704+
ENABLE = true
702705
; Lifetime of an OAuth2 access token in seconds
703706
ACCESS_TOKEN_EXPIRATION_TIME=3600
704707
; Lifetime of an OAuth2 access token in hours

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
160160
- `USER`: **root**: Database username.
161161
- `PASSWD`: **\<empty\>**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
162162
- `SSL_MODE`: **disable**: For PostgreSQL and MySQL only.
163+
- `CHARSET`: **utf8**: For MySQL only, either "utf8" or "utf8mb4", default is "utf8". NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
163164
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
164165
- `LOG_SQL`: **true**: Log the executed SQL.
165166
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
@@ -334,7 +335,7 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
334335

335336
### Console log mode (`log.console`, `log.console.*`, or `MODE=console`)
336337

337-
- For the console logger `COLORIZE` will default to `true` if not on windows.
338+
- For the console logger `COLORIZE` will default to `true` if not on windows or the terminal is determined to be able to color.
338339
- `STDERR`: **false**: Use Stderr instead of Stdout.
339340

340341
### File log mode (`log.file`, `log.file.*` or `MODE=file`)
@@ -344,7 +345,6 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
344345
- `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
345346
- `DAILY_ROTATE`: **true**: Rotate logs daily.
346347
- `MAX_DAYS`: **7**: Delete the log file after n days
347-
- NB: `COLORIZE`: will default to `true` if not on windows.
348348
- `COMPRESS`: **true**: Compress old log files by default with gzip
349349
- `COMPRESSION_LEVEL`: **-1**: Compression level
350350

@@ -420,7 +420,7 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
420420

421421
## OAuth2 (`oauth2`)
422422

423-
- `ENABLED`: **true**: Enables OAuth2 provider.
423+
- `ENABLE`: **true**: Enables OAuth2 provider.
424424
- `ACCESS_TOKEN_EXPIRATION_TIME`: **3600**: Lifetime of an OAuth2 access token in seconds
425425
- `REFRESH_TOKEN_EXPIRATION_TIME`: **730**: Lifetime of an OAuth2 access token in hours
426426
- `INVALIDATE_REFRESH_TOKEN`: **false**: Check if refresh token got already used

Diff for: docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ menu:
7878
- `NAME`: 数据库名称。
7979
- `USER`: 数据库用户名。
8080
- `PASSWD`: 数据库用户密码。
81-
- `SSL_MODE`: PostgreSQL数据库是否启用SSL模式。
81+
- `SSL_MODE`: MySQL 或 PostgreSQL数据库是否启用SSL模式。
82+
- `CHARSET`: **utf8**: 仅当数据库为 MySQL 时有效, 可以为 "utf8" 或 "utf8mb4"。注意:如果使用 "utf8mb4",你的 MySQL InnoDB 版本必须在 5.6 以上。
8283
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
8384
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
8485

Diff for: docs/content/doc/advanced/hacking-on-gitea.en-us.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -136,30 +136,36 @@ You should lint, vet and spell-check with:
136136
make vet lint misspell-check
137137
```
138138

139-
### Updating the stylesheets
139+
### Updating CSS
140140

141-
To generate the stylsheets, you will need [Node.js](https://nodejs.org/) at version 8.0 or above.
141+
To generate the CSS, you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies:
142142

143-
At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our stylesheets. Do
144-
**not** edit the files in `public/css/` directly, as they are generated from
145-
`lessc` from the files in `public/less/`.
143+
```bash
144+
npm install
145+
```
146146

147-
If you wish to work on the stylesheets, you will need to install `lessc` the
148-
less compiler and `postcss`. The recommended way to do this is using `npm install`:
147+
At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our CSS. Do
148+
**not** edit the files in `public/css` directly, as they are generated from `lessc` from the files in `public/less`.
149+
150+
Edit files in `public/less`, run the linter, regenerate the CSS and commit all changed files:
149151

150152
```bash
151-
cd "$GOPATH/src/code.gitea.io/gitea"
152-
npm install
153+
make css
153154
```
154155

155-
You can then edit the less stylesheets and regenerate the stylesheets using:
156+
### Updating JS
157+
158+
To run the JavaScript linter you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies:
156159

157160
```bash
158-
make generate-stylesheets
161+
npm install
159162
```
160163

161-
You should commit both the changes to the css and the less files when making
162-
PRs.
164+
Edit files in `public/js` and run the linter:
165+
166+
```bash
167+
make js
168+
```
163169

164170
### Updating the API
165171

Diff for: docs/content/doc/advanced/logging-documentation.en-us.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ from `[log.sublogger]`.
213213
a stacktrace. This value is inherited.
214214
* `MODE` is the mode of the log output. It will default to the sublogger
215215
name. Thus `[log.console.macaron]` will default to `MODE = console`.
216-
* `COLORIZE` will default to `true` for `file` and `console` as
216+
* `COLORIZE` will default to `true` for `console` as
217217
described, otherwise it will default to `false`.
218218

219219
### Non-inherited default values
@@ -274,7 +274,6 @@ Other values:
274274
* `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
275275
* `DAILY_ROTATE`: **true**: Rotate logs daily.
276276
* `MAX_DAYS`: **7**: Delete the log file after n days
277-
* NB: `COLORIZE`: will default to `true` if not on windows.
278277
* `COMPRESS`: **true**: Compress old log files by default with gzip
279278
* `COMPRESSION_LEVEL`: **-1**: Compression level
280279

Diff for: docs/content/doc/installation/from-binary.en-us.md

+9
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ bind: address already in use` Gitea needs to be started on another free port. Th
143143
is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
144144
is already running.
145145

146+
### Running Gitea on Raspbian
147+
148+
As of v1.8, there is a problem with the arm7 version of Gitea and it doesn't run on Raspberry Pi and similar devices.
149+
150+
It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices.
151+
152+
<!---
153+
please remove after fixing the arm7 bug
154+
--->
146155
### Git error after updating to a new version of Gitea
147156

148157
If the binary file name has been changed during the update to a new version of Gitea,

Diff for: go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ require (
9090
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect
9191
github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc
9292
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
93+
github.com/oliamb/cutter v0.2.2
9394
github.com/philhofer/fwd v1.0.0 // indirect
9495
github.com/pkg/errors v0.8.1 // indirect
9596
github.com/pquerna/otp v0.0.0-20160912161815-54653902c20e

Diff for: go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc h1:z1PgdCCmYYVL0BoJT
244244
github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc/go.mod h1:np1wUFZ6tyoke22qDJZY40URn9Ae51gX7ljIWXN5TJs=
245245
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY=
246246
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
247+
github.com/oliamb/cutter v0.2.2 h1:Lfwkya0HHNU1YLnGv2hTkzHfasrSMkgv4Dn+5rmlk3k=
248+
github.com/oliamb/cutter v0.2.2/go.mod h1:4BenG2/4GuRBDbVm/OPahDVqbrOemzpPiG5mi1iryBU=
247249
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
248250
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
249251
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

0 commit comments

Comments
 (0)