Skip to content

Commit 579f626

Browse files
feat: format PRs when committed (unraid#354)
Before Submitting This PR, Please Ensure You Have Completed The Following: 1. [ ] Are internal links to wiki documents using [relative file links](https://docusaurus.io/docs/markdown-features/links)? 2. [ ] Are all new documentation files lowercase, with dash separated names (ex. unraid-os.mdx)? 3. [ ] Are all assets (images, etc), located in an assets/ subfolder next to the .md/mdx files? 4. [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? 5. [ ] Is the build succeeding? <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Documentation - Expanded guidance across API, storage (ZFS, arrays, cache pools, filesystems), security (SSL, encryption, WoL), networking (WireGuard, Tailscale), Docker, VMs, troubleshooting, and diagnostics. - Added numerous tips, cautions, best practices, timing notes, and step-by-step examples; clarified workflows (e.g., Time Machine setup, parity checks, filesystem repairs). - Improved structure, formatting, and images; updated localization content (DE/ES/FR/ZH) with refinements and some removals. - Chores - CI enhancement: automated formatter autofix before lint, change detection and notifications for forks, optional auto-commit/push of fixes, full-history checkout, and conditional lint skipping on closed PRs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 341a23f commit 579f626

103 files changed

Lines changed: 980 additions & 91 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ concurrency:
1414

1515
jobs:
1616
lint:
17+
if: ${{ github.event.action != 'closed' }}
1718
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
1821
steps:
1922
- name: Checkout
2023
uses: actions/checkout@v5
24+
with:
25+
fetch-depth: 0
26+
ref: ${{ github.head_ref }}
2127

2228
- name: Setup Node.js
2329
uses: actions/setup-node@v5
@@ -28,9 +34,39 @@ jobs:
2834
- name: Install dependencies
2935
run: npm ci
3036

37+
- name: Run formatter autofix
38+
run: npm run format
39+
3140
- name: Run linter
3241
run: npm run lint -- --frail
3342

43+
- name: Check for lint changes
44+
id: lint_changes
45+
run: |
46+
if [[ -n "$(git status --porcelain)" ]]; then
47+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
48+
else
49+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Notify forked PRs
53+
if: steps.lint_changes.outputs.has_changes == 'true' && github.repository != github.event.pull_request.head.repo.full_name
54+
run: |
55+
echo "::warning::Format fixes were generated but cannot be pushed automatically for pull requests from forks. Please run 'npm run format' locally and push the changes."
56+
57+
- name: Commit lint fixes
58+
if: steps.lint_changes.outputs.has_changes == 'true' && github.repository == github.event.pull_request.head.repo.full_name
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
62+
git add -A
63+
git commit -m "chore: apply lint and format fixes"
64+
65+
- name: Push lint fixes
66+
if: steps.lint_changes.outputs.has_changes == 'true' && github.repository == github.event.pull_request.head.repo.full_name
67+
run: |
68+
git push origin HEAD:${{ github.head_ref }} || echo "Unable to push lint fixes (likely due to branch permissions)."
69+
3470
deploy-preview:
3571
runs-on: ubuntu-latest
3672
permissions:

docs/API/cli.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ sidebar_position: 4
77
# CLI Commands
88

99
:::info[Command Structure]
10+
1011
All commands follow the pattern: `unraid-api <command> [options]`
12+
1113
:::
1214

1315
## 🚀 Service Management
@@ -91,7 +93,9 @@ Switch between production and staging environments.
9193
### Developer Mode
9294

9395
:::tip[Web GUI Management]
96+
9497
You can also manage developer options through the web interface at **Settings****Management Access****Developer Options**
98+
9599
:::
96100

97101
```bash
@@ -110,7 +114,9 @@ Configure developer features for the API:
110114
## API Key Management
111115

112116
:::tip[Web GUI Management]
117+
113118
You can also manage API keys through the web interface at **Settings****Management Access****API Keys**
119+
114120
:::
115121

116122
### API Key Commands
@@ -132,7 +138,9 @@ Options:
132138
## SSO (Single Sign-On) Management
133139

134140
:::info[OIDC Configuration]
141+
135142
For OIDC/SSO provider configuration, see the web interface at **Settings****Management Access****API****OIDC** or refer to the [OIDC Provider Setup](./oidc-provider-setup.mdx) guide.
143+
136144
:::
137145

138146
### SSO Base Command

docs/API/how-to-use-the-api.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import ManageApiKeysCli from './partials/manage-api-keys-cli.mdx';
1212
# Using the Unraid API
1313

1414
:::tip[Quick Start]
15+
1516
The Unraid API provides a powerful GraphQL interface for managing your server. This guide covers authentication, common queries, and best practices.
17+
1618
:::
1719

1820
The Unraid API provides a GraphQL interface that allows you to interact with your Unraid server. This guide will help you get started with exploring and using the API.
@@ -22,7 +24,9 @@ The Unraid API provides a GraphQL interface that allows you to interact with you
2224
### Web GUI Method (Recommended)
2325

2426
:::info[Preferred Method]
27+
2528
Using the Web GUI is the easiest way to enable the GraphQL sandbox.
29+
2630
:::
2731

2832
1. Navigate to **Settings****Management Access****Developer Options**
@@ -50,7 +54,9 @@ unraid-api developer
5054
## 🔑 Authentication
5155

5256
:::warning[Required for Most Operations]
57+
5358
Most queries and mutations require authentication. Always include appropriate credentials in your requests.
59+
5460
:::
5561

5662
You can authenticate using:
@@ -200,17 +206,21 @@ Available roles:
200206
## ✨ Best Practices
201207

202208
:::tip[Pro Tips]
209+
203210
1. Use the Apollo Sandbox to explore the schema and test queries
204211
2. Start with small queries and gradually add fields as needed
205212
3. Monitor your query complexity to maintain performance
206213
4. Use appropriate roles and permissions for your API keys
207214
5. Keep your API keys secure and rotate them periodically
215+
208216
:::
209217

210218
## ⏱️ Rate Limiting
211219

212220
:::caution[Rate Limits]
221+
213222
The API implements rate limiting to prevent abuse. Ensure your applications handle rate limit responses appropriately.
223+
214224
:::
215225

216226
## 🚨 Error Handling
@@ -232,10 +242,12 @@ The API returns standard GraphQL errors in the following format:
232242
## 📚 Additional Resources
233243

234244
:::info[Learn More]
245+
235246
- Use the Apollo Sandbox's schema explorer to browse all available types and fields
236247
- Check the documentation tab in Apollo Sandbox for detailed field descriptions
237248
- Monitor the API's health using `unraid-api status`
238249
- Generate reports using `unraid-api report` for troubleshooting
239250

240251
For more information about specific commands and configuration options, refer to the [CLI documentation](cli.mdx) or run `unraid-api --help`.
252+
241253
:::

docs/API/index.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import GetStartedPre72 from './partials/get-started-pre72.mdx';
1313
# Welcome to Unraid API
1414

1515
:::tip[What's New]
16+
1617
Starting with Unraid OS v7.2, the API comes built into the operating system - no plugin installation required!
18+
1719
:::
1820

1921
The Unraid API provides a GraphQL interface for programmatic interaction with your Unraid server. It enables automation, monitoring, and integration capabilities.
@@ -38,34 +40,45 @@ For Unraid versions prior to v7.2 or to access newer API features:
3840
3. Access API functionality through the [GraphQL Sandbox](./how-to-use-the-api.mdx)
3941

4042
:::info[Important Notes]
43+
4144
- The Unraid Connect plugin provides the API for pre-7.2 versions
4245
- You do NOT need to sign in to Unraid Connect to use the API locally
4346
- Installing the plugin on 7.2+ gives you access to newer API features before they're included in OS releases
47+
4448
:::
4549

4650
## 📚 Documentation Sections
4751

4852
<div style={{display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem'}}>
4953
<Card title="CLI Commands" icon="terminal" href="./cli">
54+
5055
Complete reference for all CLI commands
56+
5157
</Card>
5258

5359
<Card title="Using the API" icon="code" href="./how-to-use-the-api">
60+
5461
Learn how to interact with the GraphQL API
62+
5563
</Card>
5664

5765
<Card title="OIDC Setup" icon="shield" href="./oidc-provider-setup">
66+
5867
Configure SSO authentication providers
68+
5969
</Card>
6070

6171
<Card title="Upcoming Features" icon="rocket" href="./upcoming-features">
72+
6273
See what's coming next
74+
6375
</Card>
6476
</div>
6577

6678
## 🌟 Key Features
6779

6880
:::info[Core Capabilities]
81+
6982
The API provides:
7083

7184
- **GraphQL Interface**: Modern, flexible API with strong typing
@@ -74,6 +87,7 @@ The API provides:
7487
- **Developer Tools**: Built-in GraphQL sandbox configurable via web interface or CLI
7588
- **Role-Based Access**: Granular permission control
7689
- **Web Management**: Manage API keys and settings through the web interface
90+
7791
:::
7892

7993
## 🚀 Get Started

docs/API/oidc-provider-setup.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ sidebar_position: 3
77
# OIDC Provider Setup
88

99
:::info[What is OIDC?]
10+
1011
OpenID Connect (OIDC) is an authentication protocol that allows users to sign in using their existing accounts from providers like Google, Microsoft, or your corporate identity provider. It enables Single Sign-On (SSO) for seamless and secure authentication.
12+
1113
:::
1214

1315
This guide walks you through configuring OIDC (OpenID Connect) providers for SSO authentication in the Unraid API using the web interface.
@@ -20,6 +22,7 @@ This guide walks you through configuring OIDC (OpenID Connect) providers for SSO
2022
1. Navigate to your Unraid server's web interface
2123
2. Go to **Settings****Management Access****API****OIDC**
2224
3. You'll see tabs for different providers - click the **+** button to add a new provider
25+
2326
</details>
2427

2528
### OIDC Providers Interface Overview
@@ -69,6 +72,7 @@ Simple mode is the easiest way to configure authorization. You can:
6972
- You want to verify multiple claims (e.g., email domain AND verified status)
7073
- You have complex authorization requirements
7174
- You need fine-grained control over how rules are evaluated
75+
7276
</details>
7377

7478
## Authorization Rules
@@ -149,6 +153,7 @@ In Simple Authorization:
149153
- Email must be verified
150154
- User must be in specific group
151155
- Account must have 2FA enabled (if claim available)
156+
152157
</details>
153158

154159
<details>
@@ -191,20 +196,25 @@ In Simple Authorization:
191196
- **Enable Developer Sandbox**: Toggle to enable GraphQL sandbox at `/graphql`
192197
- The interface uses a dark theme for better visibility
193198
- Field validation indicators help ensure correct configuration
199+
194200
</details>
195201

196202
### Required Redirect URI
197203

198204
:::caution[Important Configuration]
205+
199206
All providers must be configured with this exact redirect URI format:
207+
200208
:::
201209

202210
```bash
203211
http://YOUR_UNRAID_IP/graphql/api/auth/oidc/callback
204212
```
205213

206214
:::tip
215+
207216
Replace `YOUR_UNRAID_IP` with your actual server IP address (e.g., `192.168.1.100` or `tower.local`).
217+
208218
:::
209219

210220
### Issuer URL Format
@@ -306,7 +316,9 @@ The Unraid.net provider is built-in and pre-configured. You only need to configu
306316
- **Redirect URI**: `http://YOUR_UNRAID_IP/graphql/api/auth/oidc/callback`
307317

308318
:::tip[Redirect URI Protocol]
319+
309320
**Match the protocol to your server setup:** Use `http://` if accessing your Unraid server without SSL/TLS (typical for local network access). Use `https://` if you've configured SSL/TLS on your server. Some OIDC providers (like Google) require HTTPS and won't accept HTTP redirect URIs.
321+
310322
:::
311323

312324
Configure authorization rules using Simple Mode (allowed email domains/addresses) or Advanced Mode for complex requirements.
@@ -323,6 +335,7 @@ Configure authorization rules using Simple Mode (allowed email domains/addresses
323335
3. Choose **Web application** as the application type
324336
4. Add your redirect URI to **Authorized redirect URIs**
325337
5. Configure the OAuth consent screen if prompted
338+
326339
</details>
327340

328341
**Configuration:**
@@ -333,13 +346,15 @@ Configure authorization rules using Simple Mode (allowed email domains/addresses
333346
- **Redirect URI**: `http://YOUR_UNRAID_IP/graphql/api/auth/oidc/callback`
334347

335348
:::warning[Google Domain Requirements]
349+
336350
**Google requires valid domain names for OAuth redirect URIs.** Local IP addresses and `.local` domains are not accepted. To use Google OAuth with your Unraid server, you'll need:
337351

338352
- **Option 1: Reverse Proxy** - Set up a reverse proxy (like NGINX Proxy Manager or Traefik) with a valid domain name pointing to your Unraid API
339353
- **Option 2: Tailscale** - Use Tailscale to get a valid `*.ts.net` domain that Google will accept
340354
- **Option 3: Dynamic DNS** - Use a DDNS service to get a public domain name for your server
341355

342356
Remember to update your redirect URI in both Google Cloud Console and your Unraid OIDC configuration to use the valid domain.
357+
343358
:::
344359

345360
For Google Workspace domains, use Advanced Mode with the `hd` claim to restrict access to your organization's domain.

docs/API/programmatic-api-key-management.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ The `unraid-api apikey` command supports both interactive and non-interactive mo
1818
- Infrastructure as code workflows
1919

2020
:::tip[Quick Start]
21+
2122
Jump to the [Complete Workflow Example](#complete-workflow-example) to see everything in action.
23+
2224
:::
2325

2426
## Creating API Keys Programmatically
@@ -60,7 +62,9 @@ unraid-api apikey --create --name "existing key" --roles ADMIN --overwrite --jso
6062
```
6163

6264
:::warning[Key Replacement]
65+
6366
The `--overwrite` flag will permanently replace the existing key. The old key will be immediately invalidated.
67+
6468
:::
6569

6670
## Deleting API Keys Programmatically
@@ -199,6 +203,7 @@ echo "Deployment completed successfully"
199203
## Best Practices
200204

201205
:::info[Security Best Practices]
206+
202207
**Minimal Permissions**
203208

204209
- Use specific permissions instead of ADMIN role when possible
@@ -209,6 +214,7 @@ echo "Deployment completed successfully"
209214
- Always clean up temporary keys after use
210215
- Store API keys securely (environment variables, secrets management)
211216
- Use descriptive names and descriptions for audit trails
217+
212218
:::
213219

214220
### Error Handling
@@ -228,6 +234,7 @@ echo "Deployment completed successfully"
228234
### Common Issues
229235

230236
:::note[Common Error Messages]
237+
231238
**"API key name must contain only letters, numbers, and spaces"**
232239

233240
- **Solution:** Remove special characters like hyphens, underscores, or symbols
@@ -239,6 +246,7 @@ echo "Deployment completed successfully"
239246
**"Please add at least one role or permission to the key"**
240247

241248
- **Solution:** Specify either `--roles` or `--permissions` (or both)
249+
242250
:::
243251

244252
### Debug Mode

0 commit comments

Comments
 (0)