mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
switch from logo.clearbit.com to logo.dev
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
# Authentication *required*
|
||||||
|
AUTH_AUTHENTIK_SECRET=
|
||||||
|
AUTH_SECRET=
|
||||||
|
AUTH_TRUST_HOST=https://traberph.de
|
||||||
|
NEXTAUTH_URL=https://traberph.de
|
||||||
|
|
||||||
|
# Database *required*
|
||||||
|
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
|
||||||
|
|
||||||
|
# Attribution *optional*
|
||||||
|
#DISABLE_ATTRIBUTION=true
|
||||||
|
|
||||||
|
# Logo.dev *optional*
|
||||||
|
#LOGO_DEV_TOKEN=
|
||||||
@@ -1,12 +1,28 @@
|
|||||||
# Short
|
# Short
|
||||||
|
|
||||||
This tool is intended to provide simple url shorting and link aggregation functionality.
|
This tool is intended to provide simple URL shortening and link aggregation functionality.
|
||||||
Users should be able to create short links for example to generate smaller QR codes with the builtin QR code generator.
|
Users should be able to create shortened links for example to generate smaller QR codes with the built-in QR code generator.
|
||||||
|
|
||||||
The admin panel is a PWA for easy access and management of the links even on mobile devices.
|
The admin panel is a PWA for easy access and management of the links even on mobile devices.
|
||||||
|
|
||||||
It is powered by nextjs and postgres.
|
It is powered by nextjs and postgres.
|
||||||
Authentication is outsourced via OAuth2.
|
Authentication is handled via OAuth2.
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
To configure short environment variables are used.
|
||||||
|
Modify the `.env.template` to your needs.
|
||||||
|
Postgres and Auth variables are mandatory for short to work.
|
||||||
|
|
||||||
|
### logo.dev integration
|
||||||
|
Logo.dev can be used to automatically fetch logos for the urls on the aggregation pages.
|
||||||
|
To use Logo.dev an Token is required which can be requested via their webpage for free.
|
||||||
|
If Logo.dev is enabled the attribution is automatically added to the footer.
|
||||||
|
If `LOGO_DEV_TOKEN`is not set the first letter of the hostname is used as improvised logo.
|
||||||
|
|
||||||
|
### traberph/short attribution
|
||||||
|
As default in the footer is an attribution link to this GitHub repo.
|
||||||
|
This can be disabled using the `DISABLE_ATTRIBUTION=true`.
|
||||||
|
|
||||||
|
|
||||||
# Example Page
|
# Example Page
|
||||||
|
|||||||
+1
-5
@@ -4,11 +4,7 @@ const nextConfig = {
|
|||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
protocol: 'https',
|
protocol: 'https',
|
||||||
hostname: 'www.google.com',
|
hostname: 'img.logo.dev',
|
||||||
},
|
|
||||||
{
|
|
||||||
protocol: 'https',
|
|
||||||
hostname: 'logo.clearbit.com',
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import LinkFavicon from "./LinkFavicon";
|
|||||||
export default async function CustomPageComponent(params: { customPage: CustomPage }) {
|
export default async function CustomPageComponent(params: { customPage: CustomPage }) {
|
||||||
const customPage = params.customPage;
|
const customPage = params.customPage;
|
||||||
|
|
||||||
|
const token = process.env.LOGO_DEV_TOKEN;
|
||||||
|
const disableAttribution = process.env.DISABLE_ATTRIBUTION;
|
||||||
|
|
||||||
const linkBlocks = await prisma.linkBlock.findMany({
|
const linkBlocks = await prisma.linkBlock.findMany({
|
||||||
where: {
|
where: {
|
||||||
customPageUuid: customPage.uuid
|
customPageUuid: customPage.uuid
|
||||||
@@ -50,7 +53,9 @@ export default async function CustomPageComponent(params: { customPage: CustomPa
|
|||||||
className="text-slate-700 mt-10 fade-animated"
|
className="text-slate-700 mt-10 fade-animated"
|
||||||
style={{ animationDelay: `${1.5 + linkBlocks.length * 0.1}s`, opacity: 0 }}
|
style={{ animationDelay: `${1.5 + linkBlocks.length * 0.1}s`, opacity: 0 }}
|
||||||
>
|
>
|
||||||
<a className="underline" target="blank" href="https://github.com/traberph/short">traberph/short</a> by me running on <a className="underline" href="https://k3s.io/" target="blank">K3s</a>
|
|
||||||
|
{disableAttribution ? null : <p className="text-center">powered by <a className="underline" target="blank" href="https://github.com/traberph/short">traberph/short</a></p>}
|
||||||
|
{token ? <p className="text-center">Logos provided by <a className="underline" href="https://logo.dev" alt="Logo API">Logo.dev</a></p> : ""}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,10 +3,19 @@ import Image from "next/image";
|
|||||||
export default function LinkFavicon({ url }: { url: string }) {
|
export default function LinkFavicon({ url }: { url: string }) {
|
||||||
|
|
||||||
const hostname = new URL(url).hostname;
|
const hostname = new URL(url).hostname;
|
||||||
|
const token = process.env.LOGO_DEV_TOKEN;
|
||||||
|
if (!token) {
|
||||||
|
const text = hostname.split(".")[0].charAt(0).toUpperCase();
|
||||||
|
return (
|
||||||
|
<span className="rounded-full w-8 h-8 flex items-center justify-center bg-gray-100 text-gray-600">
|
||||||
|
{text}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
src={`https://logo.clearbit.com/${hostname}?`}
|
src={`https://img.logo.dev/${hostname}?token=${token}`}
|
||||||
width={100}
|
width={100}
|
||||||
height={100}
|
height={100}
|
||||||
alt=" "
|
alt=" "
|
||||||
|
|||||||
Reference in New Issue
Block a user