pick it up tomorrow

This commit is contained in:
CatAClock 2025-04-24 00:42:58 -07:00
parent 723f4c15d7
commit 2c643eed9e
6 changed files with 67 additions and 2 deletions

View file

@ -0,0 +1,36 @@
export async function GetPDSWellKnown() {
let Data = await fetch("https://bsky.social/.well-known/oauth-authorization-server", {method: "GET"})
.then((response) => response.json());
return Data;
}
export function CreatePKCE() {
let CodeVerifier = new Uint8Array(100);
let CodeChallenge;
// generate a random string of characters.
crypto.getRandomValues(CodeVerifier);
console.log(CodeVerifier);
CodeVerifier = Uint8Array.toBase64({alphabet: "Base64url"});
// Now generate a code challenge
CodeChallenge = sha256(CodeVerifier.toBase64({alphabet: "Base64url"}));
console.log(CodeVerifier);
console.log(CodeChallenge);
}
// Stolen from elsewhere
// Firefox snippet
async function sha256(message) {
// encode as UTF-8
const msgBuffer = new TextEncoder().encode(message);
// hash the message
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
// convert ArrayBuffer to Array
const hashArray = Array.from(new Uint8Array(hashBuffer));
// convert bytes to hex string
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}

View file

@ -19,6 +19,7 @@ const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
// Websites
let MastodonWebsite = "https://wetdry.world";
// Update a timer
function UpdateTime() {
@ -108,7 +109,7 @@ async function PosterContainerUpdate() {
let RemoteCookie = document.cookie.split("; ").find((row) => row.startsWith("Remote="))?.split("=")[1];
var RemoteTrue = (RemoteCookie === 'true');
let Timeline = await ActivityPub.GetPublicTimeline(LocalTrue, RemoteTrue, MastodonWebsite);
let Timeline = await MastodonAPI.GetPublicTimeline(LocalTrue, RemoteTrue, MastodonWebsite);
let Content = [];
let Users = [];
for (let i in Timeline) {

View file

@ -91,3 +91,7 @@ PopulateNotifications();
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
// The next section is dedicated to testing.
// WARNING: I don't know what I am doing.
BlueskyAPI.CreatePKCE();

View file

@ -5,4 +5,7 @@ A frontend to accessing my account on the fediverse
## technologies
- node on a bare debian install.
- npm and npx to execute it.
- currently only uses the Mastodon V1 API.
- Uses MastodonAPI, BlueskyAPI, and TumblrAPI.
- Your local machine can also run it (with the proper dependencies; take a look at the docker file).
Quick launch server without docker: `npx http-server /home/<HomeDirectory>/Documents/Fedi.CrowdedGames.Group --port 4000 --cors`

3
oauth/README.md Normal file
View file

@ -0,0 +1,3 @@
# Bluesky stuff.
Yeah.

View file

@ -0,0 +1,18 @@
{
"client_id": "https://fedi.crowdedgames.group/oauth/client-metadata.json",
"application_type": "web",
"client_name": "Example Browser App",
"client_uri": "https://fedi.crowdedgames.group",
"dpop_bound_access_tokens": true,
"grant_types": [
"authorization_code",
"refresh_token"
],
"redirect_uris": [
"https://fedi.crowdedgames.group/HTML/mail.html"
],
"response_types": [
"code"
],
"scope": "atproto transition:generic",
}