This commit is contained in:
parent
d67aeebd85
commit
7846a9b24f
94
src/build.ts
94
src/build.ts
|
@ -1,10 +1,10 @@
|
||||||
import * as esbuild from "esbuild"
|
import * as esbuild from "esbuild";
|
||||||
import {watch, cpSync, rmdirSync, readFileSync, ReadStream} from "node:fs"
|
import { watch, cpSync, rmdirSync, readFileSync, ReadStream } from "node:fs";
|
||||||
import { serve } from 'micro';
|
import { serve } from "micro";
|
||||||
import {Server} from "node:http"
|
import { Server } from "node:http";
|
||||||
import handler from "serve-handler"
|
import handler from "serve-handler";
|
||||||
import { Readable } from "node:stream";
|
import { Readable } from "node:stream";
|
||||||
import { WebSocketServer } from 'ws';
|
import { WebSocketServer } from "ws";
|
||||||
|
|
||||||
const script = `let t;function rr() {console.log("connecting to dev server")
|
const script = `let t;function rr() {console.log("connecting to dev server")
|
||||||
let a = new WebSocket("ws://localhost:8081");
|
let a = new WebSocket("ws://localhost:8081");
|
||||||
|
@ -22,67 +22,77 @@ a.addEventListener("close", () => {
|
||||||
t = setTimeout(()=>{
|
t = setTimeout(()=>{
|
||||||
rr()
|
rr()
|
||||||
},1000)
|
},1000)
|
||||||
})};rr();`;
|
})};window.addEventListener("load", () => rr())`;
|
||||||
|
|
||||||
const argv = process.argv.slice(2)
|
const argv = process.argv.slice(2);
|
||||||
|
|
||||||
async function buildTs() {
|
async function buildTs() {
|
||||||
console.log("[dev] Building file..")
|
console.log("[dev] Building file..");
|
||||||
await esbuild.build({
|
await esbuild.build({
|
||||||
entryPoints: ["./src/web/ts/index.ts"],
|
entryPoints: ["./src/web/ts/index.ts"],
|
||||||
outfile: "./src/web/dist.js"
|
outfile: "./src/web/dist.js",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
await buildTs();
|
await buildTs();
|
||||||
|
|
||||||
if(argv[0] == "--build") {
|
if (argv[0] == "--build") {
|
||||||
try{rmdirSync("./dist")}catch{}
|
try {
|
||||||
cpSync("./src/web/", "./dist/", {recursive:true})
|
rmdirSync("./dist");
|
||||||
rmdirSync("./dist/ts",{recursive:true})
|
} catch {}
|
||||||
console.log("[dev] View the dist folder")
|
cpSync("./src/web/", "./dist/", { recursive: true });
|
||||||
|
rmdirSync("./dist/ts", { recursive: true });
|
||||||
|
|
||||||
|
console.log("[dev] View the dist folder");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argv[0] == "--dev") {
|
if (argv[0] == "--dev") {
|
||||||
const wss = new WebSocketServer({ port: 8081 });
|
const wss = new WebSocketServer({ port: 8081 });
|
||||||
let allConnections = new Map<number, WebSocket>();
|
let allConnections = new Map<number, WebSocket>();
|
||||||
wss.on('connection', function connection(ws) {
|
wss.on("connection", function connection(ws) {
|
||||||
const id = Math.random();
|
const id = Math.random();
|
||||||
allConnections.set(id, ws as any);
|
allConnections.set(id, ws as any);
|
||||||
|
|
||||||
ws.on('error', console.error);
|
ws.on("error", console.error);
|
||||||
ws.on("close", () => {
|
ws.on("close", () => {
|
||||||
allConnections.delete(id);
|
allConnections.delete(id);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
const server = new Server(
|
const server = new Server(
|
||||||
serve(async (req, res) => {
|
serve(async (req, res) => {
|
||||||
if(req.url == "/" || req.url?.endsWith(".html")) {
|
await handler(
|
||||||
await handler(req, res, {
|
req,
|
||||||
|
res,
|
||||||
|
{
|
||||||
directoryListing: false,
|
directoryListing: false,
|
||||||
public: "src/web/"
|
public: "src/web/",
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
createReadStream(path, options) {
|
createReadStream(path, options) {
|
||||||
let sx = readFileSync(path).toString("utf8");
|
let sx = readFileSync(path).toString("utf8");
|
||||||
sx = sx.replaceAll("</head>", `<script>${script}</script></head>`)
|
|
||||||
return Readable.from([sx]) as ReadStream
|
if (!path.toString().endsWith(".html")) {
|
||||||
},
|
return Readable.from([sx]) as ReadStream;
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await handler(req, res, {
|
|
||||||
directoryListing: false,
|
|
||||||
public: "src/web/"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sx = sx.replace("<head>", `<head><script>${script}</script>`);
|
||||||
|
return Readable.from([sx]) as ReadStream;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
server.listen(8080)
|
server.listen(8080);
|
||||||
console.log('[http] Listening HTTP on 8080.')
|
console.log("[http] Listening HTTP on 8080.");
|
||||||
watch("./src/web", {
|
watch(
|
||||||
|
"./src/web",
|
||||||
|
{
|
||||||
recursive: true,
|
recursive: true,
|
||||||
}, async (e,f) => {
|
},
|
||||||
if(f == "dist.js") return;
|
async (e, f) => {
|
||||||
console.log("[dev] Noticed update in " + f + ", of type " + e +".")
|
if (f == "dist.js") return;
|
||||||
allConnections.forEach(z => z.send("refresh"));
|
console.log("[dev] Noticed update in " + f + ", of type " + e + ".");
|
||||||
|
allConnections.forEach((z) => z.send("refresh"));
|
||||||
await buildTs();
|
await buildTs();
|
||||||
})
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 937 KiB |
106
src/web/blog.html
Normal file
106
src/web/blog.html
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.2/p5.min.js"
|
||||||
|
integrity="sha512-eu9vkh+EbAsW3fMmPTj/DP5W3UegIdu0Z/OABMocvoofx43MYBkcQ9hRIVxZndV1vcCYQwBg+U1PkWl04TD0Jg=="
|
||||||
|
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://rsms.me/">
|
||||||
|
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
||||||
|
|
||||||
|
<!-- Primary Meta Tags -->
|
||||||
|
<title>soph's blog and information</title>
|
||||||
|
<meta name="title" content="soph's blog and information" />
|
||||||
|
<meta name="description" content="yourfriend.lol v2, soph's blog and information"" />
|
||||||
|
|
||||||
|
<!-- Open Graph / Facebook -->
|
||||||
|
<meta property=" og:type" content="website" />
|
||||||
|
<meta property="og:url" content="https://sad.ovh" />
|
||||||
|
<meta property="og:title" content="soph's blog and information" />
|
||||||
|
<meta property="og:description" content="yourfriend.lol v2, soph's blog and information" />
|
||||||
|
|
||||||
|
<!-- Twitter -->
|
||||||
|
<meta property="twitter:card" content="summary_large_image" />
|
||||||
|
<meta property="twitter:url" content="https://sad.ovh" />
|
||||||
|
<meta property="twitter:title" content="soph's blog and information" />
|
||||||
|
<meta property="twitter:description" content="yourfriend.lol v2, soph's blog and information"" />
|
||||||
|
|
||||||
|
<meta name=" viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kimeiga/bahunya/dist/bahunya.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1> sophie's blog </h1>
|
||||||
|
<a id="return_back" href="/blog" style="display:none;font-size:xx-large;">return back?</a>
|
||||||
|
|
||||||
|
<ul id="html_list" style="display: none">
|
||||||
|
</ul>
|
||||||
|
<div id="renderer"></div>
|
||||||
|
<div style="color:red;font-size:larger;font-weight:bolder;display:none;" id="error">
|
||||||
|
Blog post <span></span> does not exist.
|
||||||
|
</div>
|
||||||
|
<script type="module">
|
||||||
|
function parseMetadata(file) {
|
||||||
|
const splitfile = file.split("\n");
|
||||||
|
const properties = {};
|
||||||
|
for (let i = 0; i < splitfile.length; i++) {
|
||||||
|
const line = splitfile[i];
|
||||||
|
if(/^=+$/gm.test(line)) break;
|
||||||
|
const parts = line.split("=");
|
||||||
|
if(parts.length !== 2) break;
|
||||||
|
properties[parts[0].trim()] = parts[1].trim();
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uriParams = new URLSearchParams(location.search);
|
||||||
|
if (uriParams.has("md")) {
|
||||||
|
const error = document.getElementById("error");
|
||||||
|
const renderer = document.getElementById('renderer');
|
||||||
|
const return_back = document.getElementById("return_back");
|
||||||
|
const req = await fetch("/blogs/" + uriParams.get("md"));
|
||||||
|
if (req.status != 200) {
|
||||||
|
error.style.display = "block";
|
||||||
|
} else {
|
||||||
|
let text = await req.text();
|
||||||
|
const metadata = parseMetadata(text);
|
||||||
|
text = text.split('\n');
|
||||||
|
text.splice(0, Object.keys(metadata).length);
|
||||||
|
text.unshift(metadata.title)
|
||||||
|
text = text.join("\n");
|
||||||
|
renderer.innerHTML = marked.parse(text)
|
||||||
|
}
|
||||||
|
return_back.style.display = "block";
|
||||||
|
} else {
|
||||||
|
const blog_posts = ["opensource-watch-comparison.md", "raspberry-pi-struggles.md", "why-i-syncthing.md"];
|
||||||
|
const html_list = document.getElementById("html_list");
|
||||||
|
html_list.style.display = "block";
|
||||||
|
for (const blog_post of blog_posts) {
|
||||||
|
const req = await fetch("/blogs/" + blog_post);
|
||||||
|
const blog_post_contents = await req.text();
|
||||||
|
let metadata;
|
||||||
|
try {
|
||||||
|
metadata = parseMetadata(blog_post_contents);
|
||||||
|
} catch {
|
||||||
|
console.error("ran into issue loading metadata for blog post " + blog_post)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const li = document.createElement("li");
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = "/blog?md=" + encodeURIComponent(blog_post);
|
||||||
|
a.innerText = `${metadata.title} (created ${new Date(metadata.time * 1000).toGMTString()})`;
|
||||||
|
li.appendChild(a);
|
||||||
|
html_list.appendChild(li);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
22
src/web/blogs/opensource-watch-comparison.md
Normal file
22
src/web/blogs/opensource-watch-comparison.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
title = Opensource watch comparison
|
||||||
|
time = 1721340000
|
||||||
|
========================
|
||||||
|
|
||||||
|
This has been a topic I've been very interested for very long. There's been three main opensource watches, those being the Bangle.js 2, ZSwatch, and Pine64 Pinetime. These all have their pluses and minuses, which I'll talk about in this post. As a disclaimar, I don't own any of these. I'm writing this exact blog post to compare and figure out which one of these is the best one. If there is a best one.
|
||||||
|
|
||||||
|
There is a different talk about other watches, that aren't opensource by themselves, but can be very easily modified to run [opensource firmwares](https://wasp-os.readthedocs.io/en/latest/install.html#device-support) (also see Gadgetbridge's supported gadgets). In my opinion, these watches are sold only for a very small amount of time, and usually don't work on any opensource apps such as Gadgetbridge. I will not be talking about them in this blog post, because I honestly think that they are not a point for comparison.
|
||||||
|
|
||||||
|
## Comparison
|
||||||
|
| Watch name | Price | Prebuilt? | HR sensor | Environmental sensor? | Pressure sensor? | Flash size | GPS? | Temperature? | External SWD? | Score |
|
||||||
|
|-------------|----------------|-----------|-----------|-----------------------|------------------|------------|------|--------------|---------------|-----------------|
|
||||||
|
| Bangle.js 2 | 91,08 EUR | ✅ | ✅ | ✅ | ✅ | 8MB | ✅ | ✅ | ✅ | 7/11 (+0 Price) |
|
||||||
|
| Pinetime | 24,78 EUR | ✅ | ✅ | ❌ | ❌ | 4MB | ❌ | ❌ | ❌ (sealed) | 6/11 (+4 Price) |
|
||||||
|
| ZSWatch | Around 40 euro | ❌ | ❌ | ✅ | ✅ | 16MB | ❌ | ✅ | ✅ | 6/10 (+2 Price) |
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
In my opinion, every single one of these watches is a good option. However, if you have extra money to spend, the Bangle.js 2 is EASILY the best option. If you are on a budget, choose the pinetime. And if you have a lot of time and energy to build a ZSWatch, then do that.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
[Bangle.js 2](https://shop.espruino.com/banglejs2)
|
||||||
|
[ZSWatch](https://github.com/jakkra/ZSWatch?tab=readme-ov-file)
|
||||||
|
[PineTime](https://pine64.com/product/pinetime-smartwatch-sealed/)
|
16
src/web/blogs/raspberry-pi-struggles.md
Normal file
16
src/web/blogs/raspberry-pi-struggles.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
title = raspberry pi struggles
|
||||||
|
time = 1717925441
|
||||||
|
========================
|
||||||
|
|
||||||
|
recently, i have been experiencing struggles with my raspberry pi
|
||||||
|
here i will list all of the issues, maybe you have solutions or something
|
||||||
|
## git randomly breaking
|
||||||
|
this is entierly spontenous, and happens on every distro i've used for RPi3. it just SEGFAULT's after I update the system, and nothing helps, even uninstalling and reinstalling doesn't work.
|
||||||
|
## stdio.h
|
||||||
|
stdio.h has broken on me multiple times, to the point where it starts pulling in fortran sources and other bullshit, forcing me to use qemu on my own PC to compile stuff
|
||||||
|
## random overheating ???
|
||||||
|
my RPi has 0 load, 0 anything. absolutely nothing is being done on it, like 3 processes
|
||||||
|
and it still randomly overheats, to the point where the case has started to droop. it is literally
|
||||||
|
melting before my eyes
|
||||||
|
|
||||||
|
there is something either very wrong with my raspberry Pi, or I've broken something. at this point all I've been using has been STM32's and ESP8266's for my projects, or a hetzner dedi. i don't know why I even maintain most of my own hardware at this point, it serves 0 purpose if I could just parsec into a server with a 4090
|
25
src/web/blogs/why-i-syncthing.md
Normal file
25
src/web/blogs/why-i-syncthing.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
title = Why I ❤️ Syncthing
|
||||||
|
time = 1711916100
|
||||||
|
========================
|
||||||
|
|
||||||
|
I recently moved from Dropbox to Syncthing. It's been one of the best experiences in a long while.
|
||||||
|
## Rationale
|
||||||
|
Dropbox had limited devices, while I wanted to sync multiple devices (such as my phone, laptop and PC and RPi), and it was already hitting that limit. I didn't want to pay for a service which I could self host and use entierly independently of any company. It didn't seem hard to at all to setup Syncthing, as I had found it while scrolling friend's discord servers and finding it there.
|
||||||
|
## How to do it
|
||||||
|
Syncthing might seem complicated to use and maintain, but it's actually not at all complicated.
|
||||||
|
First, you have to have at least two devices. These can be absolutely anything, a VPS, a dedicated server, a PC, a phone, a SBC (such as a RPi, BananaPI, etc). After that you have to install syncthing on one of them (your most reliable one) and then follow https://docs.syncthing.net/intro/getting-started.html to install it. Then, grab your phone, whatever it may be, your second device. Let's say it's a laptop, to ease the setup. You have to install syncthing on that laptop too. Then grab it's device ID (the getting started guide would have thought you this), and then just add the device into the main syncthing. This is painless, happens in less than a minute and works through NAT, many firewalls, etc. I have a RPi with a 2TB harddrive setup in my collage dorms, and one on my dedicated server, and one on my laptop and one of my phone. This gives me insane reliability, if the dedicated server goes down, the syncing will resume once it's back. It's entierly painless, once your RPi goes down your data is still perfectly accessible on your server, laptop and phone.
|
||||||
|
## The experience 4 weeks in
|
||||||
|
It has been absolutely amazing. One time I had to switch the main server from a VPS to a dedicated server, which was pretty easy. I have had almost 0 hurdles, only issue I ever had was Android not supporting certain filenames (names with |\\?*<\":>+[]/' characters), which then caused a desync. Once I removed these characters from my filenames, it instantly synced and worked perfectly. I have ran into 0 other issues, since that. Absolutely smooth sailing
|
||||||
|
## Comparison
|
||||||
|
| Options | Dropbox | Syncthing | Google Drive (one) | Nextcloud | OneDrive |
|
||||||
|
| -------------------------- | ------------------------------- | -------------------- | :------------------ | ----------------------------- | ------------------------------ |
|
||||||
|
| Versioning | 30 days on basic and low plans | Configurable, (♾️) | No idea, not listed | Configurable, (♾️) | No idea, not listed |
|
||||||
|
| Price | 2.09eur (100gb), 10.99eur (2tb) | Server hosting costs | 12USD (2TB) | Server hosting costs | 1.99USD (100gb), 6.99USD (1TB) |
|
||||||
|
| Opensource | No | Yes | No | Yes | No |
|
||||||
|
| 2FA | Yes | No | Yes | Yes | Yes |
|
||||||
|
| Encryption/Encrypted files | No | Yes | Yes | Yes | No |
|
||||||
|
| Free data | 2gb | ♾️ | 15gb | ♾️(if no hosting, 1gb to 8gb) | 5gb |
|
||||||
|
## Final Opinions
|
||||||
|
If you need less than 15GB, just use Google Drive, Dropbox or Onedrive. These also usually come with effords to sync them properly, and don't work on all devices. If you need more than let's say, 1TB, just buy a server from https://contabo.com/en/ or https://www.hetzner.com/sb/ for about the same price, and a LOT more use out of your money.
|
||||||
|
|
||||||
|
(I am not endorsed by any of these websites.)
|
|
@ -77,16 +77,22 @@
|
||||||
<body>
|
<body>
|
||||||
<span class="center">
|
<span class="center">
|
||||||
<div>
|
<div>
|
||||||
<button class="selected" id="home-button">home</button> | <button id="donations-button">donations</button>
|
<button class="selected" id="home-button">home</button> | <button id="donations-button">donations</button> |
|
||||||
|
<a href="/blog"><button>blog</button></a>
|
||||||
</div>
|
</div>
|
||||||
<span id="home">
|
<span id="home">
|
||||||
I'm Latvian, 17. My name's Sophie. I love listening to music, I have <span id="songplays"><loading...></span> song plays.
|
I'm Latvian, 17. My name's Sophie. I love listening to music, I have <span
|
||||||
|
id="songplays"><loading...></span> song plays.
|
||||||
<br>
|
<br>
|
||||||
I am a JS/TS developer, mostly specializing in backend work.
|
I am a JS/TS developer, mostly specializing in backend work.
|
||||||
<br>
|
<br>
|
||||||
I play minecraft, and upgun with friends. I have developed many bukkit plugins for Paper/Folia/Spigot before, and am pretty well versed in them.
|
I play minecraft, and upgun with friends. I have developed many bukkit plugins for Paper/Folia/Spigot
|
||||||
|
before, and am pretty well versed in them.
|
||||||
<br>
|
<br>
|
||||||
Contact me at <a href="https://matrix.to/#/@yourfriend:bark.lgbt">matrix</a>, <a href="https://discord.com/users/845374523263811614">discord</a>, <a href="https://github.com/fucksophie">github (view projects here)</a>, <a href="https://git.sad.ovh/sophie">sadgit</a>, or <a href="https://bark.lgbt/@yourfriend">mastodon</a>
|
Contact me at <a href="https://matrix.to/#/@yourfriend:bark.lgbt">matrix</a>, <a
|
||||||
|
href="https://discord.com/users/845374523263811614">discord</a>, <a
|
||||||
|
href="https://github.com/fucksophie">github (view projects here)</a>, <a
|
||||||
|
href="https://git.sad.ovh/sophie">sadgit</a>, or <a href="https://bark.lgbt/@yourfriend">mastodon</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="/key.txt">Here's my PGP key.</a>
|
<a href="/key.txt">Here's my PGP key.</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -95,9 +101,11 @@
|
||||||
<li>BTC bc1q83jdukjn4a2qm0rmn9tqcfkcq60la22lqy2shx</li>
|
<li>BTC bc1q83jdukjn4a2qm0rmn9tqcfkcq60la22lqy2shx</li>
|
||||||
<li>ETH/BSC/<strong>USDT</strong>/USDC (send via BSC) 0xc691cd8950Fdf96Faa2aCA1CA9b4B3Fd5B2a44BB</li>
|
<li>ETH/BSC/<strong>USDT</strong>/USDC (send via BSC) 0xc691cd8950Fdf96Faa2aCA1CA9b4B3Fd5B2a44BB</li>
|
||||||
<li>SOL 79NKoiXaPzbwbsD5MFKKwmoeEPKtTsoQFfx64MHmULF7</li>
|
<li>SOL 79NKoiXaPzbwbsD5MFKKwmoeEPKtTsoQFfx64MHmULF7</li>
|
||||||
<li><strong>XMR 42iW3icQrybKYieQNSrm76dXetuXD6HaxZDijajXkge7GTSKVG4NefxBj3mbWudpY62dxRTihm4beJgy36X8xFKCTWpVAjS</strong></li>
|
<li><strong>XMR
|
||||||
|
42iW3icQrybKYieQNSrm76dXetuXD6HaxZDijajXkge7GTSKVG4NefxBj3mbWudpY62dxRTihm4beJgy36X8xFKCTWpVAjS</strong>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
OR <a href="https://ko-fi.com/sophskofi">kofi</a>
|
OR <a href="https://ko-fi.com/sophskofi">kofi</a> OR, dm for paypal
|
||||||
<br>
|
<br>
|
||||||
<img src="/sticker.webp" alt="monero-chan" style="width:128px;">
|
<img src="/sticker.webp" alt="monero-chan" style="width:128px;">
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue