mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
The Public API was proposed for the next version (0.2.7.54), but due to the increased security risks of providing an unauthenticated Public API, the Public API URL is being discontinued. This service will be available in the future through marketplaces offered by cloud platforms. Additionally, as the server-side script is open-source, you can set it up yourself. https://github.com/gnh1201/caterpillar
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// punycode.js
|
|
// Namhyeon Go <abuse@catswords.net>
|
|
// https://github.com/gnh1201/welsonjs
|
|
//
|
|
// ***SECURITY NOTICE***
|
|
// 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
|
|
//
|
|
var JsonRpc2 = require("lib/jsonrpc2");
|
|
|
|
var API_URL = "http://localhost:8080";
|
|
|
|
function encode(s) {
|
|
var rpc = JsonRpc2.create(API_URL);
|
|
var result = rpc.invoke("relay_invoke_method", {
|
|
"callback": "idn_to_ascii",
|
|
"args": [s]
|
|
}, "");
|
|
|
|
return result.data;
|
|
}
|
|
|
|
function decode(s) {
|
|
var rpc = JsonRpc2.create(API_URL);
|
|
var result = rpc.invoke("relay_invoke_method", {
|
|
"callback": "idn_to_utf8",
|
|
"args": [s]
|
|
}, "");
|
|
|
|
return result.data;
|
|
}
|
|
|
|
exports.encode = encode;
|
|
exports.decode = decode;
|
|
|
|
exports.VERSIONINFO = "Punycode Public API client (punycode.js) version 0.2.1";
|
|
exports.global = global;
|
|
exports.require = global.require;
|