|
| 1 | +<!-- Copyright (c) Gitpod. All rights reserved.' --> |
| 2 | +<!DOCTYPE html> |
| 3 | +<html> |
| 4 | + |
| 5 | +<head> |
| 6 | + <meta charset="utf-8" /> |
| 7 | + <meta name="viewport" |
| 8 | + content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> |
| 9 | + <title>Gitpod: Redirect</title> |
| 10 | + <style type="text/css"> |
| 11 | + html { |
| 12 | + height: 100%; |
| 13 | + } |
| 14 | + |
| 15 | + body { |
| 16 | + box-sizing: border-box; |
| 17 | + min-height: 100%; |
| 18 | + margin: 0; |
| 19 | + padding: 15px 30px; |
| 20 | + display: flex; |
| 21 | + flex-direction: column; |
| 22 | + color: white; |
| 23 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, "Ubuntu", "Droid Sans", sans-serif; |
| 24 | + background-color: #2C2C32; |
| 25 | + } |
| 26 | + |
| 27 | + .message-container { |
| 28 | + flex-grow: 1; |
| 29 | + display: flex; |
| 30 | + align-items: center; |
| 31 | + justify-content: center; |
| 32 | + margin: 0 30px; |
| 33 | + } |
| 34 | + |
| 35 | + .message { |
| 36 | + font-weight: 700; |
| 37 | + font-size: 2.0rem; |
| 38 | + } |
| 39 | + |
| 40 | + </style> |
| 41 | +</head> |
| 42 | + |
| 43 | +<body> |
| 44 | + <div class="message-container"> |
| 45 | + <div class="message"> |
| 46 | + You can close this page now. |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + |
| 50 | + <script> |
| 51 | + (function () { |
| 52 | + function decode(value) { |
| 53 | + return value === null ? null : decodeURIComponent(value); |
| 54 | + } |
| 55 | + |
| 56 | + const url = new URL(window.location.href); |
| 57 | + const params = url.searchParams; |
| 58 | + const id = decode(params.get('vscode-reqid')); |
| 59 | + const scheme = decode(params.get('vscode-scheme')); |
| 60 | + const authority = decode(params.get('vscode-authority')); |
| 61 | + |
| 62 | + if (!id) { |
| 63 | + throw new Error('Missing id'); |
| 64 | + } else if (!scheme) { |
| 65 | + throw new Error('Missing scheme'); |
| 66 | + } else if (!authority) { |
| 67 | + throw new Error('Missing authority'); |
| 68 | + } |
| 69 | + |
| 70 | + const path = decode(params.get('vscode-path')); |
| 71 | + const query = decode(params.get('vscode-query')); |
| 72 | + const fragment = decode(params.get('vscode-fragment')); |
| 73 | + |
| 74 | + params.delete('vscode-reqid'); |
| 75 | + params.delete('vscode-scheme'); |
| 76 | + params.delete('vscode-authority'); |
| 77 | + params.delete('vscode-path'); |
| 78 | + params.delete('vscode-query'); |
| 79 | + params.delete('vscode-fragment'); |
| 80 | + |
| 81 | + let uri = { scheme, authority }; |
| 82 | + |
| 83 | + if (path) { |
| 84 | + uri.path = path; |
| 85 | + } |
| 86 | + |
| 87 | + if (query) { |
| 88 | + const originalParams = new URLSearchParams(query); |
| 89 | + originalParams.forEach((value, key) => params.set(key, value)); |
| 90 | + } |
| 91 | + |
| 92 | + const resultQuery = params.toString(); |
| 93 | + if (resultQuery) { |
| 94 | + uri.query = resultQuery; |
| 95 | + } |
| 96 | + |
| 97 | + if (url.hash) { |
| 98 | + uri.fragment = url.hash.replace(/^#/, ''); |
| 99 | + } else if (fragment) { |
| 100 | + uri.fragment = fragment; |
| 101 | + } |
| 102 | + |
| 103 | + window.localStorage.setItem(`vscode-web.url-callbacks[${id}]`, JSON.stringify(uri)); |
| 104 | + })(); |
| 105 | + </script> |
| 106 | +</body> |
| 107 | + |
| 108 | +</html> |
0 commit comments