Skip to content

Commit

Permalink
Bump to v1.37.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold committed Oct 15, 2023
1 parent 6eab200 commit a68c269
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 26 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
77 changes: 55 additions & 22 deletions api/src/models/ethical-ads-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions ops/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit a68c269

Please sign in to comment.