Skip to content

Commit

Permalink
Merge pull request #412 from oblivioncth/feature/anonymous_logs
Browse files Browse the repository at this point in the history
feat: Strip username from uploaded logs
  • Loading branch information
colin969 authored Nov 16, 2023
2 parents cdbfef6 + 8744c79 commit e2f0346
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/back/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1782,8 +1782,14 @@ export function registerRequestCallbacks(state: BackState, init: () => Promise<v
});

state.socketServer.register(BackIn.UPLOAD_LOG, async (event) => {
// Filter entries
const username = os.userInfo().username;
const entries = state.log.filter(e => e !== undefined).map(e => {
e.content = e.content.replace(new RegExp('([/\\\\])' + username, 'g'), '$1***');
return e;
});

// Upload to log server
const entries = state.log.filter(e => e !== undefined);
const postUrl = url.resolve(state.config.logsBaseUrl, 'logdata');
// Server responds with log id e.g ABC123
const res = await axios.post(postUrl, { entries: entries });
Expand Down

0 comments on commit e2f0346

Please sign in to comment.