11/*
22
3- TibiaChar RPC Server 2.1
3+ TibiaChar RPC Server 2.1.1
44
5- Provies Tibia character profile data via a JSON API.
5+ Provides Tibia character profile data via a JSON API.
66
77Hint: Hash the name with a seed, have users put it in their comment section,
88and you have a confirmed method of linking tibia profiles to other profiles?
@@ -20,18 +20,19 @@ Sha.js: $ npm install sha.js
2020
2121// Config:
2222 const port = 9980 ; // set the port for the RPC server to listen on. Default for TibiaChar is 9980.
23- const seed = 'ygfkdsgif87yt7o8fhkshksjhf7' ; // CHANGE THIS. 10 - infinity random chars, more chars = more secure, but slower. Around 30 is good.
23+ const seed = 'fjylhojjhnmmjkftjyjtyjyuiuyjthdg' ; // CHANGE THIS. Ten to infinity random chars, more chars = more secure, but slower. Around 30 is good.
24+ const allowed = "*" ; // Whether the API is public or not. Not a secure method of keeping others out. "*" for public, "localhost" for private.
2425
2526
26- //This is the code. Don't mess if you think you might break something.
27+ //This is the code.
2728
2829
2930console . log ( '-----------------------------------------' ) ;
3031console . log ( '| _____ _ _ _ _____ _ |' ) ;
3132console . log ( '| |_ _|_| |_|_|___| | |_ ___ ___ |' ) ;
3233console . log ( '| | | | | . | | .\'| --| | .\'| _| |' ) ;
3334console . log ( '| |_| |_|___|_|__,|_____|_|_|__,|_| |' ) ;
34- console . log ( '------------------------------------v2 .1-' ) ;
35+ console . log ( '----------------------------------v2.1 .1-' ) ;
3536
3637
3738function tibiachar ( ) {
@@ -135,8 +136,7 @@ function sha(inp){
135136}
136137
137138rpc . use ( function ( req , res , next ) {
138- res . header ( "Access-Control-Allow-Origin" , "*" ) ;
139- //res.header("Content-Type", "application/json");
139+ res . header ( "Access-Control-Allow-Origin" , allowed ) ;
140140 next ( ) ;
141141} ) ;
142142
0 commit comments