add an about page #20

Closed
x1ddos wants to merge 0 commits from about into master
x1ddos commented 2 years ago
Owner

this is a simple static text page showing current version from
the npm package and git commit hash at which the app was built.

it's served at /about.html but i didn't link it from the root.
not sure where the best place is. @offbyn i'll let you figure out where to put the link.

part of #3

this is a simple static text page showing current version from the npm package and git commit hash at which the app was built. it's served at /about.html but i didn't link it from the root. not sure where the best place is. @offbyn i'll let you figure out where to put the link. part of https://git.qcode.ch/nostr/nostrweb/issues/3
x1ddos added 1 commit 2 years ago
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/pr/woodpecker Pipeline failed Details
6d6a3be8a8
add an about page
this is a simple static text page showing current version from
the npm package and git commit hash at which the app was built.

it's served at /about.html but i didn't link it from the root.
not sure where the best place is.
x1ddos commented 2 years ago
Poster
Owner

💩 the build fails becase node:18-slim docker image doesn't have git installed

💩 the build fails becase node:18-slim docker image doesn't have git installed
x1ddos force-pushed about from 6d6a3be8a8 to 72f8085b17 2 years ago
x1ddos commented 2 years ago
Poster
Owner

ok, swapped docker image on the ci from 18-slim to 18-alpine and made it install git. alpine is usually faster to install packages.

ok, swapped docker image on the ci from 18-slim to 18-alpine and made it install git. alpine is usually faster to install packages.
x1ddos requested review from offbyn 2 years ago
offbyn approved these changes 2 years ago
offbyn left a comment
Owner

Nice, LGTM with small nits, added some comments.

Nice, LGTM with small nits, added some comments.
src/about.html Outdated
@ -0,0 +7,4 @@
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body>
<main class="text">
offbyn commented 2 years ago
Owner

Nice, maybe also add <h1> title? :)

Nice, maybe also add `<h1>` title? :)
x1ddos marked this conversation as resolved
@ -0,0 +12,4 @@
proc.stdout.on('data', (data) => commit += data.toString().trim());
proc.stderr.on('data', (data) => err += err.toString());
proc.on('close', (code) => code === 0 ? resolve(commit) : reject(err));
});
offbyn commented 2 years ago
Owner

I think exec slightly be preferred instead of spawn https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback

The main difference is that spawn is more suitable for long-running processes with huge output. That's because spawn streams input/output with a child process. On the other hand, exec buffers output in a small (by default 200K) buffer.

https://stackoverflow.com/questions/48698234/node-js-spawn-vs-execute

also could async/await instead Promise, but not strong opinion.

I think `exec` slightly be preferred instead of `spawn` https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback > The main difference is that spawn is more suitable for long-running processes with huge output. That's because spawn streams input/output with a child process. On the other hand, exec buffers output in a small (by default 200K) buffer. https://stackoverflow.com/questions/48698234/node-js-spawn-vs-execute also could async/await instead Promise, but not strong opinion.
offbyn commented 2 years ago
Owner

Never pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution.

should it sanitize rev so we can't write evil stuff in git tag string?

> Never pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution. should it sanitize `rev` so we can't write evil stuff in git tag string?
x1ddos commented 2 years ago
Poster
Owner

didn't want to use exec because it runs in a shell but i didn't need one. it made me look again and turns out there's execFile, spot on.

rewrote to async using util.promisify. this removed a few lines. much easier to read now!

and wrapped all input/output into a sanitizeStr func.

didn't want to use exec because it runs in a shell but i didn't need one. it made me look again and turns out there's `execFile`, spot on. rewrote to async using `util.promisify`. this removed a few lines. much easier to read now! and wrapped all input/output into a `sanitizeStr` func.
@ -0,0 +42,4 @@
loader: 'copy',
}
});
}
offbyn commented 2 years ago
Owner

didn't know that setup(build) { here is es6 shorthand for setup: (build) => { 👍

didn't know that `setup(build) {` here is es6 shorthand for `setup: (build) => {` 👍
offbyn marked this conversation as resolved
offbyn commented 2 years ago
Owner

not sure where the best place is. @offbyn i'll let you figure out where to put the link.

I think for now a link in the profile view should be fine.

also I want to change profile to some gear icon soon, maybe then it would make more sense.

> not sure where the best place is. @offbyn i'll let you figure out where to put the link. I think for now a link in the profile view should be fine. also I want to change profile to some gear icon soon, maybe then it would make more sense.
x1ddos force-pushed about from 72f8085b17 to 69f7b6c2e0 2 years ago
x1ddos force-pushed about from 69f7b6c2e0 to e238bd9018 2 years ago
x1ddos commented 2 years ago
Poster
Owner

hm... merged and pushed from command line but gitea doesn't let me click the button. nothing happens.

image

hm... merged and pushed from command line but gitea doesn't let me click the button. nothing happens. ![image](/attachments/06c6aabe-64a8-4821-8159-0a5931f787b5)
x1ddos closed this pull request 2 years ago
offbyn commented 2 years ago
Owner

linked the about page in #27

linked the about page in https://git.qcode.ch/nostr/nostrweb/pulls/27

Reviewers

offbyn approved these changes 2 years ago
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This pull request cannot be reopened because the branch was deleted.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b about master
git pull origin about

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff about
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/nostrweb#20
Loading…
There is no content yet.