4853
Part of @thedevs Rules: @rulesforthedevs Join other dev groups https://thedevs.network
Hi guys I just added same new features on bloom https://github.com/hassanmiguel/Bloom-V.3.9.0. Kindly not I just add I didn't made the project from scratch bloom is free
Читать полностью…
I did create a function returning two strings as object though as openat2 suggested
Читать полностью…
I've assumed you mean mailto: and sms: URLs, like the ones in Android or web links:sms: / smsto: / mms: URLs return a String with the body.mailto: URLs return a MailContent object with the subject and body.
import java.net.URLDecoder;Читать полностью…
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public final class MessageUrlParser {
public record MailContent(String subject, String body) {}
/**
* Parses a message URL.
*
* @return a {@link String} body for sms:/smsto:/mms: URLs,
* a {@link MailContent} for mailto: URLs
* @throws IllegalArgumentException for unsupported or malformed URLs
*/
public static Object parse(String url) {
if (url == null || url.isBlank()) {
throw new IllegalArgumentException("URL is empty");
}
int colon = url.indexOf(':');
if (colon < 0) {
throw new IllegalArgumentException("Missing scheme: " + url);
}
String scheme = url.substring(0, colon).toLowerCase();
String rest = url.substring(colon + 1);
Map<String, String> params = parseQuery(rest, scheme);
return switch (scheme) {
case "mailto" -> new MailContent(
params.getOrDefault("subject", ""),
params.getOrDefault("body", ""));
case "sms", "smsto", "mms", "mmsto" -> params.getOrDefault("body", "");
default -> throw new IllegalArgumentException("Unsupported scheme: " + scheme);
};
}
private static Map<String, String> parseQuery(String rest, String scheme) {
Map<String, String> params = new HashMap<>();
int start = rest.indexOf('?');
// iOS-style SMS links sometimes use '&' instead of '?': sms:123&body=hi
if (start < 0 && scheme.startsWith("sms")) {
start = rest.indexOf('&');
}
if (start < 0) {
return params;
}
for (String pair : rest.substring(start + 1).split("&")) {
if (pair.isEmpty()) continue;
int eq = pair.indexOf('=');
String key = decode(eq < 0 ? pair : pair.substring(0, eq)).toLowerCase();
String value = eq < 0 ? "" : decode(pair.substring(eq + 1));
params.putIfAbsent(key, value); // first occurrence wins
}
return params;
}
private static String decode(String s) {
// In mailto/sms URLs '+' is a literal plus, not a space (RFC 6068),
// so protect it before URLDecoder turns it into a space.
return URLDecoder.decode(s.replace("+", "%2B"), StandardCharsets.UTF_8);
}
}
This solution was kind of right even though the question was not proper
Читать полностью…
Yeah that would need another line of destructuring the object.
Читать полностью…
That would need another function fo its own then.
export const ver_subject = `Please verify email for food_app`,
ver_body = `
<p>Hi there,</p>
<p>Click the link below to verify your email address:</p>
<p><a href="${url}">Verify Email</a></p>
<p>This link expires in 1 hour.</p>
<p>If you didn't create an account, you can safely ignore this email.</p>
`;
I have a string file to keep all strings in one place. Need to pass other variables in one of the string. Is there a way to do that?
Читать полностью…
I hope all of you who been using containerization for isolation/security have already migrated to MicroVMs.
The kernel sandbox escapes are getting more and more common accelerated by AI.
Here is CVE-2026-99999 with 9.3 score.
https://pwn.ai/blog/pwnescape
Far better reply than whatever you had sent and deleted. Thanks
Читать полностью…
What do you mean (lol, it's written in rust) ? I don't understand
Читать полностью…
jxl image format was finally shipped by chrome (lol, it's written in rust).
https://developer.chrome.com/blog/jpeg-xl-in-chrome
Posting about events like this is not suitable for a global group
Читать полностью…
xeramail is supposed to send mails but it fails with the error too.
Читать полностью…
What's this though. I am just using nodemailer for email verification there.
Читать полностью…
"import attributes" is simpler approach that won't fail on runtime.
import loginTemplate from "./login.html" with { type "text" };
//use loginTemplate accordingly
Читать полностью…
This is an expression not merely a "string".
Also, "I have a string file" is misleading if it's a normal JavaScript module file.
Create a function which takes url and returns a string of body or an object containing subject and body
Does anyone want to collaborate with me to generate income?
Читать полностью…
I meant its interesting to note that they rewrote the image decoder in rust.
Читать полностью…
SI will take care of that.
It's very efficient than humans in checking latest updates > checking vulnerabilities with new updates > ensuring deps are not broken.