123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <!DOCTYPE html>
- <!--
- Copyright © 2016-2017 Threema GmbH (https://threema.ch/).
- This file is part of Threema Web.
- Threema Web is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or (at
- your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
- General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
- -->
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="referrer" content="no-referrer">
- <meta name="robots" content="noindex" />
- <title>Threema Web Diagnostics</title>
- <!-- Favicon -->
- <link rel="icon" href="../img/favicon.ico?v=[[VERSION]]" type="image/x-icon"/>
- <link rel="shortcut icon" href="../img/favicon.ico?v=[[VERSION]]" type="image/x-icon"/>
- <!-- Fonts -->
- <link rel="stylesheet" href="../fonts/roboto.css?v=[[VERSION]]" type="text/css">
- <link rel="stylesheet" href="../fonts/material.css?v=[[VERSION]]" type="text/css">
- <!-- Styling -->
- <style>
- body {
- padding: 16px;
- font-family: 'Roboto';
- }
- #background-image {
- min-height: 100%;
- min-width: 1024px;
- width: 100%;
- height: auto;
- position: fixed;
- top: 0;
- left: 0;
- z-index: -1;
- -moz-user-select: none;
- -webkit-user-select: none;
- user-select: none;
- }
- #wrapper {
- background-color: white;
- margin: 0 auto;
- padding: 16px 32px 32px;
- min-width: 400px;
- max-width: 500px;
- text-align: center;
- }
- #logo {
- width: 300px;
- color: white;
- margin: 0px auto 16px;
- }
- h1 { margin-top: 0; font-weight: 500; }
- h2 { font-weight: 300; }
- p { font-weight: 300; }
- .status span {
- display: inline-block;
- line-height: 36px;
- vertical-align: top;
- }
- .status-yes i { color: #4caf50; }
- .status-no i { color: #f44336; }
- .status-unknown i { color: #0277BD; }
- .hidden { display: none; }
- .small { font-size: 0.8em; font-weight: 300; }
- footer {
- color: white;
- font-weight: 300;
- text-align: center;
- padding-top: 16px;
- }
- </style>
- <!-- JS -->
- <script src="../node_modules/webrtc-adapter/out/adapter.js?v=[[VERSION]]"></script>
- <script src="../node_modules/sdp/sdp.js?v=[[VERSION]]"></script>
- <script>
- function switchTo(type, newStatus) {
- var unknown = document.querySelector('#status-' + type + ' .status-unknown');
- if (unknown) {
- unknown.classList.add('hidden');
- }
- var test = document.querySelector('#status-' + type + ' .status-test')
- if (test) {
- test.classList.add('hidden');
- }
- document.querySelector('#status-' + type + ' .status-no').classList.add('hidden');
- document.querySelector('#status-' + type + ' .status-yes').classList.add('hidden');
- document.querySelector('#status-' + type + ' .status-' + newStatus).classList.remove('hidden');
- }
- function doChecks() {
- // Check for JS
- switchTo('js', 'yes');
- // Check for RTCPeerConnection
- if (window.RTCPeerConnection) {
- switchTo('pc', 'yes');
- } else {
- switchTo('pc', 'no');
- }
- // Check for RTCDataChannel
- if (window.RTCPeerConnection && (new RTCPeerConnection()).createDataChannel) {
- switchTo('dc', 'yes');
- switchTo('turn', 'test');
- } else {
- switchTo('dc', 'no');
- switchTo('turn', 'no');
- }
- // Check for LocalStorage
- function localStorageAvailable(){
- var test = 'test';
- try {
- localStorage.setItem(test, test);
- localStorage.removeItem(test);
- return true;
- } catch(e) {
- return false;
- }
- }
- if (localStorageAvailable()) {
- switchTo('ls', 'yes');
- } else {
- switchTo('ls', 'no');
- }
- // Check for TURN connectivity
- var timeout = null;
- function turnSuccess() {
- switchTo('turn', 'yes');
- clearTimeout(timeout);
- }
- function turnFail() {
- switchTo('turn', 'no');
- document.querySelector('#status-turn .results').classList.add('hidden');
- document.querySelector('#status-turn .status-no .small').classList.remove('hidden');
- }
- var button = document.querySelector('#status-turn button');
- button.addEventListener('click', function(e) {
- button.outerHTML = '<img src="loading.gif" alt="Loading...">';
- timeout = setTimeout(function() {
- turnFail();
- }, 10000);
- var noop = function() {};
- var pc = new RTCPeerConnection({iceServers: [{
- urls: [
- 'turn:turn.threema.ch:443?transport=udp',
- 'turn:turn.threema.ch:443?transport=tcp',
- 'turns:turn.threema.ch:443',
- ],
- username: 'threema-angular-test',
- credential: 'VaoVnhxKGt2wD20F9bTOgiew6yHQmj4P7y7SE4lrahAjTQC0dpnG32FR4fnrlpKa',
- }]});
- document.querySelector('#status-turn .results').classList.remove('hidden');
- var resultData = document.querySelector('#status-turn .result-data');
- pc.createDataChannel('test');
- console.info('Creating offer...');
- pc.createOffer(function(sdp) { pc.setLocalDescription(sdp, noop, noop) }, noop);
- pc.onicecandidate = function(ice) {
- if (ice.candidate === null) {
- console.info('Done collecting candidates.');
- } else if (ice.candidate.candidate) {
- var candidate = SDPUtils.parseCandidate(ice.candidate.candidate);
- console.debug(candidate);
- if (candidate.type === 'relay') {
- var info = '[' + candidate.type + '] ' + candidate.ip + ':' + candidate.port + ' (' + candidate.protocol + ')';
- if (candidate.relatedAddress.indexOf(':') !== -1) {
- info += ' (ipv6)';
- } else if (candidate.relatedAddress.indexOf('.') !== -1) {
- info += ' (ipv4)';
- } else {
- info += ' (?)';
- }
- resultData.innerHTML += info + '<br>';
- turnSuccess();
- }
- } else {
- console.warn('Invalid candidate:', ice.candidate.candidate);
- }
- }
- });
- }
- if (document.readyState != 'loading') {
- doChecks();
- } else {
- document.addEventListener('DOMContentLoaded', doChecks);
- }
- </script>
- </head>
- <body>
- <img src="../img/bg1.jpg?v=[[VERSION]]" id="background-image" draggable="false" alt="" />
- <header>
- <div id="title">
- <div id="logo">
- <img src="../img/logo.svg?v=[[VERSION]]" alt="Logo">
- </div>
- </div>
- </header>
- <div id="wrapper">
- <h1>Threema Web Diagnostics</h1>
- <h2>Is JavaScript enabled?</h2>
- <div id="status-js">
- <div class="status status-no">
- <i class="material-icons md-36">error</i> <span class="text">No</span>
- </div>
- <div class="status status-yes hidden">
- <i class="material-icons md-36">check_circle</i> <span class="text">Yes</span>
- </div>
- </div>
- <h2>Is WebRTC available?</h2>
- <div id="status-pc">
- <div class="status status-unknown">
- <i class="material-icons md-36">help</i> <span class="text">Unknown</span>
- </div>
- <div class="status status-no hidden">
- <i class="material-icons md-36">error</i> <span class="text">No</span>
- <p class="small">RTCPeerConnection is a part of WebRTC.<br>Threema Web cannot work without it.</p>
- </div>
- <div class="status status-yes hidden">
- <i class="material-icons md-36">check_circle</i> <span class="text">Yes</span>
- </div>
- </div>
- <h2>Are WebRTC DataChannels available?</h2>
- <div id="status-dc">
- <div class="status status-unknown">
- <i class="material-icons md-36">help</i> <span class="text">Unknown</span>
- </div>
- <div class="status status-no hidden">
- <i class="material-icons md-36">error</i> <span class="text">No</span>
- <p class="small">RTCDataChannel is a part of WebRTC.<br>Threema Web cannot work without it.</p>
- </div>
- <div class="status status-yes hidden">
- <i class="material-icons md-36">check_circle</i> <span class="text">Yes</span>
- </div>
- </div>
- <h2>Is LocalStorage available?</h2>
- <div id="status-ls">
- <div class="status status-unknown">
- <i class="material-icons md-36">help</i> <span class="text">Unknown</span>
- </div>
- <div class="status status-no hidden">
- <i class="material-icons md-36">error</i> <span class="text">No</span>
- <p class="small">Without LocalStorage, persistent sessions and settings<br>cannot be stored in the browser.<br>
- See the <a href="https://threema.ch/faq/web_browser_settings">FAQ</a> for information on how to fix this.</p>
- </div>
- <div class="status status-yes hidden">
- <i class="material-icons md-36">check_circle</i> <span class="text">Yes</span>
- </div>
- </div>
- <h2>Does TURN work?</h2>
- <div id="status-turn">
- <div class="status status-unknown">
- <i class="material-icons md-36">help</i> <span class="text">Unknown</span>
- </div>
- <div class="status status-no hidden">
- <i class="material-icons md-36">error</i> <span class="text">No</span>
- <p class="small hidden">It looks like TURN traffic is being blocked by your firewall.<br>
- Without TURN, connections can only be established if your computer<br>
- and your phone are in the same network.</p>
- </div>
- <div class="status status-yes hidden">
- <i class="material-icons md-36">check_circle</i> <span class="text">Yes</span>
- </div>
- <div class="status status-test hidden">
- <button>Click to test</button>
- </div>
- <div class="results hidden">
- <p>Results:</p>
- <p class="result-data"></p>
- </div>
- </div>
- </div>
- <footer>
- © 2017 Threema GmbH
- </footer>
- </body>
- </html>
|