refactor(packages): consolidate 3 feedback packages into @manacore/feedback

Merged shared-feedback-types + shared-feedback-service + shared-feedback-ui
into a single @manacore/feedback package. Updated imports in all 21 apps.

Before: 3 packages (types, service, ui) with cross-dependencies
After:  1 package with direct imports, no circular refs

Note: ESLint warnings from pre-existing unused vars in chat/mukke
servers are unrelated to this change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-28 16:27:11 +01:00
parent bf4d9cb9aa
commit 1aeb987cb6
78 changed files with 617 additions and 317 deletions

View file

@ -0,0 +1,18 @@
{
"name": "@mukke/server",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "bun run --watch src/index.ts",
"start": "bun run src/index.ts"
},
"dependencies": {
"@manacore/shared-hono": "workspace:*",
"@manacore/shared-storage": "workspace:*",
"hono": "^4.7.0"
},
"devDependencies": {
"typescript": "^5.9.3"
}
}

View file

@ -0,0 +1,110 @@
/**
* Mukke Hono Server Audio upload, metadata, presigned URLs
*
* CRUD for songs/playlists/projects handled by mana-sync.
* This server handles S3 operations and metadata extraction.
*/
import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { authMiddleware, healthRoute, errorHandler, notFoundHandler } from '@manacore/shared-hono';
const PORT = parseInt(process.env.PORT || '3010', 10);
const S3_ENDPOINT = process.env.S3_ENDPOINT || 'http://localhost:9000';
const S3_BUCKET = process.env.S3_BUCKET || 'mukke-storage';
const S3_ACCESS_KEY = process.env.S3_ACCESS_KEY || 'minioadmin';
const S3_SECRET_KEY = process.env.S3_SECRET_KEY || 'minioadmin';
const CORS_ORIGINS = (process.env.CORS_ORIGINS || 'http://localhost:5180').split(',');
const app = new Hono();
app.onError(errorHandler);
app.notFound(notFoundHandler);
app.use('*', cors({ origin: CORS_ORIGINS, credentials: true }));
app.route('/health', healthRoute('mukke-server'));
app.use('/api/*', authMiddleware());
// ─── Song Upload (server-only: S3 presigned URL) ────────────
app.post('/api/v1/songs/upload', async (c) => {
const userId = c.get('userId');
const { filename } = await c.req.json();
if (!filename) return c.json({ error: 'filename required' }, 400);
const songId = crypto.randomUUID();
const key = `users/${userId}/songs/${songId}/${filename}`;
// Generate presigned upload URL
try {
const { createMukkeStorage, generateUserFileKey } = await import('@manacore/shared-storage');
const storage = createMukkeStorage();
const uploadUrl = await storage.getUploadUrl(key, { expiresIn: 3600 });
return c.json({
song: { id: songId, title: filename.replace(/\.[^/.]+$/, ''), storagePath: key },
uploadUrl,
});
} catch (_err) {
return c.json({ error: 'Failed to generate upload URL' }, 500);
}
});
// ─── Download URL (server-only: S3 presigned URL) ────────────
app.get('/api/v1/songs/:id/download-url', async (c) => {
const { storagePath } = c.req.query();
if (!storagePath) return c.json({ error: 'storagePath required' }, 400);
try {
const { createMukkeStorage } = await import('@manacore/shared-storage');
const storage = createMukkeStorage();
const url = await storage.getDownloadUrl(storagePath, { expiresIn: 3600 });
return c.json({ url });
} catch (_err) {
return c.json({ error: 'Failed to generate download URL' }, 500);
}
});
// ─── Cover Art URL (server-only: S3 presigned URL) ───────────
app.get('/api/v1/songs/:id/cover-url', async (c) => {
const { coverArtPath } = c.req.query();
if (!coverArtPath) return c.json({ url: null });
try {
const { createMukkeStorage } = await import('@manacore/shared-storage');
const storage = createMukkeStorage();
const url = await storage.getDownloadUrl(coverArtPath, { expiresIn: 3600 });
return c.json({ url });
} catch (_err) {
return c.json({ url: null });
}
});
// ─── Batch Cover URLs ────────────────────────────────────────
app.post('/api/v1/library/cover-urls', async (c) => {
const { paths } = await c.req.json();
if (!paths?.length) return c.json({ urls: {} });
try {
const { createMukkeStorage } = await import('@manacore/shared-storage');
const storage = createMukkeStorage();
const urls: Record<string, string> = {};
for (const path of paths.slice(0, 50)) {
try {
urls[path] = await storage.getDownloadUrl(path, { expiresIn: 3600 });
} catch {
// Skip failed URLs
}
}
return c.json({ urls });
} catch (_err) {
return c.json({ urls: {} });
}
});
export default { port: PORT, fetch: app.fetch };

View file

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts"]
}

View file

@ -42,8 +42,7 @@
"@manacore/local-store": "workspace:*",
"@manacore/shared-branding": "workspace:*",
"@manacore/shared-error-tracking": "workspace:*",
"@manacore/shared-feedback-service": "workspace:^",
"@manacore/shared-feedback-ui": "workspace:^",
"@manacore/feedback": "workspace:^",
"@manacore/shared-i18n": "workspace:*",
"@manacore/shared-help-types": "workspace:*",
"@manacore/shared-help-ui": "workspace:*",

View file

@ -1,5 +1,5 @@
import { browser } from '$app/environment';
import { createFeedbackService } from '@manacore/shared-feedback-service';
import { createFeedbackService } from '@manacore/feedback';
import { authStore } from '$lib/stores/auth.svelte';
function getAuthUrl(): string {

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { FeedbackPage } from '@manacore/shared-feedback-ui';
import { FeedbackPage } from '@manacore/feedback';
import { feedbackService } from '$lib/services/feedback';
import { authStore } from '$lib/stores/auth.svelte';
</script>