PageSourceSearch

https://www.gettorf.de/:res/modules/common/common/ionas/core/web-modules/api.system.js?fp=fdba4de517ba

js gettorf.de collected 2026-10-02 21:53:35 UTC 12,665 bytes, 442 lines download raw bytes

1System.register([],(function(exports){
2'use strict';
3return{
4execute:(function(){
5exports({
6debounced:debounced,
7delayedAsync:delayedAsync,
8delayedAsyncRestart:delayedAsyncRestart,
9determineCaptchaIsNecessary:determineCaptchaIsNecessary,
10eventually:eventually,
11findElement:findElement,
12forgotPassword:forgotPassword,
13getBackendBaseUrl:getBackendBaseUrl,
14getBaseUrl:getBaseUrl,
15getCoreCookieInfo:getCoreCookieInfo,
16getCsrfHeaders:getCsrfHeaders,
17getCsrfToken:getCsrfToken,
18isBadCaptchaResponseError:isBadCaptchaResponseError,
19isBadCredentialsError:isBadCredentialsError,
20isCommunicationError:isCommunicationError,
21isCookieConsentInfoUnavailableError:isCookieConsentInfoUnavailableError,
22isLacksCookieSupportError:isLacksCookieSupportError,
23isPasswordExpiredResponseError:isPasswordExpiredResponseError,
24loadCurrentSessionInfo:loadCurrentSessionInfo,
25loadLoginOptions:loadLoginOptions,
26login:login,
27logout:logout,
28logoutCurrentWindow:logoutCurrentWindow,
29once:once,
30whenReadyState:whenReadyState
31});
32const COMMUNICATION_ERROR_MESSAGE=exports('COMMUNICATION_ERROR_MESSAGE',"Communication with server failed");
33const COMMUNICATION_ERROR_CODE=exports('COMMUNICATION_ERROR_CODE',"communication_error");
34const COOKIES_NOT_SUPPORT_MESSAGE=exports('COOKIES_NOT_SUPPORT_MESSAGE',"Cookies must be permitted");
35const COOKIES_NOT_SUPPORT_CODE=exports('COOKIES_NOT_SUPPORT_CODE',"cookies_not_supported");
36const BAD_CAPTCHA_RESPONSE_MESSAGE=exports('BAD_CAPTCHA_RESPONSE_MESSAGE',"Bad captcha response");
37const BAD_CAPTCHA_RESPONSE_CODE=exports('BAD_CAPTCHA_RESPONSE_CODE',"bad_captcha_response");
38const PASSWORD_EXPIRED_RESPONSE_MESSAGE=exports('PASSWORD_EXPIRED_RESPONSE_MESSAGE',"Password expired response");
39const PASSWORD_EXPIRED_RESPONSE_CODE=exports('PASSWORD_EXPIRED_RESPONSE_CODE',"password_expired_response");
40const VERIFICATION_CODE_NEEDED_RESPONSE_CODE=exports('VERIFICATION_CODE_NEEDED_RESPONSE_CODE',"verification_code_needed");
41const BAD_CREDENTIALS_MESSAGE=exports('BAD_CREDENTIALS_MESSAGE',"Bad credentials");
42const BAD_CREDENTIALS_CODE=exports('BAD_CREDENTIALS_CODE',"bad_credentials");
43const COOKIE_CONSENT_INFO_UNAVAILABLE_MESSAGE=exports('COOKIE_CONSENT_INFO_UNAVAILABLE_MESSAGE',"Cookie consent information unavailable");
44const COOKIE_CONSENT_INFO_UNAVAILABLE_CODE=exports('COOKIE_CONSENT_INFO_UNAVAILABLE_CODE',"cookies_consent_information_unavailable");
45const CUSTOM_ERROR_CODE=exports('CUSTOM_ERROR_CODE',"custom_error");
46class XhrError extends Error{
47statusText;
48status;
49constructor(message,statusText,status){
50super(message);
51this.statusText=statusText;
52this.status=status;
53}
54}exports('XhrError',XhrError);
55class SessionError extends Error{
56code;
57constructor(message,code){
58super(message);
59this.code=code;
60}
61}exports('SessionError',SessionError);
62function isCommunicationError(error){
63return error
64&&(error instanceof SessionError||("code"in error))
65&&COMMUNICATION_ERROR_CODE===error.code;
66}
67function isLacksCookieSupportError(error){
68return error
69&&(error instanceof SessionError||("code"in error))
70&&COOKIES_NOT_SUPPORT_CODE===error.code;
71}
72function isBadCaptchaResponseError(error){
73return error
74&&(error instanceof SessionError||("code"in error))
75&&BAD_CAPTCHA_RESPONSE_CODE===error.code;
76}
77function isPasswordExpiredResponseError(error){
78return error
79&&(error instanceof SessionError||("code"in error))
80&&PASSWORD_EXPIRED_RESPONSE_CODE===error.code;
81}
82function isBadCredentialsError(error){
83return error
84&&(error instanceof SessionError||("code"in error))
85&&BAD_CREDENTIALS_CODE===error.code;
86}
87function isCookieConsentInfoUnavailableError(error){
88return error
89&&(error instanceof SessionError||("code"in error))
90&&COOKIE_CONSENT_INFO_UNAVAILABLE_CODE===error.code;
91}
92let ionasInfoElement=document.getElementById('ionasInfo');
93var ionasInfo=exports('ionasInfo',ionasInfoElement?JSON.parse(ionasInfoElement.innerText):undefined);
94function getBaseUrl(){
95if(ionasInfo?.context){
96return ionasInfo.context;
97}
98const ionas4=window.ionas4;
99if(ionas4?.contextPath){
100return"";
101}
102if(document.head.dataset.contextPath!==undefined){
103return document.head.dataset.contextPath;
104}
105const baseLink=document.head.querySelector("link[rel='base']");
106if(baseLink&&baseLink.href){
107return baseLink.href;
108}
109return"";
110}
111function getBackendBaseUrl(){
112if(ionasInfo?.backend){
113return ionasInfo.backend;
114}
115const baseLink=document.head.querySelector("link[rel='base']");
116if(baseLink&&baseLink.href){
117return baseLink.href;
118}
119return"";
120}
121let coreCookieInfo=null;
122async function requestCoreCookieInfo(){
123let response=await fetch(getBaseUrl()+'/:ionasinfo/coreCookieConsent',{headers:{'Accept':'application/json'}});
124if(response.ok){
125return response.json();
126}
127throw new SessionError(COOKIE_CONSENT_INFO_UNAVAILABLE_MESSAGE,COOKIE_CONSENT_INFO_UNAVAILABLE_CODE);
128}
129function getCoreCookieInfo(){
130return coreCookieInfo=(coreCookieInfo||requestCoreCookieInfo());
131}
132window.addEventListener('cookie-consent-issued',()=>{
133window.IONAS_CSRF_TOKEN=undefined;
134window.IONAS_CSRF_TOKEN_PERMITTED_COOKIES=undefined;
135});
136async function requestCsrfToken(permitCookies){
137let url=new URL(getBaseUrl()+'/:ionasinfo/csrfToken',location.href);
138if(permitCookies){
139let coreCookieInfo=await getCoreCookieInfo();
140url.searchParams.append(coreCookieInfo.cookieName,coreCookieInfo.cookieValue);
141}
142let response=await fetch(url.href,{headers:{'Accept':'application/json'}});
143if(response.ok){
144return response.json();
145}
146throw new Error("Cannot fetch CSRF token. "+response.statusText);
147}
148function getCsrfToken(permitCookies){
149if(permitCookies){
150window.IONAS_CSRF_TOKEN_PERMITTED_COOKIES??=requestCsrfToken(permitCookies).finally(()=>{
151window.IONAS_CSRF_TOKEN_PERMITTED_COOKIES=undefined;
152});
153return window.IONAS_CSRF_TOKEN_PERMITTED_COOKIES;
154}
155else{
156window.IONAS_CSRF_TOKEN??=requestCsrfToken(permitCookies).finally(()=>{
157window.IONAS_CSRF_TOKEN=undefined;
158});
159return window.IONAS_CSRF_TOKEN;
160}
161}
162async function getCsrfHeaders(permitCookies){
163let csrfToken=await getCsrfToken(permitCookies);
164const csrfHeaders=new Headers();
165csrfHeaders.append(csrfToken.headerName,csrfToken.token);
166return csrfHeaders;
167}
168async function loadLoginOptions(targetUri){
169const url=getBaseUrl()+'/:users/login/options?targetUri='+encodeURIComponent(targetUri||"");
170return fetch(url,{headers:{'Accept':'application/json'}})
171.then(response=>{
172if(response.ok){
173return response.json();
174}
175else{
176throw new SessionError(`${response.status} ${response.statusText}`,COMMUNICATION_ERROR_CODE);
177}
178});
179}
180async function determineCaptchaIsNecessary(){
181return fetch(getBaseUrl()+'/:users/login/displayCaptcha',{headers:{'Accept':'application/json'}})
182.then(response=>{
183if(response.ok){
184return response.json();
185}
186else{
187throw new SessionError(`${response.status} ${response.statusText}`,COMMUNICATION_ERROR_CODE);
188}
189})
190.then(answer=>{
191return{
192type:answer.type,
193display:answer.display,
194until:answer.until?new Date(answer.until):null
195};
196});
197}
198async function login(username,password,optionsOrCaptcha){
199document.cookie="menu-slide-in=false; path=/";
200if(!(";"+document.cookie+";").match(/;\s*menu-slide-in=false;/)){
201return Promise.reject(new SessionError(COOKIES_NOT_SUPPORT_MESSAGE,COOKIES_NOT_SUPPORT_CODE));
202}
203const data=new FormData();
204data.append("login",username);
205data.append("password",password);
206data.append("dologin","true");
207let contextPath=getBaseUrl().match(/^(?:https?:\/\/[^\/]+)?(\/[^\/]+)$/)?.[1];
208data.append("deviceId",localStorage.getItem("ionas-device-id"+contextPath)||localStorage.getItem("ionas-device-id")||"");
209return getCoreCookieInfo().then(cookieInfo=>{
210let captcha;
211let verificationCode;
212let rememberMe;
213if(typeof optionsOrCaptcha==="string"){
214captcha=optionsOrCaptcha;
215}
216else if(optionsOrCaptcha!==undefined){
217captcha=optionsOrCaptcha.captcha;
218verificationCode=optionsOrCaptcha.verificationCode;
219rememberMe=optionsOrCaptcha.rememberMe;
220}
221data.append(cookieInfo.cookieName,cookieInfo.cookieValue);
222if(captcha){
223data.append("g-recaptcha-response",captcha);
224}
225if(verificationCode){
226data.append("verificationCode",verificationCode);
227}
228if(rememberMe!==undefined){
229data.append("rememberMe",rememberMe.toString());
230}
231return getCsrfHeaders(true)
232.then(csrfHeaders=>{
233let headers=new Headers(csrfHeaders);
234headers.set("Accept","application/json");
235return fetch(getBaseUrl()+'/:users/login/checkSession',{
236method:'POST',
237body:data,
238headers:headers
239});
240})
241.then(response=>{
242if(response.ok){
243return response.json();
244}
245else{
246throw new SessionError(`${response.status} ${response.statusText}`,COMMUNICATION_ERROR_CODE);
247}
248})
249.then(answer=>{
250if(answer.__errorNo&&answer.__errorNo===42){
251throw new SessionError(BAD_CAPTCHA_RESPONSE_MESSAGE,BAD_CAPTCHA_RESPONSE_CODE);
252}
253else if(answer.__errorNo&&answer.__errorNo===46){
254throw new SessionError(PASSWORD_EXPIRED_RESPONSE_MESSAGE,PASSWORD_EXPIRED_RESPONSE_CODE);
255}
256else if(answer.__errorNo&&answer.__errorNo===47){
257throw new SessionError(answer.__error,VERIFICATION_CODE_NEEDED_RESPONSE_CODE);
258}
259else if(answer.__error){
260throw new SessionError(answer.__error,CUSTOM_ERROR_CODE);
261}
262else if(answer!==false){
263let result=answer;
264if(result.deviceId!=null){
265localStorage.setItem("ionas-device-id"+contextPath,result.deviceId);
266}
267return result;
268}
269else{
270throw new SessionError(BAD_CREDENTIALS_MESSAGE,BAD_CREDENTIALS_CODE);
271}
272});
273});
274}
275async function loadCurrentSessionInfo(){
276return fetch(getBaseUrl()+'/:users/login/sessionInfo',{headers:{'Accept':'application/json'}})
277.then(response=>{
278if(response.ok){
279return response.json();
280}
281else{
282throw new SessionError(`${response.status} ${response.statusText}`,COMMUNICATION_ERROR_CODE);
283}
284});
285}
286function getLogoutUrl(){
287return ionasInfo?.logoutRoot||getBaseUrl()+'/:logout';
288}
289async function logout(){
290return logoutCurrentWindow('/');
291}
292async function logoutCurrentWindow(logoutSuccessPath){
293let csrfHeaders=await getCsrfHeaders();
294let headers=new Headers(csrfHeaders);
295headers.set("Accept","application/json");
296return fetch(getLogoutUrl()+(logoutSuccessPath||"/"),{
297method:'POST',
298headers:headers
299});
300}
301async function forgotPassword(email){
302return getCsrfHeaders()
303.then(csrfHeaders=>{
304let headers=new Headers(csrfHeaders);
305headers.set("Accept","application/json");
306const data=new FormData();
307data.append("email",email);
308return fetch(getBaseUrl()+'/:users/login/forgotPassword',{
309method:'POST',
310body:data,
311headers:headers
312});
313})
314.then(response=>{
315if(response.ok){
316return response.json();
317}
318else{
319throw new SessionError(`${response.status} ${response.statusText}`,COMMUNICATION_ERROR_CODE);
320}
321})
322.then(response=>{
323return response;
324});
325}
326function eventually(func,timeout,immediate){
327let timeoutHandle=undefined;
328if(immediate){
329return function(...args){
330if(!timeoutHandle){
331func.apply(this,args);
332timeoutHandle=setTimeout(function(){
333timeoutHandle=undefined;
334},timeout||0);
335}
336};
337}
338else{
339return function(...args){
340if(timeoutHandle){
341clearTimeout(timeoutHandle);
342}
343timeoutHandle=setTimeout((function(){
344timeoutHandle=undefined;
345func.apply(this,args);
346}).bind(this),timeout||0);
347};
348}
349}
350function once(func){
351let called=false;
352return function(...args){
353if(!called){
354called=true;
355return func.apply(this,args);
356}
357};
358}
359function debounced(func,immediate){
360return eventually(func,300,immediate);
361}
362function delayedAsync(func,delay,restartDelay){
363let active=false;
364let retrigger=false;
365let timeout=null;
366let timeoutTime=0;
367let finish=function(){
368active=false;
369if(retrigger){
370retrigger=false;
371executeNow();
372}
373};
374let executeNow=function(){
375active=true;
376try{
377func().catch(function(error){throw error;});
378}
379finally{
380finish();
381}
382};
383let trigger=function(){
384timeout=null;
385if(active){
386retrigger=true;
387}
388else{
389executeNow();
390}
391};
392return function(customDelay){
393let actualDelay=customDelay!=null?customDelay:delay;
394let newTimeoutTime=Date.now()+actualDelay;
395if(timeout!=null){
396if(restartDelay||actualDelay<0||newTimeoutTime<timeoutTime){
397clearTimeout(timeout);
398timeout=null;
399}
400else{
401return;
402}
403}
404if(actualDelay<0){
405trigger();
406}
407else{
408timeout=setTimeout(trigger,actualDelay);
409timeoutTime=newTimeoutTime;
410}
411};
412}
413function delayedAsyncRestart(func,delay){
414return delayedAsync(func,delay,true);
415}
416function findElement(elementList,predicate,thisArg){
417if(elementList){
418for(let i=0,n=elementList.length;i<n;i++){
419if(predicate.call(thisArg,elementList[i],i,elementList)){
420return elementList[i];
421}
422}
423}
424return null;
425}
426async function whenReadyState(state,document){
427return new Promise(function(resolve){
428let effectiveState=state||'complete';
429let effectiveDocument=document||window.document;
430function onReadyStateChange(){
431if(effectiveDocument.readyState===effectiveState){
432resolve(effectiveDocument);
433effectiveDocument.removeEventListener('readystatechange',onReadyStateChange);
434}
435}
436effectiveDocument.addEventListener('readystatechange',onReadyStateChange);
437onReadyStateChange();
438});
439}
440})
441};
442}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.