debug.hbs 4.02 KB
Newer Older
Robert Czechowski's avatar
Robert Czechowski committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{{#if known_session}}<p>Session in Datenbank vorhanden {{/if}}
{{#if alive_session}}<p>Session lebt {{/if}}
<p>Now: {{ now_timestamp }}
<p>Last: {{ session_timestamp }}
<p>Diff: {{ timediff }}
{{#if logged_in}}
  <p> Eingeloggt als <em>{{ username }}</em>

  {{#if firstname}}{{#if lastname}}
    <p>({{firstname}} {{lastname}})
  {{/if}}{{/if}}

  {{#if teacher}}
    <p>[Lehrer]
  {{/if}}

  {{#if admin}}
    <p>[Admin]
  {{/if}}

  <p><a href="/debug/logout">Logout</a>
{{/if}}

<p>Session-Token: {{session}}

<p><a href="/debug/reset">Neues Token</a>
<p><a href="/debug/create">Erzeuge Session in DB</a>
28
29

<p>Datenbank: {{dbinfo}}
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

   <p id="speed_local">&nbsp;</p>
   <p id="speed">&nbsp;</p>
   <p id="browser"></p>

   <script>
      var time_before = Date.now();
      var time_after = Date.now();

      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
         if (this.readyState == 4 && this.status == 200) {
         time_after = Date.now()
         var diff = time_after - time_before;
         document.getElementById("speed").innerHTML = diff;
      }
      };
      xhttp.open("GET", "https://www.foaas.com/asshole/me", true);
      xhttp.send();

      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
         if (this.readyState == 4 && this.status == 200) {
            time_after = Date.now()
            var diff = time_after - time_before;
            document.getElementById("speed_local").innerHTML = diff;
         }
      };
      xhttp.open("GET", "/", true);
      xhttp.send();
   </script>


   <script>
      // From https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
      // Opera 8.0+
      var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

      // Firefox 1.0+
      var isFirefox = typeof InstallTrigger !== 'undefined';

      // Safari 3.0+ "[object HTMLElementConstructor]" 
      var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));

      // Internet Explorer 6-11
      var isIE = /*@cc_on!@*/false || !!document.documentMode;

      // Edge 20+
      var isEdge = !isIE && !!window.StyleMedia;

      // Chrome 1 - 79
      var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);

      // Edge (based on chromium) detection
      var isEdgeChromium = isChrome && (navigator.userAgent.indexOf("Edg") != -1);

      // Blink engine detection
      var isBlink = (isChrome || isOpera) && !!window.CSS;


      var output = 'Detecting browsers by ducktyping:<hr>';
      output += 'isFirefox: ' + isFirefox + '<br>';
      output += 'isChrome: ' + isChrome + '<br>';
      output += 'isSafari: ' + isSafari + '<br>';
      output += 'isOpera: ' + isOpera + '<br>';
      output += 'isIE: ' + isIE + '<br>';
      output += 'isEdge: ' + isEdge + '<br>';
      output += 'isEdgeChromium: ' + isEdgeChromium + '<br>';
      output += 'isBlink: ' + isBlink + '<br>';
      //document.getElementById("browser").innerHTML = output;
   </script>

   <script>
      // From https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser
      navigator.sayswho= (function(){
      var ua= navigator.userAgent, tem, 
      M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
      if(/trident/i.test(M[1])){
      tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
      return 'IE '+(tem[1] || '');
      }
      if(M[1]=== 'Chrome'){
      tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
      if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
      }
      M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
      if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
      return M.join(' ');
      })();

      document.getElementById("browser").innerHTML = navigator.sayswho; // outputs: `Chrome 62`
   </script>