Merge remote-tracking branch 'origin/main'

This commit is contained in:
Nevo David 2025-09-20 15:26:13 +07:00
commit ec69b689c5
9 changed files with 576 additions and 472 deletions

View File

@ -6,6 +6,16 @@ const nextConfig = {
experimental: {
proxyTimeout: 90_000,
},
// Document-Policy header for browser profiling
async headers() {
return [{
source: "/:path*",
headers: [{
key: "Document-Policy",
value: "js-profiling",
}, ],
}, ];
},
reactStrictMode: false,
transpilePackages: ['crypto-hash'],
// Enable production sourcemaps for Sentry
@ -60,7 +70,7 @@ export default withSentryConfig(nextConfig, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
// Sourcemap configuration optimized for monorepo
sourcemaps: {
disable: false,
@ -68,7 +78,7 @@ export default withSentryConfig(nextConfig, {
assets: [
".next/static/**/*.js",
".next/static/**/*.js.map",
".next/server/**/*.js",
".next/server/**/*.js",
".next/server/**/*.js.map",
],
ignore: [
@ -97,7 +107,7 @@ export default withSentryConfig(nextConfig, {
telemetry: false,
silent: process.env.NODE_ENV === 'production',
debug: process.env.NODE_ENV === 'development',
// Error handling for CI/CD
errorHandler: (error) => {
console.warn("Sentry build error occurred:", error.message);

View File

@ -1,4 +1,4 @@
'use client';
'use client';
import React, { ReactNode, useCallback } from 'react';
import { Logo } from '@gitroom/frontend/components/new-layout/logo';
@ -24,7 +24,6 @@ import { MediaSettingsLayout } from '@gitroom/frontend/components/launches/helpe
import { Toaster } from '@gitroom/react/toaster/toaster';
import { ShowPostSelector } from '@gitroom/frontend/components/post-url-selector/post.url.selector';
import { NewSubscription } from '@gitroom/frontend/components/layout/new.subscription';
import { Onboarding } from '@gitroom/frontend/components/onboarding/onboarding';
import { Support } from '@gitroom/frontend/components/layout/support';
import { ContinueProvider } from '@gitroom/frontend/components/layout/continue.provider';
import { ContextWrapper } from '@gitroom/frontend/components/layout/user.context';
@ -39,6 +38,7 @@ import NotificationComponent from '@gitroom/frontend/components/notifications/no
import { BillingAfter } from '@gitroom/frontend/components/new-layout/billing.after';
import { OrganizationSelector } from '@gitroom/frontend/components/layout/organization.selector';
import { PreConditionComponent } from '@gitroom/frontend/components/layout/pre-condition.component';
import { AttachToFeedbackIcon } from '@gitroom/frontend/components/new-layout/sentry.feedback.component';
const jakartaSans = Plus_Jakarta_Sans({
weight: ['600', '500'],
@ -50,6 +50,8 @@ export const LayoutComponent = ({ children }: { children: ReactNode }) => {
const fetch = useFetch();
const { backendUrl, billingEnabled, isGeneral } = useVariables();
// Feedback icon component attaches Sentry feedback to a top-bar icon when DSN is present
const searchParams = useSearchParams();
const load = useCallback(async (path: string) => {
return await (await fetch(path)).json();
@ -118,6 +120,7 @@ export const LayoutComponent = ({ children }: { children: ReactNode }) => {
<LanguageComponent />
<ChromeExtensionComponent />
<div className="w-[1px] h-[20px] bg-blockSeparator" />
<AttachToFeedbackIcon />
<NotificationComponent />
</div>
</div>

View File

@ -0,0 +1,53 @@
'use client';
import { FC, useEffect, useRef, useState } from 'react';
import * as Sentry from '@sentry/nextjs';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export const AttachToFeedbackIcon: FC = () => {
const { sentryDsn } = useVariables();
const [feedback, setFeedback] = useState<any>();
const buttonRef = useRef<HTMLButtonElement | null>(null);
useEffect(() => {
if (!sentryDsn) return;
try {
const fb = (Sentry as any).getFeedback?.();
setFeedback(fb);
} catch (e) {
setFeedback(undefined);
}
}, [sentryDsn]);
useEffect(() => {
if (feedback && buttonRef.current) {
const unsubscribe = feedback.attachTo(buttonRef.current);
return unsubscribe;
}
return () => {};
}, [feedback]);
if (!sentryDsn) return null;
return (
<button
ref={buttonRef}
type="button"
aria-label="Feedback"
className="hover:text-newTextColor"
>
<svg
width="24"
height="24"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M27 10H23V6C23 5.46957 22.7893 4.96086 22.4142 4.58579C22.0391 4.21071 21.5304 4 21 4H5C4.46957 4 3.96086 4.21071 3.58579 4.58579C3.21071 4.96086 3 5.46957 3 6V22C3.00059 22.1881 3.05423 22.3723 3.15478 22.5313C3.25532 22.6903 3.39868 22.8177 3.56839 22.8989C3.7381 22.9801 3.92728 23.0118 4.11418 22.9903C4.30108 22.9689 4.47814 22.8951 4.625 22.7775L9 19.25V23C9 23.5304 9.21071 24.0391 9.58579 24.4142C9.96086 24.7893 10.4696 25 11 25H22.6987L27.375 28.7775C27.5519 28.9206 27.7724 28.9991 28 29C28.2652 29 28.5196 28.8946 28.7071 28.7071C28.8946 28.5196 29 28.2652 29 28V12C29 11.4696 28.7893 10.9609 28.4142 10.5858C28.0391 10.2107 27.5304 10 27 10ZM8.31875 17.2225L5 19.9062V6H21V17H8.9475C8.71863 17 8.4967 17.0786 8.31875 17.2225ZM27 25.9062L23.6812 23.2225C23.5043 23.0794 23.2838 23.0009 23.0562 23H11V19H21C21.5304 19 22.0391 18.7893 22.4142 18.4142C22.7893 18.0391 23 17.5304 23 17V12H27V25.9062Z"
fill="currentColor"
/>
</svg>
</button>
);
};

View File

@ -1,11 +1,11 @@
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { MainMcp } from '@gitroom/backend/mcp/main.mcp';
import { socialIntegrationList } from '@gitroom/nestjs-libraries/integrations/integration.manager';
import * as Sentry from '@sentry/nestjs';
export class McpSettings {
private _server: McpServer;
createServer(organization: string, service: MainMcp) {
this._server = new McpServer(
this._server = Sentry.wrapMcpServerWithSentry(new McpServer(
{
name: 'Postiz',
version: '2.0.0',
@ -17,7 +17,7 @@ export class McpSettings {
', '
)} to schedule you need to have the providerId (you can get it from POSTIZ_PROVIDERS_LIST), user need to specify the schedule date (or now), text, you also can send base64 images and text for the comments. When you get POSTIZ_PROVIDERS_LIST, always display all the options to the user`,
}
);
));
for (const usePrompt of Reflect.getMetadata(
'MCP_PROMPT',

View File

@ -26,12 +26,16 @@ export const initializeSentry = (appName: string, allowLogs = false) => {
// Add our Profiling integration
nodeProfilingIntegration(),
Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] }),
Sentry.openAIIntegration({
recordInputs: true,
recordOutputs: true,
}),
],
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.25,
enableLogs: true,
// Profiling
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.45,
profileLifecycle: 'trace',
});
} catch (err) {

View File

@ -6,6 +6,7 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
integrations: [
// Add default integrations back
Sentry.browserTracingIntegration(),
Sentry.browserProfilingIntegration(),
Sentry.replayIntegration({
maskAllText: true,
maskAllInputs: true,
@ -17,4 +18,6 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
],
replaysSessionSampleRate: environment === 'development' ? 1.0 : 0.5,
replaysOnErrorSampleRate: 1.0,
profilesSampleRate: environment === 'development' ? 1.0 : 0.45,
});

View File

@ -26,6 +26,26 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
...extension,
debug: environment === 'development',
tracesSampleRate: environment === 'development' ? 1.0 : 0.3,
// Filtert Events und zeigt das User-Feedback-Modal an
beforeSend(event, hint) {
if (event.exception && event.exception.values) {
for (const exception of event.exception.values) {
// Filtert "Failed to fetch" Fehler heraus
if (exception.value && /Failed to fetch/.test(exception.value)) {
return null; // Verwirft den Event
}
}
}
// Wenn der Event eine Ausnahme ist und nicht gefiltert wurde,
// wird das User-Feedback-Modal angezeigt
if (event.exception && event.event_id) {
Sentry.showReportDialog({ eventId: event.event_id });
}
return event; // Sendet den Event an Sentry
},
});
} catch (err) {}
};

View File

@ -73,9 +73,9 @@
"@neynar/react": "^0.9.7",
"@postiz/wallets": "^0.0.1",
"@prisma/client": "^6.5.0",
"@sentry/nestjs": "^9.43.0",
"@sentry/nextjs": "^9.43.0",
"@sentry/profiling-node": "^9.43.0",
"@sentry/nestjs": "^10.12.0",
"@sentry/nextjs": "^10.12.0",
"@sentry/profiling-node": "^10.12.0",
"@solana/wallet-adapter-react": "^0.15.35",
"@solana/wallet-adapter-react-ui": "^0.9.35",
"@swc/helpers": "0.5.13",

File diff suppressed because it is too large Load Diff