feat: initialize gomdown-helper with yt-dlp transfer flow
This commit is contained in:
83
packages/chrome/.vite/manifest.json
Normal file
83
packages/chrome/.vite/manifest.json
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"../../../../../@crx/manifest": {
|
||||
"file": "assets/crx-manifest.js--9ZsUvq0.js",
|
||||
"name": "crx-manifest.js",
|
||||
"src": "../../../../../@crx/manifest",
|
||||
"isEntry": true
|
||||
},
|
||||
"_browser-polyfill-CZ_dLIqp.js": {
|
||||
"file": "assets/browser-polyfill-CZ_dLIqp.js",
|
||||
"name": "browser-polyfill"
|
||||
},
|
||||
"_client-CBvt1tWS.js": {
|
||||
"file": "assets/client-CBvt1tWS.js",
|
||||
"name": "client",
|
||||
"imports": [
|
||||
"_browser-polyfill-CZ_dLIqp.js"
|
||||
]
|
||||
},
|
||||
"_downloadIntent-Dv31jC2S.js": {
|
||||
"file": "assets/downloadIntent-Dv31jC2S.js",
|
||||
"name": "downloadIntent"
|
||||
},
|
||||
"_index.ts-loader-DMyyuf2n.js": {
|
||||
"file": "assets/index.ts-loader-DMyyuf2n.js",
|
||||
"src": "_index.ts-loader-DMyyuf2n.js"
|
||||
},
|
||||
"_settings-Bo6W9Drl.js": {
|
||||
"file": "assets/settings-Bo6W9Drl.js",
|
||||
"name": "settings",
|
||||
"imports": [
|
||||
"_browser-polyfill-CZ_dLIqp.js"
|
||||
]
|
||||
},
|
||||
"src/background/index.ts": {
|
||||
"file": "assets/index.ts-U2ACoZ75.js",
|
||||
"name": "index.ts",
|
||||
"src": "src/background/index.ts",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_browser-polyfill-CZ_dLIqp.js",
|
||||
"_downloadIntent-Dv31jC2S.js",
|
||||
"_settings-Bo6W9Drl.js"
|
||||
]
|
||||
},
|
||||
"src/config/index.html": {
|
||||
"file": "assets/index.html-B0Kfv8fq.js",
|
||||
"name": "index.html",
|
||||
"src": "src/config/index.html",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_client-CBvt1tWS.js",
|
||||
"_settings-Bo6W9Drl.js",
|
||||
"_browser-polyfill-CZ_dLIqp.js"
|
||||
],
|
||||
"css": [
|
||||
"assets/index-B2D5FcJM.css"
|
||||
]
|
||||
},
|
||||
"src/content/index.ts": {
|
||||
"file": "assets/index.ts-BGLNJwsP.js",
|
||||
"name": "index.ts",
|
||||
"src": "src/content/index.ts",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_browser-polyfill-CZ_dLIqp.js",
|
||||
"_downloadIntent-Dv31jC2S.js"
|
||||
]
|
||||
},
|
||||
"src/popup/index.html": {
|
||||
"file": "assets/index.html-Tb8yZAds.js",
|
||||
"name": "index.html",
|
||||
"src": "src/popup/index.html",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_client-CBvt1tWS.js",
|
||||
"_browser-polyfill-CZ_dLIqp.js",
|
||||
"_settings-Bo6W9Drl.js"
|
||||
],
|
||||
"css": [
|
||||
"assets/index-D6aWDpYY.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
86
packages/chrome/_locales/en/messages.json
Normal file
86
packages/chrome/_locales/en/messages.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"appName": {
|
||||
"message": "Motrix WebExtension",
|
||||
"description": "The name of the application"
|
||||
},
|
||||
"appShortName": {
|
||||
"message": "Motrix WebExt",
|
||||
"description": "The short_name (maximum of 12 characters recommended) is a short version of the app's name."
|
||||
},
|
||||
"appDescription": {
|
||||
"message": "WebExtension for Motrix download manager",
|
||||
"description": "The description of the application"
|
||||
},
|
||||
"browserActionTitle": {
|
||||
"message": "Motrix WebExtension",
|
||||
"description": "The title of the browser action button"
|
||||
},
|
||||
"extensionStatus": {
|
||||
"message": "Extension status:",
|
||||
"description": "Extension status"
|
||||
},
|
||||
"enableNotifications": {
|
||||
"message": "Enable notifications:",
|
||||
"description": "Enable Notifications"
|
||||
},
|
||||
"setKey": {
|
||||
"message": "Set Key",
|
||||
"description": "Set Key"
|
||||
},
|
||||
"setMinSize": {
|
||||
"message": "Set minimum file size (mb)",
|
||||
"description": "Set minimum file size"
|
||||
},
|
||||
"setSize": {
|
||||
"message": "Set size",
|
||||
"description": "Set size"
|
||||
},
|
||||
"keyInputPlaceholder": {
|
||||
"message": "Motrix API Key",
|
||||
"description": "Motrix API Key"
|
||||
},
|
||||
"blacklist": {
|
||||
"message": "Blacklist",
|
||||
"description": "Blacklist"
|
||||
},
|
||||
"saveBlacklist": {
|
||||
"message": "Save blacklist",
|
||||
"description": "Save blacklist"
|
||||
},
|
||||
"darkMode": {
|
||||
"message": "Dark mode",
|
||||
"description": "Dark mode"
|
||||
},
|
||||
"showOnlyAria": {
|
||||
"message": "Show only Motrix downloads in the popup",
|
||||
"description": "Show only Motrix downloads in the popup"
|
||||
},
|
||||
"hideChromeBar": {
|
||||
"message": "Hide chrome download bar",
|
||||
"description": "Hide chrome download bar"
|
||||
},
|
||||
"showContextOption": {
|
||||
"message": "Show \"Download with gdown\" context option",
|
||||
"description": "Show \"Download with gdown\" context option"
|
||||
},
|
||||
"downloadWithMotrix": {
|
||||
"message": "Download with gdown",
|
||||
"description": "Download with gdown"
|
||||
},
|
||||
"setPort": {
|
||||
"message": "Set Port",
|
||||
"description": "Set Port"
|
||||
},
|
||||
"downloadFallback": {
|
||||
"message": "If launching in gdown fails, use the browser's default download manager",
|
||||
"description": "If launching in gdown fails, use the browser's default download manager"
|
||||
},
|
||||
"useNativeHost": {
|
||||
"message": "Use Native Messaging host for downloads",
|
||||
"description": "Use Native Messaging host for downloads"
|
||||
},
|
||||
"activateAppOnDownload": {
|
||||
"message": "Activate gdown app when transfer starts",
|
||||
"description": "Activate gdown app when transfer starts"
|
||||
}
|
||||
}
|
||||
86
packages/chrome/_locales/zh/messages.json
Normal file
86
packages/chrome/_locales/zh/messages.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"appName": {
|
||||
"message": "Motrix 网页扩展",
|
||||
"description": "应用程序名称"
|
||||
},
|
||||
"appShortName": {
|
||||
"message": "Motrix 扩展",
|
||||
"description": "应用程序缩略名称"
|
||||
},
|
||||
"appDescription": {
|
||||
"message": "用于 Motrix 下载管理器的网页扩展",
|
||||
"description": "应用程序描述"
|
||||
},
|
||||
"browserActionTitle": {
|
||||
"message": "Motrix 网页扩展",
|
||||
"description": "浏览器操作按钮标题"
|
||||
},
|
||||
"extensionStatus": {
|
||||
"message": "扩展状态",
|
||||
"description": "扩展状态"
|
||||
},
|
||||
"enableNotifications": {
|
||||
"message": "允许桌面通知",
|
||||
"description": "允许桌面通知"
|
||||
},
|
||||
"setKey": {
|
||||
"message": "设置密钥",
|
||||
"description": "设置密钥"
|
||||
},
|
||||
"setMinSize": {
|
||||
"message": "设置最小下载文件 (mb)",
|
||||
"description": "设置最小下载文件"
|
||||
},
|
||||
"setSize": {
|
||||
"message": "设置大小",
|
||||
"description": "设置大小"
|
||||
},
|
||||
"keyInputPlaceholder": {
|
||||
"message": "Motrix API 密钥",
|
||||
"description": "Motrix API 密钥"
|
||||
},
|
||||
"blacklist": {
|
||||
"message": "黑名单",
|
||||
"description": "黑名单"
|
||||
},
|
||||
"saveBlacklist": {
|
||||
"message": "保存黑名单",
|
||||
"description": "保存黑名单"
|
||||
},
|
||||
"darkMode": {
|
||||
"message": "深色模式",
|
||||
"description": "深色模式"
|
||||
},
|
||||
"showOnlyAria": {
|
||||
"message": "在弹出窗口中仅显示 Motrix 下载",
|
||||
"description": "在弹出窗口中仅显示 Motrix 下载"
|
||||
},
|
||||
"hideChromeBar": {
|
||||
"message": "隐藏 Chrome 下载栏",
|
||||
"description": "隐藏 Chrome 下载栏"
|
||||
},
|
||||
"showContextOption": {
|
||||
"message": "显示“使用 gdown 下载”右键选项",
|
||||
"description": "显示“使用 gdown 下载”右键选项"
|
||||
},
|
||||
"downloadWithMotrix": {
|
||||
"message": "使用 gdown 下载",
|
||||
"description": "使用 gdown 下载"
|
||||
},
|
||||
"setPort": {
|
||||
"message": "设置端口",
|
||||
"description": "设置端口"
|
||||
},
|
||||
"downloadFallback": {
|
||||
"message": "如果 gdown 启动失败,则使用浏览器的默认下载管理器",
|
||||
"description": "如果 gdown 启动失败,则使用浏览器的默认下载管理器"
|
||||
},
|
||||
"useNativeHost": {
|
||||
"message": "使用 Native Messaging 主机传输下载",
|
||||
"description": "使用 Native Messaging 主机传输下载"
|
||||
},
|
||||
"activateAppOnDownload": {
|
||||
"message": "下载转交时激活 gdown 应用",
|
||||
"description": "下载转交时激活 gdown 应用"
|
||||
}
|
||||
}
|
||||
1
packages/chrome/assets/browser-polyfill-CZ_dLIqp.js
Normal file
1
packages/chrome/assets/browser-polyfill-CZ_dLIqp.js
Normal file
File diff suppressed because one or more lines are too long
8
packages/chrome/assets/client-CBvt1tWS.js
Normal file
8
packages/chrome/assets/client-CBvt1tWS.js
Normal file
File diff suppressed because one or more lines are too long
1
packages/chrome/assets/downloadIntent-Dv31jC2S.js
Normal file
1
packages/chrome/assets/downloadIntent-Dv31jC2S.js
Normal file
@@ -0,0 +1 @@
|
||||
const s=/\.(zip|7z|rar|tar|gz|bz2|xz|dmg|pkg|exe|msi|iso|torrent|pdf|mp4|mkv|mp3|flac|apk|deb|rpm|ipa|img|bin)(?:$|[?#])/i,p=/^(text\/html|text\/plain|application\/json|application\/javascript|application\/xml|text\/xml)/i,d=/(^|\/)(download|downloads|dl|get|file|files|attachment|attachments)(\/|$)/i;function i(n,t){try{return new URL(n,t)}catch{return null}}function w(n,t){const e=i(n,t);return e?e.toString():String(n||"")}function a(n,t){const e=i(n,t);return e?s.test(e.pathname||""):s.test(String(n||""))}function g(n){const t=String(n||"").replace(/-/g,"+").replace(/_/g,"/");try{return atob(t)}catch{return""}}function m(n){if(!d.test(n))return!1;const t=String(n||"").split("/").filter(Boolean),e=t[t.length-1]||"";return!e||e.includes(".")?!1:/^[a-z0-9_-]{12,}$/i.test(e)}function h(n){const t=n.searchParams,e=t.get("golink");if(e){const r=g(e);if(r&&s.test(r))return!0}const o=t.get("filename")||t.get("file")||t.get("name")||t.get("out");return!!(o&&s.test(o)||t.has("attachment")||t.has("download"))}function y(n,t){const e=i(n,t);return!e||!["http:","https:","ftp:"].includes(e.protocol)?!1:!!(a(e.toString())||h(e)||m(e.pathname||""))}function L(n){const t=Array.isArray(n?.responseHeaders)?n.responseHeaders:[],e=l=>{const c=String(l||"").toLowerCase(),u=t.find(f=>String(f?.name||"").toLowerCase()===c);return String(u?.value||"")},o=e("content-disposition").toLowerCase(),r=e("content-type").toLowerCase();return o.includes("attachment")||a(n.url||"")?!0:!r||p.test(r)?!1:r.startsWith("application/")||r.startsWith("audio/")||r.startsWith("video/")}export{L as a,y as i,w as n};
|
||||
1
packages/chrome/assets/index-B2D5FcJM.css
Normal file
1
packages/chrome/assets/index-B2D5FcJM.css
Normal file
@@ -0,0 +1 @@
|
||||
:root{color-scheme:dark;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}body{margin:0;background:#141820;color:#e6ebf7}.wrap{max-width:860px;margin:0 auto;padding:24px;display:grid;gap:12px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.card{background:#1f2530;border:1px solid #323b4a;border-radius:10px;padding:12px;display:grid;gap:8px}label{font-size:12px;color:#aeb8cc}input,textarea{border:1px solid #3c4658;border-radius:7px;background:#121721;color:#e6ebf7;padding:8px 10px}input[type=checkbox]{width:16px;height:16px}.row{display:flex;align-items:center;justify-content:space-between;gap:8px}.actions{display:flex;gap:8px}button{border:1px solid #5967f4;background:#5967f4;color:#fff;border-radius:8px;padding:8px 12px;font-weight:600;cursor:pointer}button.ghost{background:#232a36;border-color:#3b4658}@media(max-width:900px){.grid{grid-template-columns:1fr}}
|
||||
1
packages/chrome/assets/index-D6aWDpYY.css
Normal file
1
packages/chrome/assets/index-D6aWDpYY.css
Normal file
@@ -0,0 +1 @@
|
||||
:root{color-scheme:dark;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}body{margin:0;background:#151821;color:#e7ebf7;width:360px}.container{padding:14px;display:grid;gap:10px}h1{margin:0;font-size:14px}.field{display:grid;gap:6px}label{font-size:12px;color:#aeb6cc}input[type=text],input[type=number]{height:32px;border:1px solid #3e4658;border-radius:6px;padding:0 10px;background:#202532;color:#e7ebf7}.toggle{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:#cdd5ea}button{height:34px;border:1px solid #5562f0;border-radius:8px;background:#5562f0;color:#fff;font-weight:600;cursor:pointer}.media-panel{margin-top:6px;border:1px solid #384255;border-radius:8px;padding:8px;background:#1b202c;display:grid;gap:8px}.media-head{display:flex;align-items:center;justify-content:space-between;font-size:12px}.media-list{display:grid;gap:6px;max-height:150px;overflow:auto}.media-item{display:flex;align-items:center;justify-content:space-between;gap:8px}.media-meta{min-width:0;display:grid;gap:2px}.kind{font-size:11px;color:#8fc0ff}.url{font-size:11px;color:#c6d1e8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:250px}.mini{height:26px;min-width:44px;padding:0 8px;border-radius:6px;font-size:11px}.mini.ghost{background:#2a3140;border-color:#47546c;color:#d4def2}.empty{font-size:11px;color:#96a3bc}.status{font-size:12px;color:#8fe0a6;min-height:14px}
|
||||
3
packages/chrome/assets/index.html-B0Kfv8fq.js
Normal file
3
packages/chrome/assets/index.html-B0Kfv8fq.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import{c as p,j as e,R as a}from"./client-CBvt1tWS.js";import{g as j,s as m}from"./settings-Bo6W9Drl.js";import"./browser-polyfill-CZ_dLIqp.js";function u(){const[t,i]=a.useState(null),[l,r]=a.useState(""),[h,d]=a.useState("");a.useEffect(()=>{j().then(s=>{i(s),r((s.blacklist||[]).join(`
|
||||
`))})},[]);const n=(s,c)=>{i(o=>o&&{...o,[s]:c})},x=async()=>{if(!t)return;const s={...t,minFileSize:Number(t.minFileSize||0),motrixPort:Number(t.motrixPort||16800),blacklist:l.split(`
|
||||
`).map(c=>c.trim()).filter(Boolean)};await m(s),i(s),d("Saved"),window.setTimeout(()=>d(""),1500)};return t?e.jsxs("div",{className:"wrap",children:[e.jsx("h1",{children:"Gomdown Helper Settings"}),e.jsxs("div",{className:"grid",children:[e.jsxs("section",{className:"card",children:[e.jsx("label",{children:"RPC Secret"}),e.jsx("input",{value:t.motrixAPIkey,onChange:s=>n("motrixAPIkey",s.target.value)}),e.jsx("label",{children:"RPC Port"}),e.jsx("input",{type:"number",value:t.motrixPort,onChange:s=>n("motrixPort",Number(s.target.value||16800))}),e.jsx("label",{children:"Min file size (MB)"}),e.jsx("input",{type:"number",value:t.minFileSize,onChange:s=>n("minFileSize",Number(s.target.value||0))}),e.jsx("label",{children:"Blacklist (one per line)"}),e.jsx("textarea",{rows:8,value:l,onChange:s=>r(s.target.value)})]}),e.jsxs("section",{className:"card",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Extension enabled"}),e.jsx("input",{type:"checkbox",checked:t.extensionStatus,onChange:s=>n("extensionStatus",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Enable notifications"}),e.jsx("input",{type:"checkbox",checked:t.enableNotifications,onChange:s=>n("enableNotifications",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Use native host"}),e.jsx("input",{type:"checkbox",checked:t.useNativeHost,onChange:s=>n("useNativeHost",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Activate app on download"}),e.jsx("input",{type:"checkbox",checked:t.activateAppOnDownload,onChange:s=>n("activateAppOnDownload",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Hide browser download shelf"}),e.jsx("input",{type:"checkbox",checked:t.hideChromeBar,onChange:s=>n("hideChromeBar",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Show context menu option"}),e.jsx("input",{type:"checkbox",checked:t.showContextOption,onChange:s=>n("showContextOption",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Download fallback"}),e.jsx("input",{type:"checkbox",checked:t.downloadFallback,onChange:s=>n("downloadFallback",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Dark mode"}),e.jsx("input",{type:"checkbox",checked:t.darkMode,onChange:s=>n("darkMode",s.target.checked)})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{children:"Show only aria downloads"}),e.jsx("input",{type:"checkbox",checked:t.showOnlyAria,onChange:s=>n("showOnlyAria",s.target.checked)})]})]})]}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{onClick:x,children:"Save"}),e.jsx("button",{className:"ghost",onClick:()=>window.close(),children:"Close"})]}),e.jsx("div",{children:h})]}):e.jsx("div",{className:"wrap",children:"Loading..."})}p.createRoot(document.getElementById("root")).render(e.jsx(a.StrictMode,{children:e.jsx(u,{})}));
|
||||
1
packages/chrome/assets/index.html-Tb8yZAds.js
Normal file
1
packages/chrome/assets/index.html-Tb8yZAds.js
Normal file
@@ -0,0 +1 @@
|
||||
import{c as k,j as t,R as r}from"./client-CBvt1tWS.js";import{b as i}from"./browser-polyfill-CZ_dLIqp.js";import{g as N,s as m}from"./settings-Bo6W9Drl.js";function b(){const[s,d]=r.useState(null),[x,n]=r.useState(""),[l,u]=r.useState([]);r.useEffect(()=>{N().then(d)},[]),r.useEffect(()=>{let e=null;const a=async()=>{const o=await i.runtime.sendMessage({type:"media:list"});o?.ok&&Array.isArray(o.items)&&u(o.items.slice(0,10))};return a(),e=window.setInterval(()=>{a()},2e3),()=>{e!==null&&window.clearInterval(e)}},[]);const c=(e,a)=>{d(o=>o&&{...o,[e]:a})},h=async e=>{if(!s)return;const a={...s,extensionStatus:e};d(a),await m({extensionStatus:e}),n(e?"Extension ON":"Extension OFF"),window.setTimeout(()=>n(""),1200)},p=async()=>{s&&(await m(s),n("Saved"),window.setTimeout(()=>n(""),1200))},g=async()=>{const e=i.runtime.getURL("src/config/index.html");await i.tabs.create({url:e})},j=async()=>{const e=i.runtime.getURL("src/history/index.html");await i.tabs.create({url:e})},v=async()=>{const e=await i.runtime.sendMessage({type:"page:enqueue-ytdlp"});n(e?.ok?"Active tab sent to gdown (yt-dlp)":`Send failed: ${e?.error||"unknown error"}`),window.setTimeout(()=>n(""),1800)},w=async e=>{const a=await i.runtime.sendMessage({type:"media:enqueue",url:e.url,referer:e.referer||""});n(a?.ok?"Media sent to gdown":`Send failed: ${a?.error||"unknown error"}`),window.setTimeout(()=>n(""),1600)},y=async()=>{await i.runtime.sendMessage({type:"media:clear"}),u([]),n("Captured media cleared"),window.setTimeout(()=>n(""),1200)};return s?t.jsxs("div",{className:"container",children:[t.jsx("h1",{children:"Gomdown Helper"}),t.jsxs("div",{className:"field",children:[t.jsx("label",{children:"RPC Secret"}),t.jsx("input",{type:"text",value:s.motrixAPIkey,onChange:e=>c("motrixAPIkey",e.target.value),placeholder:"aria2 rpc secret"})]}),t.jsxs("div",{className:"field",children:[t.jsx("label",{children:"RPC Port"}),t.jsx("input",{type:"number",value:s.motrixPort,onChange:e=>c("motrixPort",Number(e.target.value||16800))})]}),t.jsxs("label",{className:"toggle",children:["Extension Enabled",t.jsx("input",{type:"checkbox",checked:s.extensionStatus,onChange:e=>{h(e.target.checked)}})]}),t.jsxs("label",{className:"toggle",children:["Use Native Host",t.jsx("input",{type:"checkbox",checked:s.useNativeHost,onChange:e=>c("useNativeHost",e.target.checked)})]}),t.jsxs("label",{className:"toggle",children:["Activate gdown App",t.jsx("input",{type:"checkbox",checked:s.activateAppOnDownload,onChange:e=>c("activateAppOnDownload",e.target.checked)})]}),t.jsx("button",{onClick:p,children:"Save"}),t.jsx("button",{onClick:g,children:"Settings"}),t.jsx("button",{onClick:j,children:"History"}),t.jsx("button",{onClick:()=>{v()},children:"Send Active Tab (yt-dlp)"}),t.jsxs("div",{className:"media-panel",children:[t.jsxs("div",{className:"media-head",children:[t.jsx("strong",{children:"Captured Media"}),t.jsx("button",{className:"mini ghost",onClick:y,children:"Clear"})]}),l.length===0?t.jsx("div",{className:"empty",children:"No media captured yet"}):t.jsx("div",{className:"media-list",children:l.map(e=>t.jsxs("div",{className:"media-item",children:[t.jsxs("div",{className:"media-meta",children:[t.jsx("span",{className:"kind",children:e.kind.toUpperCase()}),t.jsx("span",{className:"url",children:e.url})]}),t.jsx("button",{className:"mini",onClick:()=>{w(e)},children:"Add"})]},e.id))})]}),t.jsx("div",{className:"status",children:x})]}):t.jsx("div",{className:"container",children:"Loading..."})}k.createRoot(document.getElementById("root")).render(t.jsx(r.StrictMode,{children:t.jsx(b,{})}));
|
||||
1
packages/chrome/assets/index.ts-BGLNJwsP.js
Normal file
1
packages/chrome/assets/index.ts-BGLNJwsP.js
Normal file
@@ -0,0 +1 @@
|
||||
import{b as w}from"./browser-polyfill-CZ_dLIqp.js";import{i as o,n as h}from"./downloadIntent-Dv31jC2S.js";const p=8e3,e=new Map;function m(){const r=Date.now();for(const[n,t]of e.entries())t<=r&&e.delete(n)}async function i(r,n){const t=h(r,window.location.href);if(!t)return!1;if(m(),e.has(t))return!0;e.set(t,Date.now()+p);try{if((await w.runtime.sendMessage({type:"capture-link-download",url:t,referer:n||document.referrer||window.location.href}))?.ok)return!0}catch{}return e.delete(t),!1}function u(r){return r?r instanceof HTMLAnchorElement?r:r instanceof Element?r.closest("a[href]"):null:null}function a(r){return!!(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey)}async function d(r){if(r.defaultPrevented||a(r))return;const n=u(r.target);if(!n)return;const t=n.href||"";!t||!o(t,window.location.href)||(r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),await i(t,document.referrer||window.location.href))}function l(r){const n=u(r.target);if(!n)return;const t=n.href||"";!t||!o(t,window.location.href)||a(r)||(r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),i(t,document.referrer||window.location.href))}document.addEventListener("pointerdown",r=>{r.button===0&&l(r)},!0);document.addEventListener("mousedown",r=>{r.button===0&&l(r)},!0);document.addEventListener("click",r=>{r.button===0&&d(r)},!0);document.addEventListener("keydown",r=>{if(r.key!=="Enter"||r.defaultPrevented||a(r))return;const n=u(r.target);if(!n)return;const t=n.href||"";!t||!o(t,window.location.href)||(r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),i(t,document.referrer||window.location.href))},!0);document.addEventListener("auxclick",r=>{r.button===1&&d(r)},!0);function g(){try{const r=window.open.bind(window);window.open=function(t,f,s){const c=String(t||"").trim();return c&&o(c,window.location.href)?(i(c,window.location.href),null):r(t,f,s)}}catch{}try{const r=HTMLAnchorElement.prototype.click;HTMLAnchorElement.prototype.click=function(){const t=this.href||this.getAttribute("href")||"";if(t&&o(t,window.location.href)){i(t,document.referrer||window.location.href);return}r.call(this)}}catch{}}g();
|
||||
1
packages/chrome/assets/index.ts-U2ACoZ75.js
Normal file
1
packages/chrome/assets/index.ts-U2ACoZ75.js
Normal file
File diff suppressed because one or more lines are too long
13
packages/chrome/assets/index.ts-loader-DMyyuf2n.js
Normal file
13
packages/chrome/assets/index.ts-loader-DMyyuf2n.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const injectTime = performance.now();
|
||||
(async () => {
|
||||
const { onExecute } = await import(
|
||||
/* @vite-ignore */
|
||||
chrome.runtime.getURL("assets/index.ts-BGLNJwsP.js")
|
||||
);
|
||||
onExecute?.({ perf: { injectTime, loadTime: performance.now() - injectTime } });
|
||||
})().catch(console.error);
|
||||
|
||||
})();
|
||||
1
packages/chrome/assets/settings-Bo6W9Drl.js
Normal file
1
packages/chrome/assets/settings-Bo6W9Drl.js
Normal file
@@ -0,0 +1 @@
|
||||
import{b as e}from"./browser-polyfill-CZ_dLIqp.js";const t={extensionStatus:!0,useNativeHost:!0,activateAppOnDownload:!0,enableNotifications:!0,hideChromeBar:!0,showContextOption:!0,downloadFallback:!1,darkMode:!1,showOnlyAria:!1,minFileSize:0,blacklist:[],motrixPort:16800,motrixAPIkey:""};async function n(){const o=await e.storage.sync.get(Object.keys(t));return{extensionStatus:!!(o.extensionStatus??t.extensionStatus),useNativeHost:!!(o.useNativeHost??t.useNativeHost),activateAppOnDownload:!!(o.activateAppOnDownload??t.activateAppOnDownload),enableNotifications:!!(o.enableNotifications??t.enableNotifications),hideChromeBar:!!(o.hideChromeBar??t.hideChromeBar),showContextOption:!!(o.showContextOption??t.showContextOption),downloadFallback:!!(o.downloadFallback??t.downloadFallback),darkMode:!!(o.darkMode??t.darkMode),showOnlyAria:!!(o.showOnlyAria??t.showOnlyAria),minFileSize:Number(o.minFileSize??t.minFileSize),blacklist:Array.isArray(o.blacklist)?o.blacklist.map(a=>String(a)):t.blacklist,motrixPort:Number(o.motrixPort??t.motrixPort),motrixAPIkey:String(o.motrixAPIkey??t.motrixAPIkey)}}async function s(o){await e.storage.sync.set(o)}export{n as g,s};
|
||||
BIN
packages/chrome/images/128.png
Normal file
BIN
packages/chrome/images/128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
packages/chrome/images/16.png
Normal file
BIN
packages/chrome/images/16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 597 B |
BIN
packages/chrome/images/32.png
Normal file
BIN
packages/chrome/images/32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/chrome/images/48.png
Normal file
BIN
packages/chrome/images/48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
packages/chrome/images/dwld.png
Normal file
BIN
packages/chrome/images/dwld.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 553 B |
BIN
packages/chrome/images/icon-large.png
Normal file
BIN
packages/chrome/images/icon-large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
68
packages/chrome/manifest.json
Normal file
68
packages/chrome/manifest.json
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Gomdown Helper",
|
||||
"description": "Send browser downloads to gdown",
|
||||
"version": "0.0.10",
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
"16": "images/16.png",
|
||||
"32": "images/32.png",
|
||||
"48": "images/48.png",
|
||||
"128": "images/128.png"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "service-worker-loader.js",
|
||||
"type": "module"
|
||||
},
|
||||
"action": {
|
||||
"default_popup": "src/popup/index.html",
|
||||
"default_title": "Gomdown Helper",
|
||||
"default_icon": {
|
||||
"16": "images/16.png",
|
||||
"32": "images/32.png",
|
||||
"48": "images/48.png",
|
||||
"128": "images/128.png"
|
||||
}
|
||||
},
|
||||
"options_page": "src/config/index.html",
|
||||
"content_scripts": [
|
||||
{
|
||||
"js": [
|
||||
"assets/index.ts-loader-DMyyuf2n.js"
|
||||
],
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
"downloads",
|
||||
"downloads.shelf",
|
||||
"notifications",
|
||||
"storage",
|
||||
"contextMenus",
|
||||
"cookies",
|
||||
"webRequest",
|
||||
"nativeMessaging"
|
||||
],
|
||||
"host_permissions": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"resources": [
|
||||
"images/*",
|
||||
"assets/browser-polyfill-CZ_dLIqp.js",
|
||||
"assets/downloadIntent-Dv31jC2S.js",
|
||||
"assets/index.ts-BGLNJwsP.js"
|
||||
],
|
||||
"use_dynamic_url": false
|
||||
}
|
||||
],
|
||||
"short_name": "Gomdown"
|
||||
}
|
||||
1
packages/chrome/service-worker-loader.js
Normal file
1
packages/chrome/service-worker-loader.js
Normal file
@@ -0,0 +1 @@
|
||||
import './assets/index.ts-U2ACoZ75.js';
|
||||
16
packages/chrome/src/config/index.html
Normal file
16
packages/chrome/src/config/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Gomdown Helper Settings</title>
|
||||
<script type="module" crossorigin src="/assets/index.html-B0Kfv8fq.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/browser-polyfill-CZ_dLIqp.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/client-CBvt1tWS.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/settings-Bo6W9Drl.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B2D5FcJM.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
16
packages/chrome/src/popup/index.html
Normal file
16
packages/chrome/src/popup/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Gomdown Helper</title>
|
||||
<script type="module" crossorigin src="/assets/index.html-Tb8yZAds.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/browser-polyfill-CZ_dLIqp.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/client-CBvt1tWS.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/settings-Bo6W9Drl.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-D6aWDpYY.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user