-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.html
More file actions
141 lines (127 loc) · 5.8 KB
/
Copy pathsettings.html
File metadata and controls
141 lines (127 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #faf9f8; color: #1f2328; padding: 22px; font-size: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand b { font-size: 17px; }
.lbl { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
.row { display: flex; gap: 8px; }
input, select {
width: 100%; padding: 9px 10px; border: 1px solid #d2d0ce; border-radius: 7px;
font-size: 14px; background: #fff;
}
.hint { font-size: 12px; color: #8a8886; margin-top: 7px; line-height: 1.55; }
.hint a { color: #0d8a6a; }
.btn { border: none; border-radius: 7px; padding: 9px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.primary { background: #10a37f; color: #fff; } .primary:hover { background: #0d8a6a; }
.ghost { background: #edebe9; color: #323130; } .ghost:hover { background: #e1dfdd; }
#result { margin-top: 10px; font-size: 13px; min-height: 18px; }
.ok { color: #0d8a6a; } .err { color: #a4262c; }
.hotkey { margin-top: 18px; padding: 12px; background: #eff6fc; border: 1px solid #c7e0f4; border-radius: 8px; font-size: 13px; line-height: 1.6; }
kbd { background: #fff; border: 1px solid #d2d0ce; border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.about { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e3e1; display: flex; align-items: center; gap: 12px; }
.about img { width: 40px; height: 40px; border-radius: 9px; }
.about .meta { flex: 1; font-size: 12.5px; line-height: 1.5; color: #605e5c; }
.about .meta b { color: #1f2328; font-size: 13.5px; }
.about .meta a { color: #0d8a6a; text-decoration: none; }
.about .meta a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="brand"><img src="assets/icon.png" alt="" /><b>GemType Desktop — Settings</b></div>
<label class="lbl">Gemini API key</label>
<div class="row">
<input type="password" id="apiKey" placeholder="AIza…" autocomplete="off" />
<button class="btn ghost" id="toggle">Show</button>
</div>
<div class="hint">
Get a free key at <a href="#" id="aistudio">aistudio.google.com/apikey</a> (no credit card).
Stored only on this computer, sent only to Google's Gemini API.
</div>
<label class="lbl">Model</label>
<select id="model">
<option value="gemini-3.1-flash-lite">gemini-3.1-flash-lite (recommended)</option>
<option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite</option>
<option value="gemini-2.5-flash">gemini-2.5-flash</option>
</select>
<label class="lbl">Language</label>
<select id="language">
<option value="auto">Auto-detect</option>
<option>English</option><option>Spanish</option><option>French</option>
<option>German</option><option>Portuguese</option><option>Bengali</option>
<option>Hindi</option><option>Arabic</option><option>Chinese</option><option>Japanese</option>
</select>
<div class="row" style="margin-top:16px">
<button class="btn primary" id="save">Save</button>
<button class="btn ghost" id="test">Save & test key</button>
</div>
<div id="result"></div>
<div class="hotkey">
<b>How to use:</b> select text in any application, then press
<kbd id="hk">Ctrl+Shift+G</kbd>. GemType fixes it and can paste the result
right back. In the popup: <kbd>Enter</kbd> replaces, <kbd>Esc</kbd> closes.
</div>
<div class="about">
<img src="assets/icon.png" alt="" />
<div class="meta">
<b>GemType Desktop</b> <span id="ver">v—</span><br />
Made by <a href="#" id="matily">Matily</a> · © 2026 Matily · Apache-2.0<br />
<a href="#" id="update">Check for updates</a> ·
<a href="#" id="repo">Source on GitHub</a>
</div>
</div>
<script>
const { ipcRenderer, shell } = require('electron');
const $ = (id) => document.getElementById(id);
if (navigator.platform.includes('Mac')) $('hk').textContent = '⌘⇧G';
(async () => {
const s = await ipcRenderer.invoke('settings:get');
$('apiKey').value = s.apiKey || '';
$('model').value = s.model || 'gemini-3.1-flash-lite';
$('language').value = s.language || 'auto';
})();
const collect = () => ({
apiKey: $('apiKey').value.trim(),
model: $('model').value,
language: $('language').value,
});
$('toggle').addEventListener('click', () => {
const i = $('apiKey');
i.type = i.type === 'password' ? 'text' : 'password';
$('toggle').textContent = i.type === 'password' ? 'Show' : 'Hide';
});
$('save').addEventListener('click', async () => {
await ipcRenderer.invoke('settings:save', collect());
$('result').innerHTML = '<span class="ok">Saved</span>';
});
$('test').addEventListener('click', async () => {
const s = collect();
await ipcRenderer.invoke('settings:save', s);
$('result').textContent = 'Testing…';
const r = await ipcRenderer.invoke('settings:test', s);
$('result').innerHTML = r.ok
? '<span class="ok">Key works — you are all set.</span>'
: '<span class="err">' + r.error + '</span>';
});
$('aistudio').addEventListener('click', (e) => {
e.preventDefault();
shell.openExternal('https://aistudio.google.com/apikey');
});
// About: version + links
(async () => {
const info = await ipcRenderer.invoke('app:info');
$('ver').textContent = 'v' + info.version;
})();
$('matily').addEventListener('click', (e) => { e.preventDefault(); ipcRenderer.send('app:open', 'matily'); });
$('update').addEventListener('click', (e) => { e.preventDefault(); ipcRenderer.send('app:open', 'releases'); });
$('repo').addEventListener('click', (e) => { e.preventDefault(); ipcRenderer.send('app:open', 'repo'); });
</script>
</body>
</html>