Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
8b6b034
chore: default to absolute imports instead of relative
pujitm Apr 23, 2025
e164487
move `PM2_PATH` & `ECOSYSTEM_CONFIG` to `@app/environment`
pujitm Apr 23, 2025
213c954
feat: synchronize redux store with nestjs config
pujitm Apr 23, 2025
203f95c
chore: add prettier to connect plugin package
pujitm Apr 23, 2025
4a8836c
chore: create PubSub module for app root
pujitm Apr 23, 2025
5d4c8ba
scaffold mothership graphql client and event system
pujitm Apr 23, 2025
4bc366d
fix: event handler disposal in gql client
pujitm Apr 23, 2025
7a318e8
fix incorrect apikey config path
pujitm Apr 23, 2025
89b201b
handle mothersip metadata updates in its service
pujitm Apr 23, 2025
ebe414b
scaffold mothership handler
pujitm Apr 28, 2025
b82edb1
fix build errors
pujitm Apr 28, 2025
5b91c43
implement mothership connection in plugin
pujitm May 5, 2025
8f07a04
Merge branch 'main' into refactor/mothership
pujitm May 5, 2025
e6df856
fix tests
pujitm May 5, 2025
4fac7e9
fix lockfile
pujitm May 5, 2025
194cc51
add `@types/ws`
pujitm May 5, 2025
3a2dc2b
add config for dynamic remote access state
pujitm May 5, 2025
c876997
implement dynamic remote access timeout job
pujitm May 5, 2025
c9dec12
improve config types
pujitm May 5, 2025
80d7152
implement `UpnpService`
pujitm May 6, 2025
df3be4c
add upnp renewal job
pujitm May 6, 2025
3c510a9
add `UpnpRemoteAccessService`
pujitm May 6, 2025
90eacf3
implement `getRemoteAccessUrl`
pujitm May 27, 2025
f548f37
replace dynamicRemoteAccess config listener with setter function
pujitm May 27, 2025
e5983ba
Merge branch 'main' into refactor/mothership
pujitm May 27, 2025
503ddc8
add `@unraid/shared` package & update vendoring logic
pujitm May 27, 2025
473e74c
fix path and tarball resolution in `build.ts`
pujitm May 27, 2025
119436c
provide upnp client to plugins
pujitm May 28, 2025
e3a7ac2
fix resolver mutations model
pujitm May 28, 2025
bb4bdec
refactor base.model.ts & `PrefixedId` into `@unraid/shared` pkg
pujitm May 28, 2025
87957d0
move connect resolvers into plugin package
pujitm May 29, 2025
33cd49b
rm related files in `api`
pujitm May 29, 2025
4bdcb20
fix incorrect store config paths
pujitm May 29, 2025
e2c3eb8
fix lint & tests
pujitm May 29, 2025
79e5d04
fix type issues
pujitm May 29, 2025
05accd8
skip config tests
pujitm May 29, 2025
a223d36
re-enable api plugins
pujitm May 30, 2025
82979d7
fix plugin builder
pujitm May 30, 2025
e8fda0b
fix module dependencies in dev
pujitm May 30, 2025
93cdb21
make `PluginModule` not global
pujitm May 30, 2025
524a655
fix dep issues in network resolver
pujitm May 30, 2025
55b7d28
wip: fixing graphql scalars - get minimal repro into ci
pujitm May 30, 2025
a79a8cc
rm possibility of importing from `plugins` vendor; use node_modules
pujitm May 30, 2025
cd69e4a
reintroduce `ConnectModule`
pujitm May 30, 2025
9cc6148
force sandbox
pujitm May 30, 2025
67b7488
re-add settings & dynamic remote access in connect resolver
pujitm May 30, 2025
8342083
wire mothership.module.ts
pujitm Jun 2, 2025
f3d12b9
create notification when plugin fails to load
pujitm Jun 2, 2025
b895301
fix `@apollo/client` esm imports in connect plugin
pujitm Jun 2, 2025
9c48f90
fix silent crash upon starting mothership sub for first time
pujitm Jun 2, 2025
1d2c355
mark event listeners as async
pujitm Jun 2, 2025
368b3b0
rm PRE_INIT from mothership conn status listener
pujitm Jun 2, 2025
4929b87
add missing assignment of mothership apollo client
pujitm Jun 2, 2025
4d8624a
add disk search to connect api key creation
pujitm Jun 3, 2025
dea0f44
replace redux store with nest config in `owners.resolver.ts`
pujitm Jun 3, 2025
fa59b6f
replace `myserversCfg['remote']` with `connect.json` in state.php
pujitm Jun 3, 2025
a547aa5
reduce context verbosity in logs
pujitm Jun 3, 2025
1f7b0ca
clear user from connect config upon logout
pujitm Jun 3, 2025
2e203e1
move `cloud.resolver.ts` into connect plugin
pujitm Jun 3, 2025
c6fd8ac
rm orphaned files
pujitm Jun 3, 2025
de68fc5
change ip diff error to warning
pujitm Jun 3, 2025
b5c882a
simplify directory structure of connect plugin
pujitm Jun 4, 2025
0096f49
add `clean` script to connect plugin
pujitm Jun 4, 2025
11c6ca4
rename config models
pujitm Jun 4, 2025
e331111
rm `ts-node` & `tsx` from api
pujitm Jun 4, 2025
b42d854
include tarballs of workspace packages
pujitm Jun 4, 2025
372c09a
rm redundant tests in `build-api` gh workflow
pujitm Jun 4, 2025
962bd21
improve code docs
pujitm Jun 4, 2025
e4497e1
move wan access listener into connect plugin
pujitm Jun 4, 2025
c106602
replace `use-directives` in api/
pujitm Jun 5, 2025
ff40bf5
rm orphaned `api/scripts/copy-plugins`
pujitm Jun 5, 2025
b53d0e1
format api tsconfig
pujitm Jun 5, 2025
8415a2a
doc: vite exclusions of monorepo packages
pujitm Jun 5, 2025
580a209
format connect plugin w prettier
pujitm Jun 5, 2025
c8fe196
correct connect plugin package.json metadata
pujitm Jun 5, 2025
2f159f3
fix `pnpm dev` dev server
pujitm Jun 5, 2025
40cc7b9
add prototype of api config
pujitm Jun 5, 2025
38a1f88
replace extraOrigins csv string with list
pujitm Jun 5, 2025
2056990
improve cloud resolver error for troubleshooting
pujitm Jun 6, 2025
2e355de
move sso back into main api
pujitm Jun 6, 2025
c26c6f9
define `UserSettingsModule`
pujitm Jun 9, 2025
fc03c07
add `ApiSettingsService`
pujitm Jun 9, 2025
1e1d247
add testing config for `@unraid/shared`
pujitm Jun 9, 2025
b7dd866
implement namespacing in user settings
pujitm Jun 9, 2025
1d7c056
add UnifiedSettings resolver
pujitm Jun 9, 2025
17ea7e3
simplify setting namespacing
pujitm Jun 9, 2025
57585ea
add parent settings resolver
pujitm Jun 10, 2025
d590269
add lifecycle service
pujitm Jun 10, 2025
e8d797b
re-enable rclone + rclone docs
pujitm Jun 10, 2025
5d6d1de
change to unified settings gql query
pujitm Jun 10, 2025
73c3801
fix slice merge & form rendering, add debugging for incorrect form state
pujitm Jun 10, 2025
124fbd6
fix jsonforms integration
pujitm Jun 10, 2025
6da3bfc
register connect settings
pujitm Jun 10, 2025
2c6c154
rm unused shared SSO_SERVICE token
pujitm Jun 10, 2025
a4aa0e3
fix alignment of UnraidSettingsLayout
pujitm Jun 10, 2025
f289be3
update docs for adding workspace packages
pujitm Jun 10, 2025
277d1be
rm demo HealthResolver
pujitm Jun 10, 2025
fe31d5f
fix unraid ui lint
pujitm Jun 10, 2025
59984aa
cleanup coderabbit issues
pujitm Jun 10, 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
6 changes: 0 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ jobs:
cd ${{ github.workspace }}
pnpm install --frozen-lockfile

- name: Lint
run: pnpm run lint

- name: Type Check
run: pnpm run type-check

- name: Build
run: pnpm run build

Expand Down
27 changes: 13 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"files.associations": {
"*.page": "php"
},
"editor.codeActionsOnSave": {
"source.fixAll": "never",
"source.fixAll.eslint": "explicit"
},
"i18n-ally.localesPaths": [
"locales"
],
"i18n-ally.keystyle": "flat",
"eslint.experimental.useFlatConfig": true
}

"files.associations": {
"*.page": "php"
},
"editor.codeActionsOnSave": {
"source.fixAll": "never",
"source.fixAll.eslint": "explicit"
},
"i18n-ally.localesPaths": ["locales"],
"i18n-ally.keystyle": "flat",
"eslint.experimental.useFlatConfig": true,
"typescript.preferences.importModuleSpecifier": "non-relative",
"javascript.preferences.importModuleSpecifier": "non-relative"
}
4 changes: 3 additions & 1 deletion api/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"eslint.options": {
"flags": ["unstable_ts_config"],
"overrideConfigFile": ".eslintrc.ts"
}
},
"typescript.preferences.importModuleSpecifier": "non-relative",
"javascript.preferences.importModuleSpecifier": "non-relative"
}
9 changes: 9 additions & 0 deletions api/dev/configs/api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "4.8.0",
"extraOrigins": [
"https://google.com",
"https://test.com"
],
"sandbox": true,
"ssoSubIds": []
}
15 changes: 14 additions & 1 deletion api/dev/configs/connect.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{
"demo": "hello.unraider"
"wanaccess": false,
"wanport": 0,
"upnpEnabled": false,
"apikey": "",
"localApiKey": "",
"email": "",
"username": "",
"avatar": "",
"regWizTime": "",
"accesstoken": "",
"idtoken": "",
"refreshtoken": "",
"dynamicRemoteAccessType": "DISABLED",
"ssoSubIds": []
}
4 changes: 2 additions & 2 deletions api/dev/states/myservers.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[api]
version="4.8.0"
version="4.4.1"
extraOrigins="https://google.com,https://test.com"
[local]
sandbox="yes"
Expand All @@ -20,5 +20,5 @@ dynamicRemoteAccessType="DISABLED"
ssoSubIds=""
allowedOrigins="/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, http://localhost:8080, https://localhost:4443, https://tower.local:4443, https://192.168.1.150:4443, https://tower:4443, https://192-168-1-150.thisisfourtyrandomcharacters012345678900.myunraid.net:4443, https://85-121-123-122.thisisfourtyrandomcharacters012345678900.myunraid.net:8443, https://10-252-0-1.hash.myunraid.net:4443, https://10-252-1-1.hash.myunraid.net:4443, https://10-253-3-1.hash.myunraid.net:4443, https://10-253-4-1.hash.myunraid.net:4443, https://10-253-5-1.hash.myunraid.net:4443, https://10-100-0-1.hash.myunraid.net:4443, https://10-100-0-2.hash.myunraid.net:4443, https://10-123-1-2.hash.myunraid.net:4443, https://221-123-121-112.hash.myunraid.net:4443, https://google.com, https://test.com, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000, https://studio.apollographql.com"
[connectionStatus]
minigraph="ERROR_RETRYING"
minigraph="PRE_INIT"
upnpStatus=""
105 changes: 99 additions & 6 deletions api/docs/developer/api-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,115 @@ where the API provides dependencies for the plugin while the plugin provides fun
### Adding a local workspace package as an API plugin

The challenge with local workspace plugins is that they aren't available via npm during production.
To solve this, we vendor them inside `dist/plugins`. To prevent the build from breaking, however,
you should mark the workspace dependency as optional. For example:
To solve this, we vendor them during the build process. Here's the complete process:

#### 1. Configure the build system

Add your workspace package to the vendoring configuration in `api/scripts/build.ts`:

```typescript
const WORKSPACE_PACKAGES_TO_VENDOR = {
'@unraid/shared': 'packages/unraid-shared',
'unraid-api-plugin-connect': 'packages/unraid-api-plugin-connect',
'your-plugin-name': 'packages/your-plugin-path', // Add your plugin here
} as const;
```

#### 2. Configure Vite

Add your workspace package to the Vite configuration in `api/vite.config.ts`:

```typescript
const workspaceDependencies = {
'@unraid/shared': 'packages/unraid-shared',
'unraid-api-plugin-connect': 'packages/unraid-api-plugin-connect',
'your-plugin-name': 'packages/your-plugin-path', // Add your plugin here
};
```

This ensures the package is:
- Excluded from Vite's optimization during development
- Marked as external during the build process
- Properly handled in SSR mode

#### 3. Configure the API package.json

Add your workspace package as a peer dependency in `api/package.json`:

```json
{
"peerDependencies": {
"unraid-api-plugin-connect": "workspace:*"
"unraid-api-plugin-connect": "workspace:*",
"your-plugin-name": "workspace:*"
},
"peerDependenciesMeta": {
"unraid-api-plugin-connect": {
"optional": true
},
"your-plugin-name": {
"optional": true
}
}
}
```

By marking the workspace dependency "optional", npm will not attempt to install it during development.
The "workspace:*" identifier will be invalid during build-time and run-time, but won't cause problems
because the package gets vendored instead.

#### 4. Plugin package setup

Your workspace plugin package should:

1. **Export types and main entry**: Set up proper `main`, `types`, and `exports` fields:
```json
{
"name": "your-plugin-name",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"files": ["dist"]
}
```

2. **Use peer dependencies**: Declare shared dependencies as peer dependencies to avoid duplication:
```json
{
"peerDependencies": {
"@nestjs/common": "^11.0.11",
"@nestjs/core": "^11.0.11",
"graphql": "^16.9.0"
}
}
```

3. **Include build script**: Add a build script that compiles TypeScript:
```json
{
"scripts": {
"build": "tsc",
"prepare": "npm run build"
}
}
```

By marking the workspace dependency "optional", npm will not attempt to install it.
Thus, even though the "workspace:*" identifier will be invalid during build-time and run-time,
it will not cause problems.
#### 5. Build process

During production builds:

1. The build script (`api/scripts/build.ts`) will automatically pack and install your workspace package as a tarball
2. This happens after `npm install --omit=dev` in the pack directory
3. The vendored package becomes a regular node_modules dependency in the final build

#### 6. Development vs Production

- **Development**: Vite resolves workspace packages directly from their source
- **Production**: Packages are vendored as tarballs in `node_modules`

This approach ensures that workspace plugins work seamlessly in both development and production environments.
Loading
Loading