Compare commits

...

5 Commits

Author SHA1 Message Date
Daniel 44c82ff426 Merge pull request #384 from linkwarden/dev
replaced link outer component with <Link> tag for better accessibility
2023-12-31 10:06:06 -05:00
daniel31x13 29e0370808 replaced link outer component with <Link> tag for better accessibility 2023-12-31 10:05:30 -05:00
Daniel 74399c1708 Merge pull request #383 from linkwarden/dev
update version number
2023-12-31 08:03:36 -05:00
daniel31x13 1dde8a6088 update version number 2023-12-31 08:03:15 -05:00
daniel31x13 e872c25332 small improvement + better error handling 2023-12-31 07:55:45 -05:00
10 changed files with 87 additions and 69 deletions
+66 -59
View File
@@ -81,68 +81,75 @@ export default function LinkGrid({ link, count, className }: Props) {
ref={ref} ref={ref}
className="border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-2xl relative" className="border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-2xl relative"
> >
<div className="relative rounded-t-2xl h-40 overflow-hidden"> <Link
{previewAvailable(link) ? ( href={link.url || ""}
<Image target="_blank"
src={`/api/v1/archives/${link.id}?format=${ArchivedFormat.jpeg}&preview=true`} className="rounded-2xl cursor-pointer"
width={1280} >
height={720} <div className="relative rounded-t-2xl h-40 overflow-hidden">
alt="" {previewAvailable(link) ? (
className="rounded-t-2xl select-none object-cover z-10 h-40 w-full shadow opacity-80 scale-105" <Image
style={{ filter: "blur(2px)" }} src={`/api/v1/archives/${link.id}?format=${ArchivedFormat.jpeg}&preview=true`}
draggable="false" width={1280}
onError={(e) => { height={720}
const target = e.target as HTMLElement; alt=""
target.style.display = "none"; className="rounded-t-2xl select-none object-cover z-10 h-40 w-full shadow opacity-80 scale-105"
}} style={{ filter: "blur(2px)" }}
/> draggable="false"
) : link.preview === "unavailable" ? ( onError={(e) => {
<div className="bg-gray-50 duration-100 h-40 bg-opacity-80"></div> const target = e.target as HTMLElement;
) : ( target.style.display = "none";
<div className="duration-100 h-40 bg-opacity-80 skeleton rounded-none"></div> }}
)} />
<div ) : link.preview === "unavailable" ? (
style={ <div className="bg-gray-50 duration-100 h-40 bg-opacity-80"></div>
{ ) : (
// background: <div className="duration-100 h-40 bg-opacity-80 skeleton rounded-none"></div>
// "radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent)", )}
<div
style={
{
// background:
// "radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent)",
}
} }
} className="absolute top-0 left-0 right-0 bottom-0 rounded-t-2xl flex items-center justify-center shadow rounded-md"
className="absolute top-0 left-0 right-0 bottom-0 rounded-t-2xl flex items-center justify-center shadow rounded-md" >
> <LinkIcon link={link} />
<LinkIcon link={link} />
</div>
</div>
<hr className="divider my-0 last:hidden border-t border-neutral-content h-[1px]" />
<div className="p-3 mt-1">
<p className="truncate w-full pr-8 text-primary">
{unescapeString(link.name || link.description) || link.url}
</p>
<Link
href={link.url || ""}
target="_blank"
title={link.url || ""}
className="w-fit"
>
<div className="flex gap-1 item-center select-none text-neutral mt-1 hover:opacity-60 duration-100">
<i className="bi-link-45deg text-lg mt-[0.15rem] leading-none"></i>
<p className="text-sm truncate">{shortendURL}</p>
</div> </div>
</Link>
</div>
<hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
<div className="flex justify-between text-xs text-neutral px-3 pb-1">
<div className="cursor-pointer w-fit">
{collection ? (
<LinkCollection link={link} collection={collection} />
) : undefined}
</div> </div>
<LinkDate link={link} />
</div> <hr className="divider my-0 last:hidden border-t border-neutral-content h-[1px]" />
<div className="p-3 mt-1">
<p className="truncate w-full pr-8 text-primary">
{unescapeString(link.name || link.description) || link.url}
</p>
<Link
href={link.url || ""}
target="_blank"
title={link.url || ""}
className="w-fit"
>
<div className="flex gap-1 item-center select-none text-neutral mt-1">
<i className="bi-link-45deg text-lg mt-[0.15rem] leading-none"></i>
<p className="text-sm truncate">{shortendURL}</p>
</div>
</Link>
</div>
<hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
<div className="flex justify-between text-xs text-neutral px-3 pb-1">
<div className="cursor-pointer w-fit">
{collection ? (
<LinkCollection link={link} collection={collection} />
) : undefined}
</div>
<LinkDate link={link} />
</div>
</Link>
{showInfo ? ( {showInfo ? (
<div className="p-3 absolute z-30 top-0 left-0 right-0 bottom-0 bg-base-200 rounded-2xl fade-in overflow-y-auto"> <div className="p-3 absolute z-30 top-0 left-0 right-0 bottom-0 bg-base-200 rounded-2xl fade-in overflow-y-auto">
@@ -17,7 +17,7 @@ export default function LinkCollection({
return ( return (
<div <div
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.preventDefault();
router.push(`/collections/${link.collection.id}`); router.push(`/collections/${link.collection.id}`);
}} }}
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100" className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100"
+4 -3
View File
@@ -55,8 +55,9 @@ export default function LinkCardCompact({ link, count, className }: Props) {
!showInfo ? "hover:bg-base-300" : "" !showInfo ? "hover:bg-base-300" : ""
} duration-200 rounded-lg`} } duration-200 rounded-lg`}
> >
<div <Link
onClick={() => link.url && window.open(link.url || "", "_blank")} href={link.url || ""}
target="_blank"
className="flex items-center cursor-pointer py-3 px-3" className="flex items-center cursor-pointer py-3 px-3"
> >
<div className="shrink-0"> <div className="shrink-0">
@@ -91,7 +92,7 @@ export default function LinkCardCompact({ link, count, className }: Props) {
<LinkDate link={link} /> <LinkDate link={link} />
</div> </div>
</div> </div>
</div> </Link>
<LinkActions <LinkActions
link={link} link={link}
+1 -1
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
export default function SettingsSidebar({ className }: { className?: string }) { export default function SettingsSidebar({ className }: { className?: string }) {
const LINKWARDEN_VERSION = "v2.4.4"; const LINKWARDEN_VERSION = "v2.4.6";
const { collections } = useCollectionStore(); const { collections } = useCollectionStore();
@@ -14,7 +14,7 @@ export default async function getDashboardData(
else if (query.sort === Sort.DescriptionZA) order = { description: "desc" }; else if (query.sort === Sort.DescriptionZA) order = { description: "desc" };
const pinnedLinks = await prisma.link.findMany({ const pinnedLinks = await prisma.link.findMany({
take: 6, take: 8,
where: { where: {
AND: [ AND: [
{ {
+4 -1
View File
@@ -68,7 +68,10 @@ export default async function postLink(
const validatedUrl = link.url ? await validateUrlSize(link.url) : undefined; const validatedUrl = link.url ? await validateUrlSize(link.url) : undefined;
if (validatedUrl === null) if (validatedUrl === null)
return { response: "File is too large to be stored.", status: 400 }; return {
response: "Something went wrong while retrieving the file size.",
status: 400,
};
const contentType = validatedUrl?.get("content-type"); const contentType = validatedUrl?.get("content-type");
let linkType = "url"; let linkType = "url";
@@ -5,6 +5,9 @@ import Stripe from "stripe";
import { DeleteUserBody } from "@/types/global"; import { DeleteUserBody } from "@/types/global";
import removeFile from "@/lib/api/storage/removeFile"; import removeFile from "@/lib/api/storage/removeFile";
const keycloakEnabled = process.env.KEYCLOAK_CLIENT_SECRET;
const authentikEnabled = process.env.AUTHENTIK_CLIENT_SECRET;
export default async function deleteUserById( export default async function deleteUserById(
userId: number, userId: number,
body: DeleteUserBody body: DeleteUserBody
@@ -22,7 +25,7 @@ export default async function deleteUserById(
} }
// Then, we check if the provided password matches the one stored in the database (disabled in Keycloak integration) // Then, we check if the provided password matches the one stored in the database (disabled in Keycloak integration)
if (!process.env.KEYCLOAK_CLIENT_SECRET) { if (!keycloakEnabled && !authentikEnabled) {
const isPasswordValid = bcrypt.compareSync( const isPasswordValid = bcrypt.compareSync(
body.password, body.password,
user.password as string user.password as string
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "linkwarden", "name": "linkwarden",
"version": "2.4.0", "version": "2.4.6",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/linkwarden/linkwarden.git", "repository": "https://github.com/linkwarden/linkwarden.git",
"author": "Daniel31X13 <daniel31x13@gmail.com>", "author": "Daniel31X13 <daniel31x13@gmail.com>",
+1
View File
@@ -598,6 +598,7 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true") {
}, },
}) })
); );
const _linkAccount = adapter.linkAccount; const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => { adapter.linkAccount = (account) => {
const { "not-before-policy": _, refresh_expires_in, ...data } = account; const { "not-before-policy": _, refresh_expires_in, ...data } = account;
+4 -1
View File
@@ -5,6 +5,9 @@ import CenteredForm from "@/layouts/CenteredForm";
import { signOut, useSession } from "next-auth/react"; import { signOut, useSession } from "next-auth/react";
import Link from "next/link"; import Link from "next/link";
const keycloakEnabled = process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true";
const authentikEnabled = process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true";
export default function Delete() { export default function Delete() {
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
const [comment, setComment] = useState<string>(); const [comment, setComment] = useState<string>();
@@ -23,7 +26,7 @@ export default function Delete() {
}, },
}; };
if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" && password == "") { if (!keycloakEnabled && !authentikEnabled && password == "") {
return toast.error("Please fill the required fields."); return toast.error("Please fill the required fields.");
} }