-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FastGPT disappearing on settings toggle #65
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,9 +273,11 @@ async function setup() { | |
if (!hasPermissions) { | ||
summarizeSection.style.display = 'none'; | ||
requestPermissionsSection.style.display = ''; | ||
fastGptSection.style.display = 'none'; | ||
} else { | ||
summarizeSection.style.display = ''; | ||
requestPermissionsSection.style.display = 'none'; | ||
fastGptSection.style.display = ''; | ||
Comment on lines
+276
to
+280
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes fix FastGPT disappearing when toggling settings (#64). |
||
} | ||
} | ||
advancedToggle.setAttribute('title', 'Advanced settings'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,11 +89,16 @@ async function setup() { | |
|
||
const searchParams = new URLSearchParams(window.location.search); | ||
|
||
// If there's no URL, get the currently active tab and default params | ||
if (!searchParams.get('url')) { | ||
if (!searchParams.get('summary_type')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes in this file allow the popup to be initialized with just a URL param (right click context open), otherwise not all parameters would've been properly set. |
||
searchParams.set('summary_type', 'summary'); | ||
} | ||
|
||
if (!searchParams.get('target_language')) { | ||
searchParams.set('target_language', ''); | ||
} | ||
|
||
// If there's no URL, get the currently active tab and default params | ||
if (!searchParams.get('url')) { | ||
const tab = await getActiveTab(true); | ||
|
||
if (!tab) { | ||
|
@@ -107,25 +112,25 @@ async function setup() { | |
const popupUrl = new URL(window.location.href); | ||
popupUrl.searchParams.set('url', tab.url); | ||
window.history.replaceState(null, '', popupUrl.toString()); | ||
} | ||
|
||
const { token, api_token, api_engine, summary_type, target_language } = | ||
await fetchSettings(); | ||
const { token, api_token, api_engine, summary_type, target_language } = | ||
await fetchSettings(); | ||
|
||
if (token) { | ||
searchParams.set('token', token); | ||
} | ||
if (api_token) { | ||
searchParams.set('api_token', api_token); | ||
} | ||
if (api_engine) { | ||
searchParams.set('api_engine', api_engine); | ||
} | ||
if (summary_type) { | ||
searchParams.set('summary_type', summary_type); | ||
} | ||
if (target_language) { | ||
searchParams.set('target_language', target_language); | ||
} | ||
if (token) { | ||
searchParams.set('token', token); | ||
} | ||
if (api_token) { | ||
searchParams.set('api_token', api_token); | ||
} | ||
if (api_engine) { | ||
searchParams.set('api_engine', api_engine); | ||
} | ||
if (summary_type) { | ||
searchParams.set('summary_type', summary_type); | ||
} | ||
if (target_language) { | ||
searchParams.set('target_language', target_language); | ||
} | ||
|
||
loadingElement.style.display = ''; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes fix opening up in the popup instead of a new tab with the summarizer (#45).