Skip to content

Commit

Permalink
Fix running GitBook locally and fix community ad rendering (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse authored Aug 20, 2024
1 parent 502d8fc commit cb782a7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-hairs-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Fix "ip" being passed to BSA for community ads
18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ jobs:
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun unit
build-oss:
# CI to check that the repository builds correctly on a machine without the credentials
runs-on: ubuntu-latest
name: Build (Open Source)
env:
NPMRC_FONT_AWESOME_TOKEN: ''
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.18
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun run build
typecheck:
runs-on: ubuntu-latest
name: Typecheck
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "env-cmd -f ../../.env.local next dev",
"dev": "env-cmd --silent -f ../../.env.local next dev",
"build": "next build",
"build:cloudflare": "next-on-pages",
"start": "next start",
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/Ads/renderAd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function renderAd(options: FetchAdOptions) {

async function fetchAd({ zoneId, placement, ignore }: FetchAdOptions): Promise<AdItem | null> {
const headersSet = headers();
const ip = headersSet.get('x-forwarded-for') ?? '';
const ip = headersSet.get('cf-connecting-ip') ?? headersSet.get('x-forwarded-for') ?? '';
const userAgent = headersSet.get('user-agent') ?? '';

const url = new URL(`https://srv.buysellads.com/ads/${zoneId}.json`);
Expand Down

0 comments on commit cb782a7

Please sign in to comment.