Skip to content
Merged
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
43 changes: 43 additions & 0 deletions LICENSES/OFL-1.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SIL OPEN FONT LICENSE

Version 1.1 - 26 February 2007

PREAMBLE

The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.

DEFINITIONS

"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the copyright statement(s).

"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting, or substituting — in part or in whole — any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS

Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.

5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.

TERMINATION

This license becomes null and void if any of the above conditions are not met.

DISCLAIMER

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
16 changes: 16 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,19 @@ path = ["spec-*.md", "apps/site/content/docs/spec-*.md", "packages/conformance-s
precedence = "override"
SPDX-FileCopyrightText = "The PDP-Connect Contributors"
SPDX-License-Identifier = "LicenseRef-CSL-1.0"

# Font files vendored for the share card renderer, copied unmodified from the
# upstream releases: Inter 4.1 (github.com/rsms/inter) and Source Serif 4.005
# (github.com/adobe-fonts/source-serif). Each upstream licence file sits beside
# its fonts.
[[annotations]]
path = ["apps/site/assets/share-card/Inter-*"]
precedence = "override"
SPDX-FileCopyrightText = "2016 The Inter Project Authors (https://github.com/rsms/inter)"
SPDX-License-Identifier = "OFL-1.1"

[[annotations]]
path = ["apps/site/assets/share-card/SourceSerif4-*"]
precedence = "override"
SPDX-FileCopyrightText = "2014-2023 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'"
SPDX-License-Identifier = "OFL-1.1"
Binary file added apps/site/assets/share-card/Inter-Bold.ttf
Binary file not shown.
92 changes: 92 additions & 0 deletions apps/site/assets/share-card/Inter-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added apps/site/assets/share-card/Inter-Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file added apps/site/assets/share-card/SourceSerif4-It.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions apps/site/assets/share-card/SourceSerif4-LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.

This Font Software is licensed under the SIL Open Font License, Version 1.1.

This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
62 changes: 62 additions & 0 deletions apps/site/src/app/(concept)/principles/card/[format]/route.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright The PDP-Connect Contributors
// SPDX-License-Identifier: Apache-2.0

import assert from "node:assert/strict";
import { afterEach, test } from "node:test";
import { SHARE_CARD_FORMATS } from "@/lib/share-card/copy.ts";
import { GET, generateStaticParams } from "./route.tsx";

const FLAG = "NEXT_PUBLIC_PDPP_SHARE_CARD";
const PNG_SIGNATURE = "89504e470d0a1a0a";

afterEach(() => {
delete process.env[FLAG];
});

function request(format: string): Promise<Response> {
return GET(new Request(`https://pdpp.dev/principles/card/${format}`), { params: Promise.resolve({ format }) });
}

// A PNG starts with an 8-byte signature, then the IHDR chunk: length, "IHDR",
// then width and height as big-endian 32-bit integers at bytes 16 and 20.
function pngSize(png: Buffer): { height: number; signature: string; width: number } {
return {
height: png.readUInt32BE(20),
signature: png.subarray(0, 8).toString("hex"),
width: png.readUInt32BE(16),
};
}

test("the card routes are built for exactly the feed and story formats", () => {
assert.deepEqual(generateStaticParams(), [{ format: "feed" }, { format: "story" }]);
});

for (const format of ["feed", "story"] as const) {
test(`${format} returns a PNG of ${SHARE_CARD_FORMATS[format].width}x${SHARE_CARD_FORMATS[format].height} when the flag is true`, async () => {
process.env[FLAG] = "true";
const response = await request(format);
assert.equal(response.status, 200);
assert.equal(response.headers.get("content-type"), "image/png");
assert.deepEqual(pngSize(Buffer.from(await response.arrayBuffer())), {
...SHARE_CARD_FORMATS[format],
signature: PNG_SIGNATURE,
});
});
}

test("an unknown format is a 404 even when the flag is on", async () => {
process.env[FLAG] = "true";
assert.equal((await request("banner")).status, 404);
});

for (const value of [undefined, "", "0", "1", "false", "yes"]) {
test(`the routes are a 404 when the flag is ${JSON.stringify(value)}`, async () => {
if (value === undefined) {
delete process.env[FLAG];
} else {
process.env[FLAG] = value;
}
const [feed, story] = await Promise.all([request("feed"), request("story")]);
assert.deepEqual([feed.status, story.status], [404, 404]);
});
}
22 changes: 22 additions & 0 deletions apps/site/src/app/(concept)/principles/card/[format]/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright The PDP-Connect Contributors
// SPDX-License-Identifier: Apache-2.0

import { isShareCardFormat, SHARE_CARD_FORMAT_NAMES } from "@/lib/share-card/copy.ts";
import { renderShareCard } from "@/lib/share-card/render.tsx";
import { shareCardEnabled } from "@/lib/site-config.ts";

// The supporter card is the same image for everyone, so each size is built once
// at build time. Only the two known formats exist; anything else is a 404.
export const dynamicParams = false;

export function generateStaticParams(): { format: string }[] {
return SHARE_CARD_FORMAT_NAMES.map((format) => ({ format }));
}

export async function GET(_request: Request, context: { params: Promise<{ format: string }> }): Promise<Response> {
const { format } = await context.params;
if (!(shareCardEnabled() && isShareCardFormat(format))) {
return new Response("Not found", { status: 404 });
}
return await renderShareCard(format);
}
6 changes: 5 additions & 1 deletion apps/site/src/app/(concept)/principles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export default async function Page({
<div className="mt-8 max-w-[46rem]">
<div className="flex flex-col gap-4">
<PdppSigningStatus signed={params.signed} withdraw={params.withdraw} />
<PdppSigningForm restoredForm={restoredForm} />
{/* After a submission or a confirmation the person is done: showing an
empty form again reads as "sign again". Error states keep it for a retry. */}
{params.signed === "pending" || params.signed === "confirmed" ? null : (
<PdppSigningForm restoredForm={restoredForm} />
)}
</div>
</div>
</PdppConceptSection>
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/components/elements/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function DiscordIcon({ className = "pdpp-icon-discord" }: { className?: s
// the design concept (index.html .wordmark__mark). currentColor so it picks
// up --pdpp-editorial-ink in the masthead and --pdpp-editorial-paper in the
// footer, same as the concept's own wordmark.
const WORDMARK_PATH =
export const WORDMARK_PATH =
"M60 30C65.3043 30 70.3919 32.1067 74.1426 35.8574C77.8933 39.6081 80 44.6957 80 50V110C80 115.304 77.8933 120.392 74.1426 124.143C70.3919 127.893 65.3043 130 60 130H20V160H0V30H60ZM270 130H210V160H190V30H270V130ZM345 30C350.304 30 355.392 32.1067 359.143 35.8574C362.893 39.6081 365 44.6957 365 50V110C365 115.304 362.893 120.392 359.143 124.143C355.392 127.893 350.304 130 345 130H305V160H285V30H345ZM175 130H115C109.696 130 104.608 127.893 100.857 124.143C97.1067 120.392 95 115.304 95 110V50C95 44.6957 97.1067 39.6081 100.857 35.8574C104.608 32.1067 109.696 30 115 30H155V0H175V130ZM20 50V110H60V50H20ZM115 110H155V50H115V110ZM210 110H250V50H210V110ZM305 110H345V50H305V110Z";

export function WordmarkIcon({ className = "block h-[23px] w-auto" }: { className?: string }) {
Expand Down
Loading
Loading