Skip to content

Commit

Permalink
Ajoute le support d'une clé (optionnel) PROXY_URL dans le manifest.js…
Browse files Browse the repository at this point in the history
…o… (#279)
  • Loading branch information
Write authored Jan 8, 2025
1 parent 5968784 commit a15614b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ophirofox/content_scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,24 @@ function permissionForPartner({ AUTH_URL }) {
return permission;
}

/**
* @param {string} partner_name
/**
* Makes a permissions request for the specified partner by checking
* if a PROXY_URL exists or falling back to a generic matching logic based on AUTH_URL.
*
* @param {string} partner_name
* @returns {{permissions: string[], origins: string[]}}
*/
function makePermissionsRequest(partner_name) {
const partner = ophirofox_config_list.find(({ name }) => name === partner_name);
if (!partner) throw new Error(`No partner found with name ${partner_name}`);
const permission = permissionForPartner(partner);

let permission = partner.PROXY_URL;
if (!permission) {
permission = permissionForPartner(partner);
}

if (!permission) throw new Error(`No valid permission found for partner "${partner_name}"`);

return { permissions: missing_permissions, origins: [permission] };
}

Expand Down

0 comments on commit a15614b

Please sign in to comment.