Skip to content

Commit 8870bf4

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Add proxy host into allow list (go-gitea#20798) Fix tooltip init after review (go-gitea#20814)
2 parents e2c5318 + a4e91c4 commit 8870bf4

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

modules/hostmatcher/hostmatcher.go

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ func (hl *HostMatchList) AppendBuiltin(builtin string) {
7878
hl.builtins = append(hl.builtins, builtin)
7979
}
8080

81+
// AppendPattern appends more pattern to match
82+
func (hl *HostMatchList) AppendPattern(pattern string) {
83+
hl.patterns = append(hl.patterns, pattern)
84+
}
85+
8186
// IsEmpty checks if the checklist is empty
8287
func (hl *HostMatchList) IsEmpty() bool {
8388
return hl == nil || (len(hl.builtins) == 0 && len(hl.patterns) == 0 && len(hl.ipNets) == 0)

services/migrations/migrate.go

+5
Original file line numberDiff line numberDiff line change
@@ -479,5 +479,10 @@ func Init() error {
479479
}
480480
// TODO: at the moment, if ALLOW_LOCALNETWORKS=false, ALLOWED_DOMAINS=domain.com, and domain.com has IP 127.0.0.1, then it's still allowed.
481481
// if we want to block such case, the private&loopback should be added to the blockList when ALLOW_LOCALNETWORKS=false
482+
483+
if setting.Proxy.Enabled && setting.Proxy.ProxyURLFixed != nil {
484+
allowList.AppendPattern(setting.Proxy.ProxyURLFixed.Host)
485+
}
486+
482487
return nil
483488
}

web_src/js/features/repo-diff.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,28 @@ export function initRepoDiffConversationForm() {
4444
$(document).on('submit', '.conversation-holder form', async (e) => {
4545
e.preventDefault();
4646

47-
const form = $(e.target);
48-
const $textArea = form.find('textarea');
47+
const $form = $(e.target);
48+
const $textArea = $form.find('textarea');
4949
if (!validateTextareaNonEmpty($textArea)) {
5050
return;
5151
}
5252

53-
const newConversationHolder = $(await $.post(form.attr('action'), form.serialize()));
54-
const {path, side, idx} = newConversationHolder.data();
53+
const formDataString = String(new URLSearchParams(new FormData($form[0])));
54+
const $newConversationHolder = $(await $.post($form.attr('action'), formDataString));
55+
const {path, side, idx} = $newConversationHolder.data();
5556

56-
initTooltip(newConversationHolder.find('.tooltip'));
57-
form.closest('.conversation-holder').replaceWith(newConversationHolder);
58-
if (form.closest('tr').data('line-type') === 'same') {
57+
$newConversationHolder.find('.tooltip').each(function () {
58+
initTooltip(this);
59+
});
60+
61+
$form.closest('.conversation-holder').replaceWith($newConversationHolder);
62+
if ($form.closest('tr').data('line-type') === 'same') {
5963
$(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).addClass('invisible');
6064
} else {
6165
$(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible');
6266
}
63-
newConversationHolder.find('.dropdown').dropdown();
64-
initCompReactionSelector(newConversationHolder);
67+
$newConversationHolder.find('.dropdown').dropdown();
68+
initCompReactionSelector($newConversationHolder);
6569
});
6670

6771

0 commit comments

Comments
 (0)