Compare commits

...

2 commits

Author SHA1 Message Date
the-djmaze 6b3f76e4ee Login form use method="POST" to prevent uri exposure when javascript fails 2024-01-09 15:56:35 +01:00
the-djmaze 2a3cea63cc KnockoutJS drop unused rateLimit method 2024-01-09 14:52:05 +01:00
5 changed files with 15 additions and 39 deletions

View file

@ -3,7 +3,7 @@
<a href="#" class="close" data-bind="click: hideError">×</a>
<span data-bind="text: submitError"></span>
</div>
<form action="#/" spellcheck="false" data-bind="submit: submitForm, css: {'errorAnimated': formError, 'submitting': submitRequest()}">
<form action="#/" spellcheck="false" method="POST" data-bind="submit: submitForm, css: {'errorAnimated': formError, 'submitting': submitRequest()}">
<div class="controls" data-bind="css: {'error': loginError}">
<span class="fontastic">👤</span>
<input name="Login" required="" type="text" class="input-block-level"

View file

@ -7,7 +7,7 @@
<!-- ko text: submitErrorAdditional --><!-- /ko -->
</p>
</div>
<form action="#/" spellcheck="false"
<form action="#/" spellcheck="false" method="POST"
data-bind="submit: submitForm, css: {'errorAnimated': formError, 'submitting': submitRequest()}">
<div class="controls" data-bind="css: {'error': emailError}">
<span class="fontastic"></span>

View file

@ -239,19 +239,7 @@ ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisp
ko.extenders = {
'debounce': (target, timeout) => target.limit(callback => debounce(callback, timeout)),
'rateLimit': (target, options) => {
var timeout, method, limitFunction;
if (typeof options == 'number') {
timeout = options;
} else {
timeout = options['timeout'];
method = options['method'];
}
limitFunction = typeof method == 'function' ? method : throttle;
target.limit(callback => limitFunction(callback, timeout, options));
},
'rateLimit': (target, timeout) => target.limit(callback => throttle(callback, timeout)),
'notify': (target, notifyWhen) => {
target.equalityComparer = notifyWhen == "always" ?

View file

@ -13,17 +13,17 @@ c.g={extend:(a,b)=>b?Object.assign(a,b):a,P:(a,b)=>a&&Object.entries(a).forEach(
a[a.length-1].parentNode!==b;)--a.length;if(1<a.length){b=a[0];var d=a[a.length-1];for(a.length=0;b!==d;)a.push(b),b=b.nextSibling;a.push(d)}}return a},Rb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),ab:a=>a.ownerDocument.documentElement.contains(1!==a.nodeType?a.parentNode:a),Tb:(a,b)=>{if(!a?.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(b))},i:a=>c.T(a)?a():a,kb:(a,b)=>a.textContent=c.g.i(b)||""};c.v("utils",
c.g);c.v("unwrap",c.g.i);(()=>{let a=0,b="__ko__"+Date.now(),d=new WeakMap;c.g.j={get:(f,h)=>(d.get(f)||{})[h],set:(f,h,l)=>{d.has(f)?d.get(f)[h]=l:d.set(f,{[h]:l});return l},eb:function(f,h,l){return this.get(f,h)||this.set(f,h,l)},clear:f=>d.delete(f),Z:()=>a++ +b}})();c.g.K=(()=>{var a=c.g.j.Z(),b={1:1,8:1,9:1},d={1:1,9:1};const f=(e,g)=>{var k=c.g.j.get(e,a);g&&!k&&(k=new Set,c.g.j.set(e,a,k));return k},h=e=>{var g=f(e);g&&(new Set(g)).forEach(k=>k(e));c.g.j.clear(e);d[e.nodeType]&&l(e.childNodes,
!0)},l=(e,g)=>{for(var k=[],n,p=0;p<e.length;p++)if(!g||8===e[p].nodeType)if(h(k[k.length]=n=e[p]),e[p]!==n)for(;p--&&!k.includes(e[p]););};return{ma:(e,g)=>{if("function"!=typeof g)throw Error("Callback must be a function");f(e,1).add(g)},jb:(e,g)=>{var k=f(e);k&&(k.delete(g),k.size||c.g.j.set(e,a,null))},fa:e=>{c.u.M(()=>{b[e.nodeType]&&(h(e),d[e.nodeType]&&l(e.getElementsByTagName("*")))});return e},removeNode:e=>{c.fa(e);e.parentNode&&e.parentNode.removeChild(e)}}})();c.fa=c.g.K.fa;c.removeNode=
c.g.K.removeNode;c.v("utils.domNodeDisposal",c.g.K);c.v("utils.domNodeDisposal.addDisposeCallback",c.g.K.ma);c.cb={debounce:(a,b)=>a.Ja(d=>fa(d,b)),rateLimit:(a,b)=>{if("number"==typeof b)var d=b;else{d=b.timeout;var f=b.method}var h="function"==typeof f?f:ea;a.Ja(l=>h(l,d,b))},notify:(a,b)=>{a.pa="always"==b?null:P}};var da={undefined:1,"boolean":1,number:1,string:1};c.v("extenders",c.cb);class ka{constructor(a,b,d){this.X=a;this.ob=b;this.Da=d;this.Qa=!1;this.L=this.ia=null;c.ha(this,"dispose",
this.A)}A(){this.Qa||(this.L&&c.g.K.jb(this.ia,this.L),this.Qa=!0,this.Da(),this.X=this.ob=this.Da=this.ia=this.L=null)}o(a){this.ia=a;c.g.K.ma(a,this.L=this.A.bind(this))}}c.V=function(){Object.setPrototypeOf(this,D);D.Fa(this)};var D={Fa:a=>{a.W=new Map;a.W.set("change",new Set);a.tb=1},subscribe:function(a,b,d){var f=this;d=d||"change";var h=new ka(f,b?a.bind(b):a,()=>{f.W.get(d).delete(h);f.Ra?.(d)});f.Ta?.(d);f.W.has(d)||f.W.set(d,new Set);f.W.get(d).add(h);return h},D:function(a,b){b=b||"change";
"change"===b&&this.Ma();if(this.ra(b)){b="change"===b&&this.Ub||new Set(this.W.get(b));try{c.u.yb(),b.forEach(d=>{d.Qa||d.ob(a)})}finally{c.u.end()}}},Ca:function(){return this.tb},fc:function(a){return this.Ca()!==a},Ma:function(){++this.tb},Ja:function(a){var b=this,d=c.T(b),f,h,l,e,g;b.wa||(b.wa=b.D,b.D=(n,p)=>{p&&"change"!==p?"beforeChange"===p?b.qb(n):b.wa(n,p):b.rb(n)});var k=a(()=>{b.ja=!1;d&&e===b&&(e=b.pb?b.pb():b());var n=h||g&&b.Ha(l,e);g=h=f=!1;n&&b.wa(l=e)});b.rb=(n,p)=>{p&&b.ja||(g=
!p);b.Ub=new Set(b.W.get("change"));b.ja=f=!0;e=n;k()};b.qb=n=>{f||(l=n,b.wa(n,"beforeChange"))};b.sb=()=>{g=!0};b.Wb=()=>{b.Ha(l,b.I(!0))&&(h=!0)}},ra:function(a){return(this.W.get(a)||[]).size},Ha:function(a,b){return!this.pa||!this.pa(a,b)},toString:()=>"[object Object]",extend:function(a){var b=this;a&&c.g.P(a,(d,f)=>{d=c.cb[d];"function"==typeof d&&(b=d(b,f)||b)});return b}};c.ha(D,"init",D.Fa);c.ha(D,"subscribe",D.subscribe);c.ha(D,"extend",D.extend);c.V.fn=Object.setPrototypeOf(D,Function.prototype);
c.kc=a=>"function"==typeof a?.subscribe&&"function"==typeof a.D;(()=>{var a=[],b,d=0;c.u={yb:f=>{a.push(b);b=f},end:()=>b=a.pop(),Pb:f=>{if(b){if(!c.kc(f))throw Error("Only subscribable things can act as dependencies");b.Yb.call(b.Zb,f,f.Vb||(f.Vb=++d))}},M:(f,h,l)=>{try{return a.push(b),b=void 0,f.apply(h,l||[])}finally{b=a.pop()}},qa:()=>b?.s.qa(),Ia:()=>b?.Ia,s:()=>b?.s}})();const B=Symbol("_latestValue");c.ba=a=>{function b(){if(0<arguments.length)return b.Ha(b[B],arguments[0])&&(b.nb(),b[B]=
arguments[0],b.Na()),this;c.u.Pb(b);return b[B]}b[B]=a;Object.defineProperty(b,"length",{get:()=>null==b[B]?void 0:b[B].length});c.V.fn.Fa(b);return Object.setPrototypeOf(b,F)};var F={toJSON:function(){let a=this[B];return a?.toJSON?.()||a},pa:P,I:function(){return this[B]},Na:function(){this.D(this[B],"spectate");this.D(this[B])},nb:function(){this.D(this[B],"beforeChange")}};Object.setPrototypeOf(F,c.V.fn);var G=c.ba.pc="__ko_proto__";F[G]=c.ba;c.T=a=>{if((a="function"==typeof a&&a[G])&&a!==F[G]&&
a!==c.s.fn[G])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!a};c.Jb=a=>"function"==typeof a&&(a[G]===F[G]||a[G]===c.s.fn[G]&&a.hc);c.v("observable",c.ba);c.v("isObservable",c.T);c.v("observable.fn",F);c.ha(F,"valueHasMutated",F.Na);c.ta=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return Object.setPrototypeOf(c.ba(a),
c.ta.fn).extend({trackArrayChanges:!0})};c.ta.fn=Object.setPrototypeOf({remove:function(a){for(var b=this.I(),d=!1,f="function"!=typeof a||c.T(a)?e=>e===a:a,h=b.length;h--;){var l=b[h];if(f(l)){if(b[h]!==l)throw Error("Array modified during remove; cannot remove item");d||this.nb();d=!0;b.splice(h,1)}}d&&this.Na()}},c.ba.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?
c.ta.fn[a]=function(...b){var d=this.I();this.nb();this.Ab(d,a,b);b=d[a](...b);this.Na();return b===d?this:b}:c.ta.fn[a]=function(...b){return this()[a](...b)})});c.Ib=a=>c.T(a)&&"function"==typeof a.remove&&"function"==typeof a.push;c.v("observableArray",c.ta);c.v("isObservableArray",c.Ib);c.cb.trackArrayChanges=(a,b)=>{function d(){function m(){if(g){var q=[].concat(a.I()||[]);if(a.ra("arrayChange")){if(!h||1<g)h=c.g.Bb(k,q,a.Va);var r=h}k=q;h=null;g=0;r?.length&&a.D(r,"arrayChange")}}f?m():(f=
!0,e=a.subscribe(()=>++g,null,"spectate"),k=[].concat(a.I()||[]),h=null,l=a.subscribe(m))}a.Va={};"object"==typeof b&&c.g.extend(a.Va,b);a.Va.sparse=!0;if(!a.Ab){var f=!1,h=null,l,e,g=0,k,n=a.Ta,p=a.Ra;a.Ta=m=>{n?.call(a,m);"arrayChange"===m&&d()};a.Ra=m=>{p?.call(a,m);"arrayChange"!==m||a.ra("arrayChange")||(l?.A(),e?.A(),e=l=null,f=!1,k=void 0)};a.Ab=(m,q,r)=>{function t(A,v,I){return u[u.length]={status:A,value:v,index:I}}if(f&&!g){var u=[],y=m.length,w=r.length,z=0;switch(q){case "push":z=y;case "unshift":for(m=
0;m<w;m++)t("added",r[m],z+m);break;case "pop":z=y-1;case "shift":y&&t("deleted",m[z],z);break;case "splice":z=Math.min(Math.max(0,0>r[0]?y+r[0]:r[0]),y);y=1===w?y:Math.min(z+(r[1]||0),y);w=z+w-2;q=Math.max(y,w);for(var C=[],H=[],O=2;z<q;++z,++O)z<y&&H.push(t("deleted",m[z],z)),z<w&&C.push(t("added",r[O],z));c.g.Gb(H,C);break;default:return}h=u}}}};var x=Symbol("_state");c.s=(a,b)=>{function d(){if(0<arguments.length){if("function"!==typeof f)throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
c.g.K.removeNode;c.v("utils.domNodeDisposal",c.g.K);c.v("utils.domNodeDisposal.addDisposeCallback",c.g.K.ma);c.cb={debounce:(a,b)=>a.Ja(d=>fa(d,b)),rateLimit:(a,b)=>a.Ja(d=>ea(d,b)),notify:(a,b)=>{a.pa="always"==b?null:P}};var da={undefined:1,"boolean":1,number:1,string:1};c.v("extenders",c.cb);class ka{constructor(a,b,d){this.X=a;this.ob=b;this.Da=d;this.Qa=!1;this.L=this.ia=null;c.ha(this,"dispose",this.A)}A(){this.Qa||(this.L&&c.g.K.jb(this.ia,this.L),this.Qa=!0,this.Da(),this.X=this.ob=this.Da=
this.ia=this.L=null)}o(a){this.ia=a;c.g.K.ma(a,this.L=this.A.bind(this))}}c.V=function(){Object.setPrototypeOf(this,D);D.Fa(this)};var D={Fa:a=>{a.W=new Map;a.W.set("change",new Set);a.tb=1},subscribe:function(a,b,d){var f=this;d=d||"change";var h=new ka(f,b?a.bind(b):a,()=>{f.W.get(d).delete(h);f.Ra?.(d)});f.Ta?.(d);f.W.has(d)||f.W.set(d,new Set);f.W.get(d).add(h);return h},D:function(a,b){b=b||"change";"change"===b&&this.Ma();if(this.ra(b)){b="change"===b&&this.Ub||new Set(this.W.get(b));try{c.u.yb(),
b.forEach(d=>{d.Qa||d.ob(a)})}finally{c.u.end()}}},Ca:function(){return this.tb},fc:function(a){return this.Ca()!==a},Ma:function(){++this.tb},Ja:function(a){var b=this,d=c.T(b),f,h,l,e,g;b.wa||(b.wa=b.D,b.D=(n,p)=>{p&&"change"!==p?"beforeChange"===p?b.qb(n):b.wa(n,p):b.rb(n)});var k=a(()=>{b.ja=!1;d&&e===b&&(e=b.pb?b.pb():b());var n=h||g&&b.Ha(l,e);g=h=f=!1;n&&b.wa(l=e)});b.rb=(n,p)=>{p&&b.ja||(g=!p);b.Ub=new Set(b.W.get("change"));b.ja=f=!0;e=n;k()};b.qb=n=>{f||(l=n,b.wa(n,"beforeChange"))};b.sb=
()=>{g=!0};b.Wb=()=>{b.Ha(l,b.I(!0))&&(h=!0)}},ra:function(a){return(this.W.get(a)||[]).size},Ha:function(a,b){return!this.pa||!this.pa(a,b)},toString:()=>"[object Object]",extend:function(a){var b=this;a&&c.g.P(a,(d,f)=>{d=c.cb[d];"function"==typeof d&&(b=d(b,f)||b)});return b}};c.ha(D,"init",D.Fa);c.ha(D,"subscribe",D.subscribe);c.ha(D,"extend",D.extend);c.V.fn=Object.setPrototypeOf(D,Function.prototype);c.kc=a=>"function"==typeof a?.subscribe&&"function"==typeof a.D;(()=>{var a=[],b,d=0;c.u={yb:f=>
{a.push(b);b=f},end:()=>b=a.pop(),Pb:f=>{if(b){if(!c.kc(f))throw Error("Only subscribable things can act as dependencies");b.Yb.call(b.Zb,f,f.Vb||(f.Vb=++d))}},M:(f,h,l)=>{try{return a.push(b),b=void 0,f.apply(h,l||[])}finally{b=a.pop()}},qa:()=>b?.s.qa(),Ia:()=>b?.Ia,s:()=>b?.s}})();const B=Symbol("_latestValue");c.ba=a=>{function b(){if(0<arguments.length)return b.Ha(b[B],arguments[0])&&(b.nb(),b[B]=arguments[0],b.Na()),this;c.u.Pb(b);return b[B]}b[B]=a;Object.defineProperty(b,"length",{get:()=>
null==b[B]?void 0:b[B].length});c.V.fn.Fa(b);return Object.setPrototypeOf(b,F)};var F={toJSON:function(){let a=this[B];return a?.toJSON?.()||a},pa:P,I:function(){return this[B]},Na:function(){this.D(this[B],"spectate");this.D(this[B])},nb:function(){this.D(this[B],"beforeChange")}};Object.setPrototypeOf(F,c.V.fn);var G=c.ba.pc="__ko_proto__";F[G]=c.ba;c.T=a=>{if((a="function"==typeof a&&a[G])&&a!==F[G]&&a!==c.s.fn[G])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
return!!a};c.Jb=a=>"function"==typeof a&&(a[G]===F[G]||a[G]===c.s.fn[G]&&a.hc);c.v("observable",c.ba);c.v("isObservable",c.T);c.v("observable.fn",F);c.ha(F,"valueHasMutated",F.Na);c.ta=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return Object.setPrototypeOf(c.ba(a),c.ta.fn).extend({trackArrayChanges:!0})};c.ta.fn=Object.setPrototypeOf({remove:function(a){for(var b=this.I(),d=!1,
f="function"!=typeof a||c.T(a)?e=>e===a:a,h=b.length;h--;){var l=b[h];if(f(l)){if(b[h]!==l)throw Error("Array modified during remove; cannot remove item");d||this.nb();d=!0;b.splice(h,1)}}d&&this.Na()}},c.ba.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?c.ta.fn[a]=function(...b){var d=this.I();this.nb();this.Ab(d,a,b);b=d[a](...b);this.Na();return b===
d?this:b}:c.ta.fn[a]=function(...b){return this()[a](...b)})});c.Ib=a=>c.T(a)&&"function"==typeof a.remove&&"function"==typeof a.push;c.v("observableArray",c.ta);c.v("isObservableArray",c.Ib);c.cb.trackArrayChanges=(a,b)=>{function d(){function m(){if(g){var q=[].concat(a.I()||[]);if(a.ra("arrayChange")){if(!h||1<g)h=c.g.Bb(k,q,a.Va);var r=h}k=q;h=null;g=0;r?.length&&a.D(r,"arrayChange")}}f?m():(f=!0,e=a.subscribe(()=>++g,null,"spectate"),k=[].concat(a.I()||[]),h=null,l=a.subscribe(m))}a.Va={};"object"==
typeof b&&c.g.extend(a.Va,b);a.Va.sparse=!0;if(!a.Ab){var f=!1,h=null,l,e,g=0,k,n=a.Ta,p=a.Ra;a.Ta=m=>{n?.call(a,m);"arrayChange"===m&&d()};a.Ra=m=>{p?.call(a,m);"arrayChange"!==m||a.ra("arrayChange")||(l?.A(),e?.A(),e=l=null,f=!1,k=void 0)};a.Ab=(m,q,r)=>{function t(A,v,I){return u[u.length]={status:A,value:v,index:I}}if(f&&!g){var u=[],y=m.length,w=r.length,z=0;switch(q){case "push":z=y;case "unshift":for(m=0;m<w;m++)t("added",r[m],z+m);break;case "pop":z=y-1;case "shift":y&&t("deleted",m[z],z);
break;case "splice":z=Math.min(Math.max(0,0>r[0]?y+r[0]:r[0]),y);y=1===w?y:Math.min(z+(r[1]||0),y);w=z+w-2;q=Math.max(y,w);for(var C=[],H=[],O=2;z<q;++z,++O)z<y&&H.push(t("deleted",m[z],z)),z<w&&C.push(t("added",r[O],z));c.g.Gb(H,C);break;default:return}h=u}}}};var x=Symbol("_state");c.s=(a,b)=>{function d(){if(0<arguments.length){if("function"!==typeof f)throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
f(...arguments);return this}h.$||c.u.Pb(d);(h.Y||h.C&&d.sa())&&d.U();return h.N}"object"===typeof a?b=a:(b=b||{},a&&(b.read=a));if("function"!=typeof b.read)throw Error("Pass a function that returns the value of the ko.computed");var f=b.write,h={N:void 0,aa:!0,Y:!0,Ga:!1,mb:!1,$:!1,ib:!1,C:!1,Ob:b.read,o:b.disposeWhenNodeIsRemoved||b.o||null,na:b.disposeWhen||b.na,$a:null,B:{},J:0,Fb:null};d[x]=h;d.hc="function"===typeof f;c.V.fn.Fa(d);Object.setPrototypeOf(d,J);b.pure&&(h.ib=!0,h.C=!0,c.g.extend(d,
la));h.o&&(h.mb=!0,h.o.nodeType||(h.o=null));h.C||d.U();h.o&&d.isActive()&&c.g.K.ma(h.o,h.$a=()=>{d.A()});return d};var J={pa:P,qa:function(){return this[x].J},dc:function(){var a=[];c.g.P(this[x].B,(b,d)=>a[d.ka]=d.X);return a},fb:function(a){if(!this[x].J)return!1;var b=this.dc();return b.includes(a)||!!b.find(d=>d.fb&&d.fb(a))},ub:function(a,b,d){if(this[x].ib&&b===this)throw Error("A 'pure' computed must not be called recursively");this[x].B[a]=d;d.ka=this[x].J++;d.la=b.Ca()},sa:function(){var a,
b=this[x].B;for(a in b)if(Object.prototype.hasOwnProperty.call(b,a)){var d=b[a];if(this.va&&d.X.ja||d.X.fc(d.la))return!0}},uc:function(){this[x].Ga||this.va?.(!1)},isActive:function(){var a=this[x];return a.Y||0<a.J},vc:function(){this.ja?this[x].Y&&(this[x].aa=!0):this.Eb()},Sb:function(a){return a.subscribe(this.Eb,this)},Eb:function(){var a=this,b=a.throttleEvaluation;0<=b?(clearTimeout(this[x].Fb),this[x].Fb=setTimeout(()=>a.U(!0),b)):a.va?a.va(!0):a.U(!0)},U:function(a){var b=this[x],d=b.na,

View file

@ -1,19 +1,7 @@
ko.extenders = {
'debounce': (target, timeout) => target.limit(callback => debounce(callback, timeout)),
'rateLimit': (target, options) => {
var timeout, method, limitFunction;
if (typeof options == 'number') {
timeout = options;
} else {
timeout = options['timeout'];
method = options['method'];
}
limitFunction = typeof method == 'function' ? method : throttle;
target.limit(callback => limitFunction(callback, timeout, options));
},
'rateLimit': (target, timeout) => target.limit(callback => throttle(callback, timeout)),
'notify': (target, notifyWhen) => {
target.equalityComparer = notifyWhen == "always" ?