Improve provider logos.

This commit is contained in:
Yang Luo
2021-10-09 22:33:39 +08:00
parent fa3681ed75
commit 122970bb54
2 changed files with 20 additions and 2 deletions

View File

@ -71,6 +71,20 @@ export function getAuthLogo(provider) {
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
}
export function getAuthHomepage(provider) {
const endpoint = authInfo[provider.type].endpoint;
const urlObj = new URL(endpoint);
let host = urlObj.host;
let tokens = host.split(".");
if (tokens.length > 2) {
tokens = tokens.slice(1);
}
host = tokens.join(".");
return `${urlObj.protocol}//${host}`;
}
export function getAuthUrl(application, provider, method) {
if (application === null || provider === null) {
return "";