From c37c6983c38833c8888a98682b6e3b3284490996 Mon Sep 17 00:00:00 2001 From: willyb321 Date: Wed, 1 Aug 2018 14:14:30 +1000 Subject: [PATCH] orbis auth --- src/app/components/ModalOrbis.jsx | 9 ++++----- src/app/utils/ShortenUrl.js | 26 +++++++------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/app/components/ModalOrbis.jsx b/src/app/components/ModalOrbis.jsx index 2a91e27e..0978e9d5 100644 --- a/src/app/components/ModalOrbis.jsx +++ b/src/app/components/ModalOrbis.jsx @@ -73,6 +73,7 @@ export default class ModalOrbis extends TranslatedComponent { * @return {React.Component} Modal Content */ render() { + const API_ORBIS_REGISTER = 'https://login.willb.info/signup?client_id=a555021d-17d2-4b4e-8f16-f831d8add0f5&scope=openid profile email address phone offline_access&response_type=code&passReqToCallback=true&redirect_uri=https%3A%2F%2Forbis.zone%3A3030%2Fapi%2Fauth%2Fcb'; let translate = this.context.language.translate; this.orbisPasswordHandler = this.orbisPasswordHandler.bind(this); this.orbisUsername = this.orbisUsername.bind(this); @@ -81,13 +82,11 @@ export default class ModalOrbis extends TranslatedComponent { return
e.stopPropagation() }>

{translate('permalink')}


-

{translate('orbis email')}

- e.target.select() }/> + Log in to Orbis

-

{translate('orbis password')}

- e.target.select() }/> + Sign up to Orbis

-

{translate('shortened')}

+

{translate('Orbis link')}

e.target.select() }/>

Orbis.zone is currently in a trial period, and may be wiped at any time as development progresses. Some elements are also still placeholders.

diff --git a/src/app/utils/ShortenUrl.js b/src/app/utils/ShortenUrl.js index c6afcb6f..f81e28b0 100644 --- a/src/app/utils/ShortenUrl.js +++ b/src/app/utils/ShortenUrl.js @@ -95,9 +95,7 @@ function orbisShorten(url, success, error) { } } -const API_ORBIS = 'https://orbis.zone/api/builds/add'; -const API_ORBIS_LOGIN = 'https://orbis.zone/api/login'; - +const API_ORBIS = 'http://localhost:3030/api/builds/add'; /** * Upload to Orbis * @param {object} ship The URL to shorten @@ -109,26 +107,16 @@ export function orbisUpload(ship, creds) { if (window.navigator.onLine) { try { agent - .post(API_ORBIS_LOGIN) - .send(creds) - .redirects(0) + .post(API_ORBIS) .withCredentials() - .end(function(err) { + .redirects(0) + .set('Content-Type', 'application/json') + .send(ship) + .end(function(err, response) { if (err) { reject('Bad Request'); } else { - agent - .post(API_ORBIS) - .withCredentials() - .set('Content-Type', 'application/json') - .send(ship) - .end(function(err, response) { - if (err) { - reject('Bad Request'); - } else { - resolve(response.body.link); - } - }); + resolve(response.body.link); } }); } catch (e) {