Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
df429f5
chore: lint
elibosley Mar 28, 2025
d9dbb6e
fix: build
elibosley Mar 28, 2025
13cdbf9
chore: lint
elibosley Mar 31, 2025
eeab410
chore: fix explicit type imports on array mutaitons
elibosley Mar 31, 2025
6e8e74f
feat: move resolvers to nested fields, add placeholder resolvers for …
elibosley Mar 28, 2025
c085b6b
chore: lint
elibosley Mar 28, 2025
dfe57dd
fix: array resolver missing
elibosley Mar 28, 2025
2e0226b
feat: add basic controls for vm start stop
elibosley Mar 28, 2025
0d1bc27
feat: massive vm cleanup and testing
elibosley Mar 29, 2025
9e92c09
fix: index file error
elibosley Mar 29, 2025
54b795f
feat: vm unit testing improvements
elibosley Mar 29, 2025
3950e27
fix: libvirt new binaries
elibosley Mar 30, 2025
5e77060
chore: update libvirt to the latest
elibosley Mar 30, 2025
dae7a0d
chore: lint
elibosley Mar 30, 2025
bb8661e
feat: setup libvirt in GHA
elibosley Mar 30, 2025
d656d66
chore: create libvirt pidfile path
elibosley Mar 30, 2025
906582f
fix: type check
elibosley Mar 30, 2025
73c8e75
chore: fix prebuilt libvirt binary selection
elibosley Mar 30, 2025
5db3917
chore: update libvirt to fix build issue
elibosley Mar 30, 2025
fde5434
feat: vm controls and new permission decorator
elibosley Mar 31, 2025
e62f422
chore: lint
elibosley Mar 31, 2025
1c49bbc
chore: fix generated schema and schema generation call
elibosley Mar 31, 2025
f33f21c
chore: test file cleanup
elibosley Mar 31, 2025
15e6f20
chore: add unit test around auth schema
elibosley Mar 31, 2025
1d80119
chore: fix tests
elibosley Mar 31, 2025
108ac5f
chore: fix return
elibosley Mar 31, 2025
3f47764
chore: fix a couple of lint errors
elibosley Apr 1, 2025
698ebb3
fix: disable decorator and fix unit tests
elibosley Apr 1, 2025
a45850b
chore: fix type-check
elibosley Apr 1, 2025
a36bdba
chore: remove unused array logic and fix flaky test
elibosley Apr 1, 2025
48ab2a2
chore: fix log on vm URI
elibosley Apr 2, 2025
a7cc7d3
fix: update patch file
elibosley Apr 2, 2025
1a32fb6
chore: update generated schema
elibosley Apr 3, 2025
c0a0803
chore: allowed origins test fixed
elibosley Apr 3, 2025
784c27c
chore: lint
elibosley Apr 3, 2025
0118144
Update api/src/unraid-api/auth/auth.interceptor.ts
elibosley Apr 3, 2025
6c491e1
Update api/src/unraid-api/graph/resolvers/array/array.service.ts
elibosley Apr 3, 2025
730c1d8
chore: lint
elibosley Apr 3, 2025
b18d625
chore: fix type error
elibosley Apr 3, 2025
4efb8e7
chore: lint
elibosley Apr 3, 2025
d2c27e1
chore: resolve issues with network test
elibosley Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Cache APT Packages
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
with:
packages: bash procps python3 libvirt-dev jq zstd git build-essential
packages: bash procps python3 libvirt-dev jq zstd git build-essential libvirt-daemon-system
version: 1.0

- name: Install pnpm
Expand All @@ -72,6 +72,45 @@ jobs:
- name: PNPM Install
run: pnpm install --frozen-lockfile

- name: Setup libvirt
run: |
# Create required groups (if they don't already exist)
sudo groupadd -f libvirt
sudo groupadd -f kvm

# Create libvirt user if not present, and add it to the kvm group
sudo useradd -m -s /bin/bash -g libvirt libvirt || true
sudo usermod -aG kvm libvirt || true

# Set up libvirt directories and permissions
sudo mkdir -p /var/run/libvirt /var/log/libvirt /etc/libvirt
sudo chown root:libvirt /var/run/libvirt /var/log/libvirt
sudo chmod g+w /var/run/libvirt /var/log/libvirt

# Configure libvirt by appending required settings
sudo tee -a /etc/libvirt/libvirtd.conf > /dev/null <<EOF
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
auth_unix_rw = "none"
EOF

# Add the current user to libvirt and kvm groups (note: this change won’t apply to the current session)
sudo usermod -aG libvirt,kvm $USER

sudo mkdir -p /var/run/libvirt
sudo chown root:libvirt /var/run/libvirt
sudo chmod 775 /var/run/libvirt


# Start libvirtd in the background
sudo /usr/sbin/libvirtd --daemon

# Wait a bit longer for libvirtd to start
sleep 5

# Verify libvirt is running using sudo to bypass group membership delays
sudo virsh list --all || true

- name: Lint
run: pnpm run lint

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ result-*
web/scripts/.sync-webgui-repo-*

# Activation code data
plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/data/activation-data.php
plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/data/activation-data.php

# Config file that changes between versions
api/dev/Unraid.net/myservers.cfg
58 changes: 38 additions & 20 deletions api/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { CodegenConfig } from '@graphql-codegen/cli';



import { getAuthEnumTypeDefs } from './src/unraid-api/graph/utils/auth-enum.utils.js';


const config: CodegenConfig = {
Expand Down Expand Up @@ -31,28 +32,21 @@ const config: CodegenConfig = {
},
},
generates: {
'src/graphql/generated/client/': {
documents: './src/graphql/mothership/*.ts',
schema: {
[process.env.MOTHERSHIP_GRAPHQL_LINK as string]: {
headers: {
origin: 'https://forums.unraid.net',
},
},
},
preset: 'client',
presetConfig: {
gqlTagName: 'graphql',
},
config: {
useTypeImports: true,
withObjectType: true,
},
plugins: [{ add: { content: '/* eslint-disable */' } }],
'./generated-schema.graphql': {
plugins: ['schema-ast'],
schema: [
'./src/graphql/types.ts',
'./src/graphql/schema/types/**/*.graphql',
getAuthEnumTypeDefs(),
],
},
// Generate Types for the API Server
'src/graphql/generated/api/types.ts': {
schema: ['./src/graphql/types.ts', './src/graphql/schema/types/**/*.graphql'],
schema: [
'./src/graphql/types.ts',
'./src/graphql/schema/types/**/*.graphql',
getAuthEnumTypeDefs(),
],
plugins: [
'typescript',
'typescript-resolvers',
Expand All @@ -66,7 +60,11 @@ const config: CodegenConfig = {
// Generate Operations for any built-in API Server Operations (e.g., report.ts)
'src/graphql/generated/api/operations.ts': {
documents: './src/graphql/client/api/*.ts',
schema: ['./src/graphql/types.ts', './src/graphql/schema/types/**/*.graphql'],
schema: [
'./src/graphql/types.ts',
'./src/graphql/schema/types/**/*.graphql',
getAuthEnumTypeDefs(),
],
preset: 'import-types',
presetConfig: {
typesPath: '@app/graphql/generated/api/types.js',
Expand All @@ -84,6 +82,26 @@ const config: CodegenConfig = {
withObjectType: true,
},
},
// Generate Types for Mothership GraphQL Client
'src/graphql/generated/client/': {
documents: './src/graphql/mothership/*.ts',
schema: {
[process.env.MOTHERSHIP_GRAPHQL_LINK as string]: {
headers: {
origin: 'https://forums.unraid.net',
},
},
},
preset: 'client',
presetConfig: {
gqlTagName: 'graphql',
},
config: {
useTypeImports: true,
withObjectType: true,
},
plugins: [{ add: { content: '/* eslint-disable */' } }],
},
Comment on lines +85 to +104
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Validate environment variable for the Mothership GraphQL link.
Ensure process.env.MOTHERSHIP_GRAPHQL_LINK is set in all relevant environments for successful client generation.


🏁 Script executed:

#!/bin/bash
# Check if MOTHERSHIP_GRAPHQL_LINK is set
[ -z "$MOTHERSHIP_GRAPHQL_LINK" ] && echo "MOTHERSHIP_GRAPHQL_LINK is not set" || echo "MOTHERSHIP_GRAPHQL_LINK is set to: $MOTHERSHIP_GRAPHQL_LINK"

Length of output: 94


Action Required: Define MOTHERSHIP_GRAPHQL_LINK Environment Variable
The GraphQL client configuration in api/codegen.ts (lines 85-104) relies on process.env.MOTHERSHIP_GRAPHQL_LINK. The verification script indicates that this variable is currently not set, which may lead to client generation failures. Please ensure that the environment variable is defined across all relevant environments (development, CI, production) or implement a fallback mechanism.

'src/graphql/generated/client/validators.ts': {
schema: {
[process.env.MOTHERSHIP_GRAPHQL_LINK as string]: {
Expand Down
2 changes: 1 addition & 1 deletion api/dev/Unraid.net/myservers.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[api]
version="4.4.1"
extraOrigins="https://google.com, https://test.com"
extraOrigins="https://google.com,https://test.com"
[local]
sandbox="yes"
[remote]
Expand Down
20 changes: 20 additions & 0 deletions api/dev/Unraid.net/myservers.example.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[api]
version="4.4.1"
extraOrigins="https://google.com,https://test.com"
[local]
sandbox="yes"
[remote]
wanaccess="yes"
wanport="8443"
upnpEnabled="no"
apikey="_______________________BIG_API_KEY_HERE_________________________"
localApiKey="_______________________LOCAL_API_KEY_HERE_________________________"
email="test@example.com"
username="zspearmint"
avatar="https://via.placeholder.com/200"
regWizTime="1611175408732_0951-1653-3509-FBA155FA23C0"
accesstoken=""
idtoken=""
refreshtoken=""
dynamicRemoteAccessType="DISABLED"
ssoSubIds=""
2 changes: 1 addition & 1 deletion api/dev/keys/b5b4aa3d-8e40-4c92-bc40-d50182071886.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"name": "Connect",
"permissions": [],
"roles": [
"connect"
"CONNECT"
]
}
4 changes: 2 additions & 2 deletions api/dev/states/myservers.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[api]
version="4.4.1"
extraOrigins="https://google.com, https://test.com"
version="4.6.6"
extraOrigins="https://google.com,https://test.com"
[local]
sandbox="yes"
[remote]
Expand Down
Loading
Loading