@paywalls-net/filter 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +1 -5
- package/src/user-agent-classification.js +3 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -193,14 +193,10 @@ async function checkAgentStatus(cfg, request) {
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
let headers = getAllHeaders(request);
|
|
196
|
-
const agentInfo = await classifyUserAgent(cfg, userAgent);
|
|
197
196
|
|
|
198
197
|
const body = JSON.stringify({
|
|
199
198
|
account_id: cfg.paywallsPublisherId,
|
|
200
|
-
|
|
201
|
-
agent: agentInfo.agent,
|
|
202
|
-
vat: agentInfo.vat,
|
|
203
|
-
act: agentInfo.act,
|
|
199
|
+
user_agent: userAgent,
|
|
204
200
|
token: token,
|
|
205
201
|
headers: headers
|
|
206
202
|
});
|
|
@@ -104,10 +104,10 @@ export async function classifyUserAgent(cfg, userAgent) {
|
|
|
104
104
|
// Check classification cache first (single lookup is more efficient than has + get)
|
|
105
105
|
const cached = classificationCache.get(userAgent);
|
|
106
106
|
if (cached !== undefined) {
|
|
107
|
-
console.log(`User agent classification cache hit for: ${userAgent}`);
|
|
107
|
+
// console.log(`User agent classification cache hit for: ${userAgent}`);
|
|
108
108
|
return cached;
|
|
109
109
|
}
|
|
110
|
-
console.log(`User agent classification cache miss for: ${userAgent}`);
|
|
110
|
+
// console.log(`User agent classification cache miss for: ${userAgent}`);
|
|
111
111
|
|
|
112
112
|
const parsedUA = new UAParser(userAgent).getResult();
|
|
113
113
|
|
|
@@ -143,7 +143,7 @@ export async function classifyUserAgent(cfg, userAgent) {
|
|
|
143
143
|
browser,
|
|
144
144
|
os,
|
|
145
145
|
vat: 'HUMAN',
|
|
146
|
-
act: 'ACT-
|
|
146
|
+
act: 'ACT-2', // Unmatched UA with detected browser — medium confidence
|
|
147
147
|
};
|
|
148
148
|
// Cache the default classification
|
|
149
149
|
classificationCache.set(userAgent, result);
|