luckyphoenix 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -4
  3. package/alist-web/README.md +34 -0
  4. package/alist-web/assets/2fa-legacy.3350d44d.js +1 -0
  5. package/alist-web/assets/2fa.0dab7189.js +1 -0
  6. package/alist-web/assets/About-legacy.e1597551.js +1 -0
  7. package/alist-web/assets/About.11e2f3bb.js +1 -0
  8. package/alist-web/assets/AddOrEdit-legacy.2a02db88.js +1 -0
  9. package/alist-web/assets/AddOrEdit-legacy.432f6c0e.js +1 -0
  10. package/alist-web/assets/AddOrEdit-legacy.6ac6f516.js +1 -0
  11. package/alist-web/assets/AddOrEdit.79c069f9.js +1 -0
  12. package/alist-web/assets/AddOrEdit.e641a9bd.js +1 -0
  13. package/alist-web/assets/AddOrEdit.f0ec5bf9.js +1 -0
  14. package/alist-web/assets/Common-legacy.5144e9c0.js +1 -0
  15. package/alist-web/assets/Common.6eff9060.js +1 -0
  16. package/alist-web/assets/Copy-legacy.3d846482.js +1 -0
  17. package/alist-web/assets/Copy.d1980101.js +1 -0
  18. package/alist-web/assets/DeletePopover-legacy.1906395c.js +1 -0
  19. package/alist-web/assets/DeletePopover.f7887d88.js +1 -0
  20. package/alist-web/assets/File-legacy.889dd355.js +1 -0
  21. package/alist-web/assets/File.23490613.js +1 -0
  22. package/alist-web/assets/Folder-legacy.a4550db5.js +29 -0
  23. package/alist-web/assets/Folder.7e9202ae.js +179 -0
  24. package/alist-web/assets/Folder.b511ba9e.css +1 -0
  25. package/alist-web/assets/FolderTree-legacy.2cffdb64.js +1 -0
  26. package/alist-web/assets/FolderTree.3d6d889d.js +1 -0
  27. package/alist-web/assets/Grid-legacy.a63ef469.js +1 -0
  28. package/alist-web/assets/Grid.7759c684.js +1 -0
  29. package/alist-web/assets/GridItem-legacy.2300a556.js +1 -0
  30. package/alist-web/assets/GridItem.5502f946.js +1 -0
  31. package/alist-web/assets/ImageWithError-legacy.184872e5.js +1 -0
  32. package/alist-web/assets/ImageWithError.fbebe083.js +1 -0
  33. package/alist-web/assets/Images-legacy.47953965.js +1 -0
  34. package/alist-web/assets/Images.cc1e423a.js +1 -0
  35. package/alist-web/assets/Layout-legacy.bbe308ea.js +1 -0
  36. package/alist-web/assets/Layout.683e33e3.js +6 -0
  37. package/alist-web/assets/List-legacy.dc5a2a38.js +1 -0
  38. package/alist-web/assets/List.249d43e3.js +1 -0
  39. package/alist-web/assets/Messenger-legacy.15747cf4.js +1 -0
  40. package/alist-web/assets/Messenger.0de50ee8.js +1 -0
  41. package/alist-web/assets/Metas-legacy.9a37ad69.js +1 -0
  42. package/alist-web/assets/Metas.94282135.js +1 -0
  43. package/alist-web/assets/Other-legacy.1defd90b.js +1 -0
  44. package/alist-web/assets/Other.c698471d.js +1 -0
  45. package/alist-web/assets/PackageDownload-legacy.13e43bb9.js +1 -0
  46. package/alist-web/assets/PackageDownload.89e4ecc4.js +1 -0
  47. package/alist-web/assets/Paginator-legacy.6f9f1dcb.js +1 -0
  48. package/alist-web/assets/Paginator.758bcfa3.js +1 -0
  49. package/alist-web/assets/Password-legacy.5e5cbd20.js +1 -0
  50. package/alist-web/assets/Password.500d1886.js +1 -0
  51. package/alist-web/assets/Profile-legacy.ccf1ddd4.js +1 -0
  52. package/alist-web/assets/Profile.33671ffe.js +1 -0
  53. package/alist-web/assets/ResponsiveGrid-legacy.d58d4dfe.js +1 -0
  54. package/alist-web/assets/ResponsiveGrid.04e247e9.js +1 -0
  55. package/alist-web/assets/S3-legacy.fb41a1b8.js +1 -0
  56. package/alist-web/assets/S3.135ba8ad.js +1 -0
  57. package/alist-web/assets/SettingItem-legacy.51bf5808.js +1 -0
  58. package/alist-web/assets/SettingItem.d9757149.js +1 -0
  59. package/alist-web/assets/SourceHanSansCN-Bold.b5627435.woff2 +0 -0
  60. package/alist-web/assets/Storages-legacy.6fe86e3a.js +1 -0
  61. package/alist-web/assets/Storages.22e89c36.js +1 -0
  62. package/alist-web/assets/Tasks-legacy.bcf4e457.js +1 -0
  63. package/alist-web/assets/Tasks.f607862a.js +1 -0
  64. package/alist-web/assets/TimesNewRoman.d9fb32eb.ttf +0 -0
  65. package/alist-web/assets/Upload-legacy.7dd2be21.js +1 -0
  66. package/alist-web/assets/Upload-legacy.cb936202.js +1 -0
  67. package/alist-web/assets/Upload.4c54bcbf.js +1 -0
  68. package/alist-web/assets/Upload.d35bb47b.js +1 -0
  69. package/alist-web/assets/Users-legacy.b992a339.js +1 -0
  70. package/alist-web/assets/Users.7eb39296.js +1 -0
  71. package/alist-web/assets/Wether-legacy.66b7b0d3.js +1 -0
  72. package/alist-web/assets/Wether.f17d6a97.js +1 -0
  73. package/alist-web/assets/_commonjs-dynamic-modules-legacy.cf19cda3.js +1 -0
  74. package/alist-web/assets/_commonjs-dynamic-modules.30ae7933.js +1 -0
  75. package/alist-web/assets/aliyun_office-legacy.7e1c4ff6.js +1 -0
  76. package/alist-web/assets/aliyun_office.627eb2ac.js +1 -0
  77. package/alist-web/assets/aliyun_video-legacy.dfd303c5.js +1 -0
  78. package/alist-web/assets/aliyun_video.681fb5ee.js +1 -0
  79. package/alist-web/assets/asciinema-legacy.554330ec.js +1 -0
  80. package/alist-web/assets/asciinema.53412307.css +1 -0
  81. package/alist-web/assets/asciinema.a6e925e9.js +7 -0
  82. package/alist-web/assets/audio-legacy.d6ef56f6.js +1 -0
  83. package/alist-web/assets/audio.0cad5cce.js +154 -0
  84. package/alist-web/assets/audio.e5b5af14.css +1 -0
  85. package/alist-web/assets/backup-restore-legacy.f4c8daf0.js +1 -0
  86. package/alist-web/assets/backup-restore.db700ca0.js +1 -0
  87. package/alist-web/assets/entry-legacy.01f22349.js +1 -0
  88. package/alist-web/assets/entry-legacy.31390e6c.js +1 -0
  89. package/alist-web/assets/entry-legacy.5119e4e8.js +1 -0
  90. package/alist-web/assets/entry-legacy.d3b909f7.js +1 -0
  91. package/alist-web/assets/entry-legacy.e017de3e.js +1 -0
  92. package/alist-web/assets/entry-legacy.eec15c4b.js +1 -0
  93. package/alist-web/assets/entry-legacy.fa23a37d.js +1 -0
  94. package/alist-web/assets/entry.2eaf5bb3.js +5 -0
  95. package/alist-web/assets/entry.371138c7.js +7 -0
  96. package/alist-web/assets/entry.5c41c532.js +5 -0
  97. package/alist-web/assets/entry.6cce3889.js +5 -0
  98. package/alist-web/assets/entry.8acdb7f9.js +9 -0
  99. package/alist-web/assets/entry.abb9e6ed.js +5 -0
  100. package/alist-web/assets/entry.e83ea613.js +6 -0
  101. package/alist-web/assets/helper-legacy.646eb2d9.js +1 -0
  102. package/alist-web/assets/helper.d54883e3.js +1 -0
  103. package/alist-web/assets/hls-legacy.9e0f7edb.js +379 -0
  104. package/alist-web/assets/hls.1623c369.js +49 -0
  105. package/alist-web/assets/html-legacy.fa26963f.js +1 -0
  106. package/alist-web/assets/html.8b79f6ca.js +1 -0
  107. package/alist-web/assets/icon-legacy.2d7c0a16.js +1 -0
  108. package/alist-web/assets/icon.94f94d81.js +37 -0
  109. package/alist-web/assets/image-legacy.236a9cca.js +1 -0
  110. package/alist-web/assets/image.82ca8574.js +1 -0
  111. package/alist-web/assets/index-legacy.0bd3a7f2.js +1 -0
  112. package/alist-web/assets/index-legacy.40b50240.js +1 -0
  113. package/alist-web/assets/index-legacy.61172c95.js +1 -0
  114. package/alist-web/assets/index-legacy.840e3d82.js +18 -0
  115. package/alist-web/assets/index-legacy.91fe7355.js +1 -0
  116. package/alist-web/assets/index-legacy.a7c40fe3.js +22 -0
  117. package/alist-web/assets/index-legacy.d72e643a.js +1 -0
  118. package/alist-web/assets/index-legacy.efef9df2.js +1 -0
  119. package/alist-web/assets/index-legacy.fb7fb711.js +1 -0
  120. package/alist-web/assets/index.0adfc44b.js +1 -0
  121. package/alist-web/assets/index.26f5b473.js +14 -0
  122. package/alist-web/assets/index.72e3f724.js +1 -0
  123. package/alist-web/assets/index.7409b67a.js +1 -0
  124. package/alist-web/assets/index.952b63b2.js +1 -0
  125. package/alist-web/assets/index.afa471fc.js +1 -0
  126. package/alist-web/assets/index.c15f7469.js +2 -0
  127. package/alist-web/assets/index.c4c82a28.css +1 -0
  128. package/alist-web/assets/index.dcae211e.js +1 -0
  129. package/alist-web/assets/index.fae3cea4.js +333 -0
  130. package/alist-web/assets/indexes-legacy.2c89d2d8.js +1 -0
  131. package/alist-web/assets/indexes.9cb6f537.js +2 -0
  132. package/alist-web/assets/ipa-legacy.7a49e0e2.js +1 -0
  133. package/alist-web/assets/ipa.97543f5f.js +1 -0
  134. package/alist-web/assets/item_type-legacy.d1f1c701.js +1 -0
  135. package/alist-web/assets/item_type.be442da4.js +1 -0
  136. package/alist-web/assets/lg.22b72ba5.ttf +0 -0
  137. package/alist-web/assets/lg.f2fe1c00.svg +54 -0
  138. package/alist-web/assets/lg.fefc5c0d.woff +0 -0
  139. package/alist-web/assets/loading.298ad3ff.gif +0 -0
  140. package/alist-web/assets/markdown-legacy.164943d8.js +1 -0
  141. package/alist-web/assets/markdown.3a932f53.js +1 -0
  142. package/alist-web/assets/markdown_with_word_wrap-legacy.5e032546.js +1 -0
  143. package/alist-web/assets/markdown_with_word_wrap.0efe2540.js +1 -0
  144. package/alist-web/assets/offline_download-legacy.11c4744c.js +1 -0
  145. package/alist-web/assets/offline_download.940ca54b.js +1 -0
  146. package/alist-web/assets/plist-legacy.c76fc720.js +1 -0
  147. package/alist-web/assets/plist.3c9cbb1a.js +1 -0
  148. package/alist-web/assets/polyfills-legacy.5f28c7ae.js +1 -0
  149. package/alist-web/assets/subtitles-octopus-worker.62892886.wasm +0 -0
  150. package/alist-web/assets/subtitles-octopus-worker.f95f2186.js +1 -0
  151. package/alist-web/assets/text-editor-legacy.6e126724.js +1 -0
  152. package/alist-web/assets/text-editor.45600bb2.js +11 -0
  153. package/alist-web/assets/url-legacy.e95c5b8b.js +1 -0
  154. package/alist-web/assets/url.f7914d75.js +1 -0
  155. package/alist-web/assets/useTitle-legacy.e942225f.js +1 -0
  156. package/alist-web/assets/useTitle.630c0b7f.js +1 -0
  157. package/alist-web/assets/video-legacy.5198eeb8.js +135 -0
  158. package/alist-web/assets/video.afae2b68.js +9 -0
  159. package/alist-web/assets/video360-legacy.227ed7df.js +16 -0
  160. package/alist-web/assets/video360.c8385eb2.js +18 -0
  161. package/alist-web/assets/video360.f0192288.css +1 -0
  162. package/alist-web/assets/video_box-legacy.d60b6928.js +7 -0
  163. package/alist-web/assets/video_box.bfb0d4a5.js +18 -0
  164. package/alist-web/assets/webauthn-json.browser-ponyfill-legacy.8ddd819a.js +1 -0
  165. package/alist-web/assets/webauthn-json.browser-ponyfill.1c672167.js +1 -0
  166. package/alist-web/images/figplayer.webp +0 -0
  167. package/alist-web/images/fileball.webp +0 -0
  168. package/alist-web/images/iina.webp +0 -0
  169. package/alist-web/images/infuse.webp +0 -0
  170. package/alist-web/images/mxplayer-pro.webp +0 -0
  171. package/alist-web/images/mxplayer.webp +0 -0
  172. package/alist-web/images/nplayer.webp +0 -0
  173. package/alist-web/images/omniplayer.webp +0 -0
  174. package/alist-web/images/potplayer.webp +0 -0
  175. package/alist-web/images/vlc.webp +0 -0
  176. package/alist-web/index.html +81 -0
  177. package/alist-web/package.json +95 -0
  178. package/alist-web/static/epub.js/viewer.html +467 -0
  179. package/alist-web/static/manifest.json +13 -0
  180. package/alist-web/streamer/mitm.html +186 -0
  181. package/alist-web/streamer/sw.js +141 -0
  182. package/css/alist_skin_v2.css +410 -410
  183. package/css/alist_skin_v3.css +216 -218
  184. package/css/alist_wallpaper.css +49 -48
  185. package/css/colorful.css +65 -65
  186. package/css/font-awesome.css +10569 -10568
  187. package/css/lxgw-style.css +12 -6
  188. package/css/lxgwwenkai-bold.css +873 -873
  189. package/css/lxgwwenkai-light.css +873 -873
  190. package/css/lxgwwenkai-regular.css +873 -873
  191. package/css/lxgwwenkaimono-bold.css +873 -873
  192. package/css/lxgwwenkaimono-light.css +873 -873
  193. package/css/lxgwwenkaimono-regular.css +873 -873
  194. package/package.json +2 -2
  195. package/favicon.ico +0 -0
@@ -0,0 +1,186 @@
1
+ <!--
2
+ mitm.html is the lite "man in the middle"
3
+ This is only meant to signal the opener's messageChannel to
4
+ the service worker - when that is done this mitm can be closed
5
+ but it's better to keep it alive since this also stops the sw
6
+ from restarting
7
+ The service worker is capable of intercepting all request and fork their
8
+ own "fake" response - wish we are going to craft
9
+ when the worker then receives a stream then the worker will tell the opener
10
+ to open up a link that will start the download
11
+ -->
12
+ <script>
13
+ // This will prevent the sw from restarting
14
+ let keepAlive = () => {
15
+ keepAlive = () => {}
16
+ var ping = location.href.substr(0, location.href.lastIndexOf("/")) + "/ping"
17
+ var interval = setInterval(() => {
18
+ if (sw) {
19
+ sw.postMessage("ping")
20
+ } else {
21
+ fetch(ping).then((res) => res.text(!res.ok && clearInterval(interval)))
22
+ }
23
+ }, 10000)
24
+ }
25
+
26
+ // message event is the first thing we need to setup a listener for
27
+ // don't want the opener to do a random timeout - instead they can listen for
28
+ // the ready event
29
+ // but since we need to wait for the Service Worker registration, we store the
30
+ // message for later
31
+ let messages = []
32
+ window.onmessage = (evt) => messages.push(evt)
33
+
34
+ let sw = null
35
+ let scope = ""
36
+
37
+ function registerWorker() {
38
+ return navigator.serviceWorker
39
+ .getRegistration("./")
40
+ .then((swReg) => {
41
+ return (
42
+ swReg || navigator.serviceWorker.register("sw.js", { scope: "./" })
43
+ )
44
+ })
45
+ .then((swReg) => {
46
+ const swRegTmp = swReg.installing || swReg.waiting
47
+
48
+ scope = swReg.scope
49
+
50
+ return (
51
+ (sw = swReg.active) ||
52
+ new Promise((resolve) => {
53
+ swRegTmp.addEventListener(
54
+ "statechange",
55
+ (fn = () => {
56
+ if (swRegTmp.state === "activated") {
57
+ swRegTmp.removeEventListener("statechange", fn)
58
+ sw = swReg.active
59
+ resolve()
60
+ }
61
+ })
62
+ )
63
+ })
64
+ )
65
+ })
66
+ }
67
+
68
+ // Now that we have the Service Worker registered we can process messages
69
+ function onMessage(event) {
70
+ let { data, ports, origin } = event
71
+
72
+ // It's important to have a messageChannel, don't want to interfere
73
+ // with other simultaneous downloads
74
+ if (!ports || !ports.length) {
75
+ throw new TypeError("[StreamSaver] You didn't send a messageChannel")
76
+ }
77
+
78
+ if (typeof data !== "object") {
79
+ throw new TypeError("[StreamSaver] You didn't send a object")
80
+ }
81
+
82
+ // the default public service worker for StreamSaver is shared among others.
83
+ // so all download links needs to be prefixed to avoid any other conflict
84
+ data.origin = origin
85
+
86
+ // if we ever (in some feature version of streamsaver) would like to
87
+ // redirect back to the page of who initiated a http request
88
+ data.referrer = data.referrer || document.referrer || origin
89
+
90
+ // pass along version for possible backwards compatibility in sw.js
91
+ data.streamSaverVersion = new URLSearchParams(location.search).get(
92
+ "version"
93
+ )
94
+
95
+ if (data.streamSaverVersion === "1.2.0") {
96
+ console.warn("[StreamSaver] please update streamsaver")
97
+ }
98
+
99
+ /** @since v2.0.0 */
100
+ if (!data.headers) {
101
+ console.warn(
102
+ "[StreamSaver] pass `data.headers` that you would like to pass along to the service worker\nit should be a 2D array or a key/val object that fetch's Headers api accepts"
103
+ )
104
+ } else {
105
+ // test if it's correct
106
+ // should thorw a typeError if not
107
+ new Headers(data.headers)
108
+ }
109
+
110
+ /** @since v2.0.0 */
111
+ if (typeof data.filename === "string") {
112
+ console.warn(
113
+ "[StreamSaver] You shouldn't send `data.filename` anymore. It should be included in the Content-Disposition header option"
114
+ )
115
+ // Do what File constructor do with fileNames
116
+ data.filename = data.filename.replace(/\//g, ":")
117
+ }
118
+
119
+ /** @since v2.0.0 */
120
+ if (data.size) {
121
+ console.warn(
122
+ "[StreamSaver] You shouldn't send `data.size` anymore. It should be included in the content-length header option"
123
+ )
124
+ }
125
+
126
+ /** @since v2.0.0 */
127
+ if (data.readableStream) {
128
+ console.warn(
129
+ "[StreamSaver] You should send the readableStream in the messageChannel, not through mitm"
130
+ )
131
+ }
132
+
133
+ /** @since v2.0.0 */
134
+ if (!data.pathname) {
135
+ console.warn(
136
+ "[StreamSaver] Please send `data.pathname` (eg: /pictures/summer.jpg)"
137
+ )
138
+ data.pathname = Math.random().toString().slice(-6) + "/" + data.filename
139
+ }
140
+
141
+ // remove all leading slashes
142
+ data.pathname = data.pathname.replace(/^\/+/g, "")
143
+
144
+ // remove protocol
145
+ let org = origin.replace(/(^\w+:|^)\/\//, "")
146
+
147
+ // set the absolute pathname to the download url.
148
+ data.url = new URL(`${scope + org}/${data.pathname}`).toString()
149
+
150
+ if (!data.url.startsWith(`${scope + org}/`)) {
151
+ throw new TypeError("[StreamSaver] bad `data.pathname`")
152
+ }
153
+
154
+ // This sends the message data as well as transferring
155
+ // messageChannel.port2 to the service worker. The service worker can
156
+ // then use the transferred port to reply via postMessage(), which
157
+ // will in turn trigger the onmessage handler on messageChannel.port1.
158
+
159
+ const transferable = data.readableStream
160
+ ? [ports[0], data.readableStream]
161
+ : [ports[0]]
162
+
163
+ if (!(data.readableStream || data.transferringReadable)) {
164
+ keepAlive()
165
+ }
166
+
167
+ return sw.postMessage(data, transferable)
168
+ }
169
+
170
+ if (window.opener) {
171
+ // The opener can't listen to onload event, so we need to help em out!
172
+ // (telling them that we are ready to accept postMessage's)
173
+ window.opener.postMessage("StreamSaver::loadedPopup", "*")
174
+ }
175
+
176
+ if (navigator.serviceWorker) {
177
+ registerWorker().then(() => {
178
+ window.onmessage = onMessage
179
+ messages.forEach(window.onmessage)
180
+ })
181
+ } else {
182
+ // FF can ping sw with fetch from a secure hidden iframe
183
+ // shouldn't really be possible?
184
+ keepAlive()
185
+ }
186
+ </script>
@@ -0,0 +1,141 @@
1
+ /* global self ReadableStream Response */
2
+
3
+ self.addEventListener("install", () => {
4
+ self.skipWaiting()
5
+ })
6
+
7
+ self.addEventListener("activate", (event) => {
8
+ event.waitUntil(self.clients.claim())
9
+ })
10
+
11
+ const map = new Map()
12
+
13
+ // This should be called once per download
14
+ // Each event has a dataChannel that the data will be piped through
15
+ self.onmessage = (event) => {
16
+ // We send a heartbeat every x second to keep the
17
+ // service worker alive if a transferable stream is not sent
18
+ if (event.data === "ping") {
19
+ return
20
+ }
21
+
22
+ const data = event.data
23
+ const downloadUrl =
24
+ data.url ||
25
+ self.registration.scope +
26
+ Math.random() +
27
+ "/" +
28
+ (typeof data === "string" ? data : data.filename)
29
+ const port = event.ports[0]
30
+ const metadata = new Array(3) // [stream, data, port]
31
+
32
+ metadata[1] = data
33
+ metadata[2] = port
34
+
35
+ // Note to self:
36
+ // old streamsaver v1.2.0 might still use `readableStream`...
37
+ // but v2.0.0 will always transfer the stream through MessageChannel #94
38
+ if (event.data.readableStream) {
39
+ metadata[0] = event.data.readableStream
40
+ } else if (event.data.transferringReadable) {
41
+ port.onmessage = (evt) => {
42
+ port.onmessage = null
43
+ metadata[0] = evt.data.readableStream
44
+ }
45
+ } else {
46
+ metadata[0] = createStream(port)
47
+ }
48
+
49
+ map.set(downloadUrl, metadata)
50
+ port.postMessage({ download: downloadUrl })
51
+ }
52
+
53
+ function createStream(port) {
54
+ // ReadableStream is only supported by chrome 52
55
+ return new ReadableStream({
56
+ start(controller) {
57
+ // When we receive data on the messageChannel, we write
58
+ port.onmessage = ({ data }) => {
59
+ if (data === "end") {
60
+ return controller.close()
61
+ }
62
+
63
+ if (data === "abort") {
64
+ controller.error("Aborted the download")
65
+ return
66
+ }
67
+
68
+ controller.enqueue(data)
69
+ }
70
+ },
71
+ cancel() {
72
+ console.log("user aborted")
73
+ },
74
+ })
75
+ }
76
+
77
+ self.onfetch = (event) => {
78
+ const url = event.request.url
79
+
80
+ // this only works for Firefox
81
+ if (url.endsWith("/ping")) {
82
+ return event.respondWith(new Response("pong"))
83
+ }
84
+
85
+ const hijacke = map.get(url)
86
+
87
+ if (!hijacke) return null
88
+
89
+ const [stream, data, port] = hijacke
90
+
91
+ map.delete(url)
92
+
93
+ // Not comfortable letting any user control all headers
94
+ // so we only copy over the length & disposition
95
+ const responseHeaders = new Headers({
96
+ "Content-Type": "application/octet-stream; charset=utf-8",
97
+
98
+ // To be on the safe side, The link can be opened in a iframe.
99
+ // but octet-stream should stop it.
100
+ "Content-Security-Policy": "default-src 'none'",
101
+ "X-Content-Security-Policy": "default-src 'none'",
102
+ "X-WebKit-CSP": "default-src 'none'",
103
+ "X-XSS-Protection": "1; mode=block",
104
+ })
105
+
106
+ let headers = new Headers(data.headers || {})
107
+
108
+ if (headers.has("Content-Length")) {
109
+ responseHeaders.set("Content-Length", headers.get("Content-Length"))
110
+ }
111
+
112
+ if (headers.has("Content-Disposition")) {
113
+ responseHeaders.set(
114
+ "Content-Disposition",
115
+ headers.get("Content-Disposition")
116
+ )
117
+ }
118
+
119
+ // data, data.filename and size should not be used anymore
120
+ if (data.size) {
121
+ console.warn("Depricated")
122
+ responseHeaders.set("Content-Length", data.size)
123
+ }
124
+
125
+ let fileName = typeof data === "string" ? data : data.filename
126
+ if (fileName) {
127
+ console.warn("Depricated")
128
+ // Make filename RFC5987 compatible
129
+ fileName = encodeURIComponent(fileName)
130
+ .replace(/['()]/g, escape)
131
+ .replace(/\*/g, "%2A")
132
+ responseHeaders.set(
133
+ "Content-Disposition",
134
+ "attachment; filename*=UTF-8''" + fileName
135
+ )
136
+ }
137
+
138
+ event.respondWith(new Response(stream, { headers: responseHeaders }))
139
+
140
+ port.postMessage({ debug: "Download started" })
141
+ }