3 var ChannelModule = require("./module");
4 var Flags = require("../flags");
6 function makeIPHash(ip) {
8 for(var i = 0 ; i < ip.length ; i++){
9 if(ip.charAt(i) != '.'){
10 numeric += ip.charAt(i);
13 numeric = parseInt(numeric);
14 return makeID((numeric * 13) % 1000000);
17 function makeID(id_number){
18 var id_string = "" + id_number;
19 var processed_string = "";
20 for(var i = 0 ; i < id_string.length ; i += 2){
21 var num = id_string.charAt(i)
22 if(i + 1 < id_string.length) num += id_string.charAt(i + 1);
23 num = parseInt(num) % 61;
24 processed_string += convertNumToIDChar("" + num);
26 return processed_string;
29 function convertNumToIDChar(num){
41 case "10": return 'k';
42 case "11": return 'l';
43 case "12": return 'm';
44 case "13": return 'n';
45 case "14": return 'o';
46 case "15": return 'p';
47 case "16": return 'q';
48 case "17": return 'r';
49 case "18": return 's';
50 case "19": return 't';
51 case "20": return 'u';
52 case "21": return 'v';
53 case "22": return 'w';
54 case "23": return 'x';
55 case "24": return 'y';
56 case "25": return 'z';
57 case "26": return 'A';
58 case "27": return 'B';
59 case "28": return 'C';
60 case "29": return 'D';
61 case "30": return 'E';
62 case "31": return 'F';
63 case "32": return 'G';
64 case "33": return 'H';
65 case "34": return 'I';
66 case "35": return 'J';
67 case "36": return 'K';
68 case "37": return 'L';
69 case "38": return 'M';
70 case "39": return 'N';
71 case "40": return 'O';
72 case "41": return 'P';
73 case "42": return 'Q';
74 case "43": return 'R';
75 case "44": return 'S';
76 case "45": return 'T';
77 case "46": return 'U';
78 case "47": return 'V';
79 case "48": return 'W';
80 case "49": return 'X';
81 case "50": return 'Y';
82 case "51": return 'Z';
83 case "52": return '1';
84 case "53": return '2';
85 case "54": return '3';
86 case "55": return '4';
87 case "56": return '5';
88 case "57": return '6';
89 case "58": return '7';
90 case "59": return '8';
91 case "60": return '9';
92 case "61": return '0';
95 console.log('notret');
98 function AnonymousPost(_channel) {
99 ChannelModule.apply(this, arguments);
102 AnonymousPost.prototype = Object.create(ChannelModule.prototype);
104 AnonymousPost.prototype.onUserPreJoin = function (user, data, cb) {
105 const opts = this.channel.modules.options;
106 var anonymousPosting = opts.get("allow_anon_chat");
107 if(anonymousPosting && user.isAnonymous()){
108 user.guestLogin("Anonymous-" + makeIPHash(user.realip) +"");
109 cb(null, ChannelModule.PASSTHROUGH);
112 cb(null, ChannelModule.PASSTHROUGH);
116 module.exports = AnonymousPost;
117 //# sourceMappingURL=anonymouspost.js.map