pinokiod 3.337.0 → 3.338.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.337.0",
3
+ "version": "3.338.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4640,7 +4640,29 @@ const rerenderMenuSection = (container, html) => {
4640
4640
  // loaded[target.target] = true
4641
4641
  // }
4642
4642
  }
4643
- renderSelection()
4643
+
4644
+
4645
+ // Need to strip the plugin= query param when redirected from "ask ai", otherwise it will keep selecting the specified plugin even after closing
4646
+ let pluginQueryStripped = false
4647
+ const stripPluginQueryOnce = () => {
4648
+ if (pluginQueryStripped) return
4649
+ const url = new URL(window.location.href)
4650
+ if (!/\/dev(?:$|\/)/.test(url.pathname)) return
4651
+ if (!url.searchParams.has("plugin")) return
4652
+ url.searchParams.delete("plugin")
4653
+ const qs = url.searchParams.toString()
4654
+ const newUrl = `${url.origin}${url.pathname}${qs ? "?" + qs : ""}${url.hash}`
4655
+ if (window.location.href !== newUrl) {
4656
+ history.replaceState({}, "", newUrl)
4657
+ }
4658
+ const dynBase = "<%-dynamic%>".split("?")[0]
4659
+ const updatedDynamic = qs ? `${dynBase}?${qs}` : dynBase
4660
+ window.__pinokioDynamicUrl = updatedDynamic
4661
+ pluginQueryStripped = true
4662
+ }
4663
+ renderSelection().then(() => {
4664
+ stripPluginQueryOnce()
4665
+ })
4644
4666
  //renderCursor()
4645
4667
  //Reporter()
4646
4668
  <% if (agent === "electron") { %>
@@ -5457,7 +5479,8 @@ const rerenderMenuSection = (container, html) => {
5457
5479
  const try_dynamic = async () => {
5458
5480
  let rendered
5459
5481
  let status
5460
- const dynamic = await fetch("<%-dynamic%>").then((res) => {
5482
+ const dynamicUrl = window.__pinokioDynamicUrl || "<%-dynamic%>"
5483
+ const dynamic = await fetch(dynamicUrl).then((res) => {
5461
5484
  status = res.status
5462
5485
  return res.text()
5463
5486
  })