Skip to content

Commit af66292

Browse files
committed
ueue interface working but i want better task
1 parent 9b98692 commit af66292

File tree

7 files changed

+179
-45
lines changed

7 files changed

+179
-45
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.*/
22
.aider*
3-
.hintrc
3+
.hintrc
4+
ultimate goal.md

config.js

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ async function migrateSyncToLocal() {
4040

4141
// Copy to local storage
4242
await chrome.storage.local.set(syncData);
43-
43+
4444
// Verify migration
4545
const localData = await chrome.storage.local.get(null);
4646
const verified = JSON.stringify(syncData) === JSON.stringify(localData);
47-
47+
4848
if (verified) {
4949
// Clear sync storage after successful migration
5050
await chrome.storage.sync.clear();
@@ -145,7 +145,7 @@ async function loadProfileConfig(profileName) {
145145
try {
146146
const result = await chrome.storage.local.get([`profiles.${profileName}`]);
147147
const profile = result[`profiles.${profileName}`];
148-
148+
149149
if (profile) {
150150
logConfigurationRelatedStuff(`Profile ${profileName} loaded successfully`);
151151
return profile;
@@ -167,13 +167,13 @@ async function switchProfile(profileName) {
167167
if (profile) {
168168
await chrome.storage.local.set({ 'currentProfile': profileName });
169169
logConfigurationRelatedStuff(`Switched to profile: ${profileName}`);
170-
170+
171171
// Broadcast profile change to all tabs
172172
broadcastProfileChange(profileName, profile);
173-
173+
174174
return profile;
175175
} else {
176-
logConfigurationRelatedStuff(`Failed to switch to profile: ${profileName}`);
176+
logConfigurationRelatedStuff(`Failed to switch to profile: ${profileName}`);
177177
return null;
178178
}
179179
} catch (error) {
@@ -189,10 +189,10 @@ async function broadcastProfileChange(profileName, profileData) {
189189
tabs.forEach(tab => {
190190
// Only send to URLs that match our content script patterns
191191
if (tab.url && (
192-
tab.url.includes('chat.openai.com') ||
193-
tab.url.includes('grok.x.ai') ||
192+
tab.url.includes('chat.openai.com') ||
193+
tab.url.includes('grok.x.ai') ||
194194
tab.url.includes('claude.ai') ||
195-
tab.url.includes('o3') ||
195+
tab.url.includes('o3') ||
196196
tab.url.includes('x.ai')
197197
)) {
198198
chrome.tabs.sendMessage(tab.id, {
@@ -219,7 +219,7 @@ async function getCurrentProfileConfig() {
219219
try {
220220
const result = await chrome.storage.local.get(['currentProfile']);
221221
const profileName = result.currentProfile;
222-
222+
223223
if (profileName) {
224224
logConfigurationRelatedStuff(`Current profile found: ${profileName}`);
225225
let profile = await loadProfileConfig(profileName);
@@ -229,17 +229,26 @@ async function getCurrentProfileConfig() {
229229
profile.customButtons = [];
230230
logConfigurationRelatedStuff(`Initialized missing 'customButtons' for profile: ${profileName}`);
231231
}
232+
// Ensure queue settings exist for backward compatibility
233+
if (typeof profile.queueDelaySeconds === 'undefined') {
234+
profile.queueDelaySeconds = 15; // Default delay in seconds
235+
logConfigurationRelatedStuff(`Initialized missing 'queueDelaySeconds' for profile: ${profileName}`);
236+
}
232237
return profile;
233238
}
234239
}
235-
240+
236241
logConfigurationRelatedStuff('No valid current profile found. Creating default profile');
237242
const defaultProfile = await createDefaultProfile();
238243
// Ensure the default profile includes 'customButtons'
239244
if (!defaultProfile.customButtons) {
240245
defaultProfile.customButtons = [];
241246
logConfigurationRelatedStuff("Initialized missing 'customButtons' for default profile");
242247
}
248+
if (typeof defaultProfile.queueDelaySeconds === 'undefined') {
249+
defaultProfile.queueDelaySeconds = 15;
250+
logConfigurationRelatedStuff("Initialized missing 'queueDelaySeconds' for default profile");
251+
}
243252
return defaultProfile;
244253
} catch (error) {
245254
handleStorageError(error);
@@ -255,7 +264,7 @@ async function listProfiles() {
255264
const profiles = Object.keys(storage)
256265
.filter(key => key.startsWith('profiles.'))
257266
.map(key => key.replace('profiles.', ''));
258-
267+
259268
logConfigurationRelatedStuff('Available profiles:', profiles);
260269
return profiles;
261270
} catch (error) {
@@ -285,15 +294,15 @@ async function deleteProfile(profileName) {
285294
logConfigurationRelatedStuff('Cannot delete Default profile');
286295
return false;
287296
}
288-
297+
289298
// Get current profile
290299
const result = await chrome.storage.local.get(['currentProfile']);
291-
300+
292301
// If we're deleting the current profile, switch to Default
293302
if (result.currentProfile === profileName) {
294303
await switchProfile('Default');
295304
}
296-
305+
297306
// Remove the profile from storage
298307
await chrome.storage.local.remove(`profiles.${profileName}`);
299308
logConfigurationRelatedStuff(`Profile ${profileName} deleted successfully`);
@@ -399,15 +408,15 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
399408
try {
400409
const result = await chrome.storage.local.get(['customSelectors']);
401410
const customSelectors = result.customSelectors || {};
402-
411+
403412
if (request.selectors) {
404413
customSelectors[request.site] = request.selectors;
405414
logConfigurationRelatedStuff('Saved custom selectors for: ' + request.site);
406415
} else {
407416
delete customSelectors[request.site];
408417
logConfigurationRelatedStuff('Removed custom selectors for: ' + request.site);
409418
}
410-
419+
411420
await chrome.storage.local.set({ customSelectors });
412421
sendResponse({ success: true });
413422
} catch (error) {
@@ -426,14 +435,14 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
426435
});
427436
return true;
428437
// ----- End Custom Selectors Cases -----
429-
438+
430439
// ----- Floating Panel Settings Cases -----
431440
case 'getFloatingPanelSettings':
432441
if (!request.hostname) {
433442
sendResponse({ error: 'Hostname is required' });
434443
return true;
435444
}
436-
445+
437446
const floatingPanelKey = 'floating_panel_' + request.hostname;
438447
chrome.storage.local.get([floatingPanelKey], result => {
439448
if (result && result[floatingPanelKey]) {
@@ -445,17 +454,17 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
445454
}
446455
});
447456
return true;
448-
457+
449458
case 'saveFloatingPanelSettings':
450459
if (!request.hostname || !request.settings) {
451460
sendResponse({ error: 'Hostname and settings are required' });
452461
return true;
453462
}
454-
463+
455464
const saveKey = 'floating_panel_' + request.hostname;
456465
const saveData = {};
457466
saveData[saveKey] = request.settings;
458-
467+
459468
chrome.storage.local.set(saveData, () => {
460469
if (chrome.runtime.lastError) {
461470
handleStorageError(chrome.runtime.lastError);
@@ -466,19 +475,19 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
466475
}
467476
});
468477
return true;
469-
478+
470479
case 'resetFloatingPanelSettings':
471480
chrome.storage.local.get(null, result => {
472-
const floatingPanelKeys = Object.keys(result).filter(key =>
481+
const floatingPanelKeys = Object.keys(result).filter(key =>
473482
key.startsWith('floating_panel_')
474483
);
475-
484+
476485
if (floatingPanelKeys.length === 0) {
477486
sendResponse({ success: true, count: 0 });
478487
logConfigurationRelatedStuff('No floating panel settings found to reset');
479488
return;
480489
}
481-
490+
482491
chrome.storage.local.remove(floatingPanelKeys, () => {
483492
if (chrome.runtime.lastError) {
484493
handleStorageError(chrome.runtime.lastError);
@@ -491,7 +500,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
491500
});
492501
return true;
493502
// ----- End Floating Panel Settings Cases -----
494-
503+
495504
default:
496505
logConfigurationRelatedStuff('Unknown message type received:', request.type);
497506
sendResponse({ error: 'Unknown message type' });
@@ -526,3 +535,4 @@ chrome.storage.onChanged.addListener((changes, namespace) => {
526535
}
527536
}
528537
});
538+

0 commit comments

Comments
 (0)