pinokiod 3.7.4 → 3.7.7
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 +1 -1
- package/server/index.js +65 -0
- package/server/views/app.ejs +6 -0
package/package.json
CHANGED
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')
|
|
@@ -328,6 +329,18 @@ class Server {
|
|
|
328
329
|
}
|
|
329
330
|
const env = await this.kernel.env("api/" + name)
|
|
330
331
|
|
|
332
|
+
console.time("SSSSSSSSS")
|
|
333
|
+
const repositoryPath = path.resolve(this.kernel.api.userdir, name)
|
|
334
|
+
let gitRemote = await git.getConfig({ fs, http, dir: repositoryPath, path: 'remote.origin.url' })
|
|
335
|
+
gitRemote = gitRemote.replace(/\.git$/i, '')
|
|
336
|
+
|
|
337
|
+
let system_env = {}
|
|
338
|
+
if (this.kernel.homedir) {
|
|
339
|
+
system_env = await Environment.get(this.kernel.homedir)
|
|
340
|
+
}
|
|
341
|
+
const PINOKIO_HOMEPAGE = system_env.PINOKIO_HOMEPAGE || "https://pinokio.computer"
|
|
342
|
+
console.timeEnd("SSSSSSSSS")
|
|
343
|
+
|
|
331
344
|
res.render("app", {
|
|
332
345
|
error,
|
|
333
346
|
env,
|
|
@@ -340,6 +353,8 @@ class Server {
|
|
|
340
353
|
memory: this.kernel.memory,
|
|
341
354
|
sidebar: "/pinokio/sidebar/" + name,
|
|
342
355
|
name,
|
|
356
|
+
profile: `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=profile`,
|
|
357
|
+
feed: `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=feed`,
|
|
343
358
|
tabs: (this.tabs[name] || []),
|
|
344
359
|
config,
|
|
345
360
|
// sidebar_url: "/pinokio/sidebar/" + name,
|
|
@@ -3440,6 +3455,56 @@ class Server {
|
|
|
3440
3455
|
console.log({ requirements_pending })
|
|
3441
3456
|
res.json({ requirements_pending })
|
|
3442
3457
|
}))
|
|
3458
|
+
this.app.get("/feed/:name", ex(async (req, res) => {
|
|
3459
|
+
try {
|
|
3460
|
+
const repositoryPath = path.resolve(this.kernel.api.userdir, req.params.name)
|
|
3461
|
+
let gitRemote = await git.getConfig({
|
|
3462
|
+
fs,
|
|
3463
|
+
http,
|
|
3464
|
+
dir: repositoryPath,
|
|
3465
|
+
path: 'remote.origin.url'
|
|
3466
|
+
})
|
|
3467
|
+
gitRemote = gitRemote.replace(/\.git$/i, '')
|
|
3468
|
+
|
|
3469
|
+
let system_env = {}
|
|
3470
|
+
if (this.kernel.homedir) {
|
|
3471
|
+
system_env = await Environment.get(this.kernel.homedir)
|
|
3472
|
+
}
|
|
3473
|
+
const PINOKIO_HOMEPAGE = system_env.PINOKIO_HOMEPAGE || "https://pinokio.computer"
|
|
3474
|
+
|
|
3475
|
+
let url = `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=feed`
|
|
3476
|
+
console.log({ url })
|
|
3477
|
+
res.redirect(url)
|
|
3478
|
+
} catch (e) {
|
|
3479
|
+
console.log(e)
|
|
3480
|
+
res.redirect(PINOKIO_HOMEPAGE)
|
|
3481
|
+
}
|
|
3482
|
+
}))
|
|
3483
|
+
this.app.get("/profile/:name", ex(async (req, res) => {
|
|
3484
|
+
try {
|
|
3485
|
+
const repositoryPath = path.resolve(this.kernel.api.userdir, req.params.name)
|
|
3486
|
+
let gitRemote = await git.getConfig({
|
|
3487
|
+
fs,
|
|
3488
|
+
http,
|
|
3489
|
+
dir: repositoryPath,
|
|
3490
|
+
path: 'remote.origin.url'
|
|
3491
|
+
})
|
|
3492
|
+
gitRemote = gitRemote.replace(/\.git$/i, '')
|
|
3493
|
+
|
|
3494
|
+
let system_env = {}
|
|
3495
|
+
if (this.kernel.homedir) {
|
|
3496
|
+
system_env = await Environment.get(this.kernel.homedir)
|
|
3497
|
+
}
|
|
3498
|
+
const PINOKIO_HOMEPAGE = system_env.PINOKIO_HOMEPAGE || "https://pinokio.computer"
|
|
3499
|
+
|
|
3500
|
+
let url = `${PINOKIO_HOMEPAGE}/i?uri=${gitRemote}&display=profile`
|
|
3501
|
+
console.log({ url })
|
|
3502
|
+
res.redirect(url)
|
|
3503
|
+
} catch (e) {
|
|
3504
|
+
console.log(e)
|
|
3505
|
+
res.redirect(PINOKIO_HOMEPAGE)
|
|
3506
|
+
}
|
|
3507
|
+
}))
|
|
3443
3508
|
this.app.get("/check", ex((req, res) => {
|
|
3444
3509
|
res.json({ success: true })
|
|
3445
3510
|
}))
|
package/server/views/app.ejs
CHANGED
|
@@ -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>
|