Просмотр исходного кода

fix #2218: don't blacklist the installed scripts

tophf 1 год назад
Родитель
Сommit
da79ffc801
2 измененных файлов с 5 добавлено и 3 удалено
  1. 2 2
      src/background/utils/url.js
  2. 3 1
      src/confirm/views/app.vue

+ 2 - 2
src/background/utils/url.js

@@ -9,8 +9,8 @@ export const requestLimited = limitConcurrency(request, 4, 100, 1000,
 );
 );
 
 
 addOwnCommands({
 addOwnCommands({
-  async Request({ url, ...opts }) {
-    const vettedUrl = vetUrl(url);
+  async Request({ url, vet, ...opts }) {
+    const vettedUrl = vet ? vetUrl(url) : url;
     const fn = isRemote(vettedUrl) && !isCdnUrlRe.test(vettedUrl)
     const fn = isRemote(vettedUrl) && !isCdnUrlRe.test(vettedUrl)
       ? requestLimited
       ? requestLimited
       : request;
       : request;

+ 3 - 1
src/confirm/views/app.vue

@@ -386,13 +386,15 @@ async function loadDeps() {
 function closeTab() {
 function closeTab() {
   sendCmdDirectly('TabClose');
   sendCmdDirectly('TabClose');
 }
 }
-async function getFile(url, { isBlob, useCache } = {}) {
+async function getFile(url, opts) {
+  const { isBlob, useCache } = opts || {};
   const cacheKey = isBlob ? `blob+${url}` : `text+${url}`;
   const cacheKey = isBlob ? `blob+${url}` : `text+${url}`;
   if (useCache && cache.has(cacheKey)) {
   if (useCache && cache.has(cacheKey)) {
     return cache.get(cacheKey);
     return cache.get(cacheKey);
   }
   }
   const { data } = await sendCmdDirectly('Request', {
   const { data } = await sendCmdDirectly('Request', {
     url,
     url,
+    vet: !!opts, // TODO: add a blacklist for installation URLs?
     [kResponseType]: isBlob ? 'blob' : null,
     [kResponseType]: isBlob ? 'blob' : null,
   });
   });
   if (useCache) cache.put(cacheKey, data);
   if (useCache) cache.put(cacheKey, data);