2024-11-25 07:15:14 +00:00
// punycode.js
// Namhyeon Go <abuse@catswords.net>
// https://github.com/gnh1201/welsonjs
2024-11-27 06:36:35 +00:00
//
2024-11-25 07:15:14 +00:00
// ***SECURITY NOTICE***
2024-11-27 06:36:35 +00:00
// Due to potential security issues, the Public API URL is not provided. If you need to request access, please refer to the project's contact information.
// You can download the server-side script that implements this functionality from the link below:
// https://github.com/gnh1201/caterpillar
2024-11-25 07:15:14 +00:00
//
var JsonRpc2 = require ( "lib/jsonrpc2" ) ;
2022-05-17 09:29:39 +00:00
function encode ( s ) {
2025-01-01 10:51:11 +00:00
var rpc = JsonRpc2 . create ( JsonRpc2 . DEFAULT _JSONRPC2 _URL ) ;
2024-11-25 07:15:14 +00:00
var result = rpc . invoke ( "relay_invoke_method" , {
2024-11-28 12:11:17 +00:00
"callback" : "load_script" ,
"requires" : [
"https://pub-f926e14287b340cd9eff33731bb25329.r2.dev/punycode.class.php"
] ,
"args" : [
"return Punycode::encodeHostname('" + s + "')"
]
2024-11-25 07:15:14 +00:00
} , "" ) ;
return result . data ;
}
function decode ( s ) {
2025-01-01 10:51:11 +00:00
var rpc = JsonRpc2 . create ( JsonRpc2 . DEFAULT _JSONRPC2 _URL ) ;
2024-11-25 07:15:14 +00:00
var result = rpc . invoke ( "relay_invoke_method" , {
2024-11-28 12:11:17 +00:00
"callback" : "load_script" ,
"requires" : [
"https://pub-f926e14287b340cd9eff33731bb25329.r2.dev/punycode.class.php"
] ,
"args" : [
"return Punycode::decodeHostname('" + s + "')"
]
2024-11-25 07:15:14 +00:00
} , "" ) ;
return result . data ;
2022-05-17 09:29:39 +00:00
}
exports . encode = encode ;
2024-11-25 07:15:14 +00:00
exports . decode = decode ;
2022-05-17 09:29:39 +00:00
2025-01-01 10:51:11 +00:00
exports . VERSIONINFO = "Punycode Public API client (punycode.js) version 0.2.3" ;
2024-11-28 12:11:17 +00:00
exports . AUTHOR = "abuse@catswords.net" ;
2022-05-17 09:29:39 +00:00
exports . global = global ;
exports . require = global . require ;