pinokiod 3.7.4 → 3.7.6

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.7.4",
3
+ "version": "3.7.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -18,6 +18,7 @@ const semver = require('semver')
18
18
  const fse = require('fs-extra')
19
19
  const QRCode = require('qrcode')
20
20
 
21
+ //const PINOKIO_HOMEPAGE = "http://localhost:3000"
21
22
 
22
23
  const git = require('isomorphic-git')
23
24
  const http = require('isomorphic-git/http/node')
@@ -340,6 +341,8 @@ class Server {
340
341
  memory: this.kernel.memory,
341
342
  sidebar: "/pinokio/sidebar/" + name,
342
343
  name,
344
+ profile: "/profile/" + name,
345
+ feed: "/feed/" + name,
343
346
  tabs: (this.tabs[name] || []),
344
347
  config,
345
348
  // sidebar_url: "/pinokio/sidebar/" + name,
@@ -3440,6 +3443,56 @@ class Server {
3440
3443
  console.log({ requirements_pending })
3441
3444
  res.json({ requirements_pending })
3442
3445
  }))
3446
+ this.app.get("/feed/:name", ex(async (req, res) => {
3447
+ try {
3448
+ const repositoryPath = path.resolve(this.kernel.api.userdir, req.params.name)
3449
+ let gitRemote = await git.getConfig({
3450
+ fs,
3451
+ http,
3452
+ dir: repositoryPath,
3453
+ path: 'remote.origin.url'
3454
+ })
3455
+ gitRemote = gitRemote.replace(/\.git$/i, '')
3456
+
3457
+ let system_env = {}
3458
+ if (this.kernel.homedir) {
3459
+ system_env = await Environment.get(this.kernel.homedir)
3460
+ }
3461
+ const PINOKIO_HOMEPAGE = system_env.PINOKIO_HOMEPAGE || "https://pinokio.computer"
3462
+
3463
+ let url = `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=feed`
3464
+ console.log({ url })
3465
+ res.redirect(url)
3466
+ } catch (e) {
3467
+ console.log(e)
3468
+ res.redirect(PINOKIO_HOMEPAGE)
3469
+ }
3470
+ }))
3471
+ this.app.get("/profile/:name", ex(async (req, res) => {
3472
+ try {
3473
+ const repositoryPath = path.resolve(this.kernel.api.userdir, req.params.name)
3474
+ let gitRemote = await git.getConfig({
3475
+ fs,
3476
+ http,
3477
+ dir: repositoryPath,
3478
+ path: 'remote.origin.url'
3479
+ })
3480
+ gitRemote = gitRemote.replace(/\.git$/i, '')
3481
+
3482
+ let system_env = {}
3483
+ if (this.kernel.homedir) {
3484
+ system_env = await Environment.get(this.kernel.homedir)
3485
+ }
3486
+ const PINOKIO_HOMEPAGE = system_env.PINOKIO_HOMEPAGE || "https://pinokio.computer"
3487
+
3488
+ let url = `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=profile`
3489
+ console.log({ url })
3490
+ res.redirect(url)
3491
+ } catch (e) {
3492
+ console.log(e)
3493
+ res.redirect(PINOKIO_HOMEPAGE)
3494
+ }
3495
+ }))
3443
3496
  this.app.get("/check", ex((req, res) => {
3444
3497
  res.json({ success: true })
3445
3498
  }))
@@ -595,6 +595,12 @@ body.dark .loader-container {
595
595
  <a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link' data-index="0">
596
596
  <div class='tab'><i class="fa-regular fa-folder-open"></i> Files <div class='disk-usage'></div></div>
597
597
  </a>
598
+ <a target="_blank" href="<%=profile%>" class='btn header-item frame-link'>
599
+ <div class='tab'><i class="fa-solid fa-circle-dollar-to-slot"></i> Donate</div>
600
+ </a>
601
+ <a target="_blank" href="<%=feed%>" class='btn header-item frame-link'>
602
+ <div class='tab'><i class="fa-solid fa-rss"></i> Newsfeed</div>
603
+ </a>
598
604
  <a target="/share/<%=name%>" href="/share/<%=name%>", class="btn header-item frame-link" data-index="1" data-mode="refresh">
599
605
  <div class='tab'><i class="fa-solid fa-wifi"></i> Share</div>
600
606
  </a>