Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
orztv committed Oct 17, 2024
1 parent df77d1a commit 3e25d0f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
4 changes: 1 addition & 3 deletions app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export type Config = {
FLUX_NUM_STEPS: number;
CUSTOMER_MODEL_MAP: { [key: string]: string };
getme: string;
CHENGYU_WEBHOOK_URL?: string;
};

export function getConfig(env: any): Config {
Expand All @@ -35,6 +34,5 @@ export function getConfig(env: any): Config {
FLUX_NUM_STEPS: parseInt(env.FLUX_NUM_STEPS || "6", 10),
CUSTOMER_MODEL_MAP: JSON.parse(env.CUSTOMER_MODEL_MAP || "{}"),
getme: env.getme || "",
CHENGYU_WEBHOOK_URL: env.CHENGYU_WEBHOOK_URL || "",
};
}
}
37 changes: 10 additions & 27 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { json, type LoaderFunction } from "@remix-run/cloudflare";
import { useLoaderData, Link } from "@remix-run/react";
import { useLoaderData } from "@remix-run/react";
import { createAppContext } from "../context";
import { AppError } from "../utils/error";
import type { AppLoadContext } from "@remix-run/cloudflare";
import { Link } from "@remix-run/react";

export const loader: LoaderFunction = async ({ context }: { context: AppLoadContext }) => {
export const loader: LoaderFunction = async ({ context }) => {
console.log("Loader started");
const appContext = createAppContext(context);
const { imageGenerationService, config } = appContext;
Expand All @@ -30,64 +30,47 @@ export const loader: LoaderFunction = async ({ context }: { context: AppLoadCont
};

export default function Index() {
const { cfAiStatus, configStatus } = useLoaderData<typeof loader>();

return (
<div className="min-h-screen flex items-center justify-center bg-gradient-to-r from-purple-600 via-pink-500 to-red-500">
<div className="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-3xl shadow-2xl p-10 max-w-lg w-full">
<h1 className="text-5xl font-extrabold text-white mb-8 text-center">CF Flux Remix</h1>
<div className="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-3xl shadow-2xl p-10">
<h1 className="text-4xl font-extrabold text-white mb-8 text-center">CF Flux Remix</h1>
<nav>
<ul className="space-y-4">
<li>
<Link
to="/generate-image"
className="block w-full text-center px-6 py-4 text-lg font-semibold text-white bg-gradient-to-r from-indigo-500 to-indigo-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-indigo-400"
className="block w-full text-center px-6 py-3 text-lg font-semibold text-white bg-gradient-to-r from-indigo-500 to-indigo-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-indigo-400"
>
白嫖 CF 的 Flux 生成图片
</Link>
</li>
<li>
<Link
to="/idioms/game"
className="block w-full text-center px-6 py-4 text-lg font-semibold text-white bg-gradient-to-r from-green-500 to-green-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-green-400"
>
看图猜成语游戏
</Link>
</li>
<li>
<Link
to="https://github.com/aigem/cf-flux-remix"
className="block w-full text-center px-6 py-4 text-lg font-semibold text-white bg-gradient-to-r from-yellow-500 to-yellow-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-yellow-400"
className="block w-full text-center px-6 py-3 text-lg font-semibold text-white bg-gradient-to-r from-indigo-500 to-indigo-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-indigo-400"
>
访问 Github
</Link>
</li>
<li>
<Link
to="https://github.com/aigem/CFr2-webdav"
className="block w-full text-center px-6 py-4 text-lg font-semibold text-white bg-gradient-to-r from-blue-500 to-blue-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-400"
className="block w-full text-center px-6 py-3 text-lg font-semibold text-white bg-gradient-to-r from-indigo-500 to-indigo-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-indigo-400"
>
Workers+R2搭建个人免费webdav网盘
</Link>
</li>
<li>
<Link
to="https://github.com/aigem/CFr2-webdav"
className="block w-full text-center px-6 py-4 text-lg font-semibold text-white bg-gradient-to-r from-red-500 to-red-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-red-400"
className="block w-full text-center px-6 py-3 text-lg font-semibold text-white bg-gradient-to-r from-indigo-500 to-indigo-700 rounded-xl transition transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-indigo-400"
>
自行搭建:全平台视频下载助手
</Link>
</li>
{/* 可以在这里添加更多的导航项 */}
</ul>
</nav>
<div className="mt-8 text-white text-center">
<h2 className="text-2xl font-bold mb-4">系统状态</h2>
<p>CF AI 状态: <span className={cfAiStatus === "已连接" ? "text-green-400" : "text-red-400"}>{cfAiStatus}</span></p>
<p>API Key: <span className={configStatus.API_KEY === "已设置" ? "text-green-400" : "text-red-400"}>{configStatus.API_KEY}</span></p>
<p>翻译模型: {configStatus.CF_TRANSLATE_MODEL}</p>
<p>CF 账户列表: <span className={configStatus.CF_ACCOUNT_LIST === "已设置" ? "text-green-400" : "text-red-400"}>{configStatus.CF_ACCOUNT_LIST}</span></p>
<p>自定义模型映射: <span className={configStatus.CUSTOMER_MODEL_MAP === "已设置" ? "text-green-400" : "text-red-400"}>{configStatus.CUSTOMER_MODEL_MAP}</span></p>
</div>
</div>
</div>
);
Expand Down
14 changes: 0 additions & 14 deletions remix.env.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Worker 名称,与CF中的Worker名称必须一致!!
# Worker 名称,与CF中的Worker名称必须一致
name = "free-flux"

# 兼容性日期,确保使用最新的 Workers 运行时功能
Expand Down

0 comments on commit 3e25d0f

Please sign in to comment.