Skip to content

Commit

Permalink
Adagio Bid Adapter: decrease adapter weight (prebid#6699)
Browse files Browse the repository at this point in the history
  • Loading branch information
osazos authored and agrandes-tappx committed Sep 29, 2021
1 parent ccdacb6 commit 9c6ba14
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 64 deletions.
1 change: 0 additions & 1 deletion allowedModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
'modules': [
...sharedWhiteList,
'criteo-direct-rsa-validate',
'jsencrypt',
'crypto-js',
'live-connect' // Maintained by LiveIntent : https://github.com/liveintent-berlin/live-connect/
],
Expand Down
79 changes: 22 additions & 57 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,27 @@ import * as utils from '../src/utils.js';
import { config } from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { loadExternalScript } from '../src/adloader.js';
import JSEncrypt from 'jsencrypt/bin/jsencrypt.js';
import sha256 from 'crypto-js/sha256.js';
import { verify } from 'criteo-direct-rsa-validate/build/verify.js';
import { getStorageManager } from '../src/storageManager.js';
import { getRefererInfo } from '../src/refererDetection.js';
import { createEidsArray } from './userId/eids.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { Renderer } from '../src/Renderer.js';
import { OUTSTREAM } from '../src/video.js';

export const BIDDER_CODE = 'adagio';
export const LOG_PREFIX = 'Adagio:';
export const VERSION = '2.10.0';
export const FEATURES_VERSION = '1';
const BIDDER_CODE = 'adagio';
const LOG_PREFIX = 'Adagio:';
export const VERSION = '2.11.0';
const FEATURES_VERSION = '1';
export const ENDPOINT = 'https://mp.4dex.io/prebid';
export const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
export const ADAGIO_TAG_URL = 'https://script.4dex.io/localstore.js';
export const ADAGIO_LOCALSTORAGE_KEY = 'adagioScript';
export const GVLID = 617;
const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
const ADAGIO_TAG_URL = 'https://script.4dex.io/localstore.js';
const ADAGIO_LOCALSTORAGE_KEY = 'adagioScript';
const GVLID = 617;
export const storage = getStorageManager(GVLID, 'adagio');
export const RENDERER_URL = 'https://script.4dex.io/outstream-player.js';
export const MAX_SESS_DURATION = 30 * 60 * 1000;
export const ADAGIO_PUBKEY = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9el0+OEn6fvEh1RdVHQu4cnT0
jFSzIbGJJyg3cKqvtE6A0iaz9PkIdJIvSSSNrmJv+lRGKPEyRA/VnzJIieL39Ngl
t0b0lsHN+W4n9kitS/DZ/xnxWK/9vxhv0ZtL1LL/rwR5Mup7rmJbNtDoNBw4TIGj
pV6EP3MTLosuUEpLaQIDAQAB
-----END PUBLIC KEY-----`;
const MAX_SESS_DURATION = 30 * 60 * 1000;
const ADAGIO_PUBKEY = 'AL16XT44Sfp+8SHVF1UdC7hydPSMVLMhsYknKDdwqq+0ToDSJrP0+Qh0ki9JJI2uYm/6VEYo8TJED9WfMkiJ4vf02CW3RvSWwc35bif2SK1L8Nn/GfFYr/2/GG/Rm0vUsv+vBHky6nuuYls20Og0HDhMgaOlXoQ/cxMuiy5QSktp';
const ADAGIO_PUBKEY_E = 65537;

// This provide a whitelist and a basic validation
// of OpenRTB 2.5 options used by the Adagio SSP.
Expand Down Expand Up @@ -81,10 +75,7 @@ export function adagioScriptFromLocalStorageCb(ls) {
const hash = r[2];
const content = r[3];

var jsEncrypt = new JSEncrypt();
jsEncrypt.setPublicKey(ADAGIO_PUBKEY);

if (jsEncrypt.verify(content, hash, sha256)) {
if (verify(content, hash, ADAGIO_PUBKEY, ADAGIO_PUBKEY_E)) {
utils.logInfo(`${LOG_PREFIX} start script.`);
Function(ls)(); // eslint-disable-line no-new-func
} else {
Expand Down Expand Up @@ -524,19 +515,8 @@ function autoDetectAdUnitElementId(adUnitCode) {

function autoDetectEnvironment() {
const device = _features.getDevice();
let environment;
switch (device) {
case 2:
environment = 'desktop';
break;
case 4:
environment = 'mobile';
break;
case 5:
environment = 'tablet';
break;
};
return environment;
const map = { 2: 'desktop', 4: 'mobile', 5: 'tablet' };
return map[device] || 'unknown';
};

function supportIObs() {
Expand Down Expand Up @@ -653,25 +633,12 @@ function _getGdprConsent(bidderRequest) {
allowAuctionWithoutConsent
} = bidderRequest.gdprConsent;

const consent = {};

if (apiVersion !== undefined) {
consent.apiVersion = apiVersion;
}

if (consentString !== undefined) {
consent.consentString = consentString;
}

if (gdprApplies !== undefined) {
consent.consentRequired = (gdprApplies) ? 1 : 0;
}

if (allowAuctionWithoutConsent !== undefined) {
consent.allowAuctionWithoutConsent = allowAuctionWithoutConsent ? 1 : 0;
}

return consent;
return utils.cleanObj({
apiVersion,
consentString,
consentRequired: gdprApplies ? 1 : 0,
allowAuctionWithoutConsent: allowAuctionWithoutConsent ? 1 : 0
});
}

function _getCoppa() {
Expand All @@ -685,9 +652,7 @@ function _getUspConsent(bidderRequest) {
}

function _getSchain(bidRequest) {
if (utils.deepAccess(bidRequest, 'schain')) {
return bidRequest.schain;
}
return utils.deepAccess(bidRequest, 'schain');
}

function _getEids(bidRequest) {
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
"dset": "2.0.1",
"express": "^4.15.4",
"fun-hooks": "^0.9.9",
"jsencrypt": "^3.0.0-rc.1",
"just-clone": "^1.0.2",
"live-connect-js": "2.0.0"
}
Expand Down
2 changes: 2 additions & 0 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ describe('Adagio bid adapter', () => {

const expected = {
consentString,
allowAuctionWithoutConsent: 0,
consentRequired: 1,
apiVersion: 2
};
Expand Down Expand Up @@ -615,6 +616,7 @@ describe('Adagio bid adapter', () => {
const expected = {
consentString,
consentRequired: 0,
allowAuctionWithoutConsent: 0,
apiVersion: 2
};

Expand Down

0 comments on commit 9c6ba14

Please sign in to comment.