From a68c269d549687fea722819367394e2ff45ebf8f Mon Sep 17 00:00:00 2001 From: Sascha Depold Date: Sun, 15 Oct 2023 14:50:17 +0200 Subject: [PATCH] Bump to v1.37.0 --- api/package.json | 2 +- api/src/models/ethical-ads-service.js | 77 +++++++++++++++++++-------- ops/docker-compose.yml | 4 +- web/package.json | 2 +- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/api/package.json b/api/package.json index c326834..254ac2f 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "feedrapp", - "version": "1.36.0", + "version": "1.37.0", "description": "A service for parsing RSS and Atom feeds.", "main": "dist/index.js", "scripts": { diff --git a/api/src/models/ethical-ads-service.js b/api/src/models/ethical-ads-service.js index 9564d54..a16e1da 100644 --- a/api/src/models/ethical-ads-service.js +++ b/api/src/models/ethical-ads-service.js @@ -2,28 +2,29 @@ const fetch = require('node-fetch'); const AD_URL = 'https://server.ethicalads.io/api/v1/decision/'; -async function getRawEthicalAd(payload = {}) { - const result = await fetch(AD_URL, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - Authorization: 'Token 0240ea84e680a7d8eab2236e4a82432655d79607' - }, - body: JSON.stringify({ - ...payload, - publisher: 'feedrappinfo', - campaign_types: ['paid'], - url: 'https://feedrapp.info', - placements: [ - { - div_id: `ad_${+new Date()}`, - ad_type: 'image-v1', - priority: 10 - } - ] - }) - }); +async function getRawEthicalAd() { + const adId = `ad_${+new Date()}`; + + const result = await fetch( + `https://server.ethicalads.io/api/v1/decision/?publisher=feedrappinfo&ad_types=image-v1&div_ids=${adId}&keywords=&campaign_types=paid&format=json&client_version=1.9.0&placement_index=0&url=https%3A%2F%2Ffeedrapp.info%2F`, + { + headers: { + accept: '*/*', + 'accept-language': 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7', + 'cache-control': 'no-cache', + pragma: 'no-cache', + 'sec-ch-ua': + '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', + 'sec-fetch-dest': 'script', + 'sec-fetch-mode': 'no-cors', + 'sec-fetch-site': 'cross-site', + Referer: 'https://feedrapp.info/', + 'Referrer-Policy': 'strict-origin-when-cross-origin' + } + } + ); if (!result.ok) { throw new Error( @@ -34,6 +35,38 @@ async function getRawEthicalAd(payload = {}) { return result.json(); } +// async function getRawEthicalAd(payload = {}) { +// const result = await fetch(AD_URL, { +// method: 'POST', +// headers: { +// 'Content-Type': 'application/json', +// Accept: 'application/json', +// Authorization: 'Token 0240ea84e680a7d8eab2236e4a82432655d79607' +// }, +// body: JSON.stringify({ +// ...payload, +// publisher: 'feedrappinfo', +// campaign_types: ['paid'], +// url: 'https://feedrapp.info', +// placements: [ +// { +// div_id: `ad_${+new Date()}`, +// ad_type: 'image-v1', +// priority: 10 +// } +// ] +// }) +// }); + +// if (!result.ok) { +// throw new Error( +// `Failed to fetch ad: ${result.status} ${result.statusText}` +// ); +// } + +// return result.json(); +// } + function trackEthicalAd(req, clientIp, viewUrl) { console.log('Tracking Ethical Ad', viewUrl); diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 9bfff5b..9543a0a 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.9" services: website: - image: ghcr.io/sdepold/feedr-web:1.36.0 + image: ghcr.io/sdepold/feedr-web:1.37.0 restart: always deploy: resources: @@ -12,7 +12,7 @@ services: cpus: "0.5" memory: 512M api: - image: ghcr.io/sdepold/feedr-api:1.36.0 + image: ghcr.io/sdepold/feedr-api:1.37.0 restart: always deploy: resources: diff --git a/web/package.json b/web/package.json index 868acd8..e42b3dd 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "FeedrApp", - "version": "1.36.0", + "version": "1.37.0", "description": "A service for parsing RSS and Atom feeds.", "scripts": { "dev": "next dev",