• 5 Posts
  • 49 Comments
Joined duela urte bat
cake
Cake day: urt. 08, 2022

help-circle
rss

A thought about sincerity:

If this article’s thesis is: “Love each other. Don’t get cynical. Don’t lose joy”… (the last paragraph)

then maybe the article’s title (and body) should feel uplifting and visionary, instead of sarcastic and fuming.

… then it would transcend its own rage.

  • [just a thought. not specifically directed at you Yσɠƚԋσʂ]

Is your question a form of experimental philosophy?


How to display a specific Lemmy post, in a <div>, on a page? (same server, same domain)
##### THE GOAL To display a specific Lemmy post (or just the comments component) in a `<div>` on a blog page. [`all blog pages`] and [`lemmy`] are in the same `/srv/` directory, served on the same domain. The ideal method would preserve Lemmy-UI's nested-comments, since they are already perfect. The purpose is: a Comments section for a blog, which brings people to the Lemmy forum. ** ##### ENVIRONMENT The [`lemmy instance`] and [`built-Hugo-pages`] are: - on a vps, in the same `/srv/` directory - served on the `same-domain` (no subdomain), by nginx. - The blog pages (hugo) are fully controlled. They are already running some JS scripts. - Lemmy is an ansible install (lemmy in `/srv/lemmy`. blog in `/srv/blog`). ** ##### THE QUESTION Is there a Direct way to display a specific Lemmy Post (or just the comments component) in a `<div>` on a page? ** ##### POSSIBLE IDEAS... Here are the ideas so far (if you have a better idea, I really want to know): ** ##### IDEA I - Inject the Lemmy Post-url at `<Router>`: 1 - Send the desired `Post-url` (or just the `/path`) to Lemmy from the blog (as a "string", via JS)... Maybe the `Post-url` (or `/path`) could be injected here, at `/server/index.tsx` ([line 165](https://github.com/LemmyNet/lemmy-ui/blob/main/src/server/index.tsx#L165)): ``` let isoData: IsoData = { path: req.path, site_res: site, routeData, }; const wrapper = ( <StaticRouter location={req.url} context={isoData}> <App /> </StaticRouter> ); if (context.url) { return res.redirect(context.url); } ``` Or perhaps the Post url (or /path) could be injected here, in `client/index.ts` ([at line 7](https://github.com/LemmyNet/lemmy-ui/blob/main/src/client/index.tsx#L7)): ``` const site = convertWindowJson(GetSiteResponse, window.isoData.site_res); initializeSite(site); const wrapper = ( <BrowserRouter> <App /> </BrowserRouter> ); hydrate(wrapper, document.getElementById("root")); ``` 2 - Now have Lemmy receive the path and display the Post (including the lemmy-UI), using `<blog-div>` as its window. Perhaps by changing the hydrate target from `("root")` to `("blog-div")` here: `hydrate(wrapper, document.getElementById("blog-div"));` 3 - Load the Lemmy CSS sheet, and any necessary JS <scripts>. ** ##### IDEA II - Intercept entire Lemmy Post string from server: 1 - In `/server/index.tsx` ([at line 187](https://github.com/LemmyNet/lemmy-ui/blob/main/src/server/index.tsx#L187))... Get the variable `const root = renderToString(wrapper);` - (which already contains the "inner HTML" for a specific Lemmy post) - currently injected in `res.send` at: `<div id='root'>${root}</div>` ([at line 231](https://github.com/LemmyNet/lemmy-ui/blob/main/src/server/index.tsx#L231)) 2 - Inject that root variable (the inner HTML for a specific Lemmy post) in the `<blog-div>`. 3 - Load the Lemmy CSS sheet, and any necessary JS <scripts>. ** ##### BACKUP PLAN 1 - Get data from Lemmy-JS-Client, Rebuild Comments UI 1 - Use the Lemmy-JS-Client to `GetPost` or `GetSite`. 2 - Then manually rebuild the nested-comments UI by injecting data from JSON objects (using html, js). Which could work, but I wonder if there's a more Direct way - since Lemmy already displays nested-comments perfectly. ** ##### BACKUP PLAN 2 - iFrame Just display the Comments page in an iFrame (and hide the navbar/sidebar). This is the laziest option. ** ##### DETERMINATION I've become a bit obsessed with this question (for months), because Lemmy displays 'nested-comments' perfectly, so it would be great to let Lemmy-UI render them. ** ##### THE QUESTION (TL;DR): Is there a Direct way to display a specific Lemmy Post (or comments component) in a `<blog-div>`? It seems possible - since [`all blog pages`] and [`lemmy`] are - in the same `/srv/` directory, and - served on the same domain An ideal method would utilize Lemmy-UI's nested-comments, since they are already perfect. I’m willing to attempt anything, if there might be a way...
fedilink

Hey, thank you for the reply.

I went through the js-client docs, and the available methods.

Seems GetPost is the one required for importing comments.

I suppose it would arrive (to Hugo) as a json object (identical to the one in the console log of a Lemmy post).

Within that GetPost data, I see that each nested-comment has a parent-comment-id.

**

1 - So would the idea be to rebuild a UI for the nested comments section?

(and then connect other JS-client objects to new UI-elements, such as voting-buttons and reply-inputs)?

2 - Or is there an easier way to display the data, since [Lemmy] and [all built-Hugo-pages] are running on the same server/domain?

(and since Lemmy already has the UI code to build nested comments)

[NOTE: Lemmy is in docker, Hugo-pages are in /srv/]

**

Essentially - What is the suggested/optimal way to display that js-client info on a js-capable static page?

[Please forgive any naiveté in those questions. I am willing to experiment with new approaches.]

I appreciate your response. It’s good to know that this technique is available.


Cool. I often wonder about pulling Lemmy data/components into Hugo (a static website, coded in Go).

For example:

  1. Showing Lemmy ‘cards’ in the main Hugo feed (which display meta info about a Lemmy post (such as: number of comments, topic title, and post summary)).

  2. Or even… displaying a Lemmy post’s entire comment section (creating a nested comment-section for each Hugo post).

It seems like you’ve experimented quite a bit.

Do you feel like either of those is possible?


Hey, thank you for sharing.

May I ask - How are you planning to use them?


After typing a comment, hit “Tab” then “Enter”

It sends without touching the mouse.

[more tabs are required for sending a post]


To me, that’s the problem with the entire “twitter format”… one-sentence posts hurled into a void.

…In two decades, the internet morphed from:

  • careful long-form essays (early 2000’s) to
  • belching choppy phrases with zero context (now).

You are smart to stay in the more intelligent zones.



It will work if you suffix the url with the file extension.

Such as “.jpg” or “.png”

In your example, that would be https://i.ibb.co/ctm60Cx/i2660690070.webp



That’s true. Much better to have clean form with 10% less weight.

Plus, in the long term, it accelerates the progression to heavier weight (especially with the avoidance of injuries, like you said).


The most frequently-used are direct links in the bookmarks bar (with single-letter titles, to display 25 across).

All others, I keep in folders.

To access the ones in folders, you can just type a keyword in the url-bar, and a dropdown will display relevant bookmarks (using chromium).

(for example, you can type ‘coconut’, and bookmarks which contain that keyword will appear)



To be fair, if form and function are the same, then this entire question is tautological. (which is a valid perspective)

For example:

  • You could make a fork that stabs food perfectly (function).
  • You could make that fork shiny, with ornate designs (form).

You could say that both are examples of function, because artistic beauty has a functional purpose (to enhance free expression, and emotional impact).

And that is the frivolity of words… They are mostly redundant (and exist for the beauty of form (which is a function)).


I don’t know why people use twitter for anything…

The UI is bloated, it’s difficult to follow threads, and it loads slowly.

Even worse is when someone shares a twit image or video, to a site like lemmy or reddit. Then hundreds/thousands of people will have to wade through that twit slop.

Much better to just post the image directly, and leave twitter out of it.

So yeah, I agree with you.



Thanks for replying. I see now.

Thought I was in a forum of advanced hydro-dynamic engineers for a second there.


@tomasz - Do you think we should bring them back?


The last word of the comment is loss.

Are people saying “None” because the spout into ‘cup 5’ is a mil lower than the rim of ‘cup 5’? If so, then “None” could make sense.


I’m curious what you mean by this.


SOLVED - Lemmy UI Fork - 502 Bad Gateway error
SOLUTION: The issue was - the ‘New UI’ docker image was automatically building for AMD64, but the Linux server is an ARM64/v8. I had to add QEMU and multi-platform build commands to the docker-image.yml file (in Github Actions). This creates an additional docker image for ARM64 machines, which loads and runs successfully. This was discovered by manually building a docker container, and receiving the following message: `WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested` So if you get that message, you must build your docker image for the platform you are on (or multiple platforms). ** == ** == ** == ** == ** == ** == ** ORIGINAL ERROR: **THE SETUP and ERROR** 1. I made a fresh ansible install, on a fresh ubuntu 20.04 server - the Lemmy instance runs perfectly. 2. I made a fresh fork of the 16.7 Lemmy-UI. 3. I built a docker-image of that forked UI, and loaded it via docker-compose (here is my [docker-image.yml build file](https://privatebin.at/?5882ef055652c602#3gVWY9YzphzrkFNmFLK6KLxWhfR4Fqtx9idoCFrZhnGx) ). Now I am getting a “502 Bad Gateway - nginx” error (the site does not load). NGINX error log shows: ``` connect() failed (111: Connection refused) while connecting to upstream, client: 75.222.232.212, server: ggg.com, request: "GET / HTTP/2.0", upstream: "http://0.0.0.0:15153/", host: "ggg.com" ``` - Nginx config has not been modified (but here is the config anyway - [ggg.conf](https://privatebin.at/?a4ba45299811eda8#GJwMDhkY1GvB4MhX914MwjxHgA9zKXpSCfhNA4rtaRcM)) - Docker log is clean. ** **DIAGNOSIS** When I list docker containers, there is no PORT mapped to the ‘New-UI’ image container. (However, when running the ‘default lemmy-UI’ image container, the PORT is successfully mapped to 127.0.0.1:15153->1234/tcp) It seems I must create a new Container, using the ‘New-UI’ image, and map the PORT to 127.0.0.1:15153->1234/tcp (unless an Environment Variable can do it). ^ Now I must figure out that exact docker command. (because `docker run -d -p 127.0.0.1:15153:1234 [ImageID]` does not successfully create the container.) ** Here are the Env Vars I’ve added (in various combinations/values): ``` lemmy-ui: environment: - LEMMY_UI_HTTPS=true - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 - LEMMY_UI_LEMMY_EXTERNAL_HOST=ggg.com - LEMMY_UI_DISABLE_CSP=true # - LEMMY_UI_LEMMY_WS_HOST=lemmy:8536 # - LEMMY_UI_HOST=0.0.0.0:1234 ``` here is [the full docker-compose.yml](https://privatebin.at/?a00b49548bb76418#3dprkF35H671DFVfyRiGs5tY1FRrNXV9fnBK7ndxugF1) (only changed Env Vars)
fedilink

Adding the UI Environment Variables
QUESTION: Where should we declare those new UI Environment Variables? (from the [readme](https://github.com/LemmyNet/lemmy-ui#readme)) ANSWER: Add the new UI Environment Variables to *docker-compose.yml* (on the server). Like this: ``` lemmy-ui: image: ggg/ui2:latest ports: - "127.0.0.1:23587:1234" restart: always environment: - LEMMY_INTERNAL_HOST=lemmy:8536 - LEMMY_EXTERNAL_HOST=ggg.quest - LEMMY_HTTPS=true - LEMMY_UI_LEMMY_EXTERNAL_HOST=ggg.com - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 - LEMMY_UI_HTTPS=true depends_on: - lemmy ```
fedilink

Clarifying the Ansible Instructions - 2 Questions
A couple questions about the [lemmy-ansible](https://github.com/LemmyNet/lemmy-ansible) instructions: *** **Step 1 - “Clone this repo: /lemmy-ansible.git”** *QUESTION 1* - Clone it to my local machine, correct? (not directly onto the VPS) ***ANSWER: - Yes, clone lemmy-ansible to local.*** *** **Step 2 - “Edit the config file”** *QUESTION 2* - By default, config.hjson has values like hostname: "{{ domain }}" - and - password: "{{ postgres_password }}". - Are those “{{values}}” automatically pulled from the hosts file? - or just directly edit them in the config.hjson file? ***ANSWER: - Edit them directly in the config.hjson file.*** *** Thank you for your patience. I want to do it right / understand. ***UPDATE: Installed Lemmy on VPS via SSH***
fedilink

2 Noob Questions - lemmy File Location / Migration
Hello Lemmy people, I’m trying to wrap my head around where editable files ultimately ‘live’ after Ansible install to a VPS. For example: 1. If you want to modify a specific cell in a Postgres table using Arctype (or another SQL GUI) - would you be: - directly modifying the VPS instance? - or modifying a mirrored database on your local computer? *** 2. If you setup Lemmy using a ‘1 year free trial’ from a VPS (like digital ocean)...and then want to migrate the Lemmy instance to another VPS (like Hetzner), would you be: - ‘pushing’ the custom Lemmy instance from your local computer to a new VPS? - or directly migrating the files from one VPS to the other? --- I realize these are noob questions. Thank you for your patience. Lemmy looks really cool.
fedilink