Skip to content

Commit a915a09

Browse files
MTecknologybkcsoft
authored andcommitted
Moved vendored js/css into public/vendor and documented sources (#1484) (#2241)
* Cleaning up public/ and documenting js/css libs. This commit mostly addresses #1484 by moving vendor'ed plugins into a vendor/ directory and documenting their upstream source and license in vendor/librejs.html. This also proves gitea is using only open source js/css libraries which helps toward reaching #1524. * Removing unused css file. The version of this file in use is located at: vendor/plugins/highlight/github.css * Cleaned up librejs.html and added javascript header A SafeJS function was added to templates/helper.go to allow keeping comments inside of javascript. A javascript comment was added in the header of templates/base/head.tmpl to mark all non-inline source as free. The librejs.html file was updated to meet the current librejs spec. I have now verified that the librejs plugin detects most of the scripts included in gitea and suspect the non-free detections are the result of a bug in the plugin. I believe this commit is enough to meet the C0.0 requirement of #1534. * Updating SafeJS function per lint suggestion * Added VERSIONS file, per request
1 parent 64b7068 commit a915a09

File tree

1,339 files changed

+813
-126
lines changed

Some content is hidden

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

1,339 files changed

+813
-126
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,9 @@ public/css/index.css: $(STYLESHEETS)
285285

286286
.PHONY: swagger-ui
287287
swagger-ui:
288-
rm -Rf public/assets/swagger-ui
288+
rm -Rf public/vendor/assets/swagger-ui
289289
git clone --depth=10 -b v3.0.7 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
290-
mv $(TMPDIR)/swagger-ui/dist public/assets/swagger-ui
290+
mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui
291291
rm -Rf $(TMPDIR)/swagger-ui
292292
$(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../swagger.v1.json;g" public/assets/swagger-ui/index.html
293293

modules/templates/helper.go

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func NewFuncMap() []template.FuncMap {
6666
},
6767
"AvatarLink": base.AvatarLink,
6868
"Safe": Safe,
69+
"SafeJS": SafeJS,
6970
"Sanitize": bluemonday.UGCPolicy().Sanitize,
7071
"Str2html": Str2html,
7172
"TimeSince": base.TimeSince,
@@ -162,6 +163,11 @@ func Safe(raw string) template.HTML {
162163
return template.HTML(raw)
163164
}
164165

166+
// SafeJS renders raw as JS
167+
func SafeJS(raw string) template.JS {
168+
return template.JS(raw)
169+
}
170+
165171
// Str2html render Markdown text to HTML
166172
func Str2html(raw string) template.HTML {
167173
return template.HTML(markdown.Sanitize(raw))

public/assets/librejs/librejs.html

-84
This file was deleted.

public/css/github.min.css

-1
This file was deleted.

public/css/themes/github/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2012-2016 GitHub, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

public/js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ $(document).ready(function () {
14561456

14571457
// Emojify
14581458
emojify.setConfig({
1459-
img_dir: suburl + '/img/emoji',
1459+
img_dir: suburl + '/plugins/emojify/images',
14601460
ignore_emoticons: true
14611461
});
14621462
var hasEmoji = document.getElementsByClassName('has-emoji');

public/vendor/VERSIONS

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# About: This file was added per request of BKC. It duplicates content present in librejs.html.
2+
# To do: Choose a dependency management solution and use it to replace both files.
3+
# Notes: Download and license information is available in librejs.html.
4+
5+
File(s): /vendor/plugins/jquery.areyousure/jquery.are-you-sure.js
6+
Version: 1.9.0
7+
8+
File(s): /vendor/plugins/jquery/jquery.min.js
9+
Version: 1.11.3
10+
11+
File(s): /vendor/plugins/semantic/semantic.min.js
12+
Version: 2.2.1
13+
14+
File(s): /vendor/plugins/clipboard/clipboard.min.js
15+
Version: 1.5.9
16+
17+
File(s): /vendor/plugins/gitgraph/gitgraph.js
18+
Version: 5fcc26b
19+
20+
File(s): /vendor/plugins/autolink/autolink.js
21+
Version: 741f66f
22+
23+
File(s): /vendor/plugins/vue/vue.min.js
24+
Version: 2.1.10
25+
26+
File(s): /vendor/plugins/emojify/emojify.min.js
27+
Version: 1.1.0
28+
29+
File(s): /vendor/plugins/cssrelpreload/
30+
Version: 1.3.1
31+
32+
File(s): /vendor/plugins/dropzone/dropzone.js
33+
Version: 4.2.0
34+
35+
File(s): /vendor/plugins/highlight/highlight.pack.js
36+
Version: 9.6.0
37+
38+
File(s): /vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js
39+
Version: 2.4.5
40+
41+
File(s): /vendor/plugins/jquery.minicolors/jquery.minicolors.min.js
42+
Version: 2.2.3
43+
44+
File(s): /vendor/plugins/codemirror/
45+
Version: 5.17.0
46+
47+
File(s): /vendor/plugins/simplemde/simplemde.min.js
48+
Version: 1.10.1
49+
50+
File(s): /vendor/plugins/pdfjs/
51+
Version: 1.4.20
52+
53+
File(s): /vendor/assets/font-awesome/fonts/
54+
Version: 4.6.0
55+
56+
File(s): /vendor/assets/octicons/
57+
Version: 4.3.0
58+
59+
File(s): /vendor/assets/swagger-ui/
60+
Version: 3.0.4
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
Copyright (c) <dates>, <Copyright Holder> (<URL|email>),
2+
with Reserved Font Name <Reserved Font Name>.
3+
Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>),
4+
with Reserved Font Name <additional Reserved Font Name>.
5+
Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>).
6+
7+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
8+
This license is copied below, and is also available with a FAQ at:
9+
http://scripts.sil.org/OFL
10+
11+
12+
-----------------------------------------------------------
13+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
14+
-----------------------------------------------------------
15+
16+
PREAMBLE
17+
The goals of the Open Font License (OFL) are to stimulate worldwide
18+
development of collaborative font projects, to support the font creation
19+
efforts of academic and linguistic communities, and to provide a free and
20+
open framework in which fonts may be shared and improved in partnership
21+
with others.
22+
23+
The OFL allows the licensed fonts to be used, studied, modified and
24+
redistributed freely as long as they are not sold by themselves. The
25+
fonts, including any derivative works, can be bundled, embedded,
26+
redistributed and/or sold with any software provided that any reserved
27+
names are not used by derivative works. The fonts and derivatives,
28+
however, cannot be released under any other type of license. The
29+
requirement for fonts to remain under this license does not apply
30+
to any document created using the fonts or their derivatives.
31+
32+
DEFINITIONS
33+
"Font Software" refers to the set of files released by the Copyright
34+
Holder(s) under this license and clearly marked as such. This may
35+
include source files, build scripts and documentation.
36+
37+
"Reserved Font Name" refers to any names specified as such after the
38+
copyright statement(s).
39+
40+
"Original Version" refers to the collection of Font Software components as
41+
distributed by the Copyright Holder(s).
42+
43+
"Modified Version" refers to any derivative made by adding to, deleting,
44+
or substituting -- in part or in whole -- any of the components of the
45+
Original Version, by changing formats or by porting the Font Software to a
46+
new environment.
47+
48+
"Author" refers to any designer, engineer, programmer, technical
49+
writer or other person who contributed to the Font Software.
50+
51+
PERMISSION & CONDITIONS
52+
Permission is hereby granted, free of charge, to any person obtaining
53+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
54+
redistribute, and sell modified and unmodified copies of the Font
55+
Software, subject to the following conditions:
56+
57+
1) Neither the Font Software nor any of its individual components,
58+
in Original or Modified Versions, may be sold by itself.
59+
60+
2) Original or Modified Versions of the Font Software may be bundled,
61+
redistributed and/or sold with any software, provided that each copy
62+
contains the above copyright notice and this license. These can be
63+
included either as stand-alone text files, human-readable headers or
64+
in the appropriate machine-readable metadata fields within text or
65+
binary files as long as those fields can be easily viewed by the user.
66+
67+
3) No Modified Version of the Font Software may use the Reserved Font
68+
Name(s) unless explicit written permission is granted by the corresponding
69+
Copyright Holder. This restriction only applies to the primary font name as
70+
presented to the users.
71+
72+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
73+
Software shall not be used to promote, endorse or advertise any
74+
Modified Version, except to acknowledge the contribution(s) of the
75+
Copyright Holder(s) and the Author(s) or with their explicit written
76+
permission.
77+
78+
5) The Font Software, modified or unmodified, in part or in whole,
79+
must be distributed entirely under this license, and must not be
80+
distributed under any other license. The requirement for fonts to
81+
remain under this license does not apply to any document created
82+
using the Font Software.
83+
84+
TERMINATION
85+
This license becomes null and void if any of the above conditions are
86+
not met.
87+
88+
DISCLAIMER
89+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
91+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
92+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
93+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
94+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
95+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
97+
OTHER DEALINGS IN THE FONT SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright <YEAR> <COPYRIGHT HOLDER>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)