diff options
author | Michael Lustfield <MTecknology@users.noreply.github.com> | 2017-08-23 09:58:05 -0500 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-08-23 16:58:05 +0200 |
commit | a915a09e4f8edc7734c9374ad9f9a51b39241ee3 (patch) | |
tree | d2498d2cfb579cd5c1d73d750163905cfbc5fab5 /templates | |
parent | 64b706884635bcac31710d878bbb5e1b2d96ac0c (diff) | |
download | gitea-a915a09e4f8edc7734c9374ad9f9a51b39241ee3.tar.gz gitea-a915a09e4f8edc7734c9374ad9f9a51b39241ee3.zip |
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
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base/footer.tmpl | 38 | ||||
-rw-r--r-- | templates/base/head.tmpl | 58 | ||||
-rw-r--r-- | templates/repo/view_file.tmpl | 2 | ||||
-rw-r--r-- | templates/swagger.tmpl | 10 |
4 files changed, 71 insertions, 37 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index a0c14db218..be1c28b761 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -22,49 +22,49 @@ {{end}} </div> </div> - <a href="{{AppSubUrl}}/assets/librejs/librejs.html" data-jslicense="1">Javascript licenses</a> + <a href="{{AppSubUrl}}/vendor/librejs.html" data-jslicense="1">Javascript licenses</a> <a href="{{AppSubUrl}}/swagger">API</a> <a target="_blank" rel="noopener" href="https://gitea.io">{{.i18n.Tr "website"}}</a> {{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}} </div> </div> </footer> - <script src="{{AppSubUrl}}/js/jquery-1.11.3.min.js"></script> - <script src="{{AppSubUrl}}/js/libs/jquery.are-you-sure.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/jquery/jquery.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script> {{if .RequireSimpleMDE}} - <script src="{{AppSubUrl}}/plugins/simplemde-1.10.1/simplemde.min.js"></script> - <script src="{{AppSubUrl}}/plugins/codemirror-5.17.0/addon/mode/loadmode.js"></script> - <script src="{{AppSubUrl}}/plugins/codemirror-5.17.0/mode/meta.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/codemirror/mode/meta.js"></script> <script> - CodeMirror.modeURL = "{{AppSubUrl}}/plugins/codemirror-5.17.0/mode/%N/%N.js"; + CodeMirror.modeURL = "{{AppSubUrl}}/vendor/plugins/codemirror/mode/%N/%N.js"; </script> {{end}} {{if .RequireGitGraph}} <!-- graph --> - <script src="{{AppSubUrl}}/js/libs/gitgraph.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/gitgraph/gitgraph.js"></script> <script src="{{AppSubUrl}}/js/draw.js"></script> {{end}} <!-- Third-party libraries --> {{if .RequireHighlightJS}} - <script src="{{AppSubUrl}}/plugins/highlight-9.11.0/highlight.pack.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/highlight/highlight.pack.js"></script> {{end}} {{if .RequireMinicolors}} - <script src="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js"></script> {{end}} {{if .RequireDatetimepicker}} - <script src="{{AppSubUrl}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js"></script> {{end}} {{if .RequireDropzone}} - <script src="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/dropzone/dropzone.js"></script> {{end}} - <script src="{{AppSubUrl}}/js/libs/autolink.js"></script> - <script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script> - <script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script> - <script src="{{AppSubUrl}}/js/libs/vue.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/autolink/autolink.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/emojify/emojify.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/clipboard/clipboard.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/vue/vue.min.js"></script> <!-- JavaScript --> - <script src="{{AppSubUrl}}/js/semantic-2.2.1.min.js"></script> - <script src="{{AppSubUrl}}/js/index.js?v={{MD5 AppVer}}"></script> + <script src="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.js"></script> + <script src="{{AppSubUrl}}/js/index.js?v={{MD5 AppVer}}"></script> </body> -</html> +</html>
\ No newline at end of file diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 88d2b14a46..edb7b2003d 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -25,40 +25,74 @@ <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}"> {{end}} + <script> + {{SafeJS `/* + @licstart The following is the entire license notice for the + JavaScript code in this page. + + Copyright (c) 2016 The Gitea Authors + Copyright (c) 2015 The Gogs Authors + + 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: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 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. + --- + Licensing information for additional javascript libraries can be found at: + {{AppSubUrl}}/vendor/librejs.html + + @licend The above is the entire license notice + for the JavaScript code in this page. + */`}} + </script> + <link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" /> - <link rel="preload" href="{{AppSubUrl}}/assets/font-awesome-4.6.3/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'"> - <noscript><link rel="stylesheet" href="{{AppSubUrl}}/assets/font-awesome-4.6.3/css/font-awesome.min.css"></noscript> - <link rel="stylesheet" href="{{AppSubUrl}}/assets/octicons-4.3.0/octicons.min.css"> + <link rel="preload" href="{{AppSubUrl}}/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'"> + <noscript><link rel="stylesheet" href="{{AppSubUrl}}/vendor/assets/font-awesome/css/font-awesome.min.css"></noscript> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/assets/octicons/octicons.min.css"> {{if .RequireSimpleMDE}} - <link rel="stylesheet" href="{{AppSubUrl}}/plugins/simplemde-1.10.1/simplemde.min.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.css"> {{end}} {{if .RequireGitGraph}} <!-- graph --> - <link rel="stylesheet" href="{{AppSubUrl}}/css/gitgraph.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/gitgraph/gitgraph.css"> {{end}} <!-- Stylesheet --> - <link rel="stylesheet" href="{{AppSubUrl}}/css/semantic-2.2.1.min.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.css"> <link rel="stylesheet" href="{{AppSubUrl}}/css/index.css?v={{MD5 AppVer}}"> {{if .RequireHighlightJS}} - <link rel="stylesheet" href="{{AppSubUrl}}/plugins/highlight-9.11.0/github.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/highlight/github.css"> {{end}} {{if .RequireMinicolors}} - <link rel="stylesheet" href="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css"> {{end}} {{if .RequireDatetimepicker}} - <link rel="stylesheet" href="{{AppSubUrl}}/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.css"> {{end}} {{if .RequireDropzone}} - <link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css"> + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/dropzone/dropzone.css"> {{end}} <style class="list-search-style"></style> - <script src="{{AppSubUrl}}/js/libs/loadCSS.min.js"></script> - <script src="{{AppSubUrl}}/js/libs/cssrelpreload.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/loadCSS.min.js"></script> + <script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script> {{if .PageIsUserProfile}} <meta property="og:title" content="{{.Owner.Name}}" /> <meta property="og:type" content="profile" /> diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 9382bb075e..36fccb00b3 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -48,7 +48,7 @@ <strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong> </video> {{else if .IsPDFFile}} - <iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe> + <iframe width="100%" height="600px" src="{{AppSubUrl}}/vendor/plugins/pdfjs/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe> {{else}} <a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a> {{end}} diff --git a/templates/swagger.tmpl b/templates/swagger.tmpl index 405db4f235..8bcc1c5340 100644 --- a/templates/swagger.tmpl +++ b/templates/swagger.tmpl @@ -5,9 +5,9 @@ <meta charset="UTF-8"> <title>Swagger UI</title> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet"> - <link rel="stylesheet" type="text/css" href="{{AppSubUrl}}/assets/swagger-ui/swagger-ui.css" > - <link rel="icon" type="image/png" href="{{AppSubUrl}}/assets/swagger-ui/favicon-32x32.png" sizes="32x32" /> - <link rel="icon" type="image/png" href="{{AppSubUrl}}/assets/swagger-ui/favicon-16x16.png" sizes="16x16" /> + <link rel="stylesheet" type="text/css" href="{{AppSubUrl}}/vendor/assets/swagger-ui/swagger-ui.css" > + <link rel="icon" type="image/png" href="{{AppSubUrl}}/vendor/assets/swagger-ui/favicon-32x32.png" sizes="32x32" /> + <link rel="icon" type="image/png" href="{{AppSubUrl}}/vendor/assets/swagger-ui/favicon-16x16.png" sizes="16x16" /> <style> html { @@ -67,8 +67,8 @@ <div id="swagger-ui"></div> -<script src="{{AppSubUrl}}/assets/swagger-ui/swagger-ui-bundle.js"> </script> -<script src="{{AppSubUrl}}/assets/swagger-ui/swagger-ui-standalone-preset.js"> </script> +<script src="{{AppSubUrl}}/vendor/assets/swagger-ui/swagger-ui-bundle.js"> </script> +<script src="{{AppSubUrl}}/vendor/assets/swagger-ui/swagger-ui-standalone-preset.js"> </script> <script> window.onload = function() { // Build a system |