diff --git a/web/components/UserProfile.ce.vue b/web/components/UserProfile.ce.vue index 176cb9039..d80507559 100644 --- a/web/components/UserProfile.ce.vue +++ b/web/components/UserProfile.ce.vue @@ -96,7 +96,7 @@ onBeforeMount(() => { onMounted(() => { if (devConfig.VITE_MOCK_USER_SESSION && devConfig.NODE_ENV === 'development') { - document.cookie = 'unraid_session_cookie=mock-user-session'; + document.cookie = 'unraid_session_cookie=mockusersession'; } }) diff --git a/web/composables/gql/graphql.ts b/web/composables/gql/graphql.ts index 754fd9204..c7c640228 100644 --- a/web/composables/gql/graphql.ts +++ b/web/composables/gql/graphql.ts @@ -44,10 +44,8 @@ export type AccessUrlInput = { }; export type AddPermissionInput = { - action: Scalars['String']['input']; - possession: Scalars['String']['input']; + actions: Array; resource: Resource; - role: Role; }; export type AddRoleForApiKeyInput = { @@ -70,6 +68,7 @@ export type ApiKey = { description?: Maybe; id: Scalars['ID']['output']; name: Scalars['String']['output']; + permissions: Array; roles: Array; }; @@ -86,6 +85,7 @@ export type ApiKeyWithSecret = { id: Scalars['ID']['output']; key: Scalars['String']['output']; name: Scalars['String']['output']; + permissions: Array; roles: Array; }; @@ -351,8 +351,13 @@ export enum ContainerState { export type CreateApiKeyInput = { description?: InputMaybe; + /** Whether to create the key in memory only (true), or on disk (false) - memory only keys will not persist through reboots of the API */ + memory?: InputMaybe; name: Scalars['String']['input']; - roles: Array; + /** This will replace the existing key if one already exists with the same name, otherwise returns the existing key */ + overwrite?: InputMaybe; + permissions?: InputMaybe>; + roles?: InputMaybe>; }; export type Devices = { @@ -599,7 +604,7 @@ export type Me = UserAccount & { description: Scalars['String']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; - permissions?: Maybe; + permissions?: Maybe>; roles: Array; }; @@ -1028,6 +1033,12 @@ export type Pci = { vendorname?: Maybe; }; +export type Permission = { + __typename?: 'Permission'; + actions: Array; + resource: Resource; +}; + export type ProfileModel = { __typename?: 'ProfileModel'; avatar?: Maybe; @@ -1196,7 +1207,7 @@ export enum Resource { Cloud = 'cloud', Config = 'config', Connect = 'connect', - CrashReportingEnabled = 'crash_reporting_enabled', + ConnectRemoteAccess = 'connect__remote_access', Customizations = 'customizations', Dashboard = 'dashboard', Disk = 'disk', @@ -1224,10 +1235,8 @@ export enum Resource { /** Available roles for API keys and users */ export enum Role { Admin = 'admin', - Guest = 'guest', - MyServers = 'my_servers', - Notifier = 'notifier', - Upc = 'upc' + Connect = 'connect', + Guest = 'guest' } export type Server = { @@ -1450,6 +1459,7 @@ export type User = UserAccount & { name: Scalars['String']['output']; /** If the account has a password set */ password?: Maybe; + permissions?: Maybe>; roles: Array; }; @@ -1457,6 +1467,7 @@ export type UserAccount = { description: Scalars['String']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; + permissions?: Maybe>; roles: Array; }; @@ -1678,6 +1689,7 @@ export enum VmState { export type Vms = { __typename?: 'Vms'; domain?: Maybe>; + id: Scalars['ID']['output']; }; export enum WAN_ACCESS_TYPE { diff --git a/web/helpers/create-apollo-client.ts b/web/helpers/create-apollo-client.ts index 94dec61d2..5ae63cb12 100644 --- a/web/helpers/create-apollo-client.ts +++ b/web/helpers/create-apollo-client.ts @@ -1,11 +1,4 @@ -import { - ApolloClient, - ApolloLink, - createHttpLink, - from, - Observable, - split, -} from '@apollo/client/core/index.js'; +import { ApolloClient, ApolloLink, createHttpLink, from, Observable, split } from '@apollo/client/core/index.js'; import { onError } from '@apollo/client/link/error/index.js'; import { RetryLink } from '@apollo/client/link/retry/index.js'; import { GraphQLWsLink } from '@apollo/client/link/subscriptions/index.js'; @@ -20,7 +13,7 @@ const httpEndpoint = WEBGUI_GRAPHQL; const wsEndpoint = new URL(WEBGUI_GRAPHQL.toString().replace('http', 'ws')); const headers = { - 'x-csrf-token': globalThis.csrf_token, + 'x-csrf-token': globalThis.csrf_token ?? '0000000000000000', }; const httpLink = createHttpLink({ @@ -108,4 +101,4 @@ export const client = new ApolloClient({ cache: createApolloCache(), }); -provideApolloClient(client); +provideApolloClient(client); \ No newline at end of file diff --git a/web/helpers/urls.ts b/web/helpers/urls.ts index ed34b4c26..36ccea357 100644 --- a/web/helpers/urls.ts +++ b/web/helpers/urls.ts @@ -40,11 +40,6 @@ const DOCS_REGISTRATION_REPLACE_KEY = new URL('/go/changing-the-flash-device/', const SUPPORT = new URL('https://unraid.net'); -// initialize csrf_token in nuxt playground -if (import.meta.env.VITE_CSRF_TOKEN) { - globalThis.csrf_token = import.meta.env.VITE_CSRF_TOKEN; -} - export { ACCOUNT, ACCOUNT_CALLBACK, diff --git a/web/pages/index.vue b/web/pages/index.vue index b999b3910..19c3f4292 100644 --- a/web/pages/index.vue +++ b/web/pages/index.vue @@ -2,9 +2,9 @@ import { ExclamationTriangleIcon } from '@heroicons/vue/24/solid'; import { BrandButton, BrandLogo } from '@unraid/ui'; import { serverState } from '~/_data/serverState'; +import SsoButtonCe from '~/components/SsoButton.ce.vue'; import type { SendPayloads } from '~/store/callback'; import AES from 'crypto-js/aes'; -import SsoButtonCe from '~/components/SsoButton.ce.vue'; const { registerEntry } = useCustomElements(); onBeforeMount(() => { @@ -15,6 +15,10 @@ useHead({ meta: [{ name: 'viewport', content: 'width=1300' }], }); +onMounted(() => { + document.cookie = 'unraid_session_cookie=mockusersession'; +}); + const valueToMakeCallback = ref(); const callbackDestination = ref(''); @@ -156,7 +160,7 @@ onMounted(() => {

SSO Button Component

- +