enzostvs HF Staff commited on
Commit
9c44b3b
·
1 Parent(s): 038ed1e

deepsite in the url absolute path

Browse files
app/layout.tsx CHANGED
@@ -23,12 +23,12 @@ export const metadata: Metadata = {
23
  description:
24
  "Build your next application with ease and speed by using AI Vibe Coding.",
25
  icons: {
26
- icon: "/logo.svg",
27
- shortcut: "/logo.svg",
28
- apple: "/logo.svg",
29
  other: {
30
  rel: "icon",
31
- url: "/logo.svg",
32
  },
33
  },
34
  };
 
23
  description:
24
  "Build your next application with ease and speed by using AI Vibe Coding.",
25
  icons: {
26
+ icon: "/deepsite/logo.svg",
27
+ shortcut: "/deepsite/logo.svg",
28
+ apple: "/deepsite/logo.svg",
29
  other: {
30
  rel: "icon",
31
+ url: "/deepsite/logo.svg",
32
  },
33
  },
34
  };
components/ask-ai/redesign.tsx CHANGED
@@ -41,7 +41,7 @@ export function Redesign({
41
  return;
42
  }
43
  setIsLoading(true);
44
- const response = await fetch("/api/redesign", {
45
  method: "PUT",
46
  body: JSON.stringify({ url: url.trim() }),
47
  headers: {
 
41
  return;
42
  }
43
  setIsLoading(true);
44
+ const response = await fetch("/deepsite/api/redesign", {
45
  method: "PUT",
46
  body: JSON.stringify({ url: url.trim() }),
47
  headers: {
components/ask-ai/uploader.tsx CHANGED
@@ -63,7 +63,7 @@ export const Uploader = ({
63
  data.append("images", file);
64
  });
65
 
66
- const response = await fetch(`/api/projects/${repoId}/medias`, {
67
  method: "POST",
68
  body: data,
69
  })
 
63
  data.append("images", file);
64
  });
65
 
66
+ const response = await fetch(`/deepsite/api/projects/${repoId}/medias`, {
67
  method: "POST",
68
  body: data,
69
  })
components/ask-ai/useGeneration.ts CHANGED
@@ -138,7 +138,7 @@ export const useGeneration = (projectName: string) => {
138
  ],
139
  });
140
  try {
141
- const response = await fetch("/api/projects", {
142
  method: "POST",
143
  body: JSON.stringify({
144
  projectTitle,
@@ -229,7 +229,7 @@ export const useGeneration = (projectName: string) => {
229
  const isFollowUp = files?.length > 0;
230
  abortController.current = new AbortController();
231
 
232
- const request = await fetch("/api/ask", {
233
  method: "POST",
234
  body: JSON.stringify({
235
  prompt,
@@ -298,7 +298,7 @@ export const useGeneration = (projectName: string) => {
298
  });
299
  } else {
300
  const response = await fetch(
301
- `/api/projects/${projectName.split("/")[1]}`,
302
  {
303
  method: "PUT",
304
  body: JSON.stringify({
 
138
  ],
139
  });
140
  try {
141
+ const response = await fetch("/deepsite/api/projects", {
142
  method: "POST",
143
  body: JSON.stringify({
144
  projectTitle,
 
229
  const isFollowUp = files?.length > 0;
230
  abortController.current = new AbortController();
231
 
232
+ const request = await fetch("/deepsite/api/ask", {
233
  method: "POST",
234
  body: JSON.stringify({
235
  prompt,
 
298
  });
299
  } else {
300
  const response = await fetch(
301
+ `/deepsite/api/projects/${projectName.split("/")[1]}`,
302
  {
303
  method: "PUT",
304
  body: JSON.stringify({
components/code/index.tsx CHANGED
@@ -31,7 +31,7 @@ export function AppEditorCode() {
31
  setIsSavingChanges(true);
32
  const manuallyUpdatedFiles =
33
  queryClient.getQueryData<File[]>(["manuallyUpdatedFiles"]) ?? [];
34
- const response = await fetch(`/api/projects/${repoId}`, {
35
  method: "PUT",
36
  body: JSON.stringify({
37
  files: manuallyUpdatedFiles,
 
31
  setIsSavingChanges(true);
32
  const manuallyUpdatedFiles =
33
  queryClient.getQueryData<File[]>(["manuallyUpdatedFiles"]) ?? [];
34
+ const response = await fetch(`/deepsite/api/projects/${repoId}`, {
35
  method: "PUT",
36
  body: JSON.stringify({
37
  files: manuallyUpdatedFiles,
components/editor/history-view.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import { Button } from "@/components/ui/button";
2
- import { ArrowLeft, ArrowRight } from "lucide-react";
3
  import { useParams, useSearchParams } from "next/navigation";
4
  import { toast } from "sonner";
5
 
@@ -13,9 +13,12 @@ export const HistoryView = function () {
13
  "This action will set this historical version as the default version of the project. Are you sure you want to proceed?"
14
  );
15
  if (!confirmation) return;
16
- const response = await fetch(`/api/projects/${repoId}/${commitId}`, {
17
- method: "POST",
18
- }).then(async (response) => {
 
 
 
19
  if (response.ok) {
20
  const data = await response.json();
21
  return data;
 
1
  import { Button } from "@/components/ui/button";
2
+ import { ArrowLeft } from "lucide-react";
3
  import { useParams, useSearchParams } from "next/navigation";
4
  import { toast } from "sonner";
5
 
 
13
  "This action will set this historical version as the default version of the project. Are you sure you want to proceed?"
14
  );
15
  if (!confirmation) return;
16
+ const response = await fetch(
17
+ `/deepsite/api/projects/${repoId}/${commitId}`,
18
+ {
19
+ method: "POST",
20
+ }
21
+ ).then(async (response) => {
22
  if (response.ok) {
23
  const data = await response.json();
24
  return data;
components/editor/project-settings.tsx CHANGED
@@ -56,7 +56,7 @@ export const ProjectSettings = ({
56
  setIsLoading(true);
57
  setError(null);
58
  try {
59
- const response = await fetch(`/api/projects/${repoId}/rename`, {
60
  method: "PUT",
61
  headers: {
62
  "Content-Type": "application/json",
@@ -95,7 +95,7 @@ export const ProjectSettings = ({
95
  <DropdownMenuTrigger asChild>
96
  <Button variant="ghost" className="pl-2.5! pr-3! py-1.5! h-auto!">
97
  <Image
98
- src="/logo.svg"
99
  alt="DeepSite"
100
  width={100}
101
  height={100}
 
56
  setIsLoading(true);
57
  setError(null);
58
  try {
59
+ const response = await fetch(`/deepsite/api/projects/${repoId}/rename`, {
60
  method: "PUT",
61
  headers: {
62
  "Content-Type": "application/json",
 
95
  <DropdownMenuTrigger asChild>
96
  <Button variant="ghost" className="pl-2.5! pr-3! py-1.5! h-auto!">
97
  <Image
98
+ src="/deepsite/deepsite/deepsite/logo.svg"
99
  alt="DeepSite"
100
  width={100}
101
  height={100}
components/projects/big-project-card.tsx CHANGED
@@ -33,8 +33,7 @@ export function BigProjectCard({
33
  onOpenDeleteDialog: (id: string) => void;
34
  }) {
35
  return (
36
- // todo: use Link instead. But first fix the fact the preview is not re-rendered when changing path
37
- <a href={`/${project.name}`} className="">
38
  <div className="group/big-card rounded-lg overflow-hidden transition-all border-2 border-background ring-[1px] ring-border relative">
39
  {project.private ? (
40
  <div className="h-40 bg-linear-to-br flex flex-col gap-1 items-center justify-center text-lg from-blue-500 to-purple-500">
 
33
  onOpenDeleteDialog: (id: string) => void;
34
  }) {
35
  return (
36
+ <a href={`/deepsite/${project.name}`} className="">
 
37
  <div className="group/big-card rounded-lg overflow-hidden transition-all border-2 border-background ring-[1px] ring-border relative">
38
  {project.private ? (
39
  <div className="h-40 bg-linear-to-br flex flex-col gap-1 items-center justify-center text-lg from-blue-500 to-purple-500">
components/projects/project-card.tsx CHANGED
@@ -2,7 +2,7 @@ import { SpaceEntry } from "@huggingface/hub";
2
 
3
  export function ProjectCard({ project }: { project: SpaceEntry }) {
4
  return (
5
- <a href={`/${project.name}`}>
6
  <div className="flex items-center justify-start gap-3 border-2 border-background ring-[1px] ring-border rounded-lg overflow-hidden transition-all hover:bg-accent">
7
  <div className="size-10 bg-linear-to-br flex items-center justify-center text-lg from-blue-500 to-purple-500">
8
  {project?.cardData?.emoji || "🚀"}
 
2
 
3
  export function ProjectCard({ project }: { project: SpaceEntry }) {
4
  return (
5
+ <a href={`/deepsite/${project.name}`}>
6
  <div className="flex items-center justify-start gap-3 border-2 border-background ring-[1px] ring-border rounded-lg overflow-hidden transition-all hover:bg-accent">
7
  <div className="size-10 bg-linear-to-br flex items-center justify-center text-lg from-blue-500 to-purple-500">
8
  {project?.cardData?.emoji || "🚀"}
components/projects/user-projects.tsx CHANGED
@@ -30,7 +30,7 @@ export function UserProjects() {
30
 
31
  const handleDeleteProject = async () => {
32
  const response = await fetch(
33
- `/api/projects/${deleteProjectId?.split("/")[1]}`,
34
  {
35
  method: "DELETE",
36
  headers: {
 
30
 
31
  const handleDeleteProject = async () => {
32
  const response = await fetch(
33
+ `/deepsite/api/projects/${deleteProjectId?.split("/")[1]}`,
34
  {
35
  method: "DELETE",
36
  headers: {
components/providers/session.tsx CHANGED
@@ -3,5 +3,7 @@
3
  import { SessionProvider } from "next-auth/react";
4
 
5
  export function AuthProvider({ children }: { children: React.ReactNode }) {
6
- return <SessionProvider>{children}</SessionProvider>;
 
 
7
  }
 
3
  import { SessionProvider } from "next-auth/react";
4
 
5
  export function AuthProvider({ children }: { children: React.ReactNode }) {
6
+ return (
7
+ <SessionProvider basePath="/deepsite/api/auth">{children}</SessionProvider>
8
+ );
9
  }
components/public/navigation.tsx CHANGED
@@ -10,7 +10,7 @@ export function Navigation() {
10
  <div className="flex items-center justify-start gap-4">
11
  <Link href="/" className="flex items-center gap-2">
12
  <Image
13
- src="/logo.svg"
14
  alt="DeepSite"
15
  width={100}
16
  height={100}
 
10
  <div className="flex items-center justify-start gap-4">
11
  <Link href="/" className="flex items-center gap-2">
12
  <Image
13
+ src="/deepsite/logo.svg"
14
  alt="DeepSite"
15
  width={100}
16
  height={100}
components/viewer/blank-page.tsx CHANGED
@@ -24,7 +24,7 @@ export function BlankPage() {
24
  <div className="bg-card max-w-lg w-full px-10 py-6 z-1 rounded-xl shadow-accent-foreground mx-auto">
25
  <header className="flex flex-col items-center justify-center">
26
  <Image
27
- src="/logo.svg"
28
  alt="DeepSite"
29
  width={56}
30
  height={56}
 
24
  <div className="bg-card max-w-lg w-full px-10 py-6 z-1 rounded-xl shadow-accent-foreground mx-auto">
25
  <header className="flex flex-col items-center justify-center">
26
  <Image
27
+ src="/deepsite/logo.svg"
28
  alt="DeepSite"
29
  width={56}
30
  height={56}
lib/auth.ts CHANGED
@@ -51,13 +51,13 @@ export const authConfig = {
51
  },
52
  authorized({ auth, request: { nextUrl } }) {
53
  const isLoggedIn = !!auth?.user;
54
- const isOnNew = nextUrl.pathname.startsWith("/new");
55
 
56
  const pathSegments = nextUrl.pathname.split("/").filter(Boolean);
57
  const isOnProjectPage =
58
  pathSegments.length >= 2 &&
59
- !nextUrl.pathname.startsWith("/new") &&
60
- !nextUrl.pathname.startsWith("/api");
61
 
62
  if (isOnProjectPage || isOnNew) {
63
  if (isLoggedIn) return true;
 
51
  },
52
  authorized({ auth, request: { nextUrl } }) {
53
  const isLoggedIn = !!auth?.user;
54
+ const isOnNew = nextUrl.pathname.includes("/new");
55
 
56
  const pathSegments = nextUrl.pathname.split("/").filter(Boolean);
57
  const isOnProjectPage =
58
  pathSegments.length >= 2 &&
59
+ !nextUrl.pathname.includes("/new") &&
60
+ !nextUrl.pathname.includes("/api");
61
 
62
  if (isOnProjectPage || isOnNew) {
63
  if (isLoggedIn) return true;
next.config.ts CHANGED
@@ -1,18 +1,18 @@
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
- // basePath: "/deepsite",
5
- // assetPrefix: "/deepsite",
6
- // async redirects() {
7
- // return [
8
- // {
9
- // source: "/",
10
- // destination: "/deepsite",
11
- // permanent: true,
12
- // basePath: false,
13
- // },
14
- // ];
15
- // },
16
  experimental: {
17
  globalNotFound: true,
18
  },
 
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
+ async redirects() {
5
+ return [
6
+ {
7
+ source: "/",
8
+ destination: "/deepsite",
9
+ permanent: true,
10
+ basePath: false,
11
+ },
12
+ ];
13
+ },
14
+ basePath: "/deepsite",
15
+ assetPrefix: "/deepsite",
16
  experimental: {
17
  globalNotFound: true,
18
  },