Simplified: Use git-based directory with Gitea Actions instead of server

This commit is contained in:
2026-04-17 02:01:51 +10:00
parent bd535138d6
commit 42a1712175
7 changed files with 1194 additions and 143 deletions

View File

@@ -1,9 +1,13 @@
import crypto from 'crypto';
import fetch from 'node-fetch';
import { readdir, readFile } from 'fs/promises';
import { join } from 'path';
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
*/
@@ -205,7 +209,7 @@ export class WebhookHandler {
* List all plugins from the plugins directory
*/
async listPlugins() {
const pluginsDir = './plugins';
const pluginsDir = resolve(__dirname, '../plugins');
const files = await readdir(pluginsDir);
const plugins = [];
@@ -228,7 +232,7 @@ export class WebhookHandler {
* Get a specific plugin
*/
async getPlugin(pluginId) {
const pluginsDir = './plugins';
const pluginsDir = resolve(__dirname, '../plugins');
const filePath = join(pluginsDir, `${pluginId}.json`);
try {

View File

@@ -81,6 +81,6 @@ app.post('/webhook', async (req, res) => {
app.listen(port, () => {
console.log(`Plugin Directory server running on port ${port}`);
console.log(`Webhook endpoint: http://localhost:${port}/webhook`);
console.log(`Plugin list: http://localhost:${port}/plugins`);
console.log(`Webhook endpoint: http://litruv-sub:${port}/webhook`);
console.log(`Plugin list: http://litruv-sub:${port}/plugins`);
});