Merge pull request 'Rename to pzp' (#3) from pzp-rename into master

Reviewed-on: https://codeberg.org/pzp/pzp-hub/pulls/3
This commit is contained in:
Powersource 2024-05-15 17:36:10 +00:00
commit e5d46e2589
10 changed files with 2540 additions and 7000 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
node_modules node_modules
pnpm-lock.yaml
yarn.lock yarn.lock
TODO TODO
data data

View File

@ -1 +1,11 @@
**Work in progress** # pzp-hub
PZP hub server
## Usage
1. Clone this repo
2. `npm run setup`
3. `npm start`
4. Go to `0.0.0.0:3000` to get an invite for the first hub member
5. Use `pzp-invite` to create more invites

View File

@ -1,6 +1,6 @@
const Path = require('node:path') const Path = require('node:path')
const Keypair = require('ppppp-keypair') const Keypair = require('pzp-keypair')
const caps = require('ppppp-caps') const caps = require('pzp-caps')
const SecretStack = require('secret-stack/bare') const SecretStack = require('secret-stack/bare')
module.exports = function startPeer() { module.exports = function startPeer() {
@ -11,7 +11,7 @@ module.exports = function startPeer() {
return SecretStack() return SecretStack()
.use(require('secret-stack/plugins/net')) .use(require('secret-stack/plugins/net'))
.use(require('secret-handshake-ext/secret-stack')) .use(require('secret-handshake-ext/secret-stack'))
.use(require('ppppp-net')) .use(require('pzp-net'))
.use(require('./plugin-hub.cjs')) .use(require('./plugin-hub.cjs'))
.use(require('./plugin-hub-client.cjs')) .use(require('./plugin-hub-client.cjs'))
.call(null, { .call(null, {
@ -28,7 +28,7 @@ module.exports = function startPeer() {
{ {
scope: 'public', scope: 'public',
transform: 'shse', transform: 'shse',
port: process.env.PPPPP_PORT ?? 8008, port: process.env.PZP_PORT ?? 8008,
host: '0.0.0.0', host: '0.0.0.0',
}, },
], ],

View File

@ -1,7 +1,7 @@
const cat = require('pull-cat') const cat = require('pull-cat')
const Notify = require('pull-notify') const Notify = require('pull-notify')
const pull = require('pull-stream') const pull = require('pull-stream')
const debug = require('debug')('ppppp:hub') const debug = require('debug')('pzp:hub')
const Tokens = require('./tokens.cjs') const Tokens = require('./tokens.cjs')
const Members = require('./members.cjs') const Members = require('./members.cjs')

View File

@ -9,11 +9,11 @@ window.addEventListener('focus', () => {
const host = window.location.hostname const host = window.location.hostname
const hostFormat = /[a-zA-Z]/.test(window.location.hostname) ? 'dns' : 'ip4'; const hostFormat = /[a-zA-Z]/.test(window.location.hostname) ? 'dns' : 'ip4';
const { tcpPort, shseCredentials } = window.hubInvite const { tcpPort, shseCredentials } = window.hubInvite
const uri = `ppppp://invite/join/${hostFormat}/${host}/tcp/${tcpPort}/shse/${shseCredentials}` const uri = `pzp://invite/join/${hostFormat}/${host}/tcp/${tcpPort}/shse/${shseCredentials}`
const inviteLinkElem = document.getElementById('invite') const inviteLinkElem = document.getElementById('invite')
inviteLinkElem.href = uri inviteLinkElem.href = uri
// Autoredirect to the PPPPP URI as soon as possible // Autoredirect to the PZP URI as soon as possible
setTimeout(() => { setTimeout(() => {
window.location.replace(uri) window.location.replace(uri)
}, 100) }, 100)

View File

@ -12,10 +12,10 @@ const failureElem = document.getElementById('failure')
const hash = window.location.hash const hash = window.location.hash
if (hash) { if (hash) {
let uri = decodeURIComponent(hash.slice(1)) let uri = decodeURIComponent(hash.slice(1))
if (!uri.startsWith('ppppp:')) uri = 'ppppp://invite' + uri if (!uri.startsWith('pzp:')) uri = 'pzp://invite' + uri
inviteLinkElem.href = uri inviteLinkElem.href = uri
// Autoredirect to the PPPPP URI as soon as possible // Autoredirect to the PZP URI as soon as possible
setTimeout(() => { setTimeout(() => {
console.log(uri) console.log(uri)
// window.location.replace(uri); // window.location.replace(uri);

View File

@ -7,7 +7,7 @@
<body> <body>
<article> <article>
<h1>Join PPPPP</h1> <h1>Join PZP</h1>
<a id="invite" class="btn" href="#">Claim invite</a> <a id="invite" class="btn" href="#">Claim invite</a>
or or
<a id="copy" class="btn" href="#">Copy invite</a> <a id="copy" class="btn" href="#">Copy invite</a>

6980
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"name": "ppppp-hub", "name": "pzp-hub",
"version": "0.0.1", "version": "0.0.1",
"description": "PPPPP hub server", "description": "PZP hub server",
"author": "Andre Staltz <contact@staltz.com>", "author": "Andre Staltz <contact@staltz.com>",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/staltz/ppppp-hub", "homepage": "https://codeberg.org/pzp/pzp-hub/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git@github.com:staltz/ppppp-hub.git" "url": "git@codeberg.org:pzp/pzp-hub.git"
}, },
"main": "index.js", "main": "index.js",
"files": [ "files": [
@ -31,9 +31,9 @@
"debug": "4.3.4", "debug": "4.3.4",
"ejs": "3.1.9", "ejs": "3.1.9",
"fastify": "4.25.2", "fastify": "4.25.2",
"ppppp-caps": "github:staltz/ppppp-caps", "pzp-caps": "^1.0.0",
"ppppp-keypair": "github:staltz/ppppp-keypair", "pzp-keypair": "^1.0.0",
"ppppp-net": "github:staltz/ppppp-net", "pzp-net": "^1.0.1",
"pino": "8.17.2", "pino": "8.17.2",
"pull-cat": "1.1.11", "pull-cat": "1.1.11",
"pull-notify": "0.1.2", "pull-notify": "0.1.2",

2511
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff