Skip to content

Commit

Permalink
Cleaning up files
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljolley committed Nov 17, 2024
1 parent d79493c commit 32ffbe6
Show file tree
Hide file tree
Showing 8 changed files with 4,781 additions and 2,308 deletions.
35 changes: 19 additions & 16 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@ import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [...compat.extends("plugin:astro/recommended"), {
files: ["**/*.astro"],
export default [
...compat.extends("plugin:astro/recommended"),
{
files: ["**/*.astro"],

languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: "script",
languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
},
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
},

rules: {},
}];
rules: {},
},
];
4 changes: 3 additions & 1 deletion netlify/edge-functions/hiya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export default async (request: Request, context: Context) => {
let updatedPage = page;

let astroReplace =
analytic.referrer && analytic.referrer.indexOf("astro.build") >= 0 ? astroed : "";
analytic.referrer && analytic.referrer.indexOf("astro.build") >= 0
? astroed
: "";
const astroRegex = /\**ASTROED\**/i;
updatedPage = updatedPage.replace(astroRegex, astroReplace);

Expand Down
38 changes: 19 additions & 19 deletions netlify/edge-functions/smolify.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import type { Config } from 'https://edge.netlify.com/';
import { getShortUrl } from './scripts/supabase.ts';
import type { Config } from "https://edge.netlify.com/";
import { getShortUrl } from "./scripts/supabase.ts";

export default async function handler(req: Request) {
// Search for the placeholder
const url = new URL(req.url);
const slug = url.searchParams.get('path');
// Search for the placeholder
const url = new URL(req.url);
const slug = url.searchParams.get("path");

if (slug) {
try {
const target = await getShortUrl(slug);
if (slug) {
try {
const target = await getShortUrl(slug);

if (target) {
return Response.redirect(target, 301);
} else {
return Response.redirect('http://baldbeardedbuilder.com/404/', 301);
}
} catch (e) {
console.error(e);
}
}
if (target) {
return Response.redirect(target, 301);
} else {
return Response.redirect("http://baldbeardedbuilder.com/404/", 301);
}
} catch (e) {
console.error(e);
}
}

return Response.redirect('http://baldbeardedbuilder.com/', 301);
return Response.redirect("http://baldbeardedbuilder.com/", 301);
}

export const config: Config = {
path: '/api/smolify',
path: "/api/smolify",
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0"
}
}
}
Loading

0 comments on commit 32ffbe6

Please sign in to comment.