// SPDX-FileCopyrightText: 2026 MOD Audio UG // SPDX-License-Identifier: AGPL-3.0-or-later /* * "Report a problem" * * Collects what the Web UI knows about this device and the current session * into a block of text, and points the user at the forum topic for the * running release so they can paste it there as a reply. * * Nothing is sent anywhere by itself: the user copies the text and posts it. * The device serial and full logs are deliberately not included; QA can ask for * them in the thread. On a computer (MOD Desktop) the system information * answers with a "host" block: operating system, CPU, memory, audio setup and * the problem lines of the launcher log, with the home folder shortened to ~. * * Used by index.html (with pedalboard and DSP stats) and settings.html * (system details only). */ function ProblemReport(options) { var self = this options = $.extend({ version: '', // OS version string as shown in Settings feedbackUrl: '', // forum topic (or category) for this release getPedalboard: null, // function () -> { title: '', plugins: [uri, ...] } or null getStats: null, // function () -> { xruns: n, cpuLoad: n } or null }, options) this.window = null this.textarea = null var TEMPLATE = [ '**What happened**', '', '', '**Steps to reproduce**', '1. ', '', '**Expected**', '', '', ].join('\n') this.build = function () { if (self.window) { return } var win = $('
') var box = $('
').appendTo(win) box.append('

Report a problem

×') box.append('
') box.append('

Describe the problem in the text below, then copy it and paste it as a reply in the forum topic for this release. ' + 'The system details are filled in for you.

') self.textarea = $('').appendTo(box) var actions = $('
').appendTo(box) actions.append('Copied to clipboard ') actions.append(' ') actions.append('Open the forum topic ') actions.append('') win.find('#report-open-forum').attr('href', options.feedbackUrl) win.find('.js-cancel').click(function () { self.close() return false }) win.find('#report-copy').click(function () { self.copy() return false }) $('body').keydown(function (e) { if (e.keyCode == 27) { self.close() } }) $('body').append(win) self.window = win } this.open = function () { self.build() self.textarea.val(TEMPLATE + '\n\nCollecting system details...') self.window.show() $.ajax({ url: '/system/info', method: 'GET', cache: false, global: false, dataType: 'json', success: function (info) { self.textarea.val(TEMPLATE + '\n' + self.render(info)) }, error: function () { self.textarea.val(TEMPLATE + '\n' + self.render(null)) }, }) } this.close = function () { if (self.window) { self.window.hide() } } this.copy = function () { self.textarea.select() var ok try { ok = document.execCommand('copy') } catch (err) { ok = false } var note = self.window.find('#report-copied') note.text(ok ? 'Copied to clipboard' : 'Press Ctrl/Cmd + C to copy').show() setTimeout(function () { note.hide() }, 2500) } function formatUptime(seconds) { if (seconds === null || seconds === undefined) { return 'unknown' } var h = Math.floor(seconds / 3600) var m = Math.floor((seconds % 3600) / 60) return h + 'h ' + m + 'm' } this.render = function (info) { info = info || {} var lines = [] lines.push('```') var host = info.host || null lines.push('MOD release: ' + (info.release || options.version || 'unknown') + (info.sysdate && info.sysdate !== 'Unknown' ? ' (built ' + info.sysdate + ')' : '')) if (host) { // a computer: describe the computer, not a device lines.push('Product: ' + (info.model || 'MOD Desktop') + ' / ' + (info.bin_compat || '?')) lines.push('Computer OS: ' + (host.os || 'unknown')) lines.push('CPU: ' + (host.cpu || 'unknown')) lines.push('Memory: ' + (host.memory_gb ? host.memory_gb + ' GB' : 'unknown')) lines.push('Up for: ' + formatUptime(host.uptime)) lines.push('Audio engine: ' + (host.sample_rate ? Math.round(host.sample_rate) + ' Hz' : '? Hz') + ', buffer ' + (host.buffer_size || '?') + ' frames') var launcher = host.launcher || null if (launcher && launcher.jackd) { lines.push('Audio start: ' + launcher.jackd) } else { lines.push('Audio start: unknown (no launcher log found)') } } else { lines.push('Device: ' + (info.hwname || 'unknown') + ' / ' + (info.platform || '?') + ' / ' + (info.bin_compat || '?') + (info.model ? ' / ' + info.model : '')) lines.push('Controller fw: ' + (info.controller || 'unknown')) if (info.uname) { lines.push('Kernel: ' + info.uname.release) } lines.push('Uptime: ' + formatUptime(info.uptime)) } var stats = options.getStats ? options.getStats() : null if (stats) { lines.push('Xruns: ' + (stats.xruns === null ? 'unknown' : stats.xruns) + ' DSP load: ' + (stats.cpuLoad === null ? 'unknown' : stats.cpuLoad + '%')) } var pb = options.getPedalboard ? options.getPedalboard() : null if (pb) { lines.push('Pedalboard: "' + pb.title + '" (' + pb.plugins.length + ' plugins)') for (var i = 0; i < pb.plugins.length; i++) { lines.push(' - ' + pb.plugins[i]) } } lines.push('Web UI at: ' + window.location.host) lines.push('Browser: ' + navigator.userAgent) lines.push('```') if (host && host.launcher && host.launcher.problems && host.launcher.problems.length) { lines.push('') lines.push('Launcher log, lines about problems since the last start (' + host.launcher.path + '):') lines.push('```') lines = lines.concat(host.launcher.problems) lines.push('```') } return lines.join('\n') } }