|
|
@ -1,8 +1,8 @@ |
|
|
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { |
|
|
|
const data = message.data; |
|
|
|
data.url = message.url; |
|
|
|
if (message.action === 'saveMedia') { |
|
|
|
fetch('https://media.gregoryleeman.com/api/items', { |
|
|
|
if (message.action === 'saveMusic') { |
|
|
|
fetch('https://music.gregoryleeman.com/api/items', { |
|
|
|
method: 'POST', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json' |
|
|
@ -19,8 +19,8 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { |
|
|
|
sendResponse({ success: false, error }); |
|
|
|
}); |
|
|
|
return true; // Keep the message channel open for async response
|
|
|
|
} else if ( message.action == 'checkMedia' ) { |
|
|
|
fetch('https://media.gregoryleeman.com/api/items/check?url=' + encodeURIComponent(data.url), { |
|
|
|
} else if ( message.action == 'checkMusic' ) { |
|
|
|
fetch('https://music.gregoryleeman.com/api/items/check?url=' + encodeURIComponent(data.url), { |
|
|
|
method: 'GET', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json' |