redirecter for ao3 that adds opengraph metadata

add svg icons to use instead of trying to make circles with limited css lmao

+5 -1
src/app/generator/page.js
···
summary: true,
wordcount: true,
chapters: true,
+
postedAt: true,
+
updatedAt: false,
summaryType: 'basic',
customSummary: ''
})
···
<div className="input-field">
<label htmlFor="theme">Theme</label>
<select name="theme" id="theme" defaultValue={props.theme} onChange={e => updateProp("theme", e.target.value)}>
-
{Object.entries(themes).map((th, i) => {
+
{Object.entries(themes).sort().map((th, i) => {
return (
<option key={i} value={th[0]}>{th[1].name}</option>
)
···
<li><label><input type="checkbox" name="features[]" value="summary" defaultChecked={props.summary} onChange={e => updateProp(e.target.value, e.target.checked)} /> Summary</label></li>
<li><label><input type="checkbox" name="features[]" value="wordcount" defaultChecked={props.wordcount} onChange={e => updateProp(e.target.value, e.target.checked)} /> Wordcount</label></li>
<li><label><input type="checkbox" name="features[]" value="chapters" defaultChecked={props.chapters} onChange={e => updateProp(e.target.value, e.target.checked)} /> Chapters</label></li>
+
<li><label><input type="checkbox" name="features[]" value="postedAt" defaultChecked={props.postedAt} onChange={e => updateProp(e.target.value, e.target.checked)} /> Posted Date</label></li>
+
<li><label><input type="checkbox" name="features[]" value="updatedAt" defaultChecked={props.updatedAt} onChange={e => updateProp(e.target.value, e.target.checked)} /> Updated Date</label></li>
</ul>
</div>
<div className="input-field">
+8
src/icons/chosenottowarn.js
···
+
export default function ChoseNotToWarn ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 128C96 128 32 224 32 336C32 448 112 512 208 512L216.4 512C240.6 512 262.8 498.3 273.6 476.6L296.8 430.3C301.2 421.5 310.1 416 320 416C329.9 416 338.8 421.5 343.2 430.3L366.4 476.6C377.2 498.3 399.4 512 423.6 512L432 512C528 512 608 448 608 336C608 224 544 128 320 128zM128 320C128 284.7 156.7 256 192 256C227.3 256 256 284.7 256 320C256 355.3 227.3 384 192 384C156.7 384 128 355.3 128 320zM448 256C483.3 256 512 284.7 512 320C512 355.3 483.3 384 448 384C412.7 384 384 355.3 384 320C384 284.7 412.7 256 448 256z" fill={fg}/>
+
</svg>
+
)
+
}
+8
src/icons/explicit.js
···
+
export default function Explicit ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M192 96C174.3 96 160 110.3 160 128L160 512C160 529.7 174.3 544 192 544L448 544C465.7 544 480 529.7 480 512C480 494.3 465.7 480 448 480L224 480L224 352L384 352C401.7 352 416 337.7 416 320C416 302.3 401.7 288 384 288L224 288L224 160L448 160C465.7 160 480 145.7 480 128C480 110.3 465.7 96 448 96L192 96z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/gen.js
···
+
export default function Yaoi ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 576C178.6 576 64 461.4 64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576zM320 112C205.1 112 112 205.1 112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320C528 205.1 434.9 112 320 112zM320 416C267 416 224 373 224 320C224 267 267 224 320 224C373 224 416 267 416 320C416 373 373 416 320 416z" fill={fg}/>
+
</svg>
+
)
+
}
+8
src/icons/general.js
···
+
export default function General ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 160C231.6 160 160 231.6 160 320C160 408.4 231.6 480 320 480C397.4 480 462 425 476.8 352L352 352C334.3 352 320 337.7 320 320C320 302.3 334.3 288 352 288L496 288C521.8 288 545.6 309.4 543.2 338.6C533.7 453.6 437.4 544 320 544C196.3 544 96 443.7 96 320C96 196.3 196.3 96 320 96C377.4 96 429.7 117.6 469.3 153C482.5 164.8 483.6 185 471.8 198.2C460 211.4 439.8 212.5 426.6 200.7C398.3 175.4 361 160 320 160z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/het.js
···
+
export default function Het ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M480 0C462.3 0 448 14.3 448 32C448 49.7 462.3 64 480 64L530.7 64L474 120.7C447.7 105 416.9 96 384 96C348.6 96 315.6 106.5 288 124.5C260.4 106.5 227.4 96 192 96C94.8 96 16 174.8 16 272C16 358.3 78.1 430.1 160 445.1L160 480L128 480C110.3 480 96 494.3 96 512C96 529.7 110.3 544 128 544L160 544L160 576C160 593.7 174.3 608 192 608C209.7 608 224 593.7 224 576L224 544L256 544C273.7 544 288 529.7 288 512C288 494.3 273.7 480 256 480L224 480L224 445.1C247.3 440.8 268.9 432 288 419.5C315.6 437.5 348.6 448 384 448C481.2 448 560 369.2 560 272C560 230.9 545.9 193 522.2 163L576 109.3L576 160C576 177.7 590.3 192 608 192C625.7 192 640 177.7 640 160L640 32C640 14.3 625.7 0 608 0L480 0zM336 373.2C356.2 344.6 368 309.7 368 272C368 234.3 356.2 199.4 336 170.8C350.6 163.9 366.8 160 384 160C445.9 160 496 210.1 496 272C496 333.9 445.9 384 384 384C366.8 384 350.5 380.1 336 373.2zM288 214.3C298.2 231.2 304 250.9 304 272C304 293.1 298.2 312.9 288 329.7C277.8 312.8 272 293.1 272 272C272 250.9 277.8 231.1 288 214.3zM240 170.8C219.8 199.4 208 234.3 208 272C208 309.7 219.8 344.6 240 373.2C225.5 380.1 209.2 384 192 384C130.1 384 80 333.9 80 272C80 210.1 130.1 160 192 160C209.2 160 225.5 163.9 240 170.8z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/mature.js
···
+
export default function Mature ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M118.7 97.4C132.2 93.3 146.8 98.5 154.6 110.3L320 358.3L485.4 110.3C493.2 98.6 507.8 93.3 521.3 97.4C534.8 101.5 544 113.9 544 128L544 512C544 529.7 529.7 544 512 544C494.3 544 480 529.7 480 512L480 233.7L346.6 433.8C340.7 442.7 330.7 448 320 448C309.3 448 299.3 442.7 293.4 433.8L160 233.7L160 512C160 529.7 145.7 544 128 544C110.3 544 96 529.7 96 512L96 128C96 113.9 105.2 101.5 118.7 97.4z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/multi.js
···
+
export default function MultiShip ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM296 408L296 344L232 344C218.7 344 208 333.3 208 320C208 306.7 218.7 296 232 296L296 296L296 232C296 218.7 306.7 208 320 208C333.3 208 344 218.7 344 232L344 296L408 296C421.3 296 432 306.7 432 320C432 333.3 421.3 344 408 344L344 344L344 408C344 421.3 333.3 432 320 432C306.7 432 296 421.3 296 408z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/notrated.js
···
+
export default function NotRated ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M224 224C224 171 267 128 320 128C373 128 416 171 416 224C416 266.7 388.1 302.9 349.5 315.4C321.1 324.6 288 350.7 288 392L288 416C288 433.7 302.3 448 320 448C337.7 448 352 433.7 352 416L352 392C352 390.3 352.6 387.9 355.5 384.7C358.5 381.4 363.4 378.2 369.2 376.3C433.5 355.6 480 295.3 480 224C480 135.6 408.4 64 320 64C231.6 64 160 135.6 160 224C160 241.7 174.3 256 192 256C209.7 256 224 241.7 224 224zM320 576C342.1 576 360 558.1 360 536C360 513.9 342.1 496 320 496C297.9 496 280 513.9 280 536C280 558.1 297.9 576 320 576z" fill={fg}/>
+
</svg>
+
)
+
}
+8
src/icons/nowarnings.js
···
+
export default function NoWarnings ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M288 509.3L288 387.5L193.7 464.6C219.8 487.4 252.2 503.3 288 509.3zM153.2 415.1L288 304.8L288 130.7C197.2 145.9 128 224.9 128 320C128 354.6 137.2 387.1 153.2 415.1zM446.3 464.6L352 387.5L352 509.3C387.7 503.3 420.1 487.4 446.3 464.6zM486.9 415.1C502.9 387.1 512.1 354.6 512.1 320C512.1 224.9 442.9 145.9 352.1 130.7L352.1 304.9L486.9 415.2zM64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576C178.6 576 64 461.4 64 320z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/other.js
···
+
export default function OtherShip ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 608C222.8 608 144 529.2 144 432C144 345.7 206.1 274 288 259L288 211.8L238.3 236.6L235.3 237.9C220.1 243.6 202.8 237.1 195.4 222.2C188 207.4 193.2 189.6 206.9 180.9L209.7 179.3L248.5 159.9L209.7 140.5C193.9 132.6 187.5 113.4 195.4 97.6C202.8 82.8 220.2 76.2 235.4 82L238.4 83.3L288.1 108.1L288.1 63.9C288.1 46.2 302.4 31.9 320.1 31.9C337.8 31.9 352.1 46.2 352.1 63.9L352.1 108.1L401.8 83.3L404.8 82C420 76.2 437.3 82.8 444.7 97.6C452.1 112.4 446.9 130.3 433.2 138.9L430.4 140.5L391.7 159.9L430.4 179.2C446.2 187.1 452.6 206.3 444.7 222.1C437.3 236.9 420 243.5 404.8 237.7L401.8 236.4L352.1 211.6L352.1 258.8C434 273.9 496.1 345.6 496.1 431.8C496.1 529 417.3 607.8 320.1 607.8zM320 544C381.9 544 432 493.9 432 432C432 370.1 381.9 320 320 320C258.1 320 208 370.1 208 432C208 493.9 258.1 544 320 544z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/teen.js
···
+
export default function Teen ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M160 96C142.3 96 128 110.3 128 128C128 145.7 142.3 160 160 160L288 160L288 512C288 529.7 302.3 544 320 544C337.7 544 352 529.7 352 512L352 160L480 160C497.7 160 512 145.7 512 128C512 110.3 497.7 96 480 96L160 96z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/warnings.js
···
+
export default function Warnings ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M320 64C334.7 64 348.2 72.1 355.2 85L571.2 485C577.9 497.4 577.6 512.4 570.4 524.5C563.2 536.6 550.1 544 536 544L104 544C89.9 544 76.8 536.6 69.6 524.5C62.4 512.4 62.1 497.4 68.8 485L284.8 85C291.8 72.1 305.3 64 320 64zM320 416C302.3 416 288 430.3 288 448C288 465.7 302.3 480 320 480C337.7 480 352 465.7 352 448C352 430.3 337.7 416 320 416zM320 224C301.8 224 287.3 239.5 288.6 257.7L296 361.7C296.9 374.2 307.4 384 319.9 384C332.5 384 342.9 374.3 343.8 361.7L351.2 257.7C352.5 239.5 338.1 224 319.8 224z" fill={fg} />
+
</svg>
+
)
+
}
+8
src/icons/yaoi.js
···
+
export default function Yaoi ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M288 96C288 78.3 302.3 64 320 64L448 64C465.7 64 480 78.3 480 96L480 224C480 241.7 465.7 256 448 256C430.3 256 416 241.7 416 224L416 173.3L321 268.3C340.5 296.7 352 331 352 368.1C352 465.3 273.2 544.1 176 544.1C78.8 544.1 0 465.2 0 368C0 270.8 78.8 192 176 192C213 192 247.4 203.4 275.8 223L370.8 128L320.1 128C302.4 128 288.1 113.7 288.1 96zM176 480C237.9 480 288 429.9 288 368C288 306.1 237.9 256 176 256C114.1 256 64 306.1 64 368C64 429.9 114.1 480 176 480zM336 544C329.2 544 322.6 543.6 316 542.9C339.6 524 359.3 500.4 373.6 473.5C416.9 458 448 416.6 448 368C448 342.8 439.7 319.5 425.6 300.8C432.7 302.9 440.2 304 448 304C465 304 480.7 298.7 493.7 289.7C505.4 313.3 512 339.9 512 368C512 465.2 433.2 544 336 544zM528 221.3L528 96C528 84.6 525.6 73.8 521.3 64L608 64C625.7 64 640 78.3 640 96L640 224C640 241.7 625.7 256 608 256C590.3 256 576 241.7 576 224L576 173.3L528 221.3z" fill={fg}/>
+
</svg>
+
)
+
}
+8
src/icons/yuri.js
···
+
export default function Yuri ({bg, fg, width, height}) {
+
return (
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width={width} height={height}>
+
<ellipse cx="320" cy="320" rx="320" ry="320" fill={bg} />
+
<path d="M192 352C253.9 352 304 301.9 304 240C304 178.1 253.9 128 192 128C130.1 128 80 178.1 80 240C80 301.9 130.1 352 192 352zM368 240C368 326.3 305.9 398.1 223.9 413.1C224 414.1 224 415 224 416L224 480L256 480C273.7 480 288 494.3 288 512C288 529.7 273.7 544 256 544L224 544L224 576C224 593.7 209.7 608 192 608C174.3 608 160 593.7 160 576L160 544L128 544C110.3 544 96 529.7 96 512C96 494.3 110.3 480 128 480L160 480L160 416C160 415 160 414.1 160.1 413.1C78.1 398.1 16 326.3 16 240C16 142.8 94.8 64 192 64C289.2 64 368 142.8 368 240zM357.5 391C371.9 375.2 384.1 357.3 393.6 337.9C409.7 346.9 428.3 352 448.1 352C510 352 560.1 301.9 560.1 240C560.1 178.1 509.9 128 448 128C428.2 128 409.7 133.1 393.5 142.1C384 122.7 371.9 104.8 357.4 89C383.8 73.1 414.8 64 447.9 64C545.1 64 623.9 142.8 623.9 240C623.9 326.3 561.8 398.1 479.8 413.1C479.9 414 479.9 415 479.9 416L479.9 480L511.9 480C529.6 480 543.9 494.3 543.9 512C543.9 529.7 529.6 544 511.9 544L479.9 544L479.9 576C479.9 593.7 465.6 608 447.9 608C430.2 608 415.9 593.7 415.9 576L415.9 544L383.9 544C366.2 544 351.9 529.7 351.9 512C351.9 494.3 366.2 480 383.9 480L415.9 480L415.9 416C415.9 415 415.9 414.1 416 413.1C394.9 409.2 375.1 401.6 357.4 390.9z" fill={fg} />
+
</svg>
+
)
+
}
+34 -51
src/lib/ogimage.js
···
import { ImageResponse } from "next/og"
+
import General from "@/icons/general.js"
+
import Teen from "@/icons/teen.js"
+
import Mature from "@/icons/mature.js"
+
import Explicit from "@/icons/explicit.js"
+
import NotRated from "@/icons/notrated.js"
+
import Gen from "@/icons/gen.js"
+
import Yaoi from "@/icons/yaoi.js"
+
import Yuri from "@/icons/yuri.js"
+
import Het from "@/icons/het.js"
+
import OtherShip from "@/icons/other.js"
+
import MultiShip from "@/icons/multi.js"
+
import NoWarnings from "@/icons/nowarnings.js"
+
import Warnings from "@/icons/warnings.js"
+
import ChoseNotToWarn from "@/icons/chosenottowarn.js"
export default async function OGImage ({ theme, baseFont, titleFont, image, addr, opts }) {
+
console.log(image)
return new ImageResponse(
(
<div
···
justifyContent: "center",
gap: 10,
color: theme.accent,
-
alignItems: "stretch"
+
alignItems: "center"
}}
>
<div
···
>
{image.topLine}
</div>
-
{image.rating && (<div
-
style={{
-
borderRadius: '100%',
-
backgroundColor: theme.accent,
-
color: theme.background,
-
padding: "0 10px",
-
display: "flex",
-
minWidth: 28,
-
justifyContent: "center",
-
alignItems: "center",
-
fontWeight: "bold"
-
}}
-
>
-
{image.rating}
-
</div>)}
-
{image.warnings && (
-
<div
-
style={{
-
borderRadius: '100%',
-
backgroundColor: theme.accent2,
-
color: theme.background,
-
padding: "0 5px",
-
display: "flex",
-
minWidth: 28,
-
justifyContent: "center",
-
alignItems: "center",
-
fontWeight: "bold"
-
}}
-
>
-
{image.warning}
-
</div>
-
)}
-
{image.category && (
-
<div
-
style={{
-
borderRadius: '100%',
-
backgroundColor: theme.accent3,
-
color: theme.background,
-
padding: "0 10px",
-
display: "flex",
-
minWidth: 28,
-
justifyContent: "center",
-
alignItems: "center",
-
fontWeight: "bold"
-
}}
-
>
-
{image.category}
-
</div>
-
)}
+
+
{image.props.get('rating') === 'true' && image.rating === 'E' && (<Explicit fg={theme.background} bg={theme.accent} width={28} height={28} />)}
+
{image.props.get('rating') === 'true' && image.rating === 'M' && (<Mature fg={theme.background} bg={theme.accent} width={28} height={28} />)}
+
{image.props.get('rating') === 'true' && image.rating === 'T' && (<Teen fg={theme.background} bg={theme.accent} width={28} height={28} />)}
+
{image.props.get('rating') === 'true' && image.rating === 'G' && (<General fg={theme.background} bg={theme.accent} width={28} height={28} />)}
+
{image.props.get('rating') === 'true' && image.rating === 'NR' && (<NotRated fg={theme.background} bg={theme.accent} width={28} height={28} />)}
+
+
{image.props.get('warnings') === 'true' && image.warning === 'NW' && (<NoWarnings fg={theme.background} bg={theme.accent2} width={28} height={28} />)}
+
{image.props.get('warnings') === 'true' && image.warning === 'CNTW' && (<ChoseNotToWarn fg={theme.background} bg={theme.accent2} width={28} height={28} />)}
+
{image.props.get('warnings') === 'true' && image.warning === 'W' && (<Warnings fg={theme.background} bg={theme.accent2} width={28} height={28} />)}
+
+
{image.props.get('category') === 'true' && image.category === 'F' && (<Yuri fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
+
{image.props.get('category') === 'true' && image.category === 'M' && (<Yaoi fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
+
{image.props.get('category') === 'true' && image.category === 'FM' && (<Het fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
+
{image.props.get('category') === 'true' && image.category === 'G' && (<Gen fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
+
{image.props.get('category') === 'true' && image.category === 'MX' && (<MultiShip fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
+
{image.props.get('category') === 'true' && image.category === 'O' && (<OtherShip fg={theme.background} bg={theme.accent3} width={28} height={28} />)}
</div>
<div
style={{
···
color: theme.accent2
}}
>
-
{image.props.get("wordcount") === 'true' && `${image.words} words • `}{(image.props.get("chapters") === 'true' && image.chapterCount !== null) && `${image.chapterCount} chapters • `}https://archiveofourown.org/{addr}
+
{image.props.get("wordcount") === 'true' && `${image.words} words • `}{(image.props.get("chapters") === 'true' && image.chapterCount !== null) && `${image.chapterCount} chapters • `}{image.props.get("postedAt") === 'true' && `posted on ${image.postedAt} • `}{image.props.get("updatedAt") === 'true' && `updated on ${image.updatedAt} • `}https://archiveofourown.org/{addr}
</div>
</div>
</div>
+16 -13
src/lib/sanitizeData.js
···
}))
const warningsUnique = warnings.reduce((a, b) => { return a.concat(b) }).filter((w, i) => { return i === warnings.indexOf(w) })
if (warningsUnique.length === 1 && warningsUnique[0] === "Creator Chose Not To Use Archive Warnings") {
-
return "⁉️"
+
return "CNTW"
} else if (warningsUnique.length === 1 && warningsUnique[0] === "No Archive Warnings Apply") {
-
return "⭕️"
+
return "NW"
}
-
return "⚠️"
+
return "W"
}
const getCategory = async (works) => {
···
const work = await getWork({workId: w.id})
return work.category
}))
-
const categoriesUnique = categories.reduce((a, b) => { return a.concat(b) }).filter((w, i) => { return i === categories.indexOf(w) })
+
const categoriesJoined = categories.reduce((a, b) => { return a.concat(b) })
+
const categoriesUnique = categoriesJoined.filter((w, i) => { return i === categoriesJoined.indexOf(w) })
+
if (categoriesUnique.length === 1) {
-
if (categoriesUnique[0] === "F/F") return "⚢"
-
if (categoriesUnique[0] === "M/M") return "⚣"
-
if (categoriesUnique[0] === "F/M") return "⚤"
-
if (categoriesUnique[0] === "Gen") return "◦"
-
if (categoriesUnique[0] === "Multi") return "⁕"
-
if (categoriesUnique[0] === "Other") return "⚧"
+
if (categoriesUnique[0] === "F/F") return "F"
+
if (categoriesUnique[0] === "M/M") return "M"
+
if (categoriesUnique[0] === "F/M") return "FM"
+
if (categoriesUnique[0] === "Gen") return "G"
+
if (categoriesUnique[0] === "Multi") return "MX"
+
if (categoriesUnique[0] === "Other") return "O"
}
-
return "⁕"
+
return "MX"
}
export default async function sanitizeData ({ type, data, props}) {
···
return a.username
})
: []
-
const rating = type === 'work' ? data.rating : await getHighestRating(data.works)
+
const rating = type === 'work' ? await getHighestRating([data]) : await getHighestRating(data.works)
const warning = type === 'work' ? await getHighestWarning([data]) : await getHighestWarning(data.works)
const category = type === 'work' ? await getCategory([data]) : await getCategory(data.works)
const authorString = authorsFormatted.length > 1
···
charTags: charTags,
relTags: relTags,
freeTags: freeTags,
-
warnings: warnings,
+
postedAt: type === 'work' ? data.publishedAt : data.startedAt,
+
updatedAt: data.updatedAt,
baseFont: baseFont,
titleFont: titleFont,
props: props,
+22
src/lib/themes.js
···
accent2: '#a33961',
accent3: '#87254A',
accent4: '#6A1133'
+
},
+
catppuccinMocha: {
+
name: 'Catppuccin Mocha',
+
background: '#1e1e2e',
+
color: '#cdd6f4',
+
descBackground: '#313244',
+
descColor: '#bac2de',
+
accent: '#f5e0dc',
+
accent2: '#cba6f7',
+
accent3: '#fab387',
+
accent4: '#89dceb'
+
},
+
catppuccinLatte: {
+
name: 'Catppuccin Latte',
+
background: '#eff1f5',
+
color: '#4c4f69',
+
descBackground: '#ccd0da',
+
descColor: '#5c5f77',
+
accent: '#dc8a78',
+
accent2: '#8839ef',
+
accent3: '#fe640b',
+
accent4: '#04a5e5'
}
}