···9090 }
9191}
92929393+// JSONTemplate renders the template as JSON response
9494+// keep in mind that the template is processed in HTML context, so JSON-things should be handled carefully, eg: by JSEscape
9595+func (ctx *Context) JSONTemplate(tmpl base.TplName) {
9696+ t, err := ctx.Render.TemplateLookup(string(tmpl), nil)
9797+ if err != nil {
9898+ ctx.ServerError("unable to find template", err)
9999+ return
100100+ }
101101+ ctx.Resp.Header().Set("Content-Type", "application/json")
102102+ if err = t.Execute(ctx.Resp, ctx.Data); err != nil {
103103+ ctx.ServerError("unable to execute template", err)
104104+ }
105105+}
106106+93107// RenderToString renders the template content to a string
94108func (ctx *Context) RenderToString(name base.TplName, data map[string]any) (string, error) {
95109 var buf strings.Builder
-14
modules/context/context_template.go
···5566import (
77 "context"
88- "errors"
98 "time"
1010-1111- "code.gitea.io/gitea/modules/log"
129)
13101411var _ context.Context = TemplateContext(nil)
···3633func (c TemplateContext) Value(key any) any {
3734 return c.parentContext().Value(key)
3835}
3939-4040-// DataRaceCheck checks whether the template context function "ctx()" returns the consistent context
4141-// as the current template's rendering context (request context), to help to find data race issues as early as possible.
4242-// When the code is proven to be correct and stable, this function should be removed.
4343-func (c TemplateContext) DataRaceCheck(dataCtx context.Context) (string, error) {
4444- if c.parentContext() != dataCtx {
4545- log.Error("TemplateContext.DataRaceCheck: parent context mismatch\n%s", log.Stack(2))
4646- return "", errors.New("parent context mismatch")
4747- }
4848- return "", nil
4949-}
···136136 args := slices.Clone(trArgs)
137137 for i, v := range args {
138138 switch v := v.(type) {
139139+ case nil, bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, template.HTML:
140140+ // for most basic types (including template.HTML which is safe), just do nothing and use it
139141 case string:
140140- args[i] = template.HTML(template.HTMLEscapeString(v))
142142+ args[i] = template.HTMLEscapeString(v)
141143 case fmt.Stringer:
142144 args[i] = template.HTMLEscapeString(v.String())
143143- default: // int, float, include template.HTML
144144- // do nothing, just use it
145145+ default:
146146+ args[i] = template.HTMLEscapeString(fmt.Sprint(v))
145147 }
146148 }
147149 return template.HTML(l.TrString(trKey, args...))
+17
options/license/Brian-Gladman-2-Clause
···11+Copyright (C) 1998-2013, Brian Gladman, Worcester, UK. All
22+ rights reserved.
33+44+The redistribution and use of this software (with or without
55+changes) is allowed without the payment of fees or royalties
66+provided that:
77+88+ source code distributions include the above copyright notice,
99+ this list of conditions and the following disclaimer;
1010+1111+ binary distributions include the above copyright notice, this
1212+ list of conditions and the following disclaimer in their
1313+ documentation.
1414+1515+This software is provided 'as is' with no explicit or implied
1616+warranties in respect of its operation, including, but not limited
1717+to, correctness and fitness for purpose.
+11
options/license/CMU-Mach-nodoc
···11+Copyright (C) 2002 Naval Research Laboratory (NRL/CCS)
22+33+Permission to use, copy, modify and distribute this software and
44+its documentation is hereby granted, provided that both the
55+copyright notice and this permission notice appear in all copies of
66+the software, derivative works or modified versions, and any
77+portions thereof.
88+99+NRL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND
1010+DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
1111+RESULTING FROM THE USE OF THIS SOFTWARE.
+1
options/license/GNOME-examples-exception
···11+As a special exception, the copyright holders give you permission to copy, modify, and distribute the example code contained in this document under the terms of your choosing, without restriction.
+16
options/license/Gmsh-exception
···11+The copyright holders of Gmsh give you permission to combine Gmsh
22+ with code included in the standard release of Netgen (from Joachim
33+ Sch"oberl), METIS (from George Karypis at the University of
44+ Minnesota), OpenCASCADE (from Open CASCADE S.A.S) and ParaView
55+ (from Kitware, Inc.) under their respective licenses. You may copy
66+ and distribute such a system following the terms of the GNU GPL for
77+ Gmsh and the licenses of the other code concerned, provided that
88+ you include the source code of that other code when and as the GNU
99+ GPL requires distribution of source code.
1010+1111+ Note that people who make modified versions of Gmsh are not
1212+ obligated to grant this special exception for their modified
1313+ versions; it is their choice whether to do so. The GNU General
1414+ Public License gives permission to release a modified version
1515+ without this exception; this exception also makes it possible to
1616+ release a modified version which carries forward this exception.
+13
options/license/HPND-Fenneberg-Livingston
···11+Copyright (C) 1995,1996,1997,1998 Lars Fenneberg <lf@elemental.net>
22+33+Permission to use, copy, modify, and distribute this software for any
44+purpose and without fee is hereby granted, provided that this copyright and
55+permission notice appear on all copies and supporting documentation, the
66+name of Lars Fenneberg not be used in advertising or publicity pertaining to
77+distribution of the program without specific prior permission, and notice be
88+given in supporting documentation that copying and distribution is by
99+permission of Lars Fenneberg.
1010+1111+Lars Fenneberg makes no representations about the suitability of this
1212+software for any purpose. It is provided "as is" without express or implied
1313+warranty.
+9
options/license/HPND-INRIA-IMAG
···11+This software is available with usual "research" terms with
22+the aim of retain credits of the software. Permission to use,
33+copy, modify and distribute this software for any purpose and
44+without fee is hereby granted, provided that the above copyright
55+notice and this permission notice appear in all copies, and
66+the name of INRIA, IMAG, or any contributor not be used in
77+advertising or publicity pertaining to this material without
88+the prior explicit permission. The software is provided "as
99+is" without any warranties, support or liabilities of any kind.
+25
options/license/Mackerras-3-Clause
···11+Copyright (c) 1995 Eric Rosenquist. All rights reserved.
22+33+ Redistribution and use in source and binary forms, with or without
44+ modification, are permitted provided that the following conditions
55+ are met:
66+77+ 1. Redistributions of source code must retain the above copyright
88+ notice, this list of conditions and the following disclaimer.
99+1010+ 2. Redistributions in binary form must reproduce the above copyright
1111+ notice, this list of conditions and the following disclaimer in
1212+ the documentation and/or other materials provided with the
1313+ distribution.
1414+1515+ 3. The name(s) of the authors of this software must not be used to
1616+ endorse or promote products derived from this software without
1717+ prior written permission.
1818+1919+ THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
2020+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2121+ AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
2222+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2323+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
2424+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
2525+ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+25
options/license/Mackerras-3-Clause-acknowledgment
···11+Copyright (c) 1993-2002 Paul Mackerras. All rights reserved.
22+33+ Redistribution and use in source and binary forms, with or without
44+ modification, are permitted provided that the following conditions
55+ are met:
66+77+ 1. Redistributions of source code must retain the above copyright
88+ notice, this list of conditions and the following disclaimer.
99+1010+2. The name(s) of the authors of this software must not be used to
1111+ endorse or promote products derived from this software without
1212+ prior written permission.
1313+1414+3. Redistributions of any form whatsoever must retain the following
1515+ acknowledgment:
1616+ "This product includes software developed by Paul Mackerras
1717+ <paulus@ozlabs.org>".
1818+1919+THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
2020+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2121+AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
2222+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2323+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
2424+AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
2525+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+33
options/license/OpenVision
···11+Copyright, OpenVision Technologies, Inc., 1993-1996, All Rights
22+Reserved
33+44+WARNING: Retrieving the OpenVision Kerberos Administration system
55+source code, as described below, indicates your acceptance of the
66+following terms. If you do not agree to the following terms, do
77+not retrieve the OpenVision Kerberos administration system.
88+99+You may freely use and distribute the Source Code and Object Code
1010+compiled from it, with or without modification, but this Source
1111+Code is provided to you "AS IS" EXCLUSIVE OF ANY WARRANTY,
1212+INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR
1313+FITNESS FOR A PARTICULAR PURPOSE, OR ANY OTHER WARRANTY, WHETHER
1414+EXPRESS OR IMPLIED. IN NO EVENT WILL OPENVISION HAVE ANY LIABILITY
1515+FOR ANY LOST PROFITS, LOSS OF DATA OR COSTS OF PROCUREMENT OF
1616+SUBSTITUTE GOODS OR SERVICES, OR FOR ANY SPECIAL, INDIRECT, OR
1717+CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, INCLUDING,
1818+WITHOUT LIMITATION, THOSE RESULTING FROM THE USE OF THE SOURCE
1919+CODE, OR THE FAILURE OF THE SOURCE CODE TO PERFORM, OR FOR ANY
2020+OTHER REASON.
2121+2222+OpenVision retains all copyrights in the donated Source Code.
2323+OpenVision also retains copyright to derivative works of the Source
2424+Code, whether created by OpenVision or by a third party. The
2525+OpenVision copyright notice must be preserved if derivative works
2626+are made based on the donated Source Code.
2727+2828+OpenVision Technologies, Inc. has donated this Kerberos
2929+Administration system to MIT for inclusion in the standard Kerberos
3030+5 distribution. This donation underscores our commitment to
3131+continuing Kerberos technology development and our gratitude for
3232+the valuable work which has been performed by MIT and the Kerberos
3333+community.
+13
options/license/Sun-PPP
···11+Copyright (c) 2001 by Sun Microsystems, Inc.
22+All rights reserved.
33+44+Non-exclusive rights to redistribute, modify, translate, and use
55+this software in source and binary forms, in whole or in part, is
66+hereby granted, provided that the above copyright notice is
77+duplicated in any source form, and that neither the name of the
88+copyright holder nor the author is used to endorse or promote
99+products derived from this software.
1010+1111+THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1212+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1313+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+19
options/license/UMich-Merit
···11+[C] The Regents of the University of Michigan and Merit Network, Inc. 1992,
22+1993, 1994, 1995 All Rights Reserved
33+44+Permission to use, copy, modify, and distribute this software and its
55+documentation for any purpose and without fee is hereby granted, provided
66+that the above copyright notice and this permission notice appear in all
77+copies of the software and derivative works or modified versions thereof,
88+and that both the copyright notice and this permission and disclaimer
99+notice appear in supporting documentation.
1010+1111+THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
1212+EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF
1313+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE REGENTS OF THE
1414+UNIVERSITY OF MICHIGAN AND MERIT NETWORK, INC. DO NOT WARRANT THAT THE
1515+FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET LICENSEE'S REQUIREMENTS OR
1616+THAT OPERATION WILL BE UNINTERRUPTED OR ERROR FREE. The Regents of the
1717+University of Michigan and Merit Network, Inc. shall not be liable for any
1818+special, indirect, incidental or consequential damages with respect to any
1919+claim by Licensee or any third party arising from use of the software.
+11
options/license/bcrypt-Solar-Designer
···11+Written by Solar Designer <solar at openwall.com> in 1998-2014.
22+No copyright is claimed, and the software is hereby placed in the public
33+domain. In case this attempt to disclaim copyright and place the software
44+in the public domain is deemed null and void, then the software is
55+Copyright (c) 1998-2014 Solar Designer and it is hereby released to the
66+general public under the following terms:
77+88+Redistribution and use in source and binary forms, with or without
99+modification, are permitted.
1010+1111+There's ABSOLUTELY NO WARRANTY, express or implied.
+6
options/license/gtkbook
···11+Copyright 2005 Syd Logan, All Rights Reserved
22+33+This code is distributed without warranty. You are free to use
44+this code for any purpose, however, if this code is republished or
55+redistributed in its original form, as hardcopy or electronically,
66+then you must include this copyright notice along with the code.
+6
options/license/softSurfer
···11+Copyright 2001, softSurfer (www.softsurfer.com)
22+This code may be freely used and modified for any purpose
33+providing that this copyright notice is included with it.
44+SoftSurfer makes no warranty for this code, and cannot be held
55+liable for any real or imagined damage resulting from its use.
66+Users of this code must verify correctness for their application.
+7-5
options/locale/locale_en-US.ini
···20232023activity.git_stats_deletion_1 = %d deletion
20242024activity.git_stats_deletion_n = %d deletions
2025202520262026-contributors = Contributors
20272026contributors.contribution_type.filter_label = Contribution type:
20282027contributors.contribution_type.commits = Commits
20292028contributors.contribution_type.additions = Additions
20302029contributors.contribution_type.deletions = Deletions
20312031-contributors.loading_title = Loading contributions...
20322032-contributors.loading_title_failed = Could not load contributions
20332033-contributors.loading_info = This might take a bit…
20342034-contributors.component_failed_to_load = An unexpected error happened.
2035203020362031search = Search
20372032search.search_repo = Search repository
···26512646error.csv.too_large = Can't render this file because it is too large.
26522647error.csv.unexpected = Can't render this file because it contains an unexpected character in line %d and column %d.
26532648error.csv.invalid_field_count = Can't render this file because it has a wrong number of fields in line %d.
26492649+26502650+[graphs]
26512651+component_loading = Loading %s...
26522652+component_loading_failed = Could not load %s
26532653+component_loading_info = This might take a bit…
26542654+component_failed_to_load = An unexpected error happened.
26552655+contributors.what = contributions
2654265626552657[org]
26562658org_name_holder = Organization Name
···1818 return nil
1919}
20202121-// ToDB exports an SMTPConfig to a serialized format.
2121+// ToDB exports the config to a byte slice to be saved into database (this method is just dummy and does nothing for DB source)
2222func (source *Source) ToDB() ([]byte, error) {
2323 return nil, nil
2424}
+4
services/pull/commit_status.go
···5252 }
5353 }
54545555+ if matchedCount != len(requiredContexts) {
5656+ return structs.CommitStatusPending
5757+ }
5858+5559 if matchedCount == 0 {
5660 status := git_model.CalcCommitStatus(commitStatuses)
5761 if status != nil {
···11import $ from 'jquery';
22+import {htmlEscape} from 'escape-goat';
23import {POST} from '../../modules/fetch.js';
44+import {imageInfo} from '../../utils/image.js';
3546async function uploadFile(file, uploadUrl) {
57 const formData = new FormData();
···109111110112 const placeholder = ``;
111113 editor.insertPlaceholder(placeholder);
112112- const data = await uploadFile(img, uploadUrl);
113113- editor.replacePlaceholder(placeholder, ``);
114114+115115+ const {uuid} = await uploadFile(img, uploadUrl);
116116+ const {width, dppx} = await imageInfo(img);
114117115115- const $input = $(`<input name="files" type="hidden">`).attr('id', data.uuid).val(data.uuid);
118118+ const url = `/attachments/${uuid}`;
119119+ let text;
120120+ if (width > 0 && dppx > 1) {
121121+ // Scale down images from HiDPI monitors. This uses the <img> tag because it's the only
122122+ // method to change image size in Markdown that is supported by all implementations.
123123+ text = `<img width="${Math.round(width / dppx)}" alt="${htmlEscape(name)}" src="${htmlEscape(url)}">`;
124124+ } else {
125125+ text = ``;
126126+ }
127127+ editor.replacePlaceholder(placeholder, text);
128128+129129+ const $input = $(`<input name="files" type="hidden">`).attr('id', uuid).val(uuid);
116130 $files.append($input);
117131 }
118132};
+8-9
web_src/js/features/repo-migrate.js
···11-import $ from 'jquery';
21import {hideElem, showElem} from '../utils/dom.js';
32import {GET, POST} from '../modules/fetch.js';
4354const {appSubUrl} = window.config;
6576export function initRepoMigrationStatusChecker() {
88- const $repoMigrating = $('#repo_migrating');
99- if (!$repoMigrating.length) return;
77+ const repoMigrating = document.getElementById('repo_migrating');
88+ if (!repoMigrating) return;
1091111- $('#repo_migrating_retry').on('click', doMigrationRetry);
1010+ document.getElementById('repo_migrating_retry').addEventListener('click', doMigrationRetry);
12111313- const task = $repoMigrating.attr('data-migrating-task-id');
1212+ const task = repoMigrating.getAttribute('data-migrating-task-id');
14131515- // returns true if the refresh still need to be called after a while
1414+ // returns true if the refresh still needs to be called after a while
1615 const refresh = async () => {
1716 const res = await GET(`${appSubUrl}/user/task/${task}`);
1817 if (res.status !== 200) return true; // continue to refresh if network error occurs
···21202221 // for all status
2322 if (data.message) {
2424- $('#repo_migrating_progress_message').text(data.message);
2323+ document.getElementById('repo_migrating_progress_message').textContent = data.message;
2524 }
26252726 // TaskStatusFinished
···3736 showElem('#repo_migrating_retry');
3837 showElem('#repo_migrating_failed');
3938 showElem('#repo_migrating_failed_image');
4040- $('#repo_migrating_failed_error').text(data.message);
3939+ document.getElementById('repo_migrating_failed_error').textContent = data.message;
4140 return false;
4241 }
4342···5958}
60596160async function doMigrationRetry(e) {
6262- await POST($(e.target).attr('data-migrating-task-retry-url'));
6161+ await POST(e.target.getAttribute('data-migrating-task-retry-url'));
6362 window.location.reload();
6463}