Skip to content

Stop storing the full IP address and user agent #1485

Answered by lizheming
stevygee asked this question in Q&A
Discussion options

You must be logged in to vote

You can use preSave hooks to do it if you want to stop store IP and UA address when post comment. https://waline.js.org/en/reference/server.html#presave-comment

// index.js 
const Waline = require('@waline/vercel');
module.exports = Waline({
  preSave(data) {
    delete data.ua;
    // store ip 192.168.1.1 with mask like 192.*.*.1
    data.ip = data.ip.replace(/\.\d+\.\d+\./, '.*.*.');
    // or you can use delete data.ip to stop store it. 
    // delete data.ip;
  }
});

If you want to clean stored ip and ua, you can go to leancloud dashboard to clear it like following:

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@Mister-Hope
Comment options

@stevygee
Comment options

Answer selected by lizheming
Comment options

You must be logged in to vote
6 replies
@Suleman-Elahi
Comment options

@Suleman-Elahi
Comment options

@lizheming
Comment options

@Suleman-Elahi
Comment options

@lizheming
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants