This commit is contained in:
jahruz67
2026-03-26 09:56:19 -07:00
commit 2d36041f6a
50 changed files with 6563 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#logo {
display: block;
width: 50%;
height: 50%;
margin: auto;
padding: 10% 0 0;
background-position: center;
background-repeat: no-repeat;
background-size: 100% 100%;
background-origin: content-box;
}
.result {
height: 20px;
line-height: 20px;
margin: 1.5rem auto;
}
.input-box .btn {
width: 60px;
height: 30px;
line-height: 30px;
border-radius: 3px;
border: none;
margin: 0 0 0 20px;
padding: 0 8px;
cursor: pointer;
}
.input-box .btn:hover {
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
color: #333333;
}
.input-box .input {
border: none;
border-radius: 3px;
outline: none;
height: 30px;
line-height: 30px;
padding: 0 10px;
background-color: rgba(240, 240, 240, 1);
-webkit-font-smoothing: antialiased;
}
.input-box .input:hover {
border: none;
background-color: rgba(255, 255, 255, 1);
}
.input-box .input:focus {
border: none;
background-color: rgba(255, 255, 255, 1);
}
+93
View File
@@ -0,0 +1,93 @@
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

+252
View File
@@ -0,0 +1,252 @@
// Main JavaScript for Settings UI
// Global state
let currentSettings = {};
let apiKeyVisible = true;
// Initialize
document.addEventListener('DOMContentLoaded', async () => {
await loadSettings();
await loadMicrophones();
// Show form after loading
document.getElementById('loadingIndicator').style.display = 'none';
document.getElementById('settingsForm').style.display = 'block';
});
// Load settings from backend
async function loadSettings() {
try {
const settings = await window.go.main.App.GetSettings();
currentSettings = settings;
console.log("Loaded settings:", settings);
// Populate fields
document.getElementById('apiKey').value = settings.api_key || '';
document.getElementById('shortcutInput').value = settings.shortcut || 'alt+z';
document.getElementById('whisperModel').value = settings.whisper_model || 'whisper-large-v3-turbo';
document.getElementById('aiModel').value = settings.ai_model || 'llama-3.3-70b-versatile';
document.getElementById('aiPrompt').value = settings.ai_prompt || '';
document.getElementById('startupToggle').checked = settings.startup || false;
// Load history
renderHistory(settings.history || []);
} catch (err) {
console.error("Failed to load settings:", err);
alert("Failed to load settings: " + err);
}
}
// Load microphones
async function loadMicrophones() {
try {
const mics = await window.go.main.App.GetMicrophones();
const select = document.getElementById('micDevice');
// Keep default option
select.innerHTML = '<option value="default">System Default</option>';
mics.forEach(mic => {
if (mic.index !== -1) {
const option = document.createElement('option');
option.value = mic.index;
option.textContent = mic.name;
select.appendChild(option);
}
});
// Set current selection
if (currentSettings.microphone_device !== null && currentSettings.microphone_device !== undefined) {
select.value = currentSettings.microphone_device;
} else {
select.value = "default";
}
} catch (err) {
console.error("Failed to load microphones:", err);
}
}
// Render history list
function renderHistory(history) {
const container = document.getElementById('historyList');
container.innerHTML = '';
if (!history || history.length === 0) {
container.innerHTML = '<div style="text-align: center; color: var(--text-muted); padding: 20px;">No history yet. Use your shortcut to start recording!</div>';
return;
}
// Show newest first
const sorted = [...history].reverse();
sorted.forEach(item => {
const el = document.createElement('div');
el.className = 'history-item';
const time = new Date(item.timestamp).toLocaleString();
el.innerHTML = `
<div class="history-time">${time}</div>
<div style="white-space: pre-wrap;">${escapeHtml(item.text)}</div>
`;
container.appendChild(el);
});
}
// Toggle API key visibility
function toggleApiKeyVisibility() {
const input = document.getElementById('apiKey');
const btn = document.getElementById('toggleKeyBtn');
if (apiKeyVisible) {
input.type = 'password';
btn.textContent = 'Show';
apiKeyVisible = false;
} else {
input.type = 'text';
btn.textContent = 'Hide';
apiKeyVisible = true;
}
}
// Save API Key
async function saveApiKey() {
const key = document.getElementById('apiKey').value.trim();
if (!key) {
alert('Please enter an API key');
return;
}
await saveSetting('api_key', key);
showToast('API Key saved');
}
// Save Shortcut
async function saveShortcut() {
const shortcut = document.getElementById('shortcutInput').value.trim().toLowerCase();
if (!shortcut) {
alert('Please enter a shortcut');
return;
}
const parts = shortcut.split('+');
if (parts.length < 2) {
alert('Shortcut must have a modifier + key (e.g., ctrl+x)');
return;
}
await saveSetting('shortcut', shortcut);
showToast('Shortcut saved: ' + shortcut);
}
// Save Whisper Model
async function saveWhisperModel() {
const model = document.getElementById('whisperModel').value;
await saveSetting('whisper_model', model);
showToast('Whisper model saved');
}
// Save AI Model
async function saveAiModel() {
const model = document.getElementById('aiModel').value;
await saveSetting('ai_model', model);
showToast('AI model saved');
}
// Save Microphone
async function saveMicDevice() {
const val = document.getElementById('micDevice').value;
let device = null;
if (val !== "default") {
device = parseInt(val);
}
await saveSetting('microphone_device', device);
showToast('Microphone saved');
}
// Save Prompt
async function savePrompt() {
const prompt = document.getElementById('aiPrompt').value.trim();
await saveSetting('ai_prompt', prompt);
showToast('Prompt saved');
}
// Toggle Startup
async function toggleStartup() {
const enabled = document.getElementById('startupToggle').checked;
try {
const result = await window.go.main.App.ToggleStartup(enabled);
if (result !== "Success") {
alert("Failed to update startup: " + result);
document.getElementById('startupToggle').checked = !enabled;
}
} catch (err) {
console.error("Failed to toggle startup:", err);
}
}
// Clear History
async function clearHistory() {
if (confirm("Are you sure you want to clear all history?")) {
await window.go.main.App.ClearHistory();
renderHistory([]);
}
}
// Helper to save a single setting
async function saveSetting(key, value) {
try {
const settings = {};
settings[key] = value;
const result = await window.go.main.App.SaveSettings(settings);
currentSettings[key] = value;
return result;
} catch (err) {
console.error(`Failed to save ${key}:`, err);
alert(`Failed to save setting: ${err}`);
}
}
// Helper to escape HTML
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
// Toast notification
function showToast(msg) {
console.log(msg);
// Create toast element
let toast = document.getElementById('toast');
if (!toast) {
toast = document.createElement('div');
toast.id = 'toast';
toast.style.cssText = `
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: var(--primary);
color: white;
padding: 12px 24px;
border-radius: 8px;
font-weight: 500;
z-index: 1000;
opacity: 0;
transition: opacity 0.3s;
`;
document.body.appendChild(toast);
}
toast.textContent = msg;
toast.style.opacity = '1';
setTimeout(() => {
toast.style.opacity = '0';
}, 2000);
}
+252
View File
@@ -0,0 +1,252 @@
:root {
--bg-color: #0b0f1a;
--card-bg: rgba(30, 41, 59, 0.7);
--input-bg: rgba(51, 65, 85, 0.5);
--text-color: #f8fafc;
--text-muted: #94a3b8;
--primary-color: #3b82f6;
--primary-hover: #2563eb;
--accent-color: #6366f1;
--border-color: rgba(75, 85, 99, 0.4);
--success-color: #10b981;
--glass-border: rgba(255, 255, 255, 0.1);
}
body {
background: radial-gradient(circle at top right, #1e293b, #0b0f1a);
color: var(--text-color);
font-family: 'Inter', system-ui, -apple-system, sans-serif;
margin: 0;
padding: 30px;
min-height: 100vh;
letter-spacing: -0.01em;
}
.container {
max-width: 720px;
margin: 0 auto;
}
h1 {
font-size: 28px;
font-weight: 700;
background: linear-gradient(135deg, #60a5fa, #a78bfa);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 30px;
}
.section {
background: var(--card-bg);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
padding: 24px;
border-radius: 16px;
margin-bottom: 24px;
border: 1px solid var(--glass-border);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
transition: transform 0.2s ease;
}
.section:hover {
border-color: rgba(255, 255, 255, 0.2);
}
label {
display: block;
color: var(--text-muted);
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 10px;
}
input[type="text"],
input[type="password"],
select,
textarea {
width: 100%;
background: var(--input-bg);
border: 1px solid var(--border-color);
color: white;
padding: 12px 14px;
border-radius: 10px;
font-size: 14px;
transition: all 0.2s ease;
box-sizing: border-box;
}
textarea {
resize: vertical;
min-height: 80px;
}
input:focus,
select:focus,
textarea:focus {
outline: none;
border-color: var(--primary-color);
background: rgba(51, 65, 85, 0.8);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-control {
max-width: 480px;
width: 100%;
}
.input-wrapper {
position: relative;
flex: 1;
min-width: 0;
}
.input-wrapper input {
width: 100%;
padding-right: 44px;
box-sizing: border-box;
display: block;
}
.eye-btn {
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
background: transparent !important;
border: none !important;
box-shadow: none !important;
cursor: pointer;
padding: 4px !important;
font-size: 16px;
opacity: 0.5;
transition: opacity 0.2s;
line-height: 1;
display: flex;
align-items: center;
justify-content: center;
}
.eye-btn:hover {
opacity: 1;
transform: translateY(-50%) scale(1.1);
}
.save-status {
position: fixed;
bottom: 30px;
right: 30px;
background: var(--success-color);
color: white;
padding: 12px 24px;
border-radius: 12px;
font-weight: 600;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
transform: translateY(100px);
opacity: 0;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1000;
}
.save-status.show {
transform: translateY(0);
opacity: 1;
}
button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 10px 20px;
border-radius: 10px;
cursor: pointer;
font-weight: 600;
font-size: 14px;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
white-space: nowrap;
flex-shrink: 0;
}
button:hover {
transform: translateY(-1px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
background-color: var(--primary-hover);
}
button:active {
transform: translateY(0);
}
button[style*="background: transparent"] {
background: transparent !important;
box-shadow: none !important;
text-decoration: underline;
opacity: 0.7;
}
button[style*="background: transparent"]:hover {
opacity: 1;
}
.flex-row {
display: flex;
gap: 12px;
align-items: center;
flex-wrap: nowrap;
}
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
}
.history-list {
max-height: 250px;
overflow-y: auto;
margin-top: 10px;
padding-right: 5px;
}
.history-item {
background: rgba(255, 255, 255, 0.03);
padding: 14px;
border-radius: 12px;
margin-bottom: 10px;
border: 1px solid rgba(255, 255, 255, 0.05);
transition: all 0.2s ease;
}
.history-item:hover {
background: rgba(255, 255, 255, 0.06);
transform: translateX(2px);
}
.history-time {
color: var(--primary-color);
font-size: 11px;
font-weight: 700;
margin-bottom: 6px;
display: block;
}
/* Scrollbar excellence */
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
}