Monday, January 31, 2022

Re: www/purritobin: @sample files (Was Re: [update] net/usockets-0.8.1, www/uwebsockets-20.8.0, www/purritobin-0.6.7)

On 22/01/31 02:18PM, Omar Polo wrote:
>
> Stuart Henderson <stu@spacehopper.org> writes:
>
> > On 2022/01/30 21:22, Aisha Tammy wrote:
> >> I think it should be fine to not manually put the examples in
> >> /var/www/purritobin.
> >> It is mentioned in the README so it should be fine
> >
> > Why not just @sample it? Saves users having to copy the file around
> > by hand. If the user doesn't make any changes then it will automatically
> > get updated, and if they do it will be left alone.
> >
> >> > I've not played too much with the web interface, but I think it should
> >> > be mentioned somewhere that /usr/local/share/PurritoBin/index.html uses
> >> > bsd.ca by default and that users that want to deploy their own instance
> >> > need to change PURRITOBIN_URL (diff below doesn't address this.)
> >>
> >> Same with the above point, I think as it is an example (and that anyone
> >> who wants to deal with crypto stuff should be paying attention)
> >
> > https isn't anything special, shouldn't this be made as easy as possible?
>
> what about something like this?
>
> it @samples the html files in the correct place and makes so that by
> default uses the current hostname to post the bins instead of hardcoding
> bsd.ac. I expect most people to run purritobin on the same host as the
> webserver, so this is pkg_add -u friendly and doesn't need further
> actions by the users.
>
>
> Index: Makefile
> ===================================================================
> RCS file: /home/cvs/ports/www/purritobin/Makefile,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile
> --- Makefile 31 Jan 2022 08:45:05 -0000 1.5
> +++ Makefile 31 Jan 2022 12:10:47 -0000
> @@ -2,6 +2,7 @@
>
> COMMENT = minimalistic command line pastebin
> PKGNAME = ${DISTNAME:L}
> +REVISION = 0
> CATEGORIES = www net
>
> GH_ACCOUNT = PurritoBin
> Index: patches/patch-frontend_index_html
> ===================================================================
> RCS file: patches/patch-frontend_index_html
> diff -N patches/patch-frontend_index_html
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-frontend_index_html 31 Jan 2022 13:14:59 -0000
> @@ -0,0 +1,14 @@
> +$OpenBSD$
> +
> +Index: frontend/index.html
> +--- frontend/index.html.orig
> ++++ frontend/index.html
> +@@ -26,7 +26,7 @@
> + the pasting website in its headers.
> + Look at the man page for an example.
> + */
> +- var PURRITOBIN_URL = "https://bsd.ac:42069";
> ++ var PURRITOBIN_URL = location.protocol+"//"+location.host+":42069";
> +

Oh, this is quite nice!
I'll add this patch in the repo too!

It should hopefully be fine for this small patch to be in the tree for now.

> + /********************************************/
> + function makeHttpObject() {
> Index: pkg/PLIST
> ===================================================================
> RCS file: /home/cvs/ports/www/purritobin/pkg/PLIST,v
> retrieving revision 1.3
> diff -u -p -r1.3 PLIST
> --- pkg/PLIST 31 Jan 2022 08:45:06 -0000 1.3
> +++ pkg/PLIST 31 Jan 2022 12:23:43 -0000
> @@ -4,13 +4,18 @@
> @rcscript ${RCDIR}/purritobin
> @bin bin/purrito
> @man man/man1/purrito.1
> -share/PurritoBin/
> -share/PurritoBin/POSIX_shell_client.sh
> -share/PurritoBin/about.html
> -share/PurritoBin/index.html
> -share/PurritoBin/paste.html
> share/doc/pkg-readmes/${PKGSTEM}
> @owner _purritobin
> @group _purritobin
> @sample /var/db/purritobin/
> @sample /var/www/purritobin/
> +@owner
> +@group
> +share/PurritoBin/
> +share/PurritoBin/POSIX_shell_client.sh
> +share/PurritoBin/about.html
> +@sample /var/www/purritobin/about.html
> +share/PurritoBin/index.html
> +@sample /var/www/purritobin/index.html
> +share/PurritoBin/paste.html
> +@sample /var/www/purritobin/paste.html
>

Regarding the bottom sample, the concept and change is fine but I don't understand it fully.
Does it automagically copy the files from share/ to /var/www/ ?

I read the @sample explanation in porting topics but this doesn't seem to be applicable there (its not under /share/examples).

No comments:

Post a Comment