2024-09-03 19:59:31 +00:00
|
|
|
const HanyuuOAuth2AppScopeEntry = function(text, warn) {
|
|
|
|
const icon = <div class="oauth2-scope-perm-icon"/>;
|
|
|
|
if(warn)
|
|
|
|
icon.classList.add('oauth2-scope-perm-icon-warn');
|
|
|
|
|
2024-07-30 00:16:42 +00:00
|
|
|
const element = <div class="oauth2-scope-perm">
|
2024-09-03 19:59:31 +00:00
|
|
|
{icon}
|
2024-07-30 00:16:42 +00:00
|
|
|
<div class="oauth2-scope-perm-text">{text}</div>
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
return {
|
|
|
|
get element() { return element; },
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-09-03 19:59:31 +00:00
|
|
|
const HanyuuOAuth2AppScopeList = function(scopes) {
|
|
|
|
const permsElem = <div class="oauth2-scope-perms"/>;
|
|
|
|
if(Array.isArray(scopes) && scopes.length > 0) {
|
|
|
|
for(const scope of scopes)
|
|
|
|
if(typeof scope === 'string')
|
|
|
|
permsElem.appendChild(new HanyuuOAuth2AppScopeEntry(scope).element);
|
|
|
|
} else
|
|
|
|
permsElem.appendChild(new HanyuuOAuth2AppScopeEntry('A limited amount of things. No scope was specified by the developer.', true).element);
|
2024-07-30 00:16:42 +00:00
|
|
|
|
|
|
|
const element = <div class="oauth2-scope">
|
|
|
|
<div class="oauth2-scope-header">This application will be able to:</div>
|
|
|
|
{permsElem}
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
return {
|
|
|
|
get element() { return element; },
|
|
|
|
};
|
|
|
|
};
|