Fix external login scopes
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { RootState } from 'soapbox/store';
|
||||
|
||||
import { PLEROMA, parseVersion } from './features';
|
||||
|
||||
import type { RootState } from 'soapbox/store';
|
||||
import type { Instance } from 'soapbox/types/entities';
|
||||
|
||||
/**
|
||||
* Get the OAuth scopes to use for login & signup.
|
||||
* Mastodon will refuse scopes it doesn't know, so care is needed.
|
||||
*/
|
||||
const getScopes = (state: RootState) => {
|
||||
const instance = state.instance;
|
||||
const getInstanceScopes = (instance: Instance) => {
|
||||
const v = parseVersion(instance.version);
|
||||
|
||||
switch (v.software) {
|
||||
@@ -18,6 +19,13 @@ const getScopes = (state: RootState) => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Convenience function to get scopes from instance in store. */
|
||||
const getScopes = (state: RootState) => {
|
||||
return getInstanceScopes(state.instance);
|
||||
};
|
||||
|
||||
|
||||
export {
|
||||
getInstanceScopes,
|
||||
getScopes,
|
||||
};
|
||||
Reference in New Issue
Block a user