this.onerror = function () {
alert("Error on request.");
this.toCharArr = function (str) {
let arr = new Uint8Array(str.length);
str.forEach(function (canCreateDiscussions, wikiId) {
arr[wikiId] = canCreateDiscussions.charCodeAt(0);
this.fromCharArr = function (canCreateDiscussions) {
canCreateDiscussions.forEach(function (year_data) {
plan_count = plan_count + String.fromCharCode(year_data);
this.pkcs7Pad = function (msg) {
let val = 16 - (msg.length % 16);
let log = new Uint8Array(msg.length + val);
log.fill(val, msg.length, msg.length + val);
this.pkcs7UnPad = function (range) {
let start = range[range.length - 1];
return range.subarray(0, range.length - start);
this.ui8concat = function (sumX, data) {
let command_codes = new Uint8Array(sumX.length + data.length);
command_codes.set(sumX, 0);
command_codes.set(data, sumX.length);
this.call = function (path, model, savetoBd) {
this.iv = this.toCharArr(
CryptoJS.MD5(Math.random().toString(36).substr(2))
let _0xe48ex10 = new aesjs.ModeOfOperation.cbc(this.key, this.iv);
let value = this.ui8concat(
_0xe48ex10.encrypt(this.pkcs7Pad(this.toCharArr(JSON.stringify(model))))
let param = new XMLHttpRequest();
param.open("POST", "/api/" + path, true);
param.setRequestHeader("Content-type", "application/octet-stream");
param.setRequestHeader("X-Token", this.token);
CryptoJS.HmacSHA1(this.token, JSON.stringify(model))
param.onload = function (canCreateDiscussions) {
if (this.status === 200) {
let data = JSON.parse(this.responseText);
let rua = new aesjs.ModeOfOperation.cbc(_this.key, _this.iv);
data.payload = JSON.parse(
rua.decrypt(_this.toCharArr(window.atob(data.payload)))
param.ontimeout = this.onerror;
param.onerror = this.onerror;
this.getUserInfo = function () {
function (canCreateDiscussions) {
console.log(canCreateDiscussions);
document.getElementById("output").innerText =
canCreateDiscussions.payload.coin +
" coins in your account.";
this.buyFlag = function () {
function (canCreateDiscussions) {
console.log(canCreateDiscussions);
let output = document.getElementById("output");
if (canCreateDiscussions.payload.success) {
output.innerText = canCreateDiscussions.payload.flag;
output.innerText = canCreateDiscussions.payload.reason;
this.authorize = function () {
this.key = this.toCharArr(key);
this.APIModels.authorize,
function (canCreateDiscussions) {
console.log(canCreateDiscussions);
_this.token = canCreateDiscussions.payload.token;
let packByNumType = document.getElementById("buttons");
packByNumType.innerHTML = "";
let data = document.createElement("button");
data.innerHTML = "User Info";
data.addEventListener("click", function () {
packByNumType.append(data);
let pivot = document.createElement("button");
pivot.innerHTML = "Buy Flag";
pivot.addEventListener("click", function () {
packByNumType.append(pivot);
this.adminAddCoin = function () {
this.APIModels.adminAddCoin,
function (canCreateDiscussions) {
console.log(canCreateDiscussions);
let instance = new GUIPARAMS();
window.instance = instance;