mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
docs: fix proxy setting
This commit is contained in:
parent
e9910c4a3e
commit
bd299c924e
|
@ -6,10 +6,12 @@ module.exports = async function (context, req) {
|
|||
// https://www.strava.com/oauth/authorize?client_id=76033&response_type=code&redirect_uri=https://ohmyposh.dev/api/auth&approval_prompt=force&scope=read,activity:read&state=strava
|
||||
|
||||
try {
|
||||
const code = (req.query._code || (req.body && req.body.code));
|
||||
const code = (req.query.code || req.query._code || (req.body && req.body.code));
|
||||
const segment = (req.query.state || (req.body && req.body.state));
|
||||
if (!code || !segment) {
|
||||
context.log(`Issue processing request: missing code (${code}) or segment (${segment})`);
|
||||
context.res = {
|
||||
body: "not all query parameters are set",
|
||||
status: 400
|
||||
};
|
||||
return;
|
||||
|
@ -21,6 +23,7 @@ module.exports = async function (context, req) {
|
|||
body = await strava.getStravaToken(code);
|
||||
break;
|
||||
default:
|
||||
context.log(`Unknown segment: ${segment}`);
|
||||
context.res = {
|
||||
body: "unknown segment",
|
||||
status: 400
|
||||
|
@ -28,7 +31,7 @@ module.exports = async function (context, req) {
|
|||
return;
|
||||
}
|
||||
|
||||
const url = `https://ohmyposh.dev/docs/auth?segment=${segment}&access_token=${body.access_token}&refresh_token=${body.refresh_token}`;
|
||||
const url = `${process.env['DOCS_LOCATION']}/docs/auth?segment=${segment}&access_token=${body.access_token}&refresh_token=${body.refresh_token}`;
|
||||
|
||||
const res = {
|
||||
status: 302,
|
||||
|
@ -39,7 +42,7 @@ module.exports = async function (context, req) {
|
|||
};
|
||||
context.done(null, res);
|
||||
} catch (error) {
|
||||
context.log(error);
|
||||
context.log(`Issue processing request:\n${error}`);
|
||||
context.res = {
|
||||
body: error,
|
||||
status: 500
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
"IsEncrypted": false,
|
||||
"Values": {
|
||||
"AzureWebJobsStorage": "",
|
||||
"FUNCTIONS_WORKER_RUNTIME": "node"
|
||||
"FUNCTIONS_WORKER_RUNTIME": "node",
|
||||
"API_LOCATION": "http://localhost:7071",
|
||||
"DOCS_LOCATION": "http://localhost:3000"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
"$schema": "http://json.schemastore.org/proxies",
|
||||
"proxies": {
|
||||
"callback": {
|
||||
"debug": true,
|
||||
"matchCondition": {
|
||||
"methods": ["GET", "POST"],
|
||||
"route": "/api/auth"
|
||||
},
|
||||
"backendUri": "http://localhost/api/auth",
|
||||
"backendUri": "%API_LOCATION%/api/auth",
|
||||
"requestOverrides": {
|
||||
"backend.request.querystring.code": "",
|
||||
"backend.request.querystring._code": "{request.querystring.code}"
|
||||
|
|
Loading…
Reference in a new issue