move server/* to scnserver/*

This commit is contained in:
2022-12-21 12:35:56 +01:00
parent 2b4d77bab4
commit bbf7962e29
123 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
function send()
{
let me = document.getElementById("btnSend");
if (me.classList.contains("btn-disabled")) return;
me.innerHTML = "<div class=\"spinnerbox\"><div class=\"spinner primary\"></div></div>";
me.classList.add("btn-disabled");
let uid = document.getElementById("uid");
let key = document.getElementById("ukey");
let tit = document.getElementById("tit");
let cnt = document.getElementById("cnt");
let pio = document.getElementById("prio");
let cha = document.getElementById("chan");
uid.classList.remove('input-invalid');
key.classList.remove('input-invalid');
msg.classList.remove('input-invalid');
cnt.classList.remove('input-invalid');
pio.classList.remove('input-invalid');
let data = new FormData();
data.append('user_id', uid.value);
data.append('user_key', key.value);
if (tit.value !== '') data.append('title', tit.value);
if (cnt.value !== '') data.append('content', cnt.value);
if (pio.value !== '') data.append('priority', pio.value);
if (cha.value !== '') data.append('channel', cha.value);
let xhr = new XMLHttpRequest();
xhr.open('POST', '/send.php', true);
xhr.onreadystatechange = function ()
{
if (xhr.readyState !== 4) return;
console.log('Status: ' + xhr.status);
if (xhr.status === 200 || xhr.status === 401 || xhr.status === 403 || xhr.status === 412)
{
let resp = JSON.parse(xhr.responseText);
if (!resp.success || xhr.status !== 200)
{
if (resp.errhighlight === 101) uid.classList.add('input-invalid');
if (resp.errhighlight === 102) key.classList.add('input-invalid');
if (resp.errhighlight === 103) tit.classList.add('input-invalid');
if (resp.errhighlight === 104) cnt.classList.add('input-invalid');
if (resp.errhighlight === 105) pio.classList.add('input-invalid');
if (resp.errhighlight === 106) cha.classList.add('input-invalid');
Toastify({
text: resp.message,
gravity: "top",
positionLeft: false,
backgroundColor: "#D32F2F",
}).showToast();
}
else
{
window.location.href =
'/message_sent' +
'?ok=' + 1 +
'&message_count=' + resp.messagecount +
'&quota=' + resp.quota +
'&quota_remain=' + (resp.quota_max-resp.quota) +
'&quota_max=' + resp.quota_max +
'&preset_user_id=' + uid.value +
'&preset_user_key=' + key.value +
'&preset_channel=' + cha.value;
}
}
else
{
Toastify({
text: 'Request failed: Statuscode=' + xhr.status,
gravity: "top",
positionLeft: false,
backgroundColor: "#D32F2F",
}).showToast();
}
me.classList.remove("btn-disabled");
me.innerHTML = "Send";
};
xhr.send(data);
}
window.addEventListener("load", function ()
{
const qp = new URLSearchParams(window.location.search);
let btn = document.getElementById("btnSend");
let uid = document.getElementById("uid");
let key = document.getElementById("ukey");
let tit = document.getElementById("tit");
let cnt = document.getElementById("cnt");
let pio = document.getElementById("prio");
let cha = document.getElementById("chan");
btn.onclick = function () { send(); return false; };
if (qp.has('preset_priority')) pio.selectedIndex = parseInt(qp.get("preset_priority"));
if (qp.has('preset_user_key')) key.value = qp.get("preset_user_key");
if (qp.has('preset_user_id')) uid.value = qp.get("preset_user_id");
if (qp.has('preset_title')) tit.value = qp.get("preset_title");
if (qp.has('preset_content')) cnt.value = qp.get("preset_content");
if (qp.has('preset_channel')) cha.value = qp.get("preset_channel");
}, false);

View File

@@ -0,0 +1,34 @@
window.addEventListener("load", function ()
{
const qp = new URLSearchParams(window.location.search);
const spanQuota1 = document.getElementById("insQuota1");
const spanQuota2 = document.getElementById("insQuota2");
const linkSucc = document.getElementById("succ_link");
const linkErr = document.getElementById("err_link");
spanQuota1.innerText = qp.get('quota_remain') ?? 'ERR';
spanQuota2.innerText = qp.get('quota_max') ?? 'ERR';
const preset_user_id = qp.get('preset_user_id') ?? 'ERR';
const preset_user_key = qp.get('preset_user_key') ?? 'ERR';
let hrefBack = "/?preset_user_id="+preset_user_id+"&preset_user_key="+preset_user_key
if (qp.has('preset_channel') && qp.get('preset_channel') !== '') hrefBack += "&preset_channel="+qp.get('preset_channel')
linkSucc.setAttribute("href", hrefBack);
if (qp.get("ok") === "1") {
linkSucc.classList.remove('display_none');
linkErr.classList.add('display_none');
} else {
linkSucc.classList.add('display_none');
linkErr.classList.remove('display_none');
}
}, false);

View File

@@ -0,0 +1,8 @@
/**
* Minified by jsDelivr using UglifyJS v3.4.3.
* Original file: /npm/toastify-js@1.3.0/src/toastify.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(t,o){"object"==typeof module&&module.exports?(require("./toastify.css"),module.exports=o()):t.Toastify=o()}(this,function(t){var i=function(t){return new i.lib.init(t)};function r(t,o){return!(!t||"string"!=typeof o)&&!!(t.className&&-1<t.className.trim().split(/\s+/gi).indexOf(o))}return i.lib=i.prototype={toastify:"1.2.2",constructor:i,init:function(t){return t||(t={}),this.options={},this.options.text=t.text||"Hi there!",this.options.duration=t.duration||3e3,this.options.selector=t.selector,this.options.callback=t.callback||function(){},this.options.destination=t.destination,this.options.newWindow=t.newWindow||!1,this.options.close=t.close||!1,this.options.gravity="bottom"==t.gravity?"bottom":"top",this.options.positionLeft=t.positionLeft||!1,this.options.backgroundColor=t.backgroundColor,this.options.avatar=t.avatar||"",this.options.className=t.className||"",this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var t=document.createElement("div");if(t.className="toastify on "+this.options.className,!0===this.options.positionLeft?t.className+=" left":t.className+=" right",t.className+=" "+this.options.gravity,this.options.backgroundColor&&(t.style.background=this.options.backgroundColor),t.innerHTML=this.options.text,""!==this.options.avatar){var o=document.createElement("img");o.src=this.options.avatar,o.className="avatar",!0===this.options.positionLeft?t.appendChild(o):t.insertAdjacentElement("beforeend",o)}if(!0===this.options.close){var i=document.createElement("span");i.innerHTML="&#10006;",i.className="toast-close",i.addEventListener("click",function(t){t.stopPropagation(),this.removeElement(t.target.parentElement),window.clearTimeout(t.target.parentElement.timeOutValue)}.bind(this));var n=0<window.innerWidth?window.innerWidth:screen.width;!0===this.options.positionLeft&&360<n?t.insertAdjacentElement("afterbegin",i):t.appendChild(i)}return void 0!==this.options.destination&&t.addEventListener("click",function(t){t.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}.bind(this)),t},showToast:function(){var t,o=this.buildToast();if(!(t=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return t.insertBefore(o,t.firstChild),i.reposition(),o.timeOutValue=window.setTimeout(function(){this.removeElement(o)}.bind(this),this.options.duration),this},removeElement:function(t){t.className=t.className.replace(" on",""),window.setTimeout(function(){t.parentNode.removeChild(t),this.options.callback.call(t),i.reposition()}.bind(this),400)}},i.reposition=function(){for(var t,o={top:15,bottom:15},i={top:15,bottom:15},n={top:15,bottom:15},e=document.getElementsByClassName("toastify"),s=0;s<e.length;s++){t=!0===r(e[s],"top")?"top":"bottom";var a=e[s].offsetHeight;(0<window.innerWidth?window.innerWidth:screen.width)<=360?(e[s].style[t]=n[t]+"px",n[t]+=a+15):!0===r(e[s],"left")?(e[s].style[t]=o[t]+"px",o[t]+=a+15):(e[s].style[t]=i[t]+"px",i[t]+=a+15)}return this},i.lib.init.prototype=i.lib,i});
//# sourceMappingURL=/sm/3f68e387be4f7a323a891120e4e01e3bee54a927113a386cf5e598b3cd442fcc.map