Compare commits
53 Commits
a3a1a11502
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 66015481dc | |||
| b20cd9f183 | |||
| 63b0987ed3 | |||
| 7f8f5d43db | |||
| 4c1e2c7e84 | |||
| 88026179b6 | |||
| 7b5ff0c233 | |||
| 8851f0f957 | |||
| 46d1fc29bc | |||
| ac9ed3b433 | |||
| 8af2f72723 | |||
| 74bcea4a15 | |||
| b78670c871 | |||
| 4df6aaad46 | |||
| 537994b4e2 | |||
|
|
d2993694df | ||
|
|
d70e9dc70d | ||
| 5401c07e2d | |||
| 2a4c5fd2b6 | |||
|
|
d31531778f | ||
| 4dc6d0919e | |||
| 2c93df7307 | |||
|
|
7aba8dbc61 | ||
| 70af2c65ee | |||
| a6fa17e285 | |||
|
|
22975cdf93 | ||
| 9a6344ffc5 | |||
|
|
dff9c6c8c8 | ||
| 75355cd41f | |||
| 6f7dea6b03 | |||
| 114c60f708 | |||
|
|
63c4b4ca10 | ||
| fcf4c490e0 | |||
|
|
ff4b685831 | ||
| bbc01a37f1 | |||
| fc4c5fb1d1 | |||
| c99a10e1c2 | |||
| 3db0e35e81 | |||
| 54b1b6efa6 | |||
| 9c34554bad | |||
| 82ae0a05b0 | |||
| d6f57ddf10 | |||
|
|
b9ad7c89a8 | ||
| edea39e558 | |||
|
|
3ebdc6b561 | ||
| 18fb15d82d | |||
|
|
0fe5f7077e | ||
| e1cb13883b | |||
| b80ba1132b | |||
| 976e275bba | |||
| 70ee9e246b | |||
| 2c5a011521 | |||
| 513dc654b0 |
@@ -1,9 +0,0 @@
|
||||
# Gitea configuration
|
||||
GITEA_URL=http://synbox.ruv.wtf:8418
|
||||
GITEA_TOKEN=your_gitea_access_token_here
|
||||
|
||||
# Webhook secret (must match Gitea webhook configuration)
|
||||
WEBHOOK_SECRET=your_webhook_secret_here
|
||||
|
||||
# Server port
|
||||
PORT=3000
|
||||
28
.gitea/scripts/update-index.js
Normal file
28
.gitea/scripts/update-index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { readdir, readFile, writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
|
||||
const pluginsDir = './plugins';
|
||||
|
||||
async function updateIndex() {
|
||||
const files = await readdir(pluginsDir);
|
||||
const pluginIds = files
|
||||
.filter(f => f.endsWith('.json') && f !== 'index.json')
|
||||
.map(f => f.replace('.json', ''))
|
||||
.sort();
|
||||
|
||||
const index = {
|
||||
version: '1.0.0',
|
||||
updatedAt: new Date().toISOString(),
|
||||
plugins: pluginIds
|
||||
};
|
||||
|
||||
await writeFile(
|
||||
join(pluginsDir, 'index.json'),
|
||||
JSON.stringify(index, null, 2) + '\n'
|
||||
);
|
||||
|
||||
console.log(`✅ Updated index.json with ${pluginIds.length} plugins`);
|
||||
console.log('Plugins:', pluginIds.join(', '));
|
||||
}
|
||||
|
||||
updateIndex().catch(console.error);
|
||||
@@ -10,12 +10,93 @@
|
||||
* 4. Plugin ID matches filename
|
||||
* 5. Author matches PR creator (for new plugins)
|
||||
* 6. Can only remove own plugins
|
||||
* 7. Thumbnail requirements: png/gif/jpg, max 512x512, max 2MB
|
||||
*/
|
||||
|
||||
import { readFile, access } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import https from 'https';
|
||||
import http from 'http';
|
||||
|
||||
const REQUIRED_FIELDS = ['id', 'name', 'version', 'description', 'author', 'repository'];
|
||||
const MAX_THUMBNAIL_SIZE = 2 * 1024 * 1024; // 2MB
|
||||
const MAX_THUMBNAIL_DIMENSIONS = 512;
|
||||
const ALLOWED_IMAGE_FORMATS = ['png', 'gif', 'jpg', 'jpeg'];
|
||||
|
||||
async function validateThumbnail(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const protocol = url.startsWith('https') ? https : http;
|
||||
|
||||
protocol.get(url, (res) => {
|
||||
if (res.statusCode !== 200) {
|
||||
return reject(new Error(`Thumbnail URL returned ${res.statusCode}`));
|
||||
}
|
||||
|
||||
const chunks = [];
|
||||
let size = 0;
|
||||
|
||||
res.on('data', (chunk) => {
|
||||
chunks.push(chunk);
|
||||
size += chunk.length;
|
||||
|
||||
if (size > MAX_THUMBNAIL_SIZE) {
|
||||
res.destroy();
|
||||
reject(new Error(`Thumbnail exceeds 2MB limit (${(size / 1024 / 1024).toFixed(2)}MB)`));
|
||||
}
|
||||
});
|
||||
|
||||
res.on('end', () => {
|
||||
const buffer = Buffer.concat(chunks);
|
||||
|
||||
// Check image format by magic bytes
|
||||
const isPNG = buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4E && buffer[3] === 0x47;
|
||||
const isJPG = buffer[0] === 0xFF && buffer[1] === 0xD8 && buffer[2] === 0xFF;
|
||||
const isGIF = buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46;
|
||||
|
||||
if (!isPNG && !isJPG && !isGIF) {
|
||||
return reject(new Error('Thumbnail must be PNG, JPG, or GIF format'));
|
||||
}
|
||||
|
||||
// Check dimensions (simplified check - reads PNG/JPG headers)
|
||||
let width, height;
|
||||
|
||||
if (isPNG) {
|
||||
width = buffer.readUInt32BE(16);
|
||||
height = buffer.readUInt32BE(20);
|
||||
} else if (isJPG) {
|
||||
// Simplified JPEG dimension reading
|
||||
let offset = 2;
|
||||
while (offset < buffer.length) {
|
||||
if (buffer[offset] !== 0xFF) break;
|
||||
offset++;
|
||||
const marker = buffer[offset];
|
||||
offset++;
|
||||
|
||||
if (marker === 0xC0 || marker === 0xC2) {
|
||||
height = buffer.readUInt16BE(offset + 3);
|
||||
width = buffer.readUInt16BE(offset + 5);
|
||||
break;
|
||||
}
|
||||
|
||||
const segmentLength = buffer.readUInt16BE(offset);
|
||||
offset += segmentLength;
|
||||
}
|
||||
} else if (isGIF) {
|
||||
width = buffer.readUInt16LE(6);
|
||||
height = buffer.readUInt16LE(8);
|
||||
}
|
||||
|
||||
if (width > MAX_THUMBNAIL_DIMENSIONS || height > MAX_THUMBNAIL_DIMENSIONS) {
|
||||
return reject(new Error(`Thumbnail dimensions ${width}x${height} exceed ${MAX_THUMBNAIL_DIMENSIONS}x${MAX_THUMBNAIL_DIMENSIONS}`));
|
||||
}
|
||||
|
||||
resolve({ width, height, size, format: isPNG ? 'PNG' : isJPG ? 'JPG' : 'GIF' });
|
||||
});
|
||||
|
||||
res.on('error', reject);
|
||||
}).on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
const prAuthor = process.argv[2];
|
||||
const changedFiles = process.argv[3]?.split('\n').filter(f => f.trim()) || [];
|
||||
@@ -48,14 +129,30 @@ for (const file of changedFiles) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip index.json - it's auto-generated
|
||||
if (file === 'plugins/index.json') {
|
||||
console.log(`⚠️ Note: index.json is auto-generated, should not be manually edited`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const pluginId = file.replace('plugins/', '').replace('.json', '');
|
||||
|
||||
// Filename must be prefixed with username
|
||||
if (!pluginId.startsWith(`${prAuthor}-`)) {
|
||||
errors.push(`❌ ${file}: Filename must start with your username "${prAuthor}-" (e.g., "${prAuthor}-my-plugin.json")`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Adjust file paths based on working directory
|
||||
const prFilePath = process.env.PR_FILES_DIR ? `${process.env.PR_FILES_DIR}/${file.replace('plugins/', '')}` : file;
|
||||
const baseFilePath = file;
|
||||
|
||||
// Check if file was added or removed
|
||||
let isAdded = false;
|
||||
let isRemoved = false;
|
||||
|
||||
try {
|
||||
await access(file);
|
||||
await access(prFilePath);
|
||||
isAdded = true;
|
||||
} catch {
|
||||
isRemoved = true;
|
||||
@@ -64,9 +161,32 @@ for (const file of changedFiles) {
|
||||
if (isAdded) {
|
||||
// Validate added/modified plugin
|
||||
try {
|
||||
const content = await readFile(file, 'utf-8');
|
||||
const content = await readFile(prFilePath, 'utf-8');
|
||||
const plugin = JSON.parse(content);
|
||||
|
||||
// Check if this plugin already exists on main
|
||||
let isModification = false;
|
||||
let originalAuthor = null;
|
||||
|
||||
try {
|
||||
const originalContent = await readFile(baseFilePath, 'utf-8');
|
||||
const originalPlugin = JSON.parse(originalContent);
|
||||
isModification = true;
|
||||
originalAuthor = originalPlugin.author;
|
||||
} catch {
|
||||
// File doesn't exist on main, this is a new plugin
|
||||
isModification = false;
|
||||
}
|
||||
|
||||
// If modifying existing plugin, MUST match original author
|
||||
if (isModification) {
|
||||
if (originalAuthor !== prAuthor) {
|
||||
errors.push(`❌ ${file}: Cannot modify plugin owned by "${originalAuthor}" (you are "${prAuthor}")`);
|
||||
continue;
|
||||
}
|
||||
console.log(` ℹ️ Modifying existing plugin by ${originalAuthor}`);
|
||||
}
|
||||
|
||||
// Check required fields
|
||||
for (const field of REQUIRED_FIELDS) {
|
||||
if (!plugin[field]) {
|
||||
@@ -84,7 +204,7 @@ for (const file of changedFiles) {
|
||||
errors.push(`❌ ${file}: Invalid version format: ${plugin.version}`);
|
||||
}
|
||||
|
||||
// Check author matches PR creator (for new files)
|
||||
// Check author matches PR creator
|
||||
if (plugin.author !== prAuthor) {
|
||||
errors.push(`❌ ${file}: Author "${plugin.author}" must match PR creator "${prAuthor}"`);
|
||||
}
|
||||
@@ -93,11 +213,64 @@ for (const file of changedFiles) {
|
||||
if (plugin.repository) {
|
||||
try {
|
||||
new URL(plugin.repository);
|
||||
|
||||
// Repository URL should not end with .git
|
||||
if (plugin.repository.endsWith('.git')) {
|
||||
errors.push(`❌ ${file}: Repository URL should not end with .git: ${plugin.repository}`);
|
||||
}
|
||||
} catch {
|
||||
errors.push(`❌ ${file}: Invalid repository URL: ${plugin.repository}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check homepage URL if provided
|
||||
if (plugin.homepage) {
|
||||
try {
|
||||
new URL(plugin.homepage);
|
||||
|
||||
if (plugin.homepage.endsWith('.git')) {
|
||||
errors.push(`❌ ${file}: Homepage URL should not end with .git: ${plugin.homepage}`);
|
||||
}
|
||||
} catch {
|
||||
errors.push(`❌ ${file}: Invalid homepage URL: ${plugin.homepage}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check downloadUrl if provided
|
||||
if (plugin.downloadUrl) {
|
||||
try {
|
||||
new URL(plugin.downloadUrl);
|
||||
|
||||
if (plugin.downloadUrl.endsWith('.git')) {
|
||||
errors.push(`❌ ${file}: Download URL should not end with .git: ${plugin.downloadUrl}`);
|
||||
}
|
||||
} catch {
|
||||
errors.push(`❌ ${file}: Invalid download URL: ${plugin.downloadUrl}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check thumbnail if provided (optional)
|
||||
if (plugin.thumbnail) {
|
||||
try {
|
||||
new URL(plugin.thumbnail);
|
||||
|
||||
// Must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif
|
||||
if (!/\/thumbnail\.(png|jpg|gif)$/i.test(plugin.thumbnail)) {
|
||||
errors.push(`❌ ${file}: Thumbnail must be named thumbnail.png, thumbnail.jpg, or thumbnail.gif`);
|
||||
}
|
||||
|
||||
// Validate thumbnail meets requirements
|
||||
try {
|
||||
const thumbInfo = await validateThumbnail(plugin.thumbnail);
|
||||
console.log(` ✓ Thumbnail: ${thumbInfo.format} ${thumbInfo.width}x${thumbInfo.height} (${(thumbInfo.size / 1024).toFixed(1)}KB)`);
|
||||
} catch (thumbErr) {
|
||||
errors.push(`❌ ${file}: Thumbnail validation failed: ${thumbErr.message}`);
|
||||
}
|
||||
} catch {
|
||||
errors.push(`❌ ${file}: Invalid thumbnail URL: ${plugin.thumbnail}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length === 0) {
|
||||
added.push(pluginId);
|
||||
console.log(`✅ Valid plugin: ${plugin.name}`);
|
||||
@@ -108,10 +281,21 @@ for (const file of changedFiles) {
|
||||
}
|
||||
|
||||
} else if (isRemoved) {
|
||||
// For removed files, we can't validate ownership easily in CI
|
||||
// Just track that it was removed
|
||||
// For removed files, check the original author from main branch
|
||||
try {
|
||||
const originalContent = await readFile(baseFilePath, 'utf-8');
|
||||
const originalPlugin = JSON.parse(originalContent);
|
||||
|
||||
if (originalPlugin.author !== prAuthor) {
|
||||
errors.push(`❌ ${file}: Cannot remove plugin owned by "${originalPlugin.author}" (you are "${prAuthor}")`);
|
||||
continue;
|
||||
}
|
||||
|
||||
removed.push(pluginId);
|
||||
console.log(`🗑️ Removed: ${pluginId}`);
|
||||
console.log(`🗑️ Removed: ${pluginId} (owned by ${prAuthor})`);
|
||||
} catch (err) {
|
||||
errors.push(`❌ ${file}: Could not verify ownership for removal: ${err.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
34
.gitea/workflows/update-index.yml
Normal file
34
.gitea/workflows/update-index.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Update Plugin Index
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'plugins/*.json'
|
||||
|
||||
jobs:
|
||||
update-index:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Generate index.json
|
||||
run: node .gitea/scripts/update-index.js
|
||||
|
||||
- name: Commit index.json
|
||||
run: |
|
||||
git config user.name "Gitea Actions"
|
||||
git config user.email "actions@gitea.local"
|
||||
git add plugins/index.json
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to index.json"
|
||||
else
|
||||
git commit -m "Auto-update plugin index [skip ci]"
|
||||
git push
|
||||
fi
|
||||
@@ -2,15 +2,21 @@ name: Validate Plugin PR
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'plugins/**'
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout base branch (main) for validation scripts
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: main
|
||||
path: base
|
||||
|
||||
- name: Checkout PR branch for plugin files
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: pr
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
@@ -21,13 +27,81 @@ jobs:
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
run: |
|
||||
cd pr
|
||||
echo "files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^plugins/' || echo '')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Validate PR
|
||||
- name: Block attempts to modify infrastructure
|
||||
run: |
|
||||
node .gitea/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
|
||||
cd pr
|
||||
INFRA_CHANGES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '^\.gitea/' || echo '')
|
||||
if [ -n "$INFRA_CHANGES" ]; then
|
||||
echo "❌ ERROR: PRs cannot modify .gitea/ directory files"
|
||||
echo "Changed infrastructure files:"
|
||||
echo "$INFRA_CHANGES"
|
||||
echo ""
|
||||
echo "Only plugins/ directory changes are allowed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Auto-approve if valid
|
||||
- name: Verify commit authors match PR creator
|
||||
run: |
|
||||
cd pr
|
||||
echo "🔍 Verifying commit authors..."
|
||||
PR_USER="${{ github.event.pull_request.user.login }}"
|
||||
echo "PR created by: $PR_USER"
|
||||
|
||||
# Get all commits in this PR
|
||||
COMMITS=$(git log --format="%H" origin/${{ github.base_ref }}..HEAD)
|
||||
|
||||
for commit in $COMMITS; do
|
||||
AUTHOR=$(git show -s --format='%an' $commit)
|
||||
EMAIL=$(git show -s --format='%ae' $commit)
|
||||
echo " Commit $commit by $AUTHOR <$EMAIL>"
|
||||
|
||||
# This is a warning, not a hard block, since git authors can be configured differently
|
||||
# The real security comes from PR creator authentication
|
||||
done
|
||||
|
||||
echo "✓ PR created by authenticated user: $PR_USER"
|
||||
echo "Note: Validation will check plugin ownership against this authenticated user, not git commit authors"
|
||||
|
||||
- name: Validate PR (using trusted validation script from main)
|
||||
run: |
|
||||
cd base
|
||||
node .gitea/scripts/validate-pr.js "${{ github.event.pull_request.user.login }}" "${{ steps.changed-files.outputs.files }}"
|
||||
env:
|
||||
PR_FILES_DIR: ../pr/plugins
|
||||
|
||||
- name: Post approval comment
|
||||
if: success()
|
||||
run: |
|
||||
echo "✅ Validation passed - PR is ready to merge"
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"body":"✅ **Validation passed!** Auto-merging this pull request.\n\nAll plugin requirements have been met:\n- ✓ Valid plugin schema\n- ✓ Correct filename format\n- ✓ Author verification\n- ✓ Repository URL valid\n\nYour plugin will be available in the directory shortly!"}' \
|
||||
"http://synbox.ruv.wtf:8418/api/v1/repos/litruv/Plugin-Directory/issues/${{ github.event.pull_request.number }}/comments"
|
||||
|
||||
- name: Auto-merge PR
|
||||
if: success()
|
||||
run: |
|
||||
cd pr
|
||||
echo "✅ Validation passed - Auto-merging PR"
|
||||
|
||||
# Configure git with token authentication
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "gitea-actions[bot]@users.noreply.gitea.io"
|
||||
|
||||
# Set up authenticated remote URL using github.token
|
||||
git remote set-url origin "http://oauth2:${{ github.token }}@synbox.ruv.wtf:8418/litruv/Plugin-Directory.git"
|
||||
|
||||
# Fetch and merge
|
||||
git fetch origin ${{ github.event.pull_request.head.ref }}
|
||||
git checkout main
|
||||
git merge --squash origin/${{ github.event.pull_request.head.ref }}
|
||||
git commit -m "${{ github.event.pull_request.title }}"
|
||||
|
||||
# Push changes
|
||||
git push origin main
|
||||
|
||||
# Delete the PR branch
|
||||
git push origin --delete ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
129
README.md
129
README.md
@@ -1,122 +1,63 @@
|
||||
# Plugin Directory
|
||||
|
||||
A simple git-based plugin registry for the Plugin Host system.
|
||||
Git-based plugin registry for Plugin Host. No server needed - just JSON files.
|
||||
|
||||
## 📦 What This Is
|
||||
## How to Submit a Plugin
|
||||
|
||||
A collection of JSON files that describe available plugins. The Plugin Host fetches these definitions directly from the git repository.
|
||||
### 1. Create your plugin JSON file
|
||||
|
||||
## 🚀 How It Works
|
||||
Filename format: `plugins/{username}-{plugin-name}.json`
|
||||
|
||||
1. Plugin authors create a JSON file in `plugins/` directory
|
||||
2. Submit via Pull Request
|
||||
3. Gitea Actions validate the submission
|
||||
4. If valid, maintainer merges the PR
|
||||
5. Plugin Host automatically discovers the new plugin
|
||||
|
||||
## 📝 Submitting a Plugin
|
||||
|
||||
### 1. Fork this repository
|
||||
|
||||
### 2. Create your plugin definition
|
||||
|
||||
Create `plugins/your-plugin-id.json`:
|
||||
Example: `plugins/litruv-example-plugin.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "your-plugin-id",
|
||||
"name": "Your Plugin Name",
|
||||
"id": "litruv-example-plugin",
|
||||
"name": "Example Plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "What your plugin does",
|
||||
"author": "your-gitea-username",
|
||||
"repository": "http://synbox.ruv.wtf:8418/you/your-plugin.git",
|
||||
"downloadUrl": "http://synbox.ruv.wtf:8418/you/your-plugin/archive/main.zip",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/you/your-plugin",
|
||||
"tags": ["category", "keywords"]
|
||||
"author": "litruv",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example",
|
||||
"thumbnail": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example/raw/branch/main/thumbnail.png",
|
||||
"tags": ["example"]
|
||||
}
|
||||
```
|
||||
|
||||
**Required fields:**
|
||||
- `id` - Must match filename (without .json)
|
||||
- `name` - Display name
|
||||
- `version` - Semantic version (X.Y.Z)
|
||||
- `description` - Brief description
|
||||
- `author` - Your Gitea username (must match PR creator)
|
||||
- `repository` - Git repository URL
|
||||
**Required fields:** `id`, `name`, `version`, `description`, `author`, `repository`
|
||||
|
||||
### 3. Create Pull Request
|
||||
**Optional fields:** `homepage`, `thumbnail`, `tags`, `downloadUrl`
|
||||
|
||||
Gitea Actions will automatically validate:
|
||||
- ✅ File is in `plugins/` directory
|
||||
- ✅ File is valid JSON
|
||||
- ✅ All required fields present
|
||||
- ✅ ID matches filename
|
||||
- ✅ Author matches your username
|
||||
- ✅ Version format is valid
|
||||
- ✅ URLs are valid
|
||||
**Rules:**
|
||||
- All URLs must NOT end with `.git`
|
||||
- `repository` and `homepage` should point to your plugin repo (without .git)
|
||||
- `thumbnail` must be `thumbnail.png`, `thumbnail.jpg`, or `thumbnail.gif` (max 512x512, max 2MB)
|
||||
|
||||
### 4. Merge
|
||||
**Important:**
|
||||
- Filename must start with your username: `{username}-`
|
||||
- Plugin `id` must match filename (without .json)
|
||||
- `author` field must match your Gitea username
|
||||
|
||||
If validation passes, maintainer will merge your PR.
|
||||
### 2. Create a Pull Request
|
||||
|
||||
## 🗑️ Removing Your Plugin
|
||||
Push your branch and create a PR. Gitea Actions will automatically:
|
||||
- Validate your submission
|
||||
- Post approval comment if valid
|
||||
- Auto-merge and update the plugin index
|
||||
|
||||
Only plugin authors can remove their own plugins:
|
||||
That's it! Your plugin will be available immediately after merge.
|
||||
|
||||
1. Fork this repository
|
||||
2. Delete `plugins/your-plugin-id.json`
|
||||
3. Create Pull Request
|
||||
## Updating or Removing
|
||||
|
||||
## 🔄 Updating Your Plugin
|
||||
- **Update:** Create PR with modified JSON (version bump required)
|
||||
- **Remove:** Create PR deleting your plugin JSON file
|
||||
|
||||
1. Fork this repository
|
||||
2. Edit `plugins/your-plugin-id.json`
|
||||
3. Update version number and any other fields
|
||||
4. Create Pull Request
|
||||
You can only modify/remove plugins you authored.
|
||||
|
||||
## 📋 Plugin Schema
|
||||
|
||||
See [SCHEMA.md](SCHEMA.md) for full schema documentation.
|
||||
|
||||
## 🔍 Validation Rules
|
||||
|
||||
PRs must:
|
||||
- Only modify files in `plugins/` directory
|
||||
- Only modify `.json` files
|
||||
- Have valid JSON
|
||||
- Match the plugin schema
|
||||
- Have author field matching PR creator
|
||||
- Have plugin ID matching filename
|
||||
|
||||
## 🏗️ Directory Structure
|
||||
## Plugin Discovery
|
||||
|
||||
Plugin Host fetches from:
|
||||
```
|
||||
Plugin-Directory/
|
||||
├── plugins/
|
||||
│ ├── example-plugin.json
|
||||
│ ├── your-plugin.json
|
||||
│ └── ...
|
||||
├── .gitea/
|
||||
│ ├── workflows/
|
||||
│ │ └── validate-pr.yml
|
||||
│ └── scripts/
|
||||
│ └── validate-pr.js
|
||||
└── README.md
|
||||
http://synbox.ruv.wtf:8418/litruv/Plugin-Directory/raw/branch/main/plugins/index.json
|
||||
```
|
||||
|
||||
## 🔗 Plugin Host Integration
|
||||
|
||||
The Plugin Host fetches plugin definitions from:
|
||||
```
|
||||
http://synbox.ruv.wtf:8418/litruv/Plugin-Directory/raw/branch/main/plugins/
|
||||
```
|
||||
|
||||
No server needed - just static JSON files served by Gitea!
|
||||
|
||||
## 📖 Example Plugins
|
||||
|
||||
- [example-plugin.json](plugins/example-plugin.json) - Reference implementation
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
73
SCHEMA.md
73
SCHEMA.md
@@ -1,73 +0,0 @@
|
||||
# Plugin Schema
|
||||
|
||||
All plugin definitions must be valid JSON files following this schema.
|
||||
|
||||
## Required Fields
|
||||
|
||||
| Field | Type | Description | Example |
|
||||
|-------|------|-------------|---------|
|
||||
| `id` | string | Unique identifier (must match filename) | `"awesome-plugin"` |
|
||||
| `name` | string | Display name | `"Awesome Plugin"` |
|
||||
| `version` | string | Semantic version | `"1.0.0"` |
|
||||
| `description` | string | What the plugin does | `"Does awesome things"` |
|
||||
| `author` | string | Gitea username of creator | `"litruv"` |
|
||||
| `repository` | string | Git repository URL | `"http://synbox.ruv.wtf:8418/litruv/awesome-plugin.git"` |
|
||||
|
||||
## Optional Fields
|
||||
|
||||
| Field | Type | Description | Example |
|
||||
|-------|------|-------------|---------|
|
||||
| `downloadUrl` | string | Direct download URL | `"http://synbox.ruv.wtf:8418/litruv/awesome-plugin/archive/main.zip"` |
|
||||
| `homepage` | string | Plugin homepage or documentation | `"http://synbox.ruv.wtf:8418/litruv/awesome-plugin"` |
|
||||
| `tags` | array | Category tags | `["utility", "automation"]` |
|
||||
| `addedDate` | string | ISO 8601 date | `"2026-04-17T00:00:00.000Z"` |
|
||||
| `dependencies` | object | Required dependencies | `{"lodash": "^4.17.21"}` |
|
||||
|
||||
## Example
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "example-plugin",
|
||||
"name": "Example Plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "An example plugin demonstrating the plugin system capabilities",
|
||||
"author": "litruv",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example.git",
|
||||
"downloadUrl": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example/archive/main.zip",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example",
|
||||
"tags": ["example", "demo"],
|
||||
"addedDate": "2026-04-17T00:00:00.000Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Validation Rules
|
||||
|
||||
1. **Filename Match**: Plugin ID must match the filename (without .json extension)
|
||||
- ✅ `awesome-plugin.json` with `"id": "awesome-plugin"`
|
||||
- ❌ `awesome-plugin.json` with `"id": "different-name"`
|
||||
|
||||
2. **Version Format**: Must follow semantic versioning (X.Y.Z)
|
||||
- ✅ `"1.0.0"`, `"2.5.3"`, `"0.1.0"`
|
||||
- ❌ `"1.0"`, `"v1.0.0"`, `"latest"`
|
||||
|
||||
3. **Author Matching**: For new plugins, author must match PR creator
|
||||
- If PR is by user `litruv`, author field must be `"litruv"`
|
||||
|
||||
4. **Valid URLs**: Repository, downloadUrl, and homepage must be valid URLs
|
||||
- ✅ `"http://example.com/repo.git"`
|
||||
- ❌ `"not-a-url"`, `"//example.com"`
|
||||
|
||||
5. **Tags**: If present, must be an array of strings
|
||||
- ✅ `["tag1", "tag2"]`
|
||||
- ❌ `"tag1,tag2"`, `{"tag": "value"}`
|
||||
|
||||
## Submission Process
|
||||
|
||||
1. Create a JSON file in the `plugins/` directory
|
||||
2. Filename must be `{plugin-id}.json`
|
||||
3. Ensure all required fields are present
|
||||
4. Author field must match your Gitea username
|
||||
5. Create a Pull Request
|
||||
6. Automated validation will run
|
||||
7. If valid, PR auto-merges
|
||||
8. If invalid, you'll receive comments explaining what to fix
|
||||
920
package-lock.json
generated
920
package-lock.json
generated
@@ -1,920 +0,0 @@
|
||||
{
|
||||
"name": "@pluginhost/directory",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pluginhost/directory",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"node-fetch": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.4",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",
|
||||
"integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"content-type": "~1.0.5",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "~1.2.0",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"on-finished": "~2.4.1",
|
||||
"qs": "~6.14.0",
|
||||
"raw-body": "~2.5.3",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
||||
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/destroy": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "4.22.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
||||
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.8",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "~1.20.3",
|
||||
"content-disposition": "~0.5.4",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "~0.7.1",
|
||||
"cookie-signature": "~1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "~1.3.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.0",
|
||||
"merge-descriptors": "1.0.3",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "~0.1.12",
|
||||
"proxy-addr": "~2.0.7",
|
||||
"qs": "~6.14.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.2.1",
|
||||
"send": "~0.19.0",
|
||||
"serve-static": "~1.16.2",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "~2.0.1",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "~2.0.2",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "~2.0.0",
|
||||
"inherits": "~2.0.4",
|
||||
"setprototypeof": "~1.2.0",
|
||||
"statuses": "~2.0.2",
|
||||
"toidentifier": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
||||
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"deprecated": "Use your platform's native DOMException instead",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
||||
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
|
||||
"integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
|
||||
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
||||
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "~2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/send/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "1.16.3",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
|
||||
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "~0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
package.json
19
package.json
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "@pluginhost/directory",
|
||||
"version": "1.0.0",
|
||||
"description": "Automated plugin directory with PR validation and auto-merge",
|
||||
"main": "src/server.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node src/server.js",
|
||||
"dev": "node --watch src/server.js",
|
||||
"validate": "node src/validate.js"
|
||||
},
|
||||
"keywords": ["plugin", "directory", "registry"],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"node-fetch": "^3.3.2"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"updatedAt": "2026-04-17T00:00:00.000Z",
|
||||
"updatedAt": "2026-04-16T17:29:40.639Z",
|
||||
"plugins": [
|
||||
"example-plugin"
|
||||
"litruv-example-plugin",
|
||||
"litruv-example-plugin-2"
|
||||
]
|
||||
}
|
||||
|
||||
12
plugins/litruv-example-plugin-2.json
Normal file
12
plugins/litruv-example-plugin-2.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "litruv-example-plugin-2",
|
||||
"name": "Example Plugin 2",
|
||||
"version": "1.0.0",
|
||||
"description": "A second example plugin demonstrating additional capabilities",
|
||||
"author": "litruv",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2",
|
||||
"downloadUrl": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2/archive/main.zip",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example2",
|
||||
"tags": ["example", "demo", "filtering", "validation"],
|
||||
"addedDate": "2026-04-17T00:00:00.000Z"
|
||||
}
|
||||
10
plugins/litruv-example-plugin-3.json
Normal file
10
plugins/litruv-example-plugin-3.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "litruv-example-plugin-3",
|
||||
"name": "Example Plugin 3",
|
||||
"version": "1.0.0",
|
||||
"description": "A third example plugin demonstrating async operations and data storage",
|
||||
"author": "litruv",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example3",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example3",
|
||||
"tags": ["example", "async", "storage"]
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"id": "example-plugin",
|
||||
"id": "litruv-example-plugin",
|
||||
"name": "Example Plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "An example plugin demonstrating the plugin system capabilities",
|
||||
"author": "litruv",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example.git",
|
||||
"repository": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example",
|
||||
"thumbnail": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example/raw/branch/main/thumbnail.png",
|
||||
"downloadUrl": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example/archive/main.zip",
|
||||
"homepage": "http://synbox.ruv.wtf:8418/litruv/Plugin-Example",
|
||||
"tags": ["example", "demo"],
|
||||
193
src/Validator.js
193
src/Validator.js
@@ -1,193 +0,0 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
|
||||
/**
|
||||
* Validator - Validates PR changes against plugin directory rules
|
||||
*/
|
||||
export class Validator {
|
||||
constructor() {
|
||||
this.requiredFields = ['id', 'name', 'version', 'description', 'author', 'repository'];
|
||||
this.optionalFields = ['downloadUrl', 'homepage', 'tags', 'addedDate', 'dependencies'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a PR's file changes
|
||||
*/
|
||||
async validatePR(files, prAuthor) {
|
||||
const errors = [];
|
||||
const added = [];
|
||||
const removed = [];
|
||||
|
||||
// Check that all files are in the plugins/ directory
|
||||
const invalidPaths = files.filter(f => !f.filename.startsWith('plugins/'));
|
||||
if (invalidPaths.length > 0) {
|
||||
errors.push(`Files outside plugins/ directory: ${invalidPaths.map(f => f.filename).join(', ')}`);
|
||||
}
|
||||
|
||||
// Check that all files are .json files
|
||||
const nonJsonFiles = files.filter(f =>
|
||||
f.filename.startsWith('plugins/') && !f.filename.endsWith('.json')
|
||||
);
|
||||
if (nonJsonFiles.length > 0) {
|
||||
errors.push(`Non-JSON files in plugins/: ${nonJsonFiles.map(f => f.filename).join(', ')}`);
|
||||
}
|
||||
|
||||
// Process each changed file
|
||||
for (const file of files) {
|
||||
if (!file.filename.startsWith('plugins/') || !file.filename.endsWith('.json')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const pluginId = file.filename.replace('plugins/', '').replace('.json', '');
|
||||
|
||||
if (file.status === 'added' || file.status === 'modified') {
|
||||
// Validate added/modified plugins
|
||||
try {
|
||||
const validation = await this.validatePluginFile(file, pluginId, prAuthor);
|
||||
|
||||
if (!validation.valid) {
|
||||
errors.push(...validation.errors.map(e => `${file.filename}: ${e}`));
|
||||
} else {
|
||||
added.push(pluginId);
|
||||
}
|
||||
} catch (error) {
|
||||
errors.push(`${file.filename}: ${error.message}`);
|
||||
}
|
||||
} else if (file.status === 'removed') {
|
||||
// Validate removed plugins (check ownership)
|
||||
try {
|
||||
const canRemove = await this.validateRemoval(pluginId, prAuthor);
|
||||
|
||||
if (!canRemove.valid) {
|
||||
errors.push(...canRemove.errors.map(e => `${file.filename}: ${e}`));
|
||||
} else {
|
||||
removed.push(pluginId);
|
||||
}
|
||||
} catch (error) {
|
||||
errors.push(`${file.filename}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Must have at least one change
|
||||
if (files.length === 0) {
|
||||
errors.push('PR has no file changes');
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors,
|
||||
added,
|
||||
removed
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a plugin JSON file
|
||||
*/
|
||||
async validatePluginFile(file, pluginId, prAuthor) {
|
||||
const errors = [];
|
||||
|
||||
try {
|
||||
// Parse the JSON content from the file patch
|
||||
const content = this.extractFileContent(file);
|
||||
const plugin = JSON.parse(content);
|
||||
|
||||
// Check required fields
|
||||
for (const field of this.requiredFields) {
|
||||
if (!plugin[field]) {
|
||||
errors.push(`Missing required field: ${field}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check that ID matches filename
|
||||
if (plugin.id !== pluginId) {
|
||||
errors.push(`Plugin ID "${plugin.id}" does not match filename "${pluginId}.json"`);
|
||||
}
|
||||
|
||||
// Validate version format (semver-ish)
|
||||
if (plugin.version && !this.isValidVersion(plugin.version)) {
|
||||
errors.push(`Invalid version format: ${plugin.version} (expected: X.Y.Z)`);
|
||||
}
|
||||
|
||||
// Validate repository URL
|
||||
if (plugin.repository && !this.isValidUrl(plugin.repository)) {
|
||||
errors.push(`Invalid repository URL: ${plugin.repository}`);
|
||||
}
|
||||
|
||||
// Validate author matches PR author (for new plugins)
|
||||
if (file.status === 'added' && plugin.author !== prAuthor) {
|
||||
errors.push(`Author "${plugin.author}" must match PR author "${prAuthor}"`);
|
||||
}
|
||||
|
||||
// Validate tags if present
|
||||
if (plugin.tags && !Array.isArray(plugin.tags)) {
|
||||
errors.push('Tags must be an array');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
errors.push(`Invalid JSON: ${error.message}`);
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a user can remove a plugin
|
||||
*/
|
||||
async validateRemoval(pluginId, prAuthor) {
|
||||
const errors = [];
|
||||
|
||||
try {
|
||||
// Read the existing plugin file from disk
|
||||
const content = await readFile(`./plugins/${pluginId}.json`, 'utf-8');
|
||||
const plugin = JSON.parse(content);
|
||||
|
||||
// Check if the PR author is the plugin author
|
||||
if (plugin.author !== prAuthor) {
|
||||
errors.push(`Cannot remove plugin: you are not the author (author: ${plugin.author})`);
|
||||
}
|
||||
} catch (error) {
|
||||
// If file doesn't exist, it's probably already removed
|
||||
console.warn(`Could not validate removal of ${pluginId}:`, error.message);
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract file content from Gitea file object
|
||||
* In a real implementation, you'd fetch the raw content from the PR
|
||||
*/
|
||||
extractFileContent(file) {
|
||||
// This is a simplified version
|
||||
// In production, fetch the actual file content from the PR's head branch
|
||||
|
||||
// For now, return a placeholder that would need to be fetched
|
||||
throw new Error('File content extraction not fully implemented - fetch from PR branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate semantic version format
|
||||
*/
|
||||
isValidVersion(version) {
|
||||
return /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/.test(version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate URL format
|
||||
*/
|
||||
isValidUrl(url) {
|
||||
try {
|
||||
new URL(url);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
import { WebhookHandler } from './WebhookHandler.js';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
/**
|
||||
* Enhanced validator that fetches actual file content from PR
|
||||
*/
|
||||
export class Validator {
|
||||
constructor(webhookHandler) {
|
||||
this.handler = webhookHandler;
|
||||
this.requiredFields = ['id', 'name', 'version', 'description', 'author', 'repository'];
|
||||
this.optionalFields = ['downloadUrl', 'homepage', 'tags', 'addedDate', 'dependencies'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a PR's file changes
|
||||
*/
|
||||
async validatePR(files, prAuthor, prNumber) {
|
||||
const errors = [];
|
||||
const added = [];
|
||||
const removed = [];
|
||||
|
||||
// Check that all files are in the plugins/ directory
|
||||
const invalidPaths = files.filter(f => !f.filename.startsWith('plugins/'));
|
||||
if (invalidPaths.length > 0) {
|
||||
errors.push(`Files outside plugins/ directory: ${invalidPaths.map(f => f.filename).join(', ')}`);
|
||||
}
|
||||
|
||||
// Check that all files are .json files
|
||||
const nonJsonFiles = files.filter(f =>
|
||||
f.filename.startsWith('plugins/') && !f.filename.endsWith('.json')
|
||||
);
|
||||
if (nonJsonFiles.length > 0) {
|
||||
errors.push(`Non-JSON files in plugins/: ${nonJsonFiles.map(f => f.filename).join(', ')}`);
|
||||
}
|
||||
|
||||
// Process each changed file
|
||||
for (const file of files) {
|
||||
if (!file.filename.startsWith('plugins/') || !file.filename.endsWith('.json')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const pluginId = file.filename.replace('plugins/', '').replace('.json', '');
|
||||
|
||||
if (file.status === 'added' || file.status === 'modified') {
|
||||
// Fetch and validate the file content
|
||||
try {
|
||||
const content = await this.fetchPRFileContent(prNumber, file.filename);
|
||||
const validation = await this.validatePluginContent(content, pluginId, prAuthor, file.status);
|
||||
|
||||
if (!validation.valid) {
|
||||
errors.push(...validation.errors.map(e => `${file.filename}: ${e}`));
|
||||
} else {
|
||||
added.push(pluginId);
|
||||
}
|
||||
} catch (error) {
|
||||
errors.push(`${file.filename}: ${error.message}`);
|
||||
}
|
||||
} else if (file.status === 'removed') {
|
||||
// Validate removed plugins (check ownership)
|
||||
try {
|
||||
const canRemove = await this.validateRemoval(pluginId, prAuthor);
|
||||
|
||||
if (!canRemove.valid) {
|
||||
errors.push(...canRemove.errors.map(e => `${file.filename}: ${e}`));
|
||||
} else {
|
||||
removed.push(pluginId);
|
||||
}
|
||||
} catch (error) {
|
||||
errors.push(`${file.filename}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Must have at least one change
|
||||
if (files.length === 0) {
|
||||
errors.push('PR has no file changes');
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors,
|
||||
added,
|
||||
removed
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch file content from a PR
|
||||
*/
|
||||
async fetchPRFileContent(prNumber, filename) {
|
||||
const pr = await this.getPRDetails(prNumber);
|
||||
const headSha = pr.head.sha;
|
||||
|
||||
const url = `${this.handler.giteaUrl}/api/v1/repos/${this.handler.repoOwner}/${this.handler.repoName}/contents/${filename}?ref=${headSha}`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: { 'Authorization': `token ${this.handler.giteaToken}` }
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch file: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const content = Buffer.from(data.content, 'base64').toString('utf-8');
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PR details
|
||||
*/
|
||||
async getPRDetails(prNumber) {
|
||||
const url = `${this.handler.giteaUrl}/api/v1/repos/${this.handler.repoOwner}/${this.handler.repoName}/pulls/${prNumber}`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: { 'Authorization': `token ${this.handler.giteaToken}` }
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch PR: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate plugin JSON content
|
||||
*/
|
||||
async validatePluginContent(content, pluginId, prAuthor, status) {
|
||||
const errors = [];
|
||||
|
||||
try {
|
||||
const plugin = JSON.parse(content);
|
||||
|
||||
// Check required fields
|
||||
for (const field of this.requiredFields) {
|
||||
if (!plugin[field]) {
|
||||
errors.push(`Missing required field: ${field}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check that ID matches filename
|
||||
if (plugin.id !== pluginId) {
|
||||
errors.push(`Plugin ID "${plugin.id}" does not match filename "${pluginId}.json"`);
|
||||
}
|
||||
|
||||
// Validate version format (semver-ish)
|
||||
if (plugin.version && !this.isValidVersion(plugin.version)) {
|
||||
errors.push(`Invalid version format: ${plugin.version} (expected: X.Y.Z)`);
|
||||
}
|
||||
|
||||
// Validate repository URL
|
||||
if (plugin.repository && !this.isValidUrl(plugin.repository)) {
|
||||
errors.push(`Invalid repository URL: ${plugin.repository}`);
|
||||
}
|
||||
|
||||
// Validate author matches PR author (for new plugins)
|
||||
if (status === 'added' && plugin.author !== prAuthor) {
|
||||
errors.push(`Author "${plugin.author}" must match PR author "${prAuthor}"`);
|
||||
}
|
||||
|
||||
// Validate tags if present
|
||||
if (plugin.tags && !Array.isArray(plugin.tags)) {
|
||||
errors.push('Tags must be an array');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
errors.push(`Invalid JSON: ${error.message}`);
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a user can remove a plugin
|
||||
*/
|
||||
async validateRemoval(pluginId, prAuthor) {
|
||||
const errors = [];
|
||||
|
||||
try {
|
||||
// Read the existing plugin file from main branch
|
||||
const url = `${this.handler.giteaUrl}/api/v1/repos/${this.handler.repoOwner}/${this.handler.repoName}/contents/plugins/${pluginId}.json`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: { 'Authorization': `token ${this.handler.giteaToken}` }
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
// If file doesn't exist on main, removal is fine
|
||||
return { valid: true, errors: [] };
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const content = Buffer.from(data.content, 'base64').toString('utf-8');
|
||||
const plugin = JSON.parse(content);
|
||||
|
||||
// Check if the PR author is the plugin author
|
||||
if (plugin.author !== prAuthor) {
|
||||
errors.push(`Cannot remove plugin: you are not the author (author: ${plugin.author})`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`Could not validate removal of ${pluginId}:`, error.message);
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate semantic version format
|
||||
*/
|
||||
isValidVersion(version) {
|
||||
return /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/.test(version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate URL format
|
||||
*/
|
||||
isValidUrl(url) {
|
||||
try {
|
||||
new URL(url);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
import crypto from 'crypto';
|
||||
import fetch from 'node-fetch';
|
||||
import { readdir, readFile } from 'fs/promises';
|
||||
import { join, dirname, resolve } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { Validator } from './ValidatorEnhanced.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
/**
|
||||
* WebhookHandler - Processes Gitea webhooks for automated PR handling
|
||||
*/
|
||||
export class WebhookHandler {
|
||||
constructor(options) {
|
||||
this.giteaUrl = options.giteaUrl;
|
||||
this.giteaToken = options.giteaToken;
|
||||
this.webhookSecret = options.webhookSecret;
|
||||
this.repoOwner = options.repoOwner;
|
||||
this.repoName = options.repoName;
|
||||
this.validator = new Validator(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify webhook signature
|
||||
*/
|
||||
verifySignature(payload, signature) {
|
||||
if (!this.webhookSecret) return true; // Skip if no secret configured
|
||||
|
||||
const hmac = crypto.createHmac('sha256', this.webhookSecret);
|
||||
const digest = hmac.update(JSON.stringify(payload)).digest('hex');
|
||||
return signature === digest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle pull request webhook
|
||||
*/
|
||||
async handlePullRequest(payload) {
|
||||
const { action, pull_request, repository } = payload;
|
||||
|
||||
console.log(`PR #${pull_request.number}: ${action} by ${pull_request.user.login}`);
|
||||
|
||||
// Only process opened or synchronized PRs
|
||||
if (action !== 'opened' && action !== 'synchronize') {
|
||||
console.log('Skipping PR action:', action);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Get PR details
|
||||
const prNumber = pull_request.number;
|
||||
const prAuthor = pull_request.user.login;
|
||||
const headBranch = pull_request.head.ref;
|
||||
const baseBranch = pull_request.base.ref;
|
||||
|
||||
// Get file changes in the PR
|
||||
const files = await this.getPRFiles(prNumber);
|
||||
|
||||
console.log(`PR files changed: ${files.map(f => `${f.filename} (${f.status})`).join(', ')}`);
|
||||
|
||||
// Validate the PR
|
||||
const validation = await this.validator.validatePR(files, prAuthor, prNumber);
|
||||
|
||||
if (!validation.valid) {
|
||||
console.log('Validation failed:', validation.errors);
|
||||
await this.commentOnPR(prNumber, this.buildErrorComment(validation.errors));
|
||||
await this.labelPR(prNumber, 'validation-failed');
|
||||
return;
|
||||
}
|
||||
|
||||
// PR is valid, auto-approve and merge
|
||||
console.log('✓ PR validation passed');
|
||||
await this.commentOnPR(prNumber, this.buildSuccessComment(validation));
|
||||
await this.labelPR(prNumber, 'auto-approved');
|
||||
await this.mergePR(prNumber);
|
||||
|
||||
console.log(`✓ Auto-merged PR #${prNumber}`);
|
||||
} catch (error) {
|
||||
console.error('Error handling PR:', error);
|
||||
await this.commentOnPR(pull_request.number,
|
||||
`❌ **Automation Error**\n\nFailed to process this PR: ${error.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files changed in a PR
|
||||
*/
|
||||
async getPRFiles(prNumber) {
|
||||
const url = `${this.giteaUrl}/api/v1/repos/${this.repoOwner}/${this.repoName}/pulls/${prNumber}/files`;
|
||||
const response = await fetch(url, {
|
||||
headers: { 'Authorization': `token ${this.giteaToken}` }
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch PR files: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment on a PR
|
||||
*/
|
||||
async commentOnPR(prNumber, body) {
|
||||
const url = `${this.giteaUrl}/api/v1/repos/${this.repoOwner}/${this.repoName}/issues/${prNumber}/comments`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `token ${this.giteaToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ body })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Failed to comment on PR:', response.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Label a PR
|
||||
*/
|
||||
async labelPR(prNumber, label) {
|
||||
const url = `${this.giteaUrl}/api/v1/repos/${this.repoOwner}/${this.repoName}/issues/${prNumber}/labels`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `token ${this.giteaToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ labels: [label] })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Failed to label PR:', response.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a PR
|
||||
*/
|
||||
async mergePR(prNumber) {
|
||||
const url = `${this.giteaUrl}/api/v1/repos/${this.repoOwner}/${this.repoName}/pulls/${prNumber}/merge`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `token ${this.giteaToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
Do: 'squash',
|
||||
MergeMessageField: 'Auto-merged plugin directory update',
|
||||
delete_branch_after_merge: true
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to merge PR: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build error comment for PR
|
||||
*/
|
||||
buildErrorComment(errors) {
|
||||
let comment = '❌ **Validation Failed**\n\nThis PR cannot be auto-merged due to the following issues:\n\n';
|
||||
|
||||
errors.forEach(error => {
|
||||
comment += `- ${error}\n`;
|
||||
});
|
||||
|
||||
comment += '\n**Rules:**\n';
|
||||
comment += '1. Only modify files in the `plugins/` directory\n';
|
||||
comment += '2. Only add or remove `.json` files\n';
|
||||
comment += '3. JSON files must match the plugin schema\n';
|
||||
comment += '4. You can only remove plugins you authored\n';
|
||||
comment += '5. Plugin ID must match the filename (without .json)\n';
|
||||
comment += '\nPlease fix these issues and push again.';
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build success comment for PR
|
||||
*/
|
||||
buildSuccessComment(validation) {
|
||||
let comment = '✅ **Validation Passed**\n\nThis PR has been automatically approved and will be merged.\n\n';
|
||||
|
||||
if (validation.added.length > 0) {
|
||||
comment += `**Added plugins:** ${validation.added.join(', ')}\n`;
|
||||
}
|
||||
|
||||
if (validation.removed.length > 0) {
|
||||
comment += `**Removed plugins:** ${validation.removed.join(', ')}\n`;
|
||||
}
|
||||
|
||||
comment += '\nTo undo this change, create a new PR that reverses these changes.';
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all plugins from the plugins directory
|
||||
*/
|
||||
async listPlugins() {
|
||||
const pluginsDir = resolve(__dirname, '../plugins');
|
||||
const files = await readdir(pluginsDir);
|
||||
const plugins = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.json')) {
|
||||
try {
|
||||
const content = await readFile(join(pluginsDir, file), 'utf-8');
|
||||
const plugin = JSON.parse(content);
|
||||
plugins.push(plugin);
|
||||
} catch (error) {
|
||||
console.error(`Error reading plugin ${file}:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific plugin
|
||||
*/
|
||||
async getPlugin(pluginId) {
|
||||
const pluginsDir = resolve(__dirname, '../plugins');
|
||||
const filePath = join(pluginsDir, `${pluginId}.json`);
|
||||
|
||||
try {
|
||||
const content = await readFile(filePath, 'utf-8');
|
||||
return JSON.parse(content);
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import express from 'express';
|
||||
import { WebhookHandler } from './WebhookHandler.js';
|
||||
import { readFile } from 'fs/promises';
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
const webhookSecret = process.env.WEBHOOK_SECRET || '';
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
const handler = new WebhookHandler({
|
||||
giteaUrl: process.env.GITEA_URL || 'http://synbox.ruv.wtf:8418',
|
||||
giteaToken: process.env.GITEA_TOKEN || '',
|
||||
webhookSecret,
|
||||
repoOwner: 'litruv',
|
||||
repoName: 'Plugin-Directory'
|
||||
});
|
||||
|
||||
/**
|
||||
* Health check endpoint
|
||||
*/
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
/**
|
||||
* List all plugins endpoint
|
||||
*/
|
||||
app.get('/plugins', async (req, res) => {
|
||||
try {
|
||||
const plugins = await handler.listPlugins();
|
||||
res.json({ plugins, count: plugins.length });
|
||||
} catch (error) {
|
||||
console.error('Error listing plugins:', error);
|
||||
res.status(500).json({ error: 'Failed to list plugins' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get specific plugin endpoint
|
||||
*/
|
||||
app.get('/plugins/:pluginId', async (req, res) => {
|
||||
try {
|
||||
const plugin = await handler.getPlugin(req.params.pluginId);
|
||||
if (plugin) {
|
||||
res.json(plugin);
|
||||
} else {
|
||||
res.status(404).json({ error: 'Plugin not found' });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error getting plugin:', error);
|
||||
res.status(500).json({ error: 'Failed to get plugin' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Webhook endpoint for Gitea PR events
|
||||
*/
|
||||
app.post('/webhook', async (req, res) => {
|
||||
try {
|
||||
const signature = req.headers['x-gitea-signature'];
|
||||
const event = req.headers['x-gitea-event'];
|
||||
|
||||
if (!handler.verifySignature(req.body, signature)) {
|
||||
console.warn('Invalid webhook signature');
|
||||
return res.status(401).json({ error: 'Invalid signature' });
|
||||
}
|
||||
|
||||
console.log(`Received webhook event: ${event}`);
|
||||
|
||||
if (event === 'pull_request') {
|
||||
await handler.handlePullRequest(req.body);
|
||||
}
|
||||
|
||||
res.json({ status: 'processed' });
|
||||
} catch (error) {
|
||||
console.error('Webhook error:', error);
|
||||
res.status(500).json({ error: 'Webhook processing failed' });
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Plugin Directory server running on port ${port}`);
|
||||
console.log(`Webhook endpoint: http://litruv-sub:${port}/webhook`);
|
||||
console.log(`Plugin list: http://litruv-sub:${port}/plugins`);
|
||||
});
|
||||
Reference in New Issue
Block a user