feat: add SVG/PNG download options, track geolocation from CF headers, and fix analytics pie charts by parsing counts as integers
This commit is contained in:
+57
@@ -0,0 +1,57 @@
|
||||
const http = require('http');
|
||||
|
||||
const options = {
|
||||
hostname: 'localhost',
|
||||
port: 4001,
|
||||
path: '/api/auth/login',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
|
||||
const req = http.request(options, (res) => {
|
||||
let data = '';
|
||||
res.on('data', (chunk) => data += chunk);
|
||||
res.on('end', () => {
|
||||
if (!res.headers['set-cookie']) {
|
||||
console.log('No cookie', data); return;
|
||||
}
|
||||
const cookie = res.headers['set-cookie'][0];
|
||||
|
||||
// Generate QR
|
||||
const largeStr = 'a'.repeat(200000);
|
||||
const postData = JSON.stringify({
|
||||
name: 'Test QR',
|
||||
type: 'dynamic',
|
||||
dataType: 'URL',
|
||||
destinationUrl: 'https://google.com',
|
||||
designData: { image: 'data:image/png;base64,' + largeStr }
|
||||
});
|
||||
|
||||
const options2 = {
|
||||
hostname: 'localhost',
|
||||
port: 4001,
|
||||
path: '/api/qr/generate',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(postData),
|
||||
'Cookie': cookie
|
||||
}
|
||||
};
|
||||
|
||||
const req2 = http.request(options2, (res2) => {
|
||||
let d = '';
|
||||
res2.on('data', c => d+=c);
|
||||
res2.on('end', () => {
|
||||
console.log('Status:', res2.statusCode);
|
||||
console.log('Body:', d);
|
||||
});
|
||||
});
|
||||
req2.write(postData);
|
||||
req2.end();
|
||||
});
|
||||
});
|
||||
req.write(JSON.stringify({email: 'admin@ckqr.com', password: 'password123'}));
|
||||
req.end();
|
||||
Reference in New Issue
Block a user