2025-07-06 00:10:04 +07:00

89 lines
1.8 KiB
JavaScript

vernum = "1.0.250706.0009"
async function getJson(url,headers={}) {
try {
const response = await fetch(url);
return await response.json();
} catch {
return ({
status: 0,
body: {}
});
}
}
async function getText(url, headers={}) {
try {
const response = await fetch(url);
return ({
status: response.status,
body: await response.text()
});
} catch {
return ({
status: 0,
body: ""
});
}
}
async function postJson(url,data = {},headers={}) {
try {
headers["content-type"] = "application/json";
const response = await fetch(url,{method: "post", headers: headers,body: JSON.stringify(data)});
return await response.json();
} catch {
return ({
status: 0,
body: {}
});
}
}
async function postText(url,data = {},headers={}) {
try {
headers["content-type"] = "application/json";
const response = await fetch(url,{method: "post", headers: headers,body: JSON.stringify(data)});
return ({
status: response.status,
body: await response.text()
});
} catch {
return ({
status: 0,
body: ""
});
}
}
monthName =
[
"#Inv#",
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember"
];
monthShort =
[
"###",
"Jan",
"Feb",
"Mar",
"Apr",
"Mei",
"Jun",
"Jul",
"Ags",
"Sep",
"Okt",
"Nov",
"Des"
]
function gen16BytesID()
{
return Date.now().toString(36)+Math.random().toString(36).substring(2,10);
}