Skip to content

Commit

Permalink
revised code for gpp_version column (issue#110)
Browse files Browse the repository at this point in the history
'
  • Loading branch information
franciscawijaya committed Jun 4, 2024
1 parent 4dd920b commit e829f65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
25 changes: 8 additions & 17 deletions gpc-analysis-extension/src/background/analysis/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ async function runAnalysis() {
post_to_debug(firstPartyDomain, gppData.data, "GPP-DATA-v1.1");
logData(domain, "GPP", gppData.data);
}
logData(domain, "GPP_version", gppData.data.gppVersion);
post_to_debug(firstPartyDomain, gppData.data.gppVersion, "gpp version");
logData(domain, "GPP_VERSION", gppData.data.gppVersion);
}

changingSitesOnAnalysis = true; // Analysis=ON flag
Expand Down Expand Up @@ -385,7 +386,8 @@ async function haltAnalysis() {
// the GPP String is just inside gppData.data
logData(domain, "GPP", gppData.data);
}
logData(domain, "GPP_version", gppData.data.gppVersion);
post_to_debug(firstPartyDomain, gppData.data.gppVersion, "gpp version");
logData(domain, "GPP_VERSION", gppData.data.gppVersion);
}
await new Promise((resolve) => setTimeout(resolve, 1000)); //new
post_to_debug(firstPartyDomain, "line 380", "haltAnalysis-end");
Expand Down Expand Up @@ -432,6 +434,7 @@ function parseURL(url) {
var analysisUserendSkeleton = () => {
return {
sent_gpc: false,
gpp_version: null,
uspapi_before_gpc: null,
uspapi_after_gpc: null,
usp_cookies_before_gpc: null,
Expand All @@ -444,8 +447,6 @@ var analysisUserendSkeleton = () => {
OneTrustWPCCPAGoogleOptOut_after_gpc: null,
OTGPPConsent_before_gpc: null,
OTGPPConsent_after_gpc: null,
gpp_version_before_gpc: null,
gpp_version_after_gpc: null,
};
};

Expand All @@ -459,7 +460,6 @@ var analysisDataSkeletonFirstParties = () => {
USPAPI_LOCATOR: {},
THIRD_PARTIES: {},
GPP: [],
GPP_VERSION: [],
},
AFTER_GPC: {
COOKIES: [],
Expand All @@ -469,9 +469,9 @@ var analysisDataSkeletonFirstParties = () => {
USPAPI_LOCATOR: {},
THIRD_PARTIES: {},
GPP: [],
GPP_VERSION: [],
},
SENT_GPC: null,
GPP_VERSION: [],
};
};

Expand Down Expand Up @@ -631,17 +631,8 @@ function logData(domain, command, data) {
}
}

if (command === "GPP_version") {
analysis[domain][callIndex][gpcStatusKey]["GPP_version"] = [];
analysis[domain][callIndex][gpcStatusKey]["GPP_version"].push(data);

// Detailed case for summary object
if (gpcStatusKey == "BEFORE_GPC") {
analysis_userend[domain]["gpp_version_before_gpc"] = data["gpp-version"];
}
if (gpcStatusKey == "AFTER_GPC") {
analysis_userend[domain]["gpp_version_after_gpc"] = data["gpp-version"];
}
if (command === "GPP_VERSION") {
analysis_userend[domain]["gpp_version"] = data;
}


Expand Down
10 changes: 3 additions & 7 deletions rest-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async function rest(table) {
app.post("/" + table, jsonParser, (req, res) => {
var domain = req.body.domain;
var sent_gpc = req.body.sent_gpc;
var gpp_version = req.body.gpp_version;
var uspapi_before_gpc = req.body.uspapi_before_gpc;
var uspapi_after_gpc = req.body.uspapi_after_gpc;
var usp_cookies_before_gpc = req.body.usp_cookies_before_gpc;
Expand All @@ -72,20 +73,17 @@ async function rest(table) {
var OneTrustWPCCPAGoogleOptOut_after_gpc = req.body.OneTrustWPCCPAGoogleOptOut_after_gpc;
var OTGPPConsent_before_gpc = req.body.OTGPPConsent_before_gpc;
var OTGPPConsent_after_gpc = req.body.OTGPPConsent_after_gpc;
var gpp_version_before_gpc = req.body.gpp_version_before_gpc;
var gpp_version_after_gpc = req.body.gpp_version_after_gpc;



console.log("posting", domain, "to analysis...");
connection.query(
// "INSERT INTO ?? (domain, dns_link, sent_gpc, uspapi_before_gpc, uspapi_after_gpc, usp_cookies_before_gpc, usp_cookies_after_gpc) VALUES (?,?,?,?,?,?,?)",
"INSERT INTO ?? (domain, sent_gpc, uspapi_before_gpc, uspapi_after_gpc, usp_cookies_before_gpc, usp_cookies_after_gpc, OptanonConsent_before_gpc, OptanonConsent_after_gpc, gpp_before_gpc, gpp_after_gpc, urlClassification, OneTrustWPCCPAGoogleOptOut_before_gpc, OneTrustWPCCPAGoogleOptOut_after_gpc, OTGPPConsent_before_gpc, OTGPPConsent_after_gpc,gpp_version_before_gpc,gpp_version_after_gpc) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
"INSERT INTO ?? (domain, sent_gpc, gpp_version, uspapi_before_gpc, uspapi_after_gpc, usp_cookies_before_gpc, usp_cookies_after_gpc, OptanonConsent_before_gpc, OptanonConsent_after_gpc, gpp_before_gpc, gpp_after_gpc, urlClassification, OneTrustWPCCPAGoogleOptOut_before_gpc, OneTrustWPCCPAGoogleOptOut_after_gpc, OTGPPConsent_before_gpc, OTGPPConsent_after_gpc) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",

[
table_name,
domain,
sent_gpc,
gpp_version,
uspapi_before_gpc,
uspapi_after_gpc,
usp_cookies_before_gpc,
Expand All @@ -99,8 +97,6 @@ async function rest(table) {
OneTrustWPCCPAGoogleOptOut_after_gpc,
OTGPPConsent_before_gpc,
OTGPPConsent_after_gpc,
gpp_version_before_gpc,
gpp_version_after_gpc,
],
(error, results, fields) => {
if (error) throw error;
Expand Down
Binary file modified selenium-optmeowt-crawler/myextension.xpi
Binary file not shown.

0 comments on commit e829f65

Please sign in to comment.