34 lines
867 B
TypeScript
34 lines
867 B
TypeScript
export class ConnectHelper{
|
|
|
|
public static getCommunityFromDomain(domain:string):string{
|
|
// domain = "beta.egi.openaire.eu"; for testing
|
|
if(domain.indexOf("di.uoa.gr")!=-1){
|
|
return null;
|
|
}
|
|
if(domain.indexOf("beta")!=-1){
|
|
domain = domain.substr(domain.indexOf(".")+1,domain.length);
|
|
domain = domain.substr(0,domain.indexOf("."));
|
|
}else{
|
|
domain = domain.substr(0,domain.indexOf("."));
|
|
}
|
|
if(domain == "connect"){
|
|
return null;
|
|
}
|
|
return domain;
|
|
}
|
|
public static isProduction(domain:string):boolean{
|
|
if(domain.indexOf(".di.uoa.gr")!=-1){
|
|
return false;
|
|
}else if(domain.indexOf(".openaire.eu")!=-1){
|
|
return true;
|
|
}
|
|
}
|
|
public static getProductionPrefix(domain:string):string{
|
|
if(domain.indexOf("beta.")!=-1){
|
|
return "beta.";
|
|
}else{
|
|
return "";
|
|
}
|
|
}
|
|
}
|