mirror of
https://github.com/turbomaster95/coderrrrr.git
synced 2025-08-02 02:32:24 +00:00
Compare commits
5 Commits
025fa5cef5
...
93065cb026
Author | SHA1 | Date | |
---|---|---|---|
93065cb026 | |||
c18b0f4400 | |||
889aa4b042 | |||
37a2af1fd3 | |||
cdf2d05004 |
@ -1,35 +1,57 @@
|
|||||||
import type { VercelRequest, VercelResponse } from '@vercel/node';
|
import type { VercelRequest, VercelResponse } from '@vercel/node';
|
||||||
|
|
||||||
export default function (req: VercelRequest, res: VercelResponse) {
|
export default function (req: VercelRequest, res: VercelResponse) {
|
||||||
|
// Get the resource query parameter
|
||||||
const { resource } = req.query;
|
const { resource } = req.query;
|
||||||
res.statusCode = 200;
|
|
||||||
res.setHeader("Content-Type", `application/jrd+json`);
|
if (!resource || typeof resource !== "string") {
|
||||||
res.end(`{
|
res.status(400).json({ error: "Missing or invalid resource parameter" });
|
||||||
"subject": "acct:blog@coderrrrr.site",
|
return;
|
||||||
"aliases": [
|
}
|
||||||
"https://coderrrrr.site/blog",
|
|
||||||
"https://coderrrrr.site/@blog"
|
// Expected format: acct:username@coderrrrr.site
|
||||||
],
|
const match = resource.match(/^acct:([^@]+)@coderrrrr\.site$/i);
|
||||||
"links": [
|
if (!match) {
|
||||||
{
|
res.status(400).json({ error: "Resource format not supported" });
|
||||||
"rel": "http://webfinger.net/rel/profile-page",
|
return;
|
||||||
"type": "text/html",
|
}
|
||||||
"href": "https://coderrrrr.site/@blog"
|
const username = match[1].toLowerCase();
|
||||||
},
|
|
||||||
{
|
// Determine the profile URL based on the username.
|
||||||
"rel": "self",
|
// For this example, we support only the "blog" account.
|
||||||
"type": "application/activity+json",
|
// You can add more supported usernames as needed.
|
||||||
"href": "https://coderrrrr.site/@blog"
|
let profileUrl: string;
|
||||||
},
|
if (username === "blog") {
|
||||||
{
|
profileUrl = "https://coderrrrr.site/@blog";
|
||||||
"rel": "http://ostatus.org/schema/1.0/subscribe",
|
} else {
|
||||||
"template": "https://coderrrrr.site/authorize_interaction?uri={uri}"
|
// If the username is not recognized, return a 404.
|
||||||
},
|
res.status(404).json({ error: "User not found" });
|
||||||
{
|
return;
|
||||||
"rel": "http://webfinger.net/rel/avatar",
|
}
|
||||||
"type": "image/png",
|
|
||||||
"href": "https://files.usr.cloud/v1/AUTH_f22cbcf5b3904990be9696691ff73fc6/files.usr.cloud/accounts/avatars/113/822/701/816/479/941/original/7d7f6088ba1ddd57.png"
|
// Build the WebFinger response object
|
||||||
}
|
const webfingerResponse = {
|
||||||
]
|
subject: resource,
|
||||||
}`);
|
aliases: [profileUrl],
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
rel: "http://webfinger.net/rel/profile-page",
|
||||||
|
type: "text/html",
|
||||||
|
href: profileUrl
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rel: "self",
|
||||||
|
type: "application/activity+json",
|
||||||
|
href: profileUrl
|
||||||
|
},
|
||||||
|
// Optional: Add a subscription template if needed.
|
||||||
|
{
|
||||||
|
rel: "http://ostatus.org/schema/1.0/subscribe",
|
||||||
|
template: "https://coderrrrr.site/authorize_interaction?uri={uri}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
res.setHeader("Content-Type", "application/jrd+json");
|
||||||
|
res.status(200).json(webfingerResponse);
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,17 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>coderrrrr</title>
|
<title>coderrrrr</title>
|
||||||
<link href="https://github.com/turbomaster95" rel="me"></a>
|
<link href="https://github.com/turbomaster95" rel="me"></a>
|
||||||
<!-- <link href="https://usr.cloud/@coder" rel="me"> -->
|
<link href="https://usr.cloud/@coder" rel="me">
|
||||||
<link rel="webmention" href="https://webmention.io/coderrrrr.site/webmention" />
|
<link rel="webmention" href="https://webmention.io/coderrrrr.site/webmention" />
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://blog.coderrrrr.site/index.xml" />
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://blog.coderrrrr.site/index.xml" />
|
||||||
<link rel="openid.delegate" href="https://coderrrrr.site/"/>
|
<link rel="openid.delegate" href="https://coderrrrr.site/"/>
|
||||||
<link rel="openid.server" href="https://indieauth.com/openid"/>
|
<link rel="openid.server" href="https://indieauth.com/openid"/>
|
||||||
<link rel="authorization_endpoint" href="https://indieauth.com/auth"/>
|
<link rel="authorization_endpoint" href="https://indieauth.com/auth"/>
|
||||||
<link rel="token_endpoint" href="https://tokens.indieauth.com/token"/>
|
<link rel="token_endpoint" href="https://tokens.indieauth.com/token"/>
|
||||||
<link href="https://coderrrrr.site/coder" rel="alternate" type="application/activity+json">
|
<link href="https://coderrrrr.site/@blog" rel="alternate" type="application/activity+json">
|
||||||
<link rel="webfinger" href="https://coderrrrr.site/.well-known/webfinger">
|
<link rel="webfinger" href="https://coderrrrr.site/.well-known/webfinger">
|
||||||
<link href="indeedlayout.css" rel="stylesheet" type="text/css" media="all">
|
<link href="indeedlayout.css" rel="stylesheet" type="text/css" media="all">
|
||||||
|
<script href="/swatch.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
@ -45,6 +46,7 @@
|
|||||||
<!--put a short bit about yourself or your site in this div; if it's outside a div it'll look a little weird.-->
|
<!--put a short bit about yourself or your site in this div; if it's outside a div it'll look a little weird.-->
|
||||||
<div>
|
<div>
|
||||||
<p>Deva, 19, he/him. India-based programmer & indie web enthusiast; likes building random things!</p>
|
<p>Deva, 19, he/him. India-based programmer & indie web enthusiast; likes building random things!</p>
|
||||||
|
<span id="swatchClock">@unkown</span>
|
||||||
</div>
|
</div>
|
||||||
<!--end of text div-->
|
<!--end of text div-->
|
||||||
|
|
||||||
|
37
swatch.js
Normal file
37
swatch.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// https://melonking.net - Swatch Clock! v2
|
||||||
|
// The script displays a live Swatch Internet Time clock on your website!
|
||||||
|
// For more info on swatch time visit https://wiki.melonland.net/swatch_time
|
||||||
|
//
|
||||||
|
// How to this script; just paste this onto your site where ever you want the clock to show:
|
||||||
|
// <span id="swatchClock">@000</span>
|
||||||
|
// OR if you dont want the info link
|
||||||
|
// <span id="swatchClock-nolink">@000</span>
|
||||||
|
// <script defer src="https://melonking.net/scripts/swatchTime.js"></script>
|
||||||
|
|
||||||
|
var swatchClock = document.getElementById("swatchClock");
|
||||||
|
var swatchClockNoLink = document.getElementById("swatchClock-nolink");
|
||||||
|
function updateSwatchClock() {
|
||||||
|
if (swatchClock != null) swatchClock.innerHTML = '<a style="color:red" href="https://wiki.melonland.net/swatch_time" target="_blank">@' + GetSwatchTime() + "</a>";
|
||||||
|
if (swatchClockNoLink != null) swatchClockNoLink.innerHTML = "@" + GetSwatchTime();
|
||||||
|
}
|
||||||
|
setInterval(updateSwatchClock, 864);
|
||||||
|
function GetSwatchTime(showDecimals = true) {
|
||||||
|
// get date in UTC/GMT
|
||||||
|
var date = new Date();
|
||||||
|
var hours = date.getUTCHours();
|
||||||
|
var minutes = date.getUTCMinutes();
|
||||||
|
var seconds = date.getUTCSeconds();
|
||||||
|
var milliseconds = date.getUTCMilliseconds();
|
||||||
|
// add hour to get time in Switzerland
|
||||||
|
hours = hours == 23 ? 0 : hours + 1;
|
||||||
|
// time in seconds
|
||||||
|
var timeInMilliseconds = ((hours * 60 + minutes) * 60 + seconds) * 1000 + milliseconds;
|
||||||
|
// there are 86.4 seconds in a beat
|
||||||
|
var millisecondsInABeat = 86400;
|
||||||
|
// calculate beats to two decimal places
|
||||||
|
if (showDecimals) {
|
||||||
|
return Math.abs(timeInMilliseconds / millisecondsInABeat).toFixed(2);
|
||||||
|
} else {
|
||||||
|
return Math.floor(Math.abs(timeInMilliseconds / millisecondsInABeat));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user