Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions donation-replay.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ window.replayDonation = (amount = '$25', username = 'GenerousDonor', message = '
timestamp: new Date().toISOString()
};

// Create the pusher event structure
const pusherEvent = {
event: 'App\\Events\\DonationEvent', // Using generic donation event
data: JSON.stringify(donationEventData),
channel: 'chatrooms.69188411' // Your current chatroom
};

console.log('📤 Dispatching donation event:', donationEventData);

// Dispatch the event through the SharedKickPusher
Expand Down Expand Up @@ -65,12 +58,6 @@ window.replayGiftSub = (gifterUsername = 'GiftMaster', recipientUsername = 'Luck
gifter_total: total
};

const pusherEvent = {
event: 'App\\Events\\GiftedSubscriptionsEvent',
data: JSON.stringify(giftSubEventData),
channel: 'chatrooms.69188411'
};

console.log('📤 Dispatching gift subscription event:', giftSubEventData);

try {
Expand Down
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ module.exports = [
react: { version: "detect" },
},
rules: {
// Keep defaults; enable stricter rules later as desired.
// Essential React rules to properly detect JSX usage
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
},
},
];
21 changes: 11 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions scripts/event-collection/event-analyzer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const readline = require('readline');

/**
Expand Down Expand Up @@ -68,7 +67,7 @@ class KickEventAnalyzer {
console.log(` Processed ${processedCount} events...`);
}

} catch (error) {
} catch (_error) {
console.warn('Skipping malformed line:', line.substring(0, 100));
}
}
Expand Down
5 changes: 2 additions & 3 deletions scripts/event-collection/event-collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const WebSocket = require('ws');
const https = require('https');
const fs = require('fs');
const path = require('path');

/**
* Kick Event Collector
Expand Down Expand Up @@ -129,7 +128,7 @@ class KickEventCollector {
console.log(`Loaded ${this.channelData.size} IDs to monitor`);

// Print the IDs we'll monitor
for (const [slug, data] of this.channelData) {
for (const [, data] of this.channelData) {
console.log(`✓ ID ${data.id} - will try both streamer and chatroom patterns`);
}
console.log('');
Expand Down Expand Up @@ -214,7 +213,7 @@ class KickEventCollector {

// For each ID, subscribe to both streamer channel patterns AND chatroom patterns
// since we don't know which type each ID is
for (const [slug, data] of this.channelData) {
for (const [, data] of this.channelData) {
const channels = [
// Streamer channel patterns (in case this ID is a streamer ID)
`channel_${data.id}`,
Expand Down
138 changes: 87 additions & 51 deletions scripts/test-telemetry-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,81 +13,115 @@ const Store = require('electron-store');
// Test configuration
const store = new Store();

async function testTelemetryDisabled() {
console.log('\n=== TEST 1: Telemetry DISABLED ===');

// Disable telemetry
store.set('telemetry', { enabled: false });
console.log('✓ Set telemetry.enabled = false');

// Start the app and capture logs
console.log('Starting app with telemetry disabled...');
const proc = spawn('npm', ['run', 'dev'], {
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const RUNTIME_WAIT_MS = Number(process.env.TELEMETRY_TEST_RUNTIME_MS || 5000);
const SHUTDOWN_TIMEOUT_MS = Number(process.env.TELEMETRY_TEST_SHUTDOWN_TIMEOUT_MS || 2000);
const SKIP_RUNTIME_TESTS = process.env.SKIP_TELEMETRY_RUNTIME === '1';
const originalTelemetrySetting = store.get('telemetry');

function restoreTelemetrySetting() {
if (typeof originalTelemetrySetting === 'undefined') {
store.delete('telemetry');
console.log('\nRestored telemetry setting: deleted (was undefined)');
} else {
store.set('telemetry', originalTelemetrySetting);
console.log(`\nRestored telemetry.enabled = ${originalTelemetrySetting?.enabled}`);
}
}

async function runAppAndCollectLogs(label) {
console.log(`Starting app with telemetry ${label}...`);

const proc = spawn(npmCommand, ['run', 'dev'], {
cwd: path.join(__dirname, '..'),
env: { ...process.env, ELECTRON_ENABLE_LOGGING: '1' },
stdio: 'pipe'
});

let logs = '';
proc.stdout.on('data', (data) => logs += data.toString());
proc.stderr.on('data', (data) => logs += data.toString());

// Wait 5 seconds then kill
await new Promise(resolve => setTimeout(resolve, 5000));
proc.kill();

// Check logs for telemetry behavior
let spawnError;

proc.stdout.on('data', (data) => {
logs += data.toString();
});
proc.stderr.on('data', (data) => {
logs += data.toString();
});
proc.on('error', (err) => {
spawnError = err;
});

await new Promise((resolve) => setTimeout(resolve, RUNTIME_WAIT_MS));
proc.kill('SIGTERM');

await new Promise((resolve) => {
const fallback = setTimeout(() => {
if (proc.exitCode === null) {
proc.kill('SIGKILL');
}
resolve();
}, SHUTDOWN_TIMEOUT_MS);

proc.once('close', () => {
clearTimeout(fallback);
resolve();
});
});

if (spawnError) {
throw spawnError;
}

return logs;
}

async function testTelemetryDisabled() {
console.log('\n=== TEST 1: Telemetry DISABLED ===');

store.set('telemetry', { enabled: false });
console.log('✓ Set telemetry.enabled = false');

const logs = await runAppAndCollectLogs('disabled');

const checks = {
'Telemetry disabled by user settings': logs.includes('Telemetry disabled by user settings'),
'SDK not initialized': logs.includes('skipping initialization') || logs.includes('SDK creation skipped'),
'No OTLP connection': !logs.includes('OTLP') || !logs.includes('exporter'),
'No spans created': !logs.includes('span started') && !logs.includes('websocket.connect')
};

console.log('\nResults:');
for (const [check, passed] of Object.entries(checks)) {
console.log(` ${passed ? '✓' : '✗'} ${check}`);
}
return Object.values(checks).every(v => v);

return Object.values(checks).every(Boolean);
}

async function testTelemetryEnabled() {
console.log('\n=== TEST 2: Telemetry ENABLED ===');

// Enable telemetry

store.set('telemetry', { enabled: true });
console.log('✓ Set telemetry.enabled = true');

// Start the app and capture logs
console.log('Starting app with telemetry enabled...');
const proc = spawn('npm', ['run', 'dev'], {
env: { ...process.env, ELECTRON_ENABLE_LOGGING: '1' },
stdio: 'pipe'
});

let logs = '';
proc.stdout.on('data', (data) => logs += data.toString());
proc.stderr.on('data', (data) => logs += data.toString());

// Wait 5 seconds then kill
await new Promise(resolve => setTimeout(resolve, 5000));
proc.kill();

// Check logs for telemetry behavior

const logs = await runAppAndCollectLogs('enabled');

const checks = {
'SDK initialized': logs.includes('NodeSDK') || logs.includes('Web tracer initialized'),
'OTLP configured': logs.includes('OTLP') || logs.includes('exporter'),
'Instrumentation active': logs.includes('instrumentation') || logs.includes('WebSocket instrumentation installed')
};

console.log('\nResults:');
for (const [check, passed] of Object.entries(checks)) {
console.log(` ${passed ? '✓' : '✗'} ${check}`);
}
return Object.values(checks).every(v => v);

return Object.values(checks).every(Boolean);
}



async function testIPCHandlers() {
console.log('\n=== TEST 3: IPC Handlers Check Settings ===');

Expand Down Expand Up @@ -122,8 +156,12 @@ async function runAllTests() {

try {
// Note: These tests require the app to be built
// results.push(await testTelemetryDisabled());
// results.push(await testTelemetryEnabled());
if (SKIP_RUNTIME_TESTS) {
console.log('\n[warning] Skipping runtime telemetry tests (set SKIP_TELEMETRY_RUNTIME=1 to suppress this warning intentionally).');
} else {
results.push(await testTelemetryDisabled());
results.push(await testTelemetryEnabled());
}
results.push(await testIPCHandlers());

console.log('\n' + '='.repeat(50));
Expand All @@ -141,13 +179,11 @@ async function runAllTests() {
console.log('\n✗ Some tests failed. Review the implementation.');
}

// Restore original setting
const originalSetting = store.get('telemetry', { enabled: false });
console.log(`\nRestored telemetry.enabled = ${originalSetting.enabled}`);

} catch (error) {
console.error('Test error:', error);
process.exit(1);
process.exitCode = 1;
} finally {
restoreTelemetrySetting();
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const genRequestId = () => {
};

// Initialize telemetry early if enabled
let initTelemetry = null;
let shutdownTelemetry = null;
let isTelemetryEnabled = () => false; // Default fallback

Expand Down Expand Up @@ -2196,7 +2195,7 @@ const findStreamlink = () => {
if (result.status === 0) {
return path;
}
} catch (pathError) {
} catch (_pathError) {
// Command not found in PATH, continue
continue;
}
Expand All @@ -2206,7 +2205,7 @@ const findStreamlink = () => {
return path;
}
}
} catch (error) {
} catch (_error) {
// Continue checking other paths
continue;
}
Expand Down
5 changes: 1 addition & 4 deletions src/preload/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contextBridge, ipcRenderer, shell, session } from "electron";
import { contextBridge, ipcRenderer, shell } from "electron";
import { electronAPI } from "@electron-toolkit/preload";
import {
sendMessageToChannel,
Expand All @@ -10,7 +10,6 @@ import {
getUserChatroomInfo,
getSelfChatroomInfo,
getSilencedUsers,
getLinkThumbnail,
getInitialChatroomMessages,
getInitialPollInfo,
getSubmitPollVote,
Expand All @@ -32,8 +31,6 @@ import {

// Kick Auth for Events
getKickAuthForEvents,
getUpdateTitle,
getClearChatroom,
} from "../../utils/services/kick/kickAPI";
import { getUserStvProfile, getChannelEmotes } from "../../utils/services/seventv/stvAPI";

Expand Down
2 changes: 0 additions & 2 deletions src/renderer/src/components/Chat/Input/EmoteDialogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import STVLogo from "../../../assets/logos/stvLogo.svg?asset";
import { CaretDownIcon, GlobeIcon, LockIcon, UserIcon } from "@phosphor-icons/react";
import useClickOutside from "../../../utils/useClickOutside";
import KickLogoIcon from "../../../assets/logos/kickLogoIcon.svg?asset";
import useChatStore from "../../../providers/ChatProvider";
import { useShallow } from "zustand/react/shallow";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../Shared/Tooltip";
import { useAccessibleKickEmotes } from "./useAccessibleKickEmotes";
import { useAllStvEmotes } from "../hooks/useAllStvEmotes";
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/Chat/Input/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ const ReplyCapture = ({ chatroomId, setReplyData, chatInputRef }) => {
has_sender: !!data.sender
});
}
} catch (e) {
} catch (_e) {
// Telemetry recording failed, but don't break the flow
}
})();
Expand Down
Loading
Loading