本站源代码
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

78 linhas
3.2KB

  1. var STATIC_CACHE = 'static-cache-v1';
  2. var urlsToCache = [
  3. // js
  4. '{{StaticUrlPrefix}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js',
  5. '{{StaticUrlPrefix}}/vendor/plugins/jquery/jquery.min.js?v=3.4.1',
  6. '{{StaticUrlPrefix}}/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1',
  7. '{{StaticUrlPrefix}}/vendor/plugins/semantic/semantic.min.js',
  8. '{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}',
  9. '{{StaticUrlPrefix}}/js/draw.js',
  10. '{{StaticUrlPrefix}}/vendor/plugins/clipboard/clipboard.min.js',
  11. '{{StaticUrlPrefix}}/vendor/plugins/gitgraph/gitgraph.js',
  12. '{{StaticUrlPrefix}}/vendor/plugins/vue/vue.min.js',
  13. '{{StaticUrlPrefix}}/vendor/plugins/emojify/emojify.min.js',
  14. '{{StaticUrlPrefix}}/vendor/plugins/cssrelpreload/loadCSS.min.js',
  15. '{{StaticUrlPrefix}}/vendor/plugins/cssrelpreload/cssrelpreload.min.js',
  16. '{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.js',
  17. '{{StaticUrlPrefix}}/vendor/plugins/highlight/highlight.pack.js',
  18. '{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js',
  19. '{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js',
  20. '{{StaticUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js',
  21. '{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js',
  22. '{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.js',
  23. // css
  24. '{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css',
  25. '{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.min.css',
  26. '{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.css',
  27. '{{StaticUrlPrefix}}/vendor/plugins/gitgraph/gitgraph.css',
  28. '{{StaticUrlPrefix}}/vendor/plugins/tribute/tribute.css',
  29. '{{StaticUrlPrefix}}/vendor/plugins/semantic/semantic.min.css',
  30. '{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}',
  31. '{{StaticUrlPrefix}}/vendor/plugins/highlight/github.css',
  32. '{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css',
  33. '{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.css',
  34. '{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.css',
  35. {{if .IsSigned }}
  36. {{ if ne .SignedUser.Theme "gitea" }}
  37. '{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css',
  38. {{end}}
  39. {{else if ne DefaultTheme "gitea"}}
  40. '{{StaticUrlPrefix}}/css/theme-{{DefaultTheme}}.css',
  41. {{end}}
  42. // img
  43. '{{StaticUrlPrefix}}/img/gitea-sm.png',
  44. '{{StaticUrlPrefix}}/img/gitea-lg.png',
  45. // fonts
  46. '{{StaticUrlPrefix}}/vendor/plugins/semantic/themes/default/assets/fonts/icons.woff2',
  47. '{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.woff2?ef21c39f0ca9b1b5116e5eb7ac5eabe6',
  48. '{{StaticUrlPrefix}}/vendor/assets/lato-fonts/lato-v14-latin-regular.woff2',
  49. '{{StaticUrlPrefix}}/vendor/assets/lato-fonts/lato-v14-latin-700.woff2'
  50. ];
  51. self.addEventListener('install', function (event) {
  52. // Perform install steps
  53. event.waitUntil(
  54. caches.open(STATIC_CACHE)
  55. .then(function (cache) {
  56. return cache.addAll(urlsToCache);
  57. })
  58. );
  59. });
  60. self.addEventListener('fetch', function (event) {
  61. event.respondWith(
  62. caches.match(event.request)
  63. .then(function (response) {
  64. // Cache hit - return response
  65. if (response) {
  66. return response;
  67. }
  68. return fetch(event.request);
  69. }
  70. )
  71. );
  72. });
上海开阖软件有限公司 沪ICP备12045867号-1