pinokiod 8.3.23 → 8.3.26

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.
@@ -0,0 +1,30 @@
1
+ // The app's Git page: every repository in the app's folder, with its changes,
2
+ // history, fork and publish, all on one page. Opened as a tab on the app page.
3
+ //
4
+ // GET /pinokio/git/:name ?publish=1 opens on the Publish section
5
+ const fs = require("fs")
6
+
7
+ module.exports = function registerGitPageRoutes(app, options = {}) {
8
+ const kernel = options.kernel
9
+ const getPageContext = options.getPageContext || (() => ({}))
10
+
11
+ app.get("/pinokio/git/:name", async (req, res) => {
12
+ const name = req.params.name
13
+ const cwd = kernel.path("api", name)
14
+ try {
15
+ const stat = await fs.promises.stat(cwd)
16
+ if (!stat.isDirectory()) {
17
+ throw new Error("not a folder")
18
+ }
19
+ } catch (_) {
20
+ res.status(404).send("App not found")
21
+ return
22
+ }
23
+ res.render("git_page", {
24
+ ...getPageContext(req),
25
+ name,
26
+ cwd,
27
+ publish: req.query && req.query.publish === "1",
28
+ })
29
+ })
30
+ }
@@ -8441,6 +8441,9 @@ body.dark .pinokio-custom-terminal-header {
8441
8441
  <div class="app-header-info-popover-title"><%=config.title || name%></div>
8442
8442
  <div class="app-header-info-popover-description"><%=config.description || 'No description provided.'%></div>
8443
8443
  </div>
8444
+ <button type="button" id="edit" class="app-header-info-popover-row-action" style="flex: 0 0 auto" title="Edit metadata" aria-label="Edit metadata" data-app-info-reveal-path>
8445
+ <i class="fa-solid fa-pen-to-square" aria-hidden="true"></i>
8446
+ </button>
8444
8447
  </div>
8445
8448
  <div class="app-header-info-popover-meta">
8446
8449
  <% if (appInfoFolderPath) { %>
@@ -8567,16 +8570,6 @@ body.dark .pinokio-custom-terminal-header {
8567
8570
  <aside id='app-sidebar' class='active'>
8568
8571
  <div class='menu-container'>
8569
8572
  <div class='menu-scroller'>
8570
- <div class='workspace-mode-switch' role="tablist" aria-label="Workspace mode">
8571
- <a class="workspace-mode-link <%=type === 'run' ? 'selected' : ''%>" href="<%=run_tab%>" role="tab" aria-selected="<%=type === 'run' ? 'true' : 'false'%>">
8572
- <i class="fa-solid fa-circle-play"></i>
8573
- <span>Run</span>
8574
- </a>
8575
- <a class="workspace-mode-link <%=type === 'browse' || type === 'files' ? 'selected' : ''%>" href="<%=dev_tab%>" role="tab" aria-selected="<%=type === 'browse' || type === 'files' ? 'true' : 'false'%>">
8576
- <i class="fa-solid fa-terminal"></i>
8577
- <span>Dev</span>
8578
- </a>
8579
- </div>
8580
8573
  <%if (type==='browse') { %>
8581
8574
  <div class='m n system' data-type="n">
8582
8575
  <a id='devtab' data-mode="refresh" target="<%=dev_link%>" href="<%=dev_link%>" class="btn frame-link <%=dev_initial_tab === 'files' ? '' : 'selected'%>" data-index="10">
@@ -8696,13 +8689,22 @@ body.dark .pinokio-custom-terminal-header {
8696
8689
  <span class='logs-new-badge hidden' id='logs-new-badge'>New</span>
8697
8690
  </div>
8698
8691
  </button>
8699
- <button type='button' id='sidebar-open-explorer' class="btn header-item" data-filepath="<%=path%>" data-tippy-content="Open in File Explorer">
8692
+ <% if (type === 'run') { %>
8693
+ <a id='files-tab' target="pinokio-files" href="<%=editor_tab%>" class="btn header-item frame-link" data-index="files" data-static="retain">
8700
8694
  <div class='tab'>
8701
- <i class="fa-solid fa-folder-open menu-action-leading-icon"></i>
8702
- <div class='display'>File Explorer</div>
8695
+ <i class="fa-solid fa-file-lines menu-action-leading-icon"></i>
8696
+ <div class='display'>Files</div>
8703
8697
  <div class='flexible'></div>
8704
8698
  </div>
8705
- </button>
8699
+ </a>
8700
+ <a id='git-tab' target="app-git" href="/pinokio/git/<%=encodeURIComponent(name)%><%=typeof git_initial_publish !== 'undefined' && git_initial_publish ? '?publish=1' : ''%>" class="btn header-item frame-link" data-index="git" data-static="retain">
8701
+ <div class='tab'>
8702
+ <i class="fa-brands fa-git-alt menu-action-leading-icon"></i>
8703
+ <div class='display'>Git</div>
8704
+ <div class='flexible'></div>
8705
+ </div>
8706
+ </a>
8707
+ <% } %>
8706
8708
  <% if (typeof vault_enabled !== 'undefined' && vault_enabled) { %>
8707
8709
  <% const vaultAutomaticMode = typeof vault_automatic_mode === 'string' && vault_automatic_mode === 'manual' ? 'manual' : 'automatic' %>
8708
8710
  <% const vaultGlobalScanReady = typeof vault_global_scan_ready !== 'undefined' && vault_global_scan_ready === true %>
@@ -9057,6 +9059,9 @@ body.dark .pinokio-custom-terminal-header {
9057
9059
  <div class="app-header-info-popover-title"><%=config.title || name%></div>
9058
9060
  <div class="app-header-info-popover-description"><%=config.description || 'No description provided.'%></div>
9059
9061
  </div>
9062
+ <button type="button" class="app-header-info-popover-row-action" style="flex: 0 0 auto" title="Edit metadata" aria-label="Edit metadata" data-app-info-reveal-path onclick="document.getElementById('edit').click()">
9063
+ <i class="fa-solid fa-pen-to-square" aria-hidden="true"></i>
9064
+ </button>
9060
9065
  </div>
9061
9066
  <div class="app-header-info-popover-meta">
9062
9067
  <% if (appInfoFolderPath) { %>
@@ -9136,16 +9141,6 @@ body.dark .pinokio-custom-terminal-header {
9136
9141
  <div>Pinokio</div>
9137
9142
  </div>
9138
9143
  <div class='mobile-menu-fallback__body'>
9139
- <div class='workspace-mode-switch' role="tablist" aria-label="Workspace mode">
9140
- <a class="workspace-mode-link <%=type === 'run' ? 'selected' : ''%>" href="<%=run_tab%>" role="tab" aria-selected="<%=type === 'run' ? 'true' : 'false'%>">
9141
- <i class="fa-solid fa-circle-play"></i>
9142
- <span>Run</span>
9143
- </a>
9144
- <a class="workspace-mode-link <%=type === 'browse' || type === 'files' ? 'selected' : ''%>" href="<%=dev_tab%>" role="tab" aria-selected="<%=type === 'browse' || type === 'files' ? 'true' : 'false'%>">
9145
- <i class="fa-solid fa-terminal"></i>
9146
- <span>Dev</span>
9147
- </a>
9148
- </div>
9149
9144
  <div class='mobile-drawer-actions' aria-label="App actions">
9150
9145
  <button type='button' class='btn header-item mobile-nav-logs' data-mobile-proxy="#fs-status .fs-logs .fs-status-btn" data-mobile-panel="logs" data-mobile-close-menu="true" aria-pressed="false" aria-label="Logs">
9151
9146
  <div class='tab'>
@@ -17313,11 +17308,8 @@ document.addEventListener("DOMContentLoaded", () => {
17313
17308
  focusConfirm: false,
17314
17309
  }).then((result) => {
17315
17310
  if (result && result.isConfirmed) {
17316
- const params = new URLSearchParams(window.location.search || "")
17317
- params.set("pinokio.publish", "1")
17318
- const qs = params.toString()
17319
- const url = `/p/${encodeURIComponent(workspace)}/dev${qs ? `?${qs}` : ""}`
17320
- window.location.href = url
17311
+ // the app page, not launching the app, on its Git tab's Publish section
17312
+ window.location.href = `/v/${encodeURIComponent(workspace)}?git_publish=1`
17321
17313
  }
17322
17314
  })
17323
17315
  return
@@ -20039,5 +20031,8 @@ document.addEventListener("DOMContentLoaded", () => {
20039
20031
  }
20040
20032
  })()
20041
20033
  </script>
20034
+ <% if (type === 'run') { %>
20035
+ <script src="/app-run-tabs.js" data-tab="<%=typeof run_initial_tab === 'string' ? run_initial_tab : ''%>"></script>
20036
+ <% } %>
20042
20037
  </body>
20043
20038
  </html>
@@ -10,6 +10,7 @@
10
10
  <link href="/css/brands.min.css" rel="stylesheet">
11
11
  <link href="/style.css" rel="stylesheet">
12
12
  <link href="/files-app/app.css" rel="stylesheet">
13
+ <link href="/files-app/toolbar.css" rel="stylesheet">
13
14
  <link href="/filepond.min.css" rel="stylesheet" />
14
15
  <link href="/filepond-plugin-image-preview.min.css" rel="stylesheet" />
15
16
  <link href="/filepond-plugin-image-edit.min.css" rel="stylesheet" />
@@ -20,36 +21,6 @@
20
21
  </head>
21
22
  <body class="<%=theme%>" data-agent="<%=agent%>">
22
23
  <div class="files-app" data-theme="<%=theme%>">
23
- <header class="files-app__header">
24
- <button class="files-app__mobile-back" id="files-app-mobile-back" type="button" aria-label="Back to files">
25
- <i class="fa-solid fa-chevron-left" aria-hidden="true"></i>
26
- <span>Files</span>
27
- </button>
28
- <div class="files-app__header-title">
29
- <% if (workspaceMeta && workspaceMeta.icon) { %>
30
- <img class="files-app__header-icon" src="<%= workspaceMeta.icon %>" onerror="this.onerror=null; this.src='/pinokio-black.png'" alt="Project icon" />
31
- <% } else { %>
32
- <i class="fa-regular fa-folder-open"></i>
33
- <% } %>
34
- <div class="files-app__header-text">
35
- <div class="files-app__header-primary"><%= (workspaceMeta && workspaceMeta.title) ? workspaceMeta.title : workspaceLabel %></div>
36
- <% if (workspaceMeta && workspaceMeta.description) { %>
37
- <div class="files-app__header-desc"><%= workspaceMeta.description %></div>
38
- <% } %>
39
- <div class="files-app__header-sub"><%=workspaceRoot%></div>
40
- </div>
41
- </div>
42
- <div class="files-app__header-actions">
43
- <button class="files-app__meta" type="button" id="files-app-edit-metadata">
44
- <i class="fa-solid fa-pen-to-square"></i>
45
- <span>Edit metadata</span>
46
- </button>
47
- <button class="files-app__save" id="files-app-save" disabled>
48
- <i class="fa-solid fa-floppy-disk"></i>
49
- <span>Save</span>
50
- </button>
51
- </div>
52
- </header>
53
24
  <section class="files-app__body">
54
25
  <aside class="files-app__sidebar" aria-label="Project files">
55
26
  <div class="files-app__sidebar-scroll" id="files-app-tree">
@@ -60,7 +31,21 @@
60
31
  <span class="sr-only">Hide files</span>
61
32
  <i class="fa-solid fa-chevron-left" aria-hidden="true"></i>
62
33
  </button>
63
- <div class="files-app__tabs" id="files-app-tabs" role="tablist" aria-label="Open files"></div>
34
+ <div class="files-app__tabbar">
35
+ <button class="files-app__mobile-back" id="files-app-mobile-back" type="button" aria-label="Back to files">
36
+ <i class="fa-solid fa-chevron-left" aria-hidden="true"></i>
37
+ <span>Files</span>
38
+ </button>
39
+ <div class="files-app__tabs" id="files-app-tabs" role="tablist" aria-label="Open files"></div>
40
+ <button class="files-app__meta" type="button" id="files-app-open-explorer" data-root="<%=workspaceRoot%>">
41
+ <i class="fa-solid fa-folder-open"></i>
42
+ <span>File Explorer</span>
43
+ </button>
44
+ <button class="files-app__save" id="files-app-save" title="Save" aria-label="Save" disabled>
45
+ <i class="fa-solid fa-floppy-disk"></i>
46
+ <span>Save</span>
47
+ </button>
48
+ </div>
64
49
  <div class="files-app__editor" id="files-app-editor" role="presentation"></div>
65
50
  <div class="files-app__status" id="files-app-status" role="status" aria-live="polite"></div>
66
51
  </main>
@@ -79,6 +64,7 @@
79
64
  <script src="/ace/ace.js"></script>
80
65
  <script src="/ace/ext-modelist.js"></script>
81
66
  <script src="/files-app/app.js"></script>
67
+ <script src="/files-app/open-folder.js"></script>
82
68
  <script>
83
69
  window.FilesApp.init({
84
70
  workspace: <%- JSON.stringify(workspaceSlug) %>,
@@ -0,0 +1,21 @@
1
+ <html>
2
+ <head>
3
+ <title>Git</title>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
6
+ <link href="/css/fontawesome.min.css" rel="stylesheet">
7
+ <link href="/css/solid.min.css" rel="stylesheet">
8
+ <link href="/css/regular.min.css" rel="stylesheet">
9
+ <link href="/css/brands.min.css" rel="stylesheet">
10
+ <link href="/style.css" rel="stylesheet"/>
11
+ <% if (agent === "electron") { %>
12
+ <link href="/electron.css" rel="stylesheet"/>
13
+ <% } %>
14
+ <link href="/git-page.css" rel="stylesheet"/>
15
+ <script src="/timeago.min.js"></script>
16
+ </head>
17
+ <body class='<%=theme%> git-page' data-agent="<%=agent%>">
18
+ <div class='git-page-root' id='git-page' data-name="<%=name%>" data-cwd="<%=cwd%>" data-publish="<%= publish ? '1' : '' %>"></div>
19
+ <script src="/git-page.js"></script>
20
+ </body>
21
+ </html>
@@ -1866,7 +1866,7 @@ body.dark aside .current.selected {
1866
1866
  <% const runningTerminalOnlineCount = Number(item.terminal_online_count || 0) %>
1867
1867
  <% const runningTerminalLabel = runningTerminalOnlineCount > 0 ? `${runningTerminalOnlineCount} terminal${runningTerminalOnlineCount === 1 ? "" : "s"} online` : "Terminals" %>
1868
1868
  <% if (runningTerminalOnlineCount > 0) { %>
1869
- <button class='btn browse terminals-link is-online' type='button' data-src="<%=item.dev_url%>" title="<%=runningTerminalLabel%>">
1869
+ <button class='btn browse terminals-link is-online' type='button' data-src="<%=item.view_url%>" title="<%=runningTerminalLabel%>">
1870
1870
  <i class="fa-solid fa-terminal" aria-hidden="true"></i>
1871
1871
  <span><%=runningTerminalLabel%></span>
1872
1872
  <i class="fa-solid fa-circle-notch fa-spin terminals-link-indicator" aria-hidden="true"></i>
@@ -1956,7 +1956,7 @@ body.dark aside .current.selected {
1956
1956
  </button>
1957
1957
  <% if (notRunningTerminalOnlineCount > 0) { %>
1958
1958
  <% const notRunningTerminalLabel = notRunningTerminalOnlineCount > 0 ? `${notRunningTerminalOnlineCount} terminal${notRunningTerminalOnlineCount === 1 ? "" : "s"} online` : "Terminals" %>
1959
- <button class='btn browse terminals-link is-online' type='button' data-src="<%=item.dev_url%>" title="<%=notRunningTerminalLabel%>">
1959
+ <button class='btn browse terminals-link is-online' type='button' data-src="<%=item.view_url%>" title="<%=notRunningTerminalLabel%>">
1960
1960
  <i class="fa-solid fa-terminal" aria-hidden="true"></i>
1961
1961
  <span><%=notRunningTerminalLabel%></span>
1962
1962
  <i class="fa-solid fa-circle-notch fa-spin terminals-link-indicator" aria-hidden="true"></i>
@@ -76,13 +76,6 @@ const homeActionsShareExternalReadyUrls = item && Array.isArray(item.external_re
76
76
  <i class='fa-regular fa-eye' aria-hidden='true'></i>
77
77
  <span>Open without launching</span>
78
78
  </button>
79
- <button type='button' class='home-mode-command home-browse' data-src='<%= item.dev_url %>'>
80
- <i class='fa-solid fa-code' aria-hidden='true'></i>
81
- <span>Open dev mode</span>
82
- <% if (item.terminal_online_count > 0) { %>
83
- <span class='home-actions-count'><%= item.terminal_online_count %> online</span>
84
- <% } %>
85
- </button>
86
79
  <% if (homeActionsSettingsHref) { %>
87
80
  <a class='home-mode-command' href='<%= homeActionsSettingsHref %>'>
88
81
  <i class='fa-solid fa-gear' aria-hidden='true'></i>
@@ -372,7 +372,7 @@ test("static guard: open without launching is not wired to launch requirement st
372
372
 
373
373
  assert.match(homeActionModal, /Open without launching/)
374
374
  assert.match(homeActionModal, /class='home-mode-command home-browse' data-src='<%= item\.view_url %>'/)
375
- assert.match(homeActionModal, /Open dev mode/)
375
+ assert.doesNotMatch(homeActionModal, /Open dev mode/)
376
376
  assert.match(homeActionModal, /const homeActionsAppId = item && \(item\.uri \|\| item\.path \|\| item\.name\)/)
377
377
  assert.match(homeActionModal, /pinokio_home_select: JSON\.stringify/)
378
378
  assert.match(homeActionModal, /target: "env-settings"/)
@@ -94,7 +94,7 @@ test("split URL modal uses inline submit and omits Files actions", async () => {
94
94
  assert.equal(content.classList.contains("split-mode"), true)
95
95
  assert.equal(inlineSubmit.textContent, "Open in pane")
96
96
  assert.ok(actions)
97
- assert.deepEqual([...new Set(modeLabels)].sort(), ["Dev", "Run"])
97
+ assert.deepEqual([...new Set(modeLabels)].sort(), ["Run"])
98
98
  assert.doesNotMatch(content.textContent, /\bFiles\b/)
99
99
 
100
100
  const input = document.querySelector(".url-modal-input")