Rename some things
This commit is contained in:
parent
fdd16d8236
commit
fc711c2194
@ -5,7 +5,7 @@ import Article from "../models/article.ts";
|
||||
import Profile from "../models/profile.ts";
|
||||
import { articleHtml } from "../html.ts";
|
||||
import notFoundHandler from "../handlers/not-found.ts";
|
||||
import generateOgProfileImage from "../tasks/generate_og_profile_image.ts";
|
||||
import { generateOgProfileImage } from "../magick.ts";
|
||||
|
||||
const userEventHandler = async function (ctx: Context) {
|
||||
const username = ctx.state.username.replace(/^(@|~)/, "");
|
||||
|
@ -5,7 +5,7 @@ import Article from "../models/article.ts";
|
||||
import Profile from "../models/profile.ts";
|
||||
import { profilePageHtml } from "../html.ts";
|
||||
import notFoundHandler from "../handlers/not-found.ts";
|
||||
import generateOgProfileImage from "../tasks/generate_og_profile_image.ts";
|
||||
import { generateOgProfileImage } from "../magick.ts";
|
||||
|
||||
const userProfileHandler = async function (ctx: Context) {
|
||||
const username = ctx.state.path.replace(/^(@|~)/, "");
|
||||
|
@ -1,10 +1,10 @@
|
||||
import Profile from "../models/profile.ts";
|
||||
import { checkIfFileExists, runCommand } from "../utils.ts";
|
||||
import { log } from "../log.ts";
|
||||
import Profile from "./models/profile.ts";
|
||||
import { checkIfFileExists, runCommand } from "./utils.ts";
|
||||
import { log } from "./log.ts";
|
||||
|
||||
const tmpImgDir = "/tmp/substr/img";
|
||||
|
||||
const createRoundedImage = function (profile: Profile) {
|
||||
function createRoundedImage(profile: Profile) {
|
||||
const command = [
|
||||
'magick',
|
||||
profile.picture,
|
||||
@ -23,7 +23,7 @@ const createRoundedImage = function (profile: Profile) {
|
||||
return runCommand(command);
|
||||
}
|
||||
|
||||
const createOgImage = async function (profile: Profile, ogImagePath: string, backgroundColor: string) {
|
||||
async function createOgImage(profile: Profile, ogImagePath: string, backgroundColor: string) {
|
||||
const status = await createRoundedImage(profile);
|
||||
|
||||
if (status.success) {
|
||||
@ -43,7 +43,7 @@ const createOgImage = async function (profile: Profile, ogImagePath: string, bac
|
||||
}
|
||||
};
|
||||
|
||||
const generateOgProfileImage = async function(profile: Profile) {
|
||||
export async function generateOgProfileImage(profile: Profile) {
|
||||
if (!profile.picture) return false;
|
||||
|
||||
const ogImagePath = `${tmpImgDir}/og-p-${profile.event.id}.png`;
|
||||
@ -59,5 +59,3 @@ const generateOgProfileImage = async function(profile: Profile) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default generateOgProfileImage;
|
Loading…
x
Reference in New Issue
Block a user