Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Edit on GitHub link #2453

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions astro/src/components/GitHubEdit.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ export function getGithubEditUrl(Astro: Readonly<AstroGlobal>) {
const path = Astro.url.pathname;
const splitSlug = slug?.split("/");

const { id } = Astro.props; // Passed from page level

// Each file layout is unique
let appendFile = "";
if (path.includes("/articles/")) {
appendFile = splitSlug?.length
? splitSlug?.length > 1
? path.replace(`${slug}`, "") + `${slug}.md`
? path.replace(`${slug}`, "") + id
: path + `index.mdx`
: path;
} else if (path.includes("/dev-tools/")) {
appendFile = splitSlug?.length
? appendFileSuffix(path)
appendFile = splitSlug?.length
? appendFileSuffix(path)
: path + `index.mdx`;
} else if (path.includes("/quickstarts/")) {
appendFile = splitSlug?.length
Expand Down
6 changes: 3 additions & 3 deletions astro/src/components/Head.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
const { description, title } = Astro.props;
const openGraphImage = new URL("/img/articles-developers.png", Astro.url);
const { description, title, openGraphImage } = Astro.props;
const openGraphImageUrl = openGraphImage ? new URL(openGraphImage, Astro.url): new URL("/img/articles-developers.png", Astro.url);
const normalizedUrl = Astro.url.toString().replace(/.html$/, '');
const isProd = import.meta.env.PROD as boolean;
---
Expand Down Expand Up @@ -30,7 +30,7 @@ const isProd = import.meta.env.PROD as boolean;
<meta name="og:title" content={title}/>
<meta property="og:type" content="website"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:image" content={openGraphImage}/>
<meta property="og:image" content={openGraphImageUrl}/>
{ isProd &&
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
Expand Down
6 changes: 3 additions & 3 deletions astro/src/layouts/Blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const markdownStyles = [
---
<!DOCTYPE html>
<html class="antialiased" lang="en">
<HeadComponent title={ title } description={description}></HeadComponent>
<HeadComponent title={ title } description={description} openGraphImage={image}></HeadComponent>
<body class="antialiased leading-tight">
<Nav/>
<!-- Hero -->
Expand Down Expand Up @@ -118,8 +118,8 @@ const markdownStyles = [
</div>
</section>
<section id="blog-content">
<div
class="max-w-8xl mx-auto pt-2 px-6 lg:pr-0 lg:w-10/12 xl:pl-32 xl:w-10/12 2xl:mx-auto 2xl:pl-40 2xl:pr-0 2xl:w-8/12">
<div name="blog-main-div"
class="max-w-8xl mx-auto pt-2 px-6 lg:pr-0 lg:w-10/12 xl:pl-36 xl:w-10/12 2xl:mx-auto 2xl:pl-40 2xl:pr-0 2xl:w-8/12">
<div class="mt-4">
<div class="md:flex md:flex-col md:justify-start lg:flex-row lg:self-start">
<div id="content" class="mb-16 md:basis-full md:mr-10 md:w-full lg:w-4/6 xl:mr-0 2xl:mr-12">
Expand Down
2 changes: 1 addition & 1 deletion astro/src/layouts/Default.astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cta = frontmatter.cta ? frontmatter.cta : cta;
<Navigation items={sideMenu}/>

<!-- Contribute -->
<GitHubEdit />
<GitHubEdit {...Astro.props} />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion astro/src/pages/articles/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function getStaticPaths() {
const { entry } = Astro.props;
const { Content, headings } = await entry.render();
---
<Layout frontmatter={entry.data} headings={headings}>
<Layout frontmatter={entry.data} headings={headings} id={entry.id}>
<Content/>
</Layout>
18 changes: 9 additions & 9 deletions src/cloudfront/fusionauth-website-request-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ function handler(event) {
}

// fusionauth:rocks
//if (hdrs.host && hdrs.host.value !== 'fusionauth.io' && (!hdrs.authorization || hdrs.authorization.value !== 'Basic ZnVzaW9uYXV0aDpyb2Nrcw==')) {
//return {
//statusCode: 401,
//statusDescription: 'Unauthorized',
//headers: {
//'www-authenticate': { value: 'Basic' }
//}
//};
//}
if (hdrs.host && hdrs.host.value !== 'fusionauth.io' && (!hdrs.authorization || hdrs.authorization.value !== 'Basic ZnVzaW9uYXV0aDpyb2Nrcw==')) {
return {
statusCode: 401,
statusDescription: 'Unauthorized',
headers: {
'www-authenticate': { value: 'Basic' }
}
};
}

var uri = req.uri;
if (uri.endsWith('.html')) {
Expand Down