summaryrefslogtreecommitdiffstats
path: root/templates/repo/settings/options.tmpl
blob: 09f80cac8446612ae99618c14263e1033b68b86b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}
	<div class="user-main-content twelve wide column">
		<h4 class="ui top attached header">
			{{ctx.Locale.Tr "repo.settings.basic_settings"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" action="{{.Link}}" method="post">
				{{template "base/disable_form_autofill"}}
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="update">
				<div class="required field {{if .Err_RepoName}}error{{end}}">
					<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
					<input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required>
				</div>
				<div class="inline field">
					<label>{{ctx.Locale.Tr "repo.repo_size"}}</label>
					<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}>{{ctx.Locale.TrSize .Repository.Size}}</span>
				</div>
				<div class="inline field">
					<label>{{ctx.Locale.Tr "repo.template"}}</label>
					<div class="ui checkbox">
						<input name="template" type="checkbox" {{if .Repository.IsTemplate}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.template_helper"}}</label>
					</div>
				</div>
				{{if not .Repository.IsFork}}
					<div class="inline field">
						<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
						<div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}>
							{{if .IsAdmin}}
								<input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}>
							{{else}}
								<input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} disabled{{end}}>
								{{if and .Repository.IsPrivate $.ForcePrivate}}<input type="hidden" name="private" value="{{.Repository.IsPrivate}}">{{end}}
							{{end}}
							<label>{{ctx.Locale.Tr "repo.visibility_helper"}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label>
						</div>
					</div>
				{{end}}
				<div class="field {{if .Err_Description}}error{{end}}">
					<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
					<textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea>
				</div>
				<div class="field {{if .Err_Website}}error{{end}}">
					<label for="website">{{ctx.Locale.Tr "repo.settings.site"}}</label>
					<input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}">
				</div>
				<div class="field">
					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
				</div>
			</form>

			<div class="divider"></div>
			<form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data">
				{{.CsrfTokenHtml}}
				<div class="inline field">
					<label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label>
					<input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp">
				</div>
				<div class="field">
					<button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button>
					<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button>
				</div>
			</form>
		</div>

		{{if FederationEnabled}}
			<h4 class="ui top attached header">
				{{ctx.Locale.Tr "repo.settings.federation_settings"}}
			</h4>
			<div class="ui attached segment">
				<form class="ui form" method="post">
					{{.CsrfTokenHtml}}
					<input type="hidden" name="action" value="federation">
					<div class="field {{if .Err_FollowingRepos}}error{{end}}">
						<p>{{ctx.Locale.Tr "repo.settings.federation_apapiurl"}}</p>
						<p><b>{{.RepositoryAPActorID}}</b></p>
						<div class="divider"></div>
						<label for="following_repos">{{ctx.Locale.Tr "repo.settings.federation_following_repos"}}</label>
						<input id="following_repos" name="following_repos" value="{{.FollowingRepos}}">
					</div>
					<div class="field">
						<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
					</div>
				</form>
			</div>
		{{end}}

		{{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}}
		{{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
		{{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}}
		{{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}}
		{{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
		{{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}}
		{{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}}
		{{$existingPushMirror := or .Repository.IsMirror .PushMirrors}}
		{{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}}
		{{$isWorkingPullMirror := .PullMirror}}

		{{if $showMirrorSettings}}
			<h4 class="ui top attached header">
				{{ctx.Locale.Tr "repo.settings.mirror_settings"}}
			</h4>
			<div class="ui attached segment">
				{{if .Repository.IsArchived}}
					<div class="ui warning message tw-text-center">
						{{ctx.Locale.Tr "repo.settings.archive.mirrors_unavailable"}}
					</div>
				{{else}}
					{{if $newMirrorsEntirelyEnabled}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}}
						<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pushing-to-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}}
						<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}</a><br>
					{{else if $onlyNewPushMirrorsEnabled}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
						<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br>
					{{else if $onlyNewPullMirrorsEnabled}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
						<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}}
						{{if $existingPushMirror}}
							{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
						{{end}}
					{{else}}
						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}<br>
					{{end}}

					{{if .Repository.IsMirror}}
					<table class="ui table">
						<thead>
							<tr>
								<th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th>
								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th>
								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th>
								<th>{{ctx.Locale.Tr "repo.mirror_public_key"}}</th>
								<th></th>
							</tr>
						</thead>
						{{if $modifyBrokenPullMirror}}
							{{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}}
							<tbody>
								<tr>
									<td colspan="4">
										<div class="text red tw-py-4">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div>
									</td>
								</tr>
							</tbody>
						{{else if $isWorkingPullMirror}}
						<tbody>
							<tr>
								<td>{{.PullMirror.RemoteAddress}}</td>
								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
								<td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td>
								<td class="right aligned">
									<form method="post" class="tw-inline-block">
										{{.CsrfTokenHtml}}
										<input type="hidden" name="action" value="mirror-sync">
										<button class="ui primary tiny button inline">{{ctx.Locale.Tr "repo.settings.sync_mirror"}}</button>
									</form>
								</td>
							</tr>
							<tr>
								<td colspan="4">
									<form class="ui form" method="post">
										{{template "base/disable_form_autofill"}}
										{{.CsrfTokenHtml}}
										<input type="hidden" name="action" value="mirror">
										<div class="inline field {{if .Err_EnablePrune}}error{{end}}">
											<label>{{ctx.Locale.Tr "repo.mirror_prune"}}</label>
											<div class="ui checkbox">
										<input id="enable_prune" name="enable_prune" type="checkbox" {{if .PullMirror.EnablePrune}}checked{{end}}>
										<label>{{ctx.Locale.Tr "repo.mirror_prune_desc"}}</label>
											</div>
										</div>
										<div class="inline field {{if .Err_Interval}}error{{end}}">
											<label for="interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
											<input id="interval" name="interval" value="{{.PullMirror.Interval}}">
										</div>
										{{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}}
										<div class="field {{if .Err_MirrorAddress}}error{{end}}">
											<label for="mirror_address">{{ctx.Locale.Tr "repo.mirror_address"}}</label>
											<input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required>
											<p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
										</div>
										<details class="ui optional field" {{if or .Err_Auth $address.Username}}open{{end}}>
											<summary class="tw-p-1">
												{{ctx.Locale.Tr "repo.need_auth"}}
											</summary>
											<div class="tw-p-1">
												<div class="inline field {{if .Err_Auth}}error{{end}}">
													<label for="mirror_username">{{ctx.Locale.Tr "username"}}</label>
													<input id="mirror_username" name="mirror_username" value="{{$address.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}>
												</div>
												<div class="inline field {{if .Err_Auth}}error{{end}}">
													<label for="mirror_password">{{ctx.Locale.Tr "password"}}</label>
													<input id="mirror_password" name="mirror_password" type="password" placeholder="{{if $address.Password}}{{ctx.Locale.Tr "repo.mirror_password_placeholder"}}{{else}}{{ctx.Locale.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off">
												</div>
												<p class="help">{{ctx.Locale.Tr "repo.mirror_password_help"}}</p>
											</div>
										</details>

										{{if .LFSStartServer}}
										<div class="inline field">
											<label>{{ctx.Locale.Tr "repo.mirror_lfs"}}</label>
											<div class="ui checkbox">
												<input id="mirror_lfs" name="mirror_lfs" type="checkbox" {{if .PullMirror.LFS}}checked{{end}}>
												<label>{{ctx.Locale.Tr "repo.mirror_lfs_desc"}}</label>
											</div>
										</div>
										<div class="field {{if .Err_LFSEndpoint}}error{{end}}">
											<label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label>
											<input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}">
											<p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}</p>
										</div>
										{{end}}
										<div class="field">
											<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_mirror_settings"}}</button>
										</div>
									</form>
								</td>
							</tr>
						</tbody>
						{{end}}{{/* end if: $modifyBrokenPullMirror / $isWorkingPullMirror */}}
					</table>
					{{end}}{{/* end if .Repository.IsMirror */}}

					<table class="ui table">
						<thead>
							<tr>
								<th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.pushed_repository"}}</th>
								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th>
								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th>
								<th>{{ctx.Locale.Tr "repo.mirror_public_key"}}</th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							{{range .PushMirrors}}
							<tr>
								<td class="tw-break-anywhere">{{.RemoteAddress}}</td>
								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
								<td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td>
								<td>{{if not (eq (len .GetPublicKey) 0)}}<a data-clipboard-text="{{.GetPublicKey}}">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.copy_public_key"}}</a>{{else}}{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none_ssh"}}{{end}}</td>
								<td class="right aligned df">
									<button
										class="ui tiny button show-modal"
										data-modal="#push-mirror-edit-modal"
										data-tooltip-content="{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}"
										data-modal-push-mirror-edit-id="{{.ID}}"
										data-modal-push-mirror-edit-interval="{{.Interval}}"
										data-modal-push-mirror-edit-address="{{.RemoteAddress}}"
									>
										{{svg "octicon-pencil" 14}}
									</button>
									<form method="post" class="tw-inline-block">
										{{$.CsrfTokenHtml}}
										<input type="hidden" name="action" value="push-mirror-sync">
										<input type="hidden" name="push_mirror_id" value="{{.ID}}">
										<button class="ui primary tiny button" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button>
									</form>
									<form method="post" class="tw-inline-block">
										{{$.CsrfTokenHtml}}
										<input type="hidden" name="action" value="push-mirror-remove">
										<input type="hidden" name="push_mirror_id" value="{{.ID}}">
										<button class="ui basic red tiny button" data-tooltip-content="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button>
									</form>
								</td>
							</tr>
							{{else}}
							<tr>
								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td>
							</tr>
							{{end}}
							{{if (not .DisableNewPushMirrors)}}
								<tr>
									<td colspan="5">
										<form class="ui form" method="post">
											{{template "base/disable_form_autofill"}}
											{{.CsrfTokenHtml}}
											<input type="hidden" name="action" value="push-mirror-add">
											<div class="field {{if .Err_PushMirrorAddress}}error{{end}}">
												<label for="push_mirror_address">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label>
												<input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" required>
												<p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
											</div>
											<details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}>
												<summary class="tw-p-1">
													{{ctx.Locale.Tr "repo.need_auth"}}
												</summary>
												<div class="tw-p-1">
													<div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
														<label for="push_mirror_username">{{ctx.Locale.Tr "username"}}</label>
														<input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}">
													</div>
													<div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
														<label for="push_mirror_password">{{ctx.Locale.Tr "password"}}</label>
														<input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off">
													</div>
													{{if .CanUseSSHMirroring}}
													<div class="inline field {{if .Err_PushMirrorUseSSH}}error{{end}}">
														<div class="ui checkbox df ac">
															<input id="push_mirror_use_ssh" name="push_mirror_use_ssh" type="checkbox" {{if .push_mirror_use_ssh}}checked{{end}}>
															<label for="push_mirror_use_ssh" class="inline">{{ctx.Locale.Tr "repo.mirror_use_ssh.text"}}</label>
															<span class="help tw-block">{{ctx.Locale.Tr "repo.mirror_use_ssh.helper"}}
														</div>
													</div>
													{{end}}
												</div>
											</details>
											<div class="field">
												<div class="ui checkbox">
													<input id="push_mirror_sync_on_commit" name="push_mirror_sync_on_commit" type="checkbox" {{if .push_mirror_sync_on_commit}}checked{{end}}>
													<label for="push_mirror_sync_on_commit">{{ctx.Locale.Tr "repo.mirror_sync_on_commit"}}</label>
												</div>
											</div>
											<div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}">
												<label for="push_mirror_interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
												<input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}">
											</div>
											<div class="field">
												<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button>
											</div>
										</form>
									</td>
								</tr>
							{{end}}
						</tbody>
					</table>
				{{end}}
			</div>
		{{end}}

		<h4 class="ui top attached header">
			{{ctx.Locale.Tr "repo.settings.signing_settings"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="signing">
				<div class="field">
					<label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label><br>
					<div class="field">
						<div class="ui radio checkbox">
							<input type="radio" id="trust_model_default" name="trust_model" {{if eq .Repository.TrustModel.String "default"}}checked="checked"{{end}} value="default">
							<label for="trust_model_default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</label>
							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}</p>
						</div>
					</div>
					<div class="field">
						<div class="ui radio checkbox">
							<input type="radio" id="trust_model_collaborator" name="trust_model" {{if eq .Repository.TrustModel.String "collaborator"}}checked="checked"{{end}} value="collaborator">
							<label for="trust_model_collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.long"}}</label>
							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}</p>
						</div>
					</div>
					<div class="field">
						<div class="ui radio checkbox">
							<input type="radio" name="trust_model" id="trust_model_committer" {{if eq .Repository.TrustModel.String "committer"}}checked="checked"{{end}} value="committer">
							<label for="trust_model_committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer.long"}}</label>
							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}</p>
						</div>
					</div>
					<div class="field">
						<div class="ui radio checkbox">
							<input type="radio" name="trust_model" id="trust_model_collaboratorcommitter" {{if eq .Repository.TrustModel.String "collaboratorcommitter"}}checked="checked"{{end}} value="collaboratorcommitter">
							<label for="trust_model_collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long"}}</label>
							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}</p>
						</div>
					</div>
				</div>

				<div class="divider"></div>
				<div class="field">
					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
				</div>
			</form>
		</div>

		{{if .IsAdmin}}
		<h4 class="ui top attached header">
			{{ctx.Locale.Tr "repo.settings.admin_settings"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="admin">
				<div class="field">
					<div class="ui checkbox">
						<input name="enable_health_check" type="checkbox" {{if .Repository.IsFsckEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.admin_enable_health_check"}}</label>
					</div>
				</div>

				<div class="field">
					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
				</div>
			</form>

			<div class="divider"></div>
			<form class="ui form" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="admin_index">
				{{if .CodeIndexerEnabled}}
					<h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}</h4>
					<div class="inline fields">
						<label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
						<span class="field">
							{{if .CodeIndexerStatus}}
								<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.CodeIndexerStatus.CommitSha}}">
									<span class="shortsha">{{ShortSha .CodeIndexerStatus.CommitSha}}</span>
								</a>
							{{else}}
									<span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
							{{end}}
						</span>
						<div class="field">
							<button class="ui primary button" name="request_reindex_type" value="code">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
						</div>
					</div>
				{{end}}
				<h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}</h4>
				<div class="inline fields">
					{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
						<label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
					{{end}}
					<span class="field">
						{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
							<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}">
								<span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span>
							</a>
						{{else}}
							<span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
						{{end}}
					</span>
					<div class="field">
						<button class="ui primary button" name="request_reindex_type" value="stats">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
					</div>
				</div>
			</form>
		</div>
		{{end}}

		{{if .Permission.IsOwner}}
		<h4 class="ui top attached error header">
			{{ctx.Locale.Tr "repo.settings.danger_zone"}}
		</h4>
		<div class="ui attached error danger segment">
			<div class="flex-list">
				{{if .Repository.IsMirror}}
					<div class="flex-item">
						<div class="flex-item-main">
							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert"}}</div>
							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_desc"}}</div>
						</div>
						<div class="flex-item-trailing">
							<button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{ctx.Locale.Tr "repo.settings.convert"}}</button>
						</div>
					</div>
				{{end}}
				{{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
					<div class="flex-item">
						<div class="flex-item-main">
							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div>
							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}</div>
						</div>
						<div class="flex-item-trailing">
							<button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</button>
						</div>
					</div>
				{{end}}
				<div class="flex-item">
					<div class="flex-item-main">
						<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.transfer.title"}}</div>
						<div class="flex-item-body">
							{{if .RepoTransfer}}
								{{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}}
							{{else}}
								{{ctx.Locale.Tr "repo.settings.transfer_desc"}}
							{{end}}
						</div>
					</div>
					<div class="flex-item-trailing">
						{{if .RepoTransfer}}
							<form class="ui form" action="{{.Link}}" method="post">
								{{.CsrfTokenHtml}}
								<input type="hidden" name="action" value="cancel_transfer">
								<button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_abort"}}</button>
							</form>
						{{else}}
							<button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{ctx.Locale.Tr "repo.settings.transfer.button"}}</button>
						{{end}}
					</div>
				</div>
				{{if .Permission.CanRead $.UnitTypeWiki}}
					{{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}}
						<div class="flex-item">
							<div class="flex-item-main">
								<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</div>
								<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_desc" .DefaultWikiBranchName}}</div>
							</div>
							<div class="flex-item-trailing">
								<button class="ui basic red show-modal button" data-modal="#rename-wiki-branch-modal">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</button>
							</div>
						</div>
					{{end}}
					<div class="flex-item">
						<div class="flex-item-main">
							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</div>
							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}</div>
						</div>
						<div class="flex-item-trailing">
							<button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</button>
						</div>
					</div>
				{{end}}
				<div class="flex-item">
					<div class="flex-item-main">
						<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.delete"}}</div>
						<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.delete_desc"}}</div>
					</div>
					<div class="flex-item-trailing">
						<button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button>
					</div>
				</div>
				{{if not .Repository.IsMirror}}
					<div class="flex-item tw-items-center">
						<div class="flex-item-main">
							{{if .Repository.IsArchived}}
								<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.unarchive.header"}}</div>
								<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.unarchive.text"}}</div>
							{{else}}
								<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.archive.header"}}</div>
								<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.archive.text"}}</div>
							{{end}}
						</div>
						<div class="flex-item-trailing">
							<button class="ui basic red show-modal button" data-modal="#archive-repo-modal">
								{{if .Repository.IsArchived}}
									{{ctx.Locale.Tr "repo.settings.unarchive.button"}}
								{{else}}
									{{ctx.Locale.Tr "repo.settings.archive.button"}}
								{{end}}
							</button>
						</div>
					</div>
				{{end}}
			</div>
		</div>
		{{end}}
	</div>
{{template "repo/settings/layout_footer" .}}

{{if .Permission.IsOwner}}
	{{if .Repository.IsMirror}}
		<div class="ui small modal" id="convert-mirror-repo-modal">
			<div class="header">
				{{ctx.Locale.Tr "repo.settings.convert"}}
			</div>
			<div class="content">
				<div class="ui warning message">
					{{ctx.Locale.Tr "repo.settings.convert_notices_1"}}
				</div>
				<form class="ui form" action="{{.Link}}" method="post">
					{{.CsrfTokenHtml}}
					<input type="hidden" name="action" value="convert">
					<div class="field">
						<label>
							{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
							<span class="text red">{{.Repository.FullName}}</span>
						</label>
					</div>
					<div class="required field">
						<label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
						<input name="repo_name" required maxlength="100">
					</div>

					<div class="text right actions">
						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
						<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button>
					</div>
				</form>
			</div>
		</div>
	{{end}}
	{{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
		<div class="ui small modal" id="convert-fork-repo-modal">
			<div class="header">
				{{ctx.Locale.Tr "repo.settings.convert_fork"}}
			</div>
			<div class="content">
				<div class="ui warning message">
					{{ctx.Locale.Tr "repo.settings.convert_fork_notices_1"}}
				</div>
				<form class="ui form" action="{{.Link}}" method="post">
					{{.CsrfTokenHtml}}
					<input type="hidden" name="action" value="convert_fork">
					<div class="field">
						<label>
							{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
							<span class="text red">{{.Repository.FullName}}</span>
						</label>
					</div>
					<div class="required field">
						<label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
						<input name="repo_name" required>
					</div>

					<div class="text right actions">
						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
						<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button>
					</div>
				</form>
			</div>
		</div>
	{{end}}
	<div class="ui small modal" id="transfer-repo-modal">
		<div class="header">
			{{ctx.Locale.Tr "repo.settings.transfer.modal.title"}}
		</div>
		<div class="content">
			<div class="ui warning message">
				{{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br>
				{{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br>
				{{ctx.Locale.Tr "repo.settings.transfer_notices_3"}}
			</div>
			<form class="ui form" action="{{.Link}}" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="transfer">
				<div class="field">
					<label>
						{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
						<span class="text red">{{.Repository.FullName}}</span>
					</label>
				</div>
				<div class="required field">
					<label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
					<input name="repo_name" required>
				</div>
				<div class="required field">
					<label for="new_owner_name">{{ctx.Locale.Tr "repo.settings.transfer_owner"}}</label>
					<input id="new_owner_name" name="new_owner_name" required>
				</div>

				<div class="text right actions">
					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button>
				</div>
			</form>
		</div>
	</div>

	<div class="ui small modal" id="delete-repo-modal">
		<div class="header">
			{{ctx.Locale.Tr "repo.settings.delete"}}
		</div>
		<div class="content">
			<div class="ui warning message">
				{{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br>
				{{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName}}
				{{if .Repository.NumForks}}<br>
				{{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}
				{{end}}
			</div>
			<form class="ui form" action="{{.Link}}" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="delete">
				<div class="field">
					<label>
						{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
						<span class="text red">{{.Repository.FullName}}</span>
					</label>
				</div>
				<div class="required field">
					<label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
					<input id="repo_name_to_delete" name="repo_name" required>
				</div>

				<div class="text right actions">
					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button>
				</div>
			</form>
		</div>
	</div>

	{{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}}
	<div class="ui small modal" id="delete-wiki-modal">
		<div class="header">
			{{ctx.Locale.Tr "repo.settings.wiki_delete"}}
		</div>
		<div class="content">
			<div class="ui warning message">
				{{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br>
				{{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name}}
			</div>
			<form class="ui form" action="{{.Link}}" method="post">
				{{.CsrfTokenHtml}}
				<input type="hidden" name="action" value="delete-wiki">
				<div class="field">
					<label>
						{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
						<span class="text red">{{.Repository.FullName}}</span>
					</label>
				</div>
				<div class="required field">
					<label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
					<input name="repo_name" required>
				</div>

				<div class="text right actions">
					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button>
				</div>
			</form>
		</div>
	</div>
	{{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}}
		<div class="ui small modal" id="rename-wiki-branch-modal">
			<div class="header">
				{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}
			</div>
			<div class="content">
				<div class="ui warning message">
					<ul>
						<li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_1"}}</li>
						<li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_2" .Repository.Name}}</li>
					</ul>
				</div>
				<form class="ui form" action="{{.Link}}" method="post">
					{{.CsrfTokenHtml}}
					<input type="hidden" name="action" value="rename-wiki-branch">
					<div class="field">
						<label>
							{{ctx.Locale.Tr "repo.settings.enter_repo_name"}}
							<span class="text red">{{.Repository.FullName}}</span>
						</label>
					</div>
					<div class="required field">
						<label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label>
						<input name="repo_name" required>
					</div>

					<div class="text right actions">
						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
						<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_branch_rename"}}</button>
					</div>
				</form>
			</div>
		</div>
	{{end}}
	{{end}}

	{{if not .Repository.IsMirror}}
		<div class="ui g-modal-confirm modal" id="archive-repo-modal">
			<div class="header">
				{{if .Repository.IsArchived}}
					{{ctx.Locale.Tr "repo.settings.unarchive.header"}}
				{{else}}
					{{ctx.Locale.Tr "repo.settings.archive.header"}}
				{{end}}
			</div>
			<div class="content">
				<div class="ui warning message">
					{{if .Repository.IsArchived}}
						{{ctx.Locale.Tr "repo.settings.unarchive.text"}}
					{{else}}
						{{ctx.Locale.Tr "repo.settings.archive.text"}}
					{{end}}
				</div>
				<form action="{{.Link}}" method="post">
					{{.CsrfTokenHtml}}
					<input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}">
					<input type="hidden" name="repo_id" value="{{.Repository.ID}}">
					<div class="text right actions">
						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
						<button class="ui red button">
							{{if .Repository.IsArchived}}
								{{ctx.Locale.Tr "repo.settings.unarchive.button"}}
							{{else}}
								{{ctx.Locale.Tr "repo.settings.archive.button"}}
							{{end}}
						</button>
					</div>
			</form>
			</div>
		</div>
	{{end}}
{{end}}

{{template "repo/settings/push_mirror_sync_modal" .}}