pick it up tomorrow
This commit is contained in:
parent
723f4c15d7
commit
2c643eed9e
6 changed files with 67 additions and 2 deletions
|
@ -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;
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
|
||||||
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
|
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
|
||||||
|
|
||||||
// Websites
|
// Websites
|
||||||
|
let MastodonWebsite = "https://wetdry.world";
|
||||||
|
|
||||||
// Update a timer
|
// Update a timer
|
||||||
function UpdateTime() {
|
function UpdateTime() {
|
||||||
|
@ -108,7 +109,7 @@ async function PosterContainerUpdate() {
|
||||||
let RemoteCookie = document.cookie.split("; ").find((row) => row.startsWith("Remote="))?.split("=")[1];
|
let RemoteCookie = document.cookie.split("; ").find((row) => row.startsWith("Remote="))?.split("=")[1];
|
||||||
var RemoteTrue = (RemoteCookie === 'true');
|
var RemoteTrue = (RemoteCookie === 'true');
|
||||||
|
|
||||||
let Timeline = await ActivityPub.GetPublicTimeline(LocalTrue, RemoteTrue, MastodonWebsite);
|
let Timeline = await MastodonAPI.GetPublicTimeline(LocalTrue, RemoteTrue, MastodonWebsite);
|
||||||
let Content = [];
|
let Content = [];
|
||||||
let Users = [];
|
let Users = [];
|
||||||
for (let i in Timeline) {
|
for (let i in Timeline) {
|
||||||
|
|
|
@ -91,3 +91,7 @@ PopulateNotifications();
|
||||||
function getRandomArbitrary(min, max) {
|
function getRandomArbitrary(min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The next section is dedicated to testing.
|
||||||
|
// WARNING: I don't know what I am doing.
|
||||||
|
BlueskyAPI.CreatePKCE();
|
||||||
|
|
|
@ -5,4 +5,7 @@ A frontend to accessing my account on the fediverse
|
||||||
## technologies
|
## technologies
|
||||||
- node on a bare debian install.
|
- node on a bare debian install.
|
||||||
- npm and npx to execute it.
|
- 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
3
oauth/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Bluesky stuff.
|
||||||
|
|
||||||
|
Yeah.
|
18
oauth/client-metadata.json
Normal file
18
oauth/client-metadata.json
Normal 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",
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue