switch to docker based runners starting with nostr

This commit is contained in:
Travis Shears 2025-05-22 12:23:39 +02:00
parent 3ffbfd9cd4
commit a1c3231081
8 changed files with 367 additions and 573 deletions

View file

@ -44,8 +44,16 @@ export class MicroBlogBackend {
}
private async login() {
const pw = process.env.POCKET_BASE_PW!;
const userName = process.env.POCKET_BASE_USER!;
const pw = process.env.POCKET_BASE_PW;
const userName = process.env.POCKET_BASE_USER;
if (!pw) {
this.logger.error("POCKET_BASE_PW env var not set");
throw new Error("POCKET_BASE_PW env var not set");
}
if (!userName) {
this.logger.error("POCKET_BASE_USER env var not set");
throw new Error("POCKET_BASE_USER env var not set");
}
this.logger.info({ userName }, "Logging in to pocketbase");
await this.pb.collection("users").authWithPassword(userName, pw);
this.clientSetTime = new Date();
@ -67,7 +75,7 @@ export class MicroBlogBackend {
}
public async getLatestPostBySource(
postSource: MicroBlogPostSource
postSource: MicroBlogPostSource,
): Promise<MicroBlogPost | undefined> {
await this.checkLogin();
try {
@ -105,7 +113,7 @@ export class MicroBlogBackend {
}
async getImageByRemoteURL(
remoteURL: string
remoteURL: string,
): Promise<MicroBlogPostImage | undefined> {
await this.checkLogin();
try {
@ -122,7 +130,7 @@ export class MicroBlogBackend {
}
private async checkForPost(
remoteId: string
remoteId: string,
): Promise<MicroBlogPost | undefined> {
await this.checkLogin();
try {
@ -138,7 +146,7 @@ export class MicroBlogBackend {
}
public async savePost(
post: Omit<MicroBlogPost, "id" | "expand">
post: Omit<MicroBlogPost, "id" | "expand">,
): Promise<MicroBlogPost> {
await this.checkLogin();
const existingPost = await this.checkForPost(post.remoteId);
@ -169,7 +177,7 @@ export class MicroBlogBackend {
public async saveAndSetImage(
imageToSave: Omit<MicroBlogPostImage, "id" | "image" | "collectionId">,
postId: string
postId: string,
) {
await this.checkLogin();
let image = await this.getImageByRemoteURL(imageToSave.remoteURL);