Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node upgrade, functions configuration, and changes to adtech #54

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attribution-reporting/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion attribution-reporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Set up (one time only)
1. If it's not yet installed on your machine, install [node.js](https://nodejs.org/en/download/).
2. Install the latest Firebase CLI by running the following in your terminal: `npm install -g firebase-tools`.
2. Install the latest Firebase CLI by running the following in your terminal: `npm install -g firebase-tools`. The version known to work with this README.md is 13.3.0.
3. In your terminal, run `git clone https://github.com/GoogleChromeLabs/trust-safety-demo.git && cd trust-safety-demo/attribution-reporting`. This command will create a folder, clone all of the `trust-safety` demo code in that folder, and navigate you to the `attribution-reporting` demo subfolder.
4. In your terminal, run `cd functions && npm install && cd ..`. This command will install all the required dependencies for you to locally run the `attribution-reporting` demo.

Expand Down
52 changes: 36 additions & 16 deletions attribution-reporting/firebase.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"hosting": [{
"hosting": [
{
"site": "arapi-home",
"public": "sites/home",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"function": "home"
}]
"rewrites": [
{
"source": "**",
"function": "home"
}
]
},
{
"site": "arapi-adtech",
Expand All @@ -20,7 +23,8 @@
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"rewrites": [
{
"source": "**",
"function": "adtech"
},
Expand All @@ -38,10 +42,12 @@
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"function": "advertiser"
}]
"rewrites": [
{
"source": "**",
"function": "advertiser"
}
]
},
{
"site": "arapi-publisher",
Expand All @@ -51,10 +57,12 @@
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"function": "publisher"
}]
"rewrites": [
{
"source": "**",
"function": "publisher"
}
]
}
],
"emulators": {
Expand All @@ -65,5 +73,17 @@
"host": "localhost",
"port": "8080"
}
}
}
},
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
]
}
]
}
1 change: 1 addition & 0 deletions attribution-reporting/functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
7 changes: 5 additions & 2 deletions attribution-reporting/functions/apps/adtech.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,15 @@ adtech.get(
res.set('Attribution-Reporting-Register-Source', JSON.stringify(headerConfig))
log('REGISTERING SOURCE \n', headerConfig)

if (req.originalUrl === '/register-source-image') {
const urlParts = req.originalUrl.split('/')
const url = urlParts[urlParts.length - 1]

if (url === 'register-source-image') {
// Send back the response
res.status(200).sendFile('blue-shoes.png', {
root: path.join(__dirname, '../../sites/adtech')
})
} else if (['/register-source-href', '/register-source-js'].includes(req.originalUrl)) {
} else if (['register-source-href', 'register-source-js'].includes(url)) {
res.redirect(advertiserUrl)
}
})
Expand Down
2 changes: 1 addition & 1 deletion attribution-reporting/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"logs": "firebase functions:log"
},
"engines": {
"node": "14"
"node": "20"
},
"repository": {
"type": "git"
Expand Down
4 changes: 2 additions & 2 deletions attribution-reporting/functions/views/home/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ body
li Visit
span.code.select chrome://flags/#privacy-sandbox-enrollment-overrides
| and add
span.code.select https://arapi-adtech.web.app
span.code.select #{adtechUrl}
| in the text box
li Start Chrome from the command line with
span.code.select --privacy-sandbox-enrollment-overrides=https://arapi-adtech.web.app
span.code.select --privacy-sandbox-enrollment-overrides=#{adtechUrl}
li See the
a(href="https://github.com/privacysandbox/attestation/blob/main/how-to-enroll.md#5-do-i-need-to-enroll-to-test-against-local-development-environments" noreferrer noopener target="_blank") explainer
| to learn more
Expand Down