Skip to content

Commit 4635190

Browse files
committed
Merge branch 'master' of git://github.com/go-gitea/gitea
Manually move my changes from public/js/index.js to web_src/js/index.js to account for new webpack minification move.
2 parents 0c0fc47 + 1716150 commit 4635190

File tree

275 files changed

+9180
-5051
lines changed

Some content is hidden

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

275 files changed

+9180
-5051
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
browser: true
1111
jquery: true
1212
es6: true
13+
node: true
1314

1415
globals:
1516
Clipboard: false

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
289289
* wiki - editor - add buttons 'inline code', 'empty checkbox', 'checked checkbox' (#7243)
290290
* Fix Statuses API only shows first 10 statuses: Add paging and extend API GetCommitStatuses (#7141)
291291

292+
## [1.9.6](https://github.com/go-gitea/gitea/releases/tag/v1.9.6) - 2019-11-13
293+
* BUGFIXES
294+
* Allow to merge if file path contains " or \ (#8629) (#8772)
295+
* Fix 500 when edit hook (#8782) (#8790)
296+
* Fix issue with user.fullname (#8904)
297+
* Update Github Migration Test (#8897) (#8946)
298+
* Add Close() method to gogitRepository (#8901) (#8958)
299+
292300
## [1.9.5](https://github.com/go-gitea/gitea/releases/tag/v1.9.5) - 2019-10-30
293301
* BREAKING
294302
* Hide some user information via API if user doesn't have enough permission (#8655) (#8658)

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,14 @@ npm-update: npm-check
434434

435435
.PHONY: js
436436
js: npm
437-
npx eslint public/js
437+
npx eslint web_src/js webpack.config.js
438+
npx webpack
438439

439440
.PHONY: css
440441
css: npm
441-
npx stylelint public/less
442-
npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css
443-
$(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;)
442+
npx stylelint web_src/less
443+
npx lessc --clean-css="--s0 -b" web_src/less/index.less public/css/index.css
444+
$(foreach file, $(filter-out web_src/less/themes/_base.less, $(wildcard web_src/less/themes/*)),npx lessc --clean-css="--s0 -b" web_src/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
444445
npx postcss --use autoprefixer --no-map --replace public/css/*
445446

446447
@diff=$$(git diff public/css/*); \

cmd/admin.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,20 @@ func runRepoSyncReleases(c *cli.Context) error {
375375

376376
if err = models.SyncReleasesWithTags(repo, gitRepo); err != nil {
377377
log.Warn(" SyncReleasesWithTags: %v", err)
378+
gitRepo.Close()
378379
continue
379380
}
380381

381382
count, err = getReleaseCount(repo.ID)
382383
if err != nil {
383384
log.Warn(" GetReleaseCountByRepoID: %v", err)
385+
gitRepo.Close()
384386
continue
385387
}
386388

387389
log.Trace(" repo %s releases synchronized to tags: from %d to %d",
388390
repo.FullName(), oldnum, count)
391+
gitRepo.Close()
389392
}
390393
}
391394

contrib/systemd/gitea.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Type=simple
5151
User=git
5252
Group=git
5353
WorkingDirectory=/var/lib/gitea/
54-
# If using unix socket: Tells Systemd to create /run/gitea folder to home gitea.sock
55-
# Manual cration would vanish after reboot.
54+
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
55+
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
5656
#RuntimeDirectory=gitea
5757
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
5858
Restart=always

custom/conf/app.ini.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ SHOW_REGISTRATION_BUTTON = true
501501
; When adding a repo to a team or creating a new repo all team members will watch the
502502
; repo automatically if enabled
503503
AUTO_WATCH_NEW_REPOS = true
504+
; Default value for AutoWatchOnChanges
505+
; Make the user watch a repository When they commit for the first time
506+
AUTO_WATCH_ON_CHANGES = false
504507

505508
[webhook]
506509
; Hook task queue length, increase if webhook shooting starts hanging

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
public/
22
templates/swagger/v1_json.tmpl
33
themes/
4+
resources/

docs/assets/js/search.js

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
function ready(fn) {
2+
if (document.readyState != 'loading') {
3+
fn();
4+
} else {
5+
document.addEventListener('DOMContentLoaded', fn);
6+
}
7+
}
8+
9+
ready(doSearch);
10+
11+
const summaryInclude = 60;
12+
const fuseOptions = {
13+
shouldSort: true,
14+
includeMatches: true,
15+
matchAllTokens: true,
16+
threshold: 0.0, // for parsing diacritics
17+
tokenize: true,
18+
location: 0,
19+
distance: 100,
20+
maxPatternLength: 32,
21+
minMatchCharLength: 1,
22+
keys: [{
23+
name: "title",
24+
weight: 0.8
25+
},
26+
{
27+
name: "contents",
28+
weight: 0.5
29+
},
30+
{
31+
name: "tags",
32+
weight: 0.3
33+
},
34+
{
35+
name: "categories",
36+
weight: 0.3
37+
}
38+
]
39+
};
40+
41+
function param(name) {
42+
return decodeURIComponent((location.search.split(name + '=')[1] || '').split('&')[0]).replace(/\+/g, ' ');
43+
}
44+
45+
let searchQuery = param("s");
46+
47+
function doSearch() {
48+
if (searchQuery) {
49+
document.getElementById("search-query").value = searchQuery;
50+
executeSearch(searchQuery);
51+
} else {
52+
const para = document.createElement("P");
53+
para.innerText = "Please enter a word or phrase above";
54+
document.getElementById("search-results").appendChild(para);
55+
}
56+
}
57+
58+
function getJSON(url, fn) {
59+
const request = new XMLHttpRequest();
60+
request.open('GET', url, true);
61+
request.onload = function () {
62+
if (request.status >= 200 && request.status < 400) {
63+
const data = JSON.parse(request.responseText);
64+
fn(data);
65+
} else {
66+
console.log("Target reached on " + url + " with error " + request.status);
67+
}
68+
};
69+
request.onerror = function () {
70+
console.log("Connection error " + request.status);
71+
};
72+
request.send();
73+
}
74+
75+
function executeSearch(searchQuery) {
76+
getJSON("/" + document.LANG + "/index.json", function (data) {
77+
const pages = data;
78+
const fuse = new Fuse(pages, fuseOptions);
79+
const result = fuse.search(searchQuery);
80+
console.log({
81+
"matches": result
82+
});
83+
document.getElementById("search-results").innerHTML = "";
84+
if (result.length > 0) {
85+
populateResults(result);
86+
} else {
87+
const para = document.createElement("P");
88+
para.innerText = "No matches found";
89+
document.getElementById("search-results").appendChild(para);
90+
}
91+
});
92+
}
93+
94+
function populateResults(result) {
95+
result.forEach(function (value, key) {
96+
const content = value.item.contents;
97+
let snippet = "";
98+
const snippetHighlights = [];
99+
if (fuseOptions.tokenize) {
100+
snippetHighlights.push(searchQuery);
101+
value.matches.forEach(function (mvalue) {
102+
if (mvalue.key === "tags" || mvalue.key === "categories") {
103+
snippetHighlights.push(mvalue.value);
104+
} else if (mvalue.key === "contents") {
105+
const ind = content.toLowerCase().indexOf(searchQuery.toLowerCase());
106+
const start = ind - summaryInclude > 0 ? ind - summaryInclude : 0;
107+
const end = ind + searchQuery.length + summaryInclude < content.length ? ind + searchQuery.length + summaryInclude : content.length;
108+
snippet += content.substring(start, end);
109+
if (ind > -1) {
110+
snippetHighlights.push(content.substring(ind, ind + searchQuery.length))
111+
} else {
112+
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0], mvalue.indices[0][1] - mvalue.indices[0][0] + 1));
113+
}
114+
}
115+
});
116+
}
117+
118+
if (snippet.length < 1) {
119+
snippet += content.substring(0, summaryInclude * 2);
120+
}
121+
//pull template from hugo templarte definition
122+
const templateDefinition = document.getElementById("search-result-template").innerHTML;
123+
//replace values
124+
const output = render(templateDefinition, {
125+
key: key,
126+
title: value.item.title,
127+
link: value.item.permalink,
128+
tags: value.item.tags,
129+
categories: value.item.categories,
130+
snippet: snippet
131+
});
132+
document.getElementById("search-results").appendChild(htmlToElement(output));
133+
134+
snippetHighlights.forEach(function (snipvalue) {
135+
new Mark(document.getElementById("summary-" + key)).mark(snipvalue);
136+
});
137+
138+
});
139+
}
140+
141+
function render(templateString, data) {
142+
let conditionalMatches, copy;
143+
const conditionalPattern = /\$\{\s*isset ([a-zA-Z]*) \s*\}(.*)\$\{\s*end\s*}/g;
144+
//since loop below depends on re.lastInxdex, we use a copy to capture any manipulations whilst inside the loop
145+
copy = templateString;
146+
while ((conditionalMatches = conditionalPattern.exec(templateString)) !== null) {
147+
if (data[conditionalMatches[1]]) {
148+
//valid key, remove conditionals, leave content.
149+
copy = copy.replace(conditionalMatches[0], conditionalMatches[2]);
150+
} else {
151+
//not valid, remove entire section
152+
copy = copy.replace(conditionalMatches[0], '');
153+
}
154+
}
155+
templateString = copy;
156+
//now any conditionals removed we can do simple substitution
157+
let key, find, re;
158+
for (key in data) {
159+
find = '\\$\\{\\s*' + key + '\\s*\\}';
160+
re = new RegExp(find, 'g');
161+
templateString = templateString.replace(re, data[key]);
162+
}
163+
return templateString;
164+
}
165+
166+
/**
167+
* By Mark Amery: https://stackoverflow.com/a/35385518
168+
* @param {String} HTML representing a single element
169+
* @return {Element}
170+
*/
171+
function htmlToElement(html) {
172+
const template = document.createElement('template');
173+
html = html.trim(); // Never return a text node of whitespace as the result
174+
template.innerHTML = html;
175+
return template.content.firstChild;
176+
}

docs/config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.9.5
21+
version: 1.10.0
22+
23+
outputs:
24+
home:
25+
- HTML
26+
- RSS
27+
- JSON
2228

2329
menu:
2430
page:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ relation to port exhaustion.
303303
on this instance.
304304
- `SHOW_REGISTRATION_BUTTON`: **! DISABLE\_REGISTRATION**: Show Registration Button
305305
- `AUTO_WATCH_NEW_REPOS`: **true**: Enable this to let all organisation users watch new repos when they are created
306+
- `AUTO_WATCH_ON_CHANGES`: **false**: Enable this to make users watch a repository after their first commit to it
306307
- `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private".
307308
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation.
308309

0 commit comments

Comments
 (0)