Versions

  • v30

    5/26/2024
    Open: Version
    Changes from v29 to v30
    +1
    -29
    ⦚ 14 unchanged lines ⦚
    }

    function err(message: string): Response {
    const errorMessage = JSON.stringify({ error: { message, code: 400 } });
    return response(errorMessage, "application/rss+xml");
    }

    function fudgeURL(url: string) {
    try {
    return new URL(url);
    } catch (e) {
    // console.log("Url parsing failed", e.stack);
    return new URL("https://" + url);
    }
    }

    function processInput(req: Request) {
    let ret = {
    url: undefined as undefined | URL,
    response: undefined as undefined | Response,
    };
    const myurl = new URL(req.url);
    const pathname = myurl.pathname.substring(1) + myurl.search;
    ret.url = fudgeURL(pathname);
    return ret;
    }

    export default async function(req: Request): Promise<Response> {
    const action = processInput(req);
    const url = action.url;
    if (!url) return action.response!;

    const html = await fetch(url.toString(), {
    method: req.method,
    ⦚ 14 unchanged lines ⦚
    }

    export default async function(req: Request): Promise<Response> {
    const url = new URL(`https://tanstack.com/blog`);
    const html = await fetch(url.toString(), {
    method: req.method,
    ⦚ 74 unchanged lines ⦚
  • v29

    5/26/2024
    Open: Version
    Changes from v28 to v29
    +1
    -1
    ⦚ 96 unchanged lines ⦚
    if (link && date && title && description && linkFormatted) {
    items.push({
    title: post.textContent!,
    guid: linkFormatted,
    link: linkFormatted,
    ⦚ 21 unchanged lines ⦚
    ⦚ 96 unchanged lines ⦚
    if (link && date && title && description && linkFormatted) {
    items.push({
    title,
    guid: linkFormatted,
    link: linkFormatted,
    ⦚ 21 unchanged lines ⦚
  • v28

    5/26/2024
    Open: Version
    Changes from v27 to v28
    +3
    -2
    ⦚ 84 unchanged lines ⦚
    const items = [];
    for (const post of postsLinks) {
    const link = post.getAttribute("href");
    const dateText = post.querySelector(".italic.font-light")?.textContent;
    const date = dateText ? new Date(dateText) : undefined;
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    ⦚ 3 unchanged lines ⦚
    ${p.textContent}`, "");

    if (link && date) {
    items.push({
    title: post.textContent!,
    ⦚ 23 unchanged lines ⦚
    ⦚ 84 unchanged lines ⦚
    const items = [];
    for (const post of postsLinks) {
    const title = post.querySelector(".text-lg.font-extrabold")?.textContent.trim();
    const link = post.getAttribute("href");
    const dateText = post.querySelector(".italic.font-light")?.textContent.trim();
    const date = dateText ? new Date(dateText) : undefined;
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    ⦚ 3 unchanged lines ⦚
    ${p.textContent}`, "");

    if (link && date && title && description && linkFormatted) {
    items.push({
    title: post.textContent!,
    ⦚ 23 unchanged lines ⦚
  • v27

    5/26/2024
    Open: Version
    Changes from v26 to v27
    +3
    -1
    ⦚ 89 unchanged lines ⦚
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    const paragraphs = Array.from(post.querySelectorAll("p"));
    const description = paragraphs.reduce((acc, p) => `${acc} ${p.textContent}`, "");

    if (link && date) {
    ⦚ 25 unchanged lines ⦚
    ⦚ 89 unchanged lines ⦚
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    const paragraphs = Array.from(post.querySelectorAll("p"));
    const description = paragraphs.reduce((acc, p) =>
    `${acc}
    ${p.textContent}`, "");

    if (link && date) {
    ⦚ 25 unchanged lines ⦚
  • v26

    5/26/2024
    Open: Version
    Changes from v25 to v26
    +1
    -3
    ⦚ 89 unchanged lines ⦚
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    const paragraphs = Array.from(post.querySelectorAll("p"));
    const description = paragraphs.reduce((acc, p) =>
    `${acc}
    ${p.textContent}`, "");

    if (link && date) {
    ⦚ 25 unchanged lines ⦚
    ⦚ 89 unchanged lines ⦚
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    const paragraphs = Array.from(post.querySelectorAll("p"));
    const description = paragraphs.reduce((acc, p) => `${acc} ${p.textContent}`, "");

    if (link && date) {
    ⦚ 25 unchanged lines ⦚
  • v25

    5/26/2024
    Open: Version
    Changes from v24 to v25
    +1
    -0
    ⦚ 98 unchanged lines ⦚
    guid: linkFormatted,
    link: linkFormatted,
    description,
    date,
    });
    ⦚ 17 unchanged lines ⦚
    ⦚ 98 unchanged lines ⦚
    guid: linkFormatted,
    link: linkFormatted,
    author: `Tanner Linsley`,
    description,
    date,
    });
    ⦚ 17 unchanged lines ⦚
  • v24

    5/26/2024
    Open: Version
    Changes from v23 to v24
    +5
    -0
    ⦚ 88 unchanged lines ⦚
    const date = dateText ? new Date(dateText) : undefined;
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");

    if (link && date) {
    items.push({
    title: post.textContent!,
    guid: linkFormatted,
    link: linkFormatted,
    date,
    });
    ⦚ 17 unchanged lines ⦚
    ⦚ 88 unchanged lines ⦚
    const date = dateText ? new Date(dateText) : undefined;
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");
    const paragraphs = Array.from(post.querySelectorAll("p"));
    const description = paragraphs.reduce((acc, p) =>
    `${acc}
    ${p.textContent}`, "");

    if (link && date) {
    items.push({
    title: post.textContent!,
    guid: linkFormatted,
    link: linkFormatted,
    description,
    date,
    });
    ⦚ 17 unchanged lines ⦚
  • v23

    5/26/2024
    Open: Version
    Changes from v22 to v23
    +3
    -2
    ⦚ 87 unchanged lines ⦚
    const dateText = post.querySelector(".italic.font-light")?.textContent;
    const date = dateText ? new Date(dateText) : undefined;

    if (link && date) {
    items.push({
    title: post.textContent!,
    link: `${url.origin}/${link}`.replace(/\/\//g, "/"),
    date,
    });
    ⦚ 7 unchanged lines ⦚
    image: imagePath && {
    url: image.trim(),
    guid: url.toString(),
    title: `Icon for "${title.trim()}"`,
    link: url.toString(),
    ⦚ 6 unchanged lines ⦚
    ⦚ 87 unchanged lines ⦚
    const dateText = post.querySelector(".italic.font-light")?.textContent;
    const date = dateText ? new Date(dateText) : undefined;
    const linkFormatted = `${url.origin}/${link}`.replace(/\/\//g, "/");

    if (link && date) {
    items.push({
    title: post.textContent!,
    guid: linkFormatted,
    link: linkFormatted,
    date,
    });
    ⦚ 7 unchanged lines ⦚
    image: imagePath && {
    url: image.trim(),
    title: `Icon for "${title.trim()}"`,
    link: url.toString(),
    ⦚ 6 unchanged lines ⦚
  • v22

    5/26/2024
    Open: Version
    +114
    -0

    import buildRSSFeedString from "https://esm.town/v/vogelino/buildRSSFeedString";
    import { DOMParser } from "npm:linkedom@0.16.10";

    function response(message: string, contentType = "text/markdown"): Response {
    const headers = new Headers();
    headers.set("Access-Control-Allow-Origin", "*");
    headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
    headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization");
    headers.set("Access-Control-Max-Age", "86400");
    headers.set("Content-Type", contentType);
    return new Response(message, {
    status: 200,
    headers: headers,
    });
    }

    function err(message: string): Response {
    const errorMessage = JSON.stringify({ error: { message, code: 400 } });
    return response(errorMessage, "application/rss+xml");
    }

    function fudgeURL(url: string) {
    try {
    return new URL(url);
    } catch (e) {
    // console.log("Url parsing failed", e.stack);
    return new URL("https://" + url);
    }
    }

    function processInput(req: Request) {
    let ret = {
    url: undefined as undefined | URL,
    response: undefined as undefined | Response,
    };
    const myurl = new URL(req.url);