2017-11-22 07:51:31 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
export function slackAuth(
|
|
|
|
state: string,
|
|
|
|
scopes: string[] = [
|
|
|
|
'identity.email',
|
|
|
|
'identity.basic',
|
|
|
|
'identity.avatar',
|
|
|
|
'identity.team',
|
|
|
|
],
|
|
|
|
redirectUri: string = `${process.env.URL}/auth/slack`
|
|
|
|
): string {
|
|
|
|
const baseUrl = 'https://slack.com/oauth/authorize';
|
|
|
|
const params = {
|
|
|
|
client_id: process.env.SLACK_KEY,
|
|
|
|
scope: scopes ? scopes.join(' ') : '',
|
|
|
|
redirect_uri: redirectUri,
|
|
|
|
state,
|
|
|
|
};
|
|
|
|
|
|
|
|
const urlParams = Object.keys(params)
|
|
|
|
.map(key => `${key}=${encodeURIComponent(params[key])}`)
|
|
|
|
.join('&');
|
|
|
|
|
|
|
|
return `${baseUrl}?${urlParams}`;
|
|
|
|
}
|
2017-11-27 06:03:23 +00:00
|
|
|
|
|
|
|
export function githubUrl(): string {
|
|
|
|
return 'https://www.github.com/outline';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function blogUrl(): string {
|
|
|
|
return 'https://medium.com/getoutline';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function twitterUrl(): string {
|
|
|
|
return 'https://twitter.com/getoutline';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function spectrumUrl(): string {
|
|
|
|
return 'https://spectrum.chat/outline';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function developers(): string {
|
|
|
|
return '/developers';
|
|
|
|
}
|
|
|
|
|
2017-11-29 06:46:26 +00:00
|
|
|
export function changelog(): string {
|
|
|
|
return '/changelog';
|
|
|
|
}
|
|
|
|
|
2017-11-27 06:03:23 +00:00
|
|
|
export function signin(): string {
|
|
|
|
return '/auth/slack';
|
|
|
|
}
|
2018-01-22 07:56:08 +00:00
|
|
|
|
|
|
|
export function about(): string {
|
|
|
|
return '/about';
|
|
|
|
}
|
|
|
|
|
|
|
|
export function privacy(): string {
|
|
|
|
return '/privacy';
|
|
|
|
}
|