Skip to content

Commit

Permalink
Use URIR and not URIT in subsequent query for fallback aggregator
Browse files Browse the repository at this point in the history
Re:#367
  • Loading branch information
machawk1 committed Oct 14, 2024
1 parent aeacb6a commit 7ed2859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 3 additions & 2 deletions mink-plugin/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,11 @@ function getMementos (uri) {

setTimeout(animatePageActionIcon, 500)

log('in getMementos, sending "fetchTimeMap" message')
log(`in getMementos, sending "fetchTimeMap" message to service worker using ${timemapLocation}`)
chrome.runtime.sendMessage({
method: 'fetchTimeMap',
value: timemapLocation
value: timemapLocation,
urir: uri
})
}

Expand Down
11 changes: 4 additions & 7 deletions mink-plugin/mink.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ chrome.runtime.onMessage.addListener(
// memento_datetime: window.localStorage.getItem('memento_datetime')
// })
} else if (request.method === 'fetchTimeMap') {
fetchTimeMap(request.value, sender.tab.id)
fetchTimeMap(request.value, sender.tab.id, request.urir)
} else if (request.method === 'notify') {
chrome.notifications.create(
'id1', {
Expand Down Expand Up @@ -298,7 +298,7 @@ class ZeroMementos extends Error {
this.name = this.constructor.name
}
}
async function fetchTimeMap (uri, tabid) {
async function fetchTimeMap (uri, tabid, urir) {
log(`Fetching TimeMap for ${uri} in tab ${tabid}`)

fetch(uri)
Expand Down Expand Up @@ -342,10 +342,10 @@ async function fetchTimeMap (uri, tabid) {
} else if (err instanceof SyntaxError) {
logWithTrace("JSON parsing failed, switch up the aggregator")
log(`Previous aggregator endpoint: ${uri}`)
// TODO: obtain URI-R here (don't parse it from URI-T) to send as a param
chrome.tabs.sendMessage(tabid, {
method: 'tryNextAggregator',
uri: uri
}, startAgainWithNewAggregatorTempFunctionName)
uri: urir})
}
})
/*
Expand All @@ -360,9 +360,6 @@ async function fetchTimeMap (uri, tabid) {
*/
}

function startAgainWithNewAggregatorTempFunctionName () {
console.log('repeating query logic with a new aggregator')
}

function setBadgeText (value, tabid) {
let badgeValue = value
Expand Down

0 comments on commit 7ed2859

Please sign in to comment.