pinokiod 3.235.0 → 3.236.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/kernel/bin/git.js CHANGED
@@ -6,11 +6,11 @@ const path = require("path")
6
6
  class Git {
7
7
  cmd() {
8
8
  if (this.kernel.platform === "darwin") {
9
- return "git git-lfs"
9
+ return "git git-lfs gh=2.82.1"
10
10
  } else if (this.kernel.platform === "win32") {
11
- return "git git-lfs gh git-bash"
11
+ return "git git-lfs gh=2.82.1 git-bash"
12
12
  } else {
13
- return "git git-lfs gh"
13
+ return "git git-lfs gh=2.82.1"
14
14
  }
15
15
  }
16
16
  async install(req, ondata) {
@@ -21,20 +21,6 @@ class Git {
21
21
  `conda install -y -c conda-forge ${this.cmd()}`
22
22
  ]
23
23
  }, ondata)
24
- if (this.kernel.platform === "darwin") {
25
- console.log("brew install gh")
26
- await this.kernel.bin.exec({
27
- // conda: { skip: true },
28
- message: [
29
- "echo $PATH",
30
- "which brew",
31
- "brew install gh",
32
- ],
33
- }, (e) => {
34
- process.stdout.write(e.raw)
35
- ondata(e)
36
- })
37
- }
38
24
  await fs.promises.mkdir(this.kernel.path("config/gh"), { recursive: true }).catch((e) => { })
39
25
 
40
26
  let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
@@ -121,7 +107,7 @@ class Git {
121
107
 
122
108
  if (this.kernel.platform === "darwin") {
123
109
  let gh_config_exists = await this.kernel.exists("config/gh")
124
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.brew.has("gh") && gh_config_exists
110
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists
125
111
  } else if (this.kernel.platform === "win32") {
126
112
  let gh_config_exists = await this.kernel.exists("config/gh")
127
113
  return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists && this.kernel.bin.installed.conda.has("git-bash")
@@ -131,15 +117,7 @@ class Git {
131
117
  }
132
118
  }
133
119
  async uninstall(req, ondata) {
134
- if (this.kernel.platform === "darwin") {
135
- await this.kernel.bin.exec({ message: "conda remove git" }, ondata)
136
- await this.kernel.bin.exec({
137
- conda: { skip: true },
138
- message: "brew uninstall gh",
139
- })
140
- } else {
141
- await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
142
- }
120
+ await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
143
121
  }
144
122
  env() {
145
123
  let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.235.0",
3
+ "version": "3.236.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -178,6 +178,13 @@ class Server {
178
178
  }
179
179
  running_dynamic (name, menu, selected_query) {
180
180
  let cwd = this.kernel.path("api", name)
181
+ const projectSlug = typeof name === 'string' ? name : ''
182
+ const assignProjectSlug = (entry) => {
183
+ if (!entry || !projectSlug) {
184
+ return
185
+ }
186
+ entry.project_slug = projectSlug
187
+ }
181
188
  let running_dynamic = []
182
189
  const traverse = (obj, indexPath) => {
183
190
  if (Array.isArray(obj)) {
@@ -212,6 +219,7 @@ class Server {
212
219
  }
213
220
  }
214
221
  }
222
+ assignProjectSlug(obj)
215
223
  running_dynamic.push(obj)
216
224
  }
217
225
  } else if (href.startsWith("/run")) {
@@ -230,6 +238,7 @@ class Server {
230
238
  obj.href = obj.href + "&" + key + "=" + encodeURIComponent(selected_query[key])
231
239
  }
232
240
  }
241
+ assignProjectSlug(obj)
233
242
  running_dynamic.push(obj)
234
243
  } else {
235
244
  const normalizedFilepath = path.normalize(filepath)
@@ -284,6 +293,7 @@ class Server {
284
293
  obj2.target = "@" + obj2.href
285
294
  obj2.target_full = obj2.href
286
295
 
296
+ assignProjectSlug(obj2)
287
297
  running_dynamic.push(obj2)
288
298
  }
289
299
  }
@@ -334,6 +344,7 @@ class Server {
334
344
  }
335
345
 
336
346
  if (activeShells.length === 0) {
347
+ assignProjectSlug(obj)
337
348
  running_dynamic.push(obj)
338
349
  } else {
339
350
  activeShells.forEach((shellEntry) => {
@@ -353,6 +364,7 @@ class Server {
353
364
  clone.target = originalTarget ? originalTarget : `@${clone.href}`
354
365
  clone.target_full = clone.href
355
366
  }
367
+ assignProjectSlug(clone)
356
368
  running_dynamic.push(clone)
357
369
  })
358
370
  }
@@ -5268,7 +5280,7 @@ class Server {
5268
5280
  }
5269
5281
  let message = [
5270
5282
  "gh auth setup-git --hostname github.com --force",
5271
- "gh auth login --web --git-protocol https"
5283
+ "gh auth login --web --clipboard --git-protocol https"
5272
5284
  ].join(delimiter)
5273
5285
  params.set("message", encodeURIComponent(message))
5274
5286
  params.set("input", true)
@@ -38,7 +38,18 @@
38
38
  if (targetMode === "_self") {
39
39
  window.location.assign(url)
40
40
  } else {
41
- window.open(url, "_blank", "noopener")
41
+ // window.open(url, "_blank", "noopener")
42
+ fetch("/go", {
43
+ method: "POST",
44
+ headers: {
45
+ "Content-Type": "application/json"
46
+ },
47
+ body: JSON.stringify({ url })
48
+ }).then((res) => {
49
+ return res.json()
50
+ }).then((res) => {
51
+ console.log(res)
52
+ })
42
53
  }
43
54
  }
44
55
  hideTabLinkPopover({ immediate: true })
@@ -142,6 +153,10 @@
142
153
  if (!node) {
143
154
  return ""
144
155
  }
156
+ const explicit = node.getAttribute("data-project-slug")
157
+ if (typeof explicit === "string" && explicit.trim().length > 0) {
158
+ return explicit.trim().toLowerCase()
159
+ }
145
160
  const candidates = []
146
161
  const targetFull = node.getAttribute("data-target-full")
147
162
  if (typeof targetFull === "string" && targetFull.length > 0) {
@@ -1327,7 +1342,7 @@
1327
1342
  if (!link || !container.contains(link)) {
1328
1343
  return
1329
1344
  }
1330
- renderTabLinkPopover(link)
1345
+ renderTabLinkPopover(link, { requireAlternate: false })
1331
1346
  })
1332
1347
 
1333
1348
  container.addEventListener("mouseout", (event) => {
@@ -5916,6 +5916,7 @@ body.dark .pinokio-fork-dropdown-remote, body.dark .pinokio-publish-dropdown-rem
5916
5916
  const remoteUrl = repo && repo.url ? repo.url : ''
5917
5917
  const pushUri = resolvePushUri(repo)
5918
5918
  const hasRemote = hasRemoteConfigured(repo)
5919
+ const canPublish = hasRemote && Boolean(pushUri)
5919
5920
 
5920
5921
  const item = document.createElement('button')
5921
5922
  item.type = 'button'
@@ -5923,19 +5924,31 @@ body.dark .pinokio-fork-dropdown-remote, body.dark .pinokio-publish-dropdown-rem
5923
5924
  item.dataset.repo = key
5924
5925
  item.dataset.name = name
5925
5926
 
5926
- const remoteClass = remoteUrl
5927
- ? 'pinokio-publish-dropdown-remote'
5928
- : 'pinokio-publish-dropdown-remote empty'
5929
- const remoteDisplay = remoteUrl ? escapeHtml(remoteUrl) : 'No remote detected'
5927
+ let remoteClass
5928
+ let remoteDisplay
5929
+ if (!canPublish) {
5930
+ remoteClass = 'pinokio-publish-dropdown-remote'
5931
+ remoteDisplay = 'Create on GitHub'
5932
+ } else if (remoteUrl) {
5933
+ remoteClass = 'pinokio-publish-dropdown-remote'
5934
+ remoteDisplay = escapeHtml(remoteUrl)
5935
+ } else {
5936
+ remoteClass = 'pinokio-publish-dropdown-remote empty'
5937
+ remoteDisplay = 'No remote detected'
5938
+ }
5930
5939
 
5931
5940
  item.innerHTML = `
5932
5941
  <div class="pinokio-publish-dropdown-title">${escapeHtml(name)}</div>
5933
5942
  <div class="${remoteClass}">${remoteDisplay}</div>
5934
5943
  `
5935
5944
 
5936
- if (!hasRemote || !pushUri) {
5937
- item.disabled = true
5938
- item.classList.add('fs-dropdown-item--disabled')
5945
+ if (!canPublish) {
5946
+ item.addEventListener('click', (event) => {
5947
+ event.preventDefault()
5948
+ event.stopPropagation()
5949
+ closeStatusDropdowns()
5950
+ showCreateModal()
5951
+ })
5939
5952
  } else {
5940
5953
  item.addEventListener('click', (event) => {
5941
5954
  event.preventDefault()
@@ -28,14 +28,14 @@
28
28
  <div class='tab'><%-item.btn%></div>
29
29
  </div>
30
30
  <% } else if (item.target === "_blank") { %>
31
- <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %>>
31
+ <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %><%= item.project_slug ? ` data-project-slug="${item.project_slug}"` : '' %>>
32
32
  <div class='tab'><%-item.btn%></div>
33
33
  <div class='loader'>
34
34
  <i class="fa-solid fa-up-right-from-square"></i>
35
35
  </div>
36
36
  </a>
37
37
  <% } else { %>
38
- <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%>>
38
+ <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%><%= item.project_slug ? ` data-project-slug="${item.project_slug}"` : '' %>>
39
39
  <% if (item.running) { %>
40
40
  <i class="fa-solid fa-circle"></i>
41
41
  <% } %>
@@ -40,7 +40,7 @@
40
40
  <% } %>
41
41
  </div>
42
42
  <% } else if (item.target === "_blank") { %>
43
- <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %>>
43
+ <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %><%= item.project_slug ? ` data-project-slug="${item.project_slug}"` : '' %>>
44
44
  <div class='tab'><%-item.btn%></div>
45
45
  <% if (item.arrow) { %>
46
46
  <i class="fa-solid fa-angle-right"></i>
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  </a>
52
52
  <% } else { %>
53
- <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%>>
53
+ <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%><%= item.project_slug ? ` data-project-slug="${item.project_slug}"` : '' %>>
54
54
  <% if (item.running) { %>
55
55
  <i class="fa-solid fa-circle"></i>
56
56
  <% } %>
@@ -1,5 +1,5 @@
1
1
  <% dynamic.forEach((item, index) => { %>
2
- <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%>>
2
+ <a <%=item.default ? 'data-default' : ''%> data-confirm="<%=item.confirm%>" data-index="<%=index+4%>" target="<%=item.target%>" data-mode="<%=item.mode%>" href="<%=item.href%>" class='btn header-item frame-link <%=item.display || ""%>'<%= item.target_full ? ` data-target-full="${item.target_full}"` : '' %> <%=item.shell_id ? `data-shell=${item.shell_id}` : ""%> <%=item.script_id ? `data-script=${item.script_id}` : ''%><%= item.project_slug ? ` data-project-slug="${item.project_slug}"` : '' %>>
3
3
  <% if (item.running) { %>
4
4
  <i class="fa-solid fa-circle"></i>
5
5
  <% } %>