6989a98d75
- Arkitektur: docs/auth/passwordless-architecture.md - Backend: iom/quixzoom-auth-service/ (FastAPI + Redis) - Webb: quixzoom-market-pages/se/login/ (QR-kod + polling) - App: iom/quixzoom-app/src/features/auth/ (push + deep links) Flöde: QR-kod → app-godkännande → webb-inloggad
41 lines
862 B
JavaScript
41 lines
862 B
JavaScript
'use strict';
|
|
|
|
const { Transform } = require('stream');
|
|
|
|
/**
|
|
* Ensures that only <LF> is used for linebreaks
|
|
*
|
|
* @param {Object} options Stream options
|
|
*/
|
|
class LeUnix extends Transform {
|
|
constructor(options) {
|
|
super(options);
|
|
}
|
|
|
|
/**
|
|
* Escapes dots
|
|
*/
|
|
_transform(chunk, encoding, done) {
|
|
let buf;
|
|
let lastPos = 0;
|
|
|
|
for (let i = 0, len = chunk.length; i < len; i++) {
|
|
if (chunk[i] === 0x0d) {
|
|
// \r
|
|
buf = chunk.slice(lastPos, i);
|
|
lastPos = i + 1;
|
|
this.push(buf);
|
|
}
|
|
}
|
|
if (lastPos && lastPos < chunk.length) {
|
|
buf = chunk.slice(lastPos);
|
|
this.push(buf);
|
|
} else if (!lastPos) {
|
|
this.push(chunk);
|
|
}
|
|
done();
|
|
}
|
|
}
|
|
|
|
module.exports = LeUnix;
|