ProtecyaTec

joined 2 years ago
[–] [email protected] 1 points 1 week ago* (last edited 1 week ago)

Not a single modern system does that. It’s terrible practice and won’t even pass automated code reviews with sane settings.

What you're talking about is semantics. At a base level, whether you use a templating engine, include / require, or just straight up mix HTML / PHP - PHP "stops execution" to output to the browser. The few exceptions to this that I can think of is if it's instead handing off that responsibility to JS or some other frontend processor.

Templating engines are cool. They make it easier to separate your views from logic. It makes interloping more straight-forward and possibly more maintainable (though, not always - Engines don't save from bad practices), but I do not agree that it's defacto. I think the strength of PHP is it's ease to just jump into it and get something working, right "out of the box". The ease of mixing PHP and HTML is a boon from an entry level aspect. Low entry level leads to wider adoption, leads to more discussions, more volunteers for FOSS, more bug reports, more more more.

I could create a vanilla PHP application that organizes views just as well without a templating engine which could be understood by someone with baseline PHP knowledge - that's good thing. It's inherit to PHP and I won't need to worry about keeping any templating library updated or ported to a new engine. In my made-up vanilla app, I wouldn't do what 4chan did in their views, but I may do what WordPress does in your example because, used sparingly, in an organized application, it's not that big of a deal. For the most part though, I do like to keep my HTML views and my PHP logic separate in an MVC kind of way either through templating or just straight up includes.

[–] [email protected] 2 points 1 week ago (1 children)

This is unfortunate. My first NAS was an ASUS and it sucked balls to the point I made the switch to Synology and was able to get everything I needed working. Storage, external view access, connection to my apps. IDK what ima do when I need to move NAS solutions.

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago) (2 children)

I completely disagree.

Intermingling PHP and HTML is one of PHP strengths. The processing/executing difference you're describing is almost always negligible due to how PHP is optimized (specifically for this kind of thing - outputting HTML to the browser sometimes).

Seriously, compare this to the 4chan image board view we really aren't looking at the same source code. In comparison, the WordPress function is blocked, purposeful, together. It's a single CSS block output all at once. On the otherhand, in the linked 4chan discussion board PHP file, it echos as strings, broken up by multiple conditionals, and is difficult (even from an IDE perspective on highlighting) to tell where a block starts and where it ends (again due to it being echo'd in strings, and broken by conditionals). Trying to modify this blocked CSS is going to be wayyyyyyyyyyyyyyyyyyyy easier than trying to modify a bunch of printed HTML strings broken up by multiple nested conditionals. Plus it's just straight-up easier to read and straight-forward to understand what the function does right away.

To harp on this even more, one of the benefits of blocking HTML in this way is IDE highlighting. In your example, if you were to pop that into a modern IDE like VSCode, it'll highlight tags and allow collapsing like a normal HTML doc. It'll probably even highlight the CSS as expected. On the other-hand, by echoing / printing HTML strings, IDEs aren't going to highlight these things as HTML since they're PHP strings, and in the case of the imageboard, it's going to struggle finding matching open/end tags due to PHP strings and broken conditionals. I'd much prefer the WordPress example over echo / printing multiple lines of HTML strings (this is really a pet-peeve of mine).

I can't think of a single system that doesn't "stop PHP executing" at some point to output HTML in some way. Maybe an app that dynamically pulls it's views in through JS I guess.

For comparison to future readers, this is just a small portion of the imageboard which goes on like this for another 600 lines:

	if( $resno ) {
		$closed = $log[$resno]['closed'] || $log[$resno]['archived'];
		
		if( !$stripm ) {
			$msg .= '<div class="navLinks mobile">
	<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>';
		}

			if( !$stripm ) $msg .= '<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_REPLY . '</a></div>';
	} else {
		if( !$stripm ) $msg .= '
<div class="navLinks mobile">
	<span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_THREAD . '</a></div>';
	}

Formatting and structure is important for a readable framework / project and longevity. 4chan had none of this - Moot took the bag and ran and whoever took it over just left left the PHP standards/organization in 2003.

[–] [email protected] 1 points 1 week ago* (last edited 1 week ago) (5 children)

Really though, it doesn't.

Github -> WordPress

Github -> 4chan

I absolutely hate the way 4chan formats their HTML + PHP intermingling in views. That's not to say WordPress doesn't do this as well, but oh man in a much better, cleaner, and more sparingly way. The 4chan imageboard view Github -> 4chan is absolute chaos. Why this wasn't rewritten is beyond me. That's just the first thing I see as I peruse the source, I can't imagine it gets much better from here.

Here's a fun exercise: What's the deepest nest in this loop? Github -> 4chan Bonus points: What's the deepest nested statement in the whole source?

[–] [email protected] 3 points 2 months ago (4 children)

That's part of the problem with the media circle we're in here in the U.S. - 4 of the richest American own and run 7/10 the most popular websites on the entire internet. The people who need to be reached won't leave their platform because it's all they know.

The only way to actually reach people, to actually make change, is IRL. Write letters, attend protests, invite people to protests, encourage discussion outside an online space.

[–] [email protected] 11 points 2 months ago* (last edited 2 months ago) (2 children)

4 of the richest men in the world who own 7/10 of the most popular websites on the internet donated to and sat at The Presidents inauguration. They own the information pipeline and can literally control propaganda completely unchecked and unsupervised. Most of those gun toting freedom fighters use those platforms because it's all they know. Their family is on it, their business is on it, their news comes from it, they get their daily dopamine kicks from it.

There isn't going to be any Civil War. It's just going to be a slow rotation into what Russia currently is now. Little by little by little, hardly noticable changes, over a long enough period of time (say 4 years or so), until one day they wake up and say "Well, it was better then but there's nothing we can do about it now." and go about their day.

The next war is going to be a war of ideas and a war of messaging. We can't rely on online outreach and have to be proactive IRL spreading messages that it really is a class war. There's no better time than now, no more apparent point in history than today, it's just pulling those people away from the propaganda for them to realize it. Somehow, We The People, need to convince the Boiling Frogs.

[–] [email protected] 3 points 2 months ago

I saw that, I wasn't commenting to your entire opinion which is why I quoted the specific parts I was referring to.

The only thing he’s spreading is the illusion there is place for progressives in that horrible party

That's not the message I'm getting from his talks and video blog updates. Maybe stop reading article headlines and head to the source directly to reinforce your opinion on the message he's spreading. I don't think you're here to convince people of some kind of solution or better future though. All you've done is doomsay and complain. None of your opinions address the current message he's trying to get to the people, which is that Billionaires are buying Politicians and money in Politics is a huge problem right now, and We, The People, need to voice our opinions on it or do something about it before it gets too bad.

Your Doomsaying only distracts from the current problems at hand, which I'm willing to bet you understand.

[–] [email protected] 2 points 2 months ago (2 children)

Your claim is that "Bernie being the only one voting 'no' is virtue signaling." where my point is that if you know a vote is going to pass or fail, you might as well either stand out of use that opportunity to voice your opinion. If a vote is going to pass regardless of Bernies vote, who care if he wants to use that as a catalyst to spread his message, ideas, and opinions.

[–] [email protected] 3 points 2 months ago

This honestly isn't a bad idea at this point. It would still take a ton of money, a ton of support, a ton of boots on the ground to achieve though. It would really need to snowball into a movement. Who are the superfriends of "Fuck you, pay Americans fairly" kind of politicians?

[–] [email protected] 27 points 2 months ago* (last edited 2 months ago) (2 children)

Real Question - Bernie Sanders is old; it's 83. If Bernie passes - who carries on his message? AOC? Who fr? You?

Which, in my opinion, the message is honest outreach to people, IRL, and share the message that Billionares are buying our Politicians which needs to be addressed (like, the sooner the better)?

[–] [email protected] 4 points 2 months ago* (last edited 2 months ago) (4 children)

He and other fake progressives do this when they are absolutely sure it will have no consequences.

Not when it’s possibly a close call. Pure empty virtue signaling.

First off, based on everything else he does - who fucking cares fr What a great way to both share your stance on an issue and garner attention for your causes - stand out. It's both harmless and clever - in American Politics even.

[–] [email protected] 2 points 2 months ago

First off, there's nothing we can do about moving away from larger hosting Corporations, not with the technology we currently have. If we want to reach a national or international audience, we need infrastructure, and that has to come from somewhere; a business model makes sense. If you're hosting to a small community, you'd be able to get away with 1 selfhost, but to scale you'd need redundancies and bandwidth. The best choice we can make is the companies we would rather do business with. At this point, I'm definitely favoring Cloudflare and Azure (in that order) over AWS.

I would argue that the fractured - often openly hostile - intra-instance infighting on Lemmy feeds directly into OP’s image’s “this is too weird and scary” attitude.

I see this in a lot of comments about this so while I don't want to downplay the severity of this, I've personally never see instance in-fighting. Maybe it's the things I'm subscribed to, idk, but I usually visit both my local and all just to see what's going on. The Hexbear domain being sold is probably one of the first times I've run across discussions about other instances. Also, their domain being sold is lowkey hilarious. That was a problem as old as the internet (losing a domain). As we move to decentralization and privatization/ownership of data that's going to continue to be a thing I think.

Its the same intra-channel fighting we saw on Reddit,

Maybe I'm misunderstanding the intra-channel fighting - is it just disagreeable people commenting, or is it like "This community is better than that" or "This instance is better than that"? I often see discussions on Reddit, arguing, bad faith actors, but I wouldn't classify that as in-channel-fighting. idk.

There’s not a lot we can do about it individually.

Complain. JoinLemmy is Open Source on Github. If you have ideas - share them. If you take a look through their issues and feel like adding in your 2 cents, go for it.

 

What are y'all using for your offline game libraries? I ended up getting Resident Evil on GoG and started thinking about how I can host these on a NAS. Maybe something Dockerized?

Jellyfin for music and video

Immich for images

Audiobookshelf for Audiobooks

??? for Gaming?

 

I feel like I have a doozy of a complicated issue and am looking for some guidance.

I'm new to Selfhosting so I got myself an off-the-shelf Asustor NAS. It's got apps which is cool, so I've installed Jellyfin. I want to access my Jellyfin over the web so I've set up DDNS via my Asusstor Manual Connect and FreeDNS. This works well, I can access it over HTTP but the domain is... kind of long and unpleasant, so I got myself a "pretty" domain and setup a CNAME to the FreeDNS. I'm port forwarding on my router, everything works, so far so good.

To make it overtly complicated, I want to make the connection HTTPS. This is where I'm struggling. I've set up the SSL cert for my "pretty" domain via Lets Encrypt, but it times out. I'm not sure if, or how I can make the FreeDNS HTTPS or covered under my Lets Encrypt cert since I don't technically own the FreeDNS domain. My provider doesn't give my any wildcard options on the "pretty" domains cert either.

I've got the HTTPS set on my Asustor and Jellyfin based on the "pretty" domains SSL cert. I've got my port-forwarding 443 to Jellyfins suggested HTTPS port on my router. I feel like the lynchpin is the FreeDNS subdomain handing off the DDNS request but I'm not sure how to solve it. Any suggestions on how I can get this setup to work? Anyone else run a similar setup where they access their local X port via the web via HTTPS?

Open to similar experiences, suggestions, ideas, pretty much anything at this point.

24
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 

I've started working with Media Servers recently and am starting to get acustom to Jellyfin. I'm using Book Lib Connect and AAX Audio Converter to download and convert my purchased Audiobooks.

I would like my Audiobooks to retain chapters, but I'm not sure the export I'm getting from the above is fully compatible with Jellyfin. Here's what I've tried so far:

Audiobooks

  • Author
    • Book
      • (01) Opening Credits.m4b
      • (02) Chapter 1.m4b
      • etc.
      • Book.txt
      • metadata.json
      • chapters.json

I also have the full m4b file and the aax file in an ignored folder at the top of the book.

Book.txt contains the author, title, narrator, publish year, description, duration. Separated by new lines.

metadata.json contains specific information like purchase date, product #, author #, SKU.

chapters.json contains the actual chapter titles. chapter length, start offset.

Any ideas on how I can get Jellyfin to read the json files? Do I need to write a conversion script into some other file type? Maybe Jellyfin isn't the right software for Audiobooks?

I'm open to ideas, suggestions, or any other advice.

 

I'm trying to better understand hosting a Lemmy Instance. Lurking discussions it seems like some people are hosting from the Cloud or VPS. My understanding is that it's better to futureproof by running your own home server so that you have the data and the top most control of hardware, software etc. My understanding is that by hosting an instance via Cloud or VPS you are offloading the data / information to a 3rd party.

Are people actually running their own actual self-hosted servers from home? Do you have any recommended guides on running a Lemmy Instance?

view more: next ›