[chore] remove unusable files

This commit is contained in:
Purp1e
2025-03-12 22:20:06 +08:00
parent a78b63259a
commit 71858e5fec
21 changed files with 142 additions and 326 deletions

View File

@@ -1,28 +0,0 @@
version: 2
updates:
# Enable version updates for Node.js dependencies
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
groups:
all:
patterns:
- "*"
ignore:
- dependency-name: "eslint"
versions: ">= 9"
# Enable version updates for rust
- package-ecosystem: "cargo"
directory: "/src-tauri"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
groups:
all:
patterns:
- "*"

View File

@@ -1,34 +0,0 @@
# Automatically squashes and merges Dependabot dependency upgrades if tests pass
name: Dependabot Auto-merge
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.3.3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve Dependabot PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-merge (squash) Dependabot PR
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,46 +0,0 @@
# Installs Node.js dependencies and pnpm, and checks formatting + linting
name: Lint Node.js
on:
push:
branches:
- main
pull_request:
paths-ignore:
- "src-tauri/**"
- "README.md"
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Disable git core.autocrlf on Windows
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout repository code
uses: actions/checkout@v4
- name: Set up pnpm package manager
uses: pnpm/action-setup@v4
with:
version: latest
- name: Set up Node.js v22
uses: actions/setup-node@v3
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies from lockfile
run: pnpm install --frozen-lockfile
- name: Run lint step
run: pnpm lint

View File

@@ -1,55 +0,0 @@
# Installs Rust and checks formatting + linting
name: Lint Rust
on:
push:
branches:
- main
pull_request:
paths-ignore:
- "src/**"
- "package.json"
- "package-lock.json"
- "yarn.lock"
- "pnpm-lock.yaml"
- "README.md"
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Disable git core.autocrlf on Windows
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout repository code
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install libdbus-1-dev libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- name: Create empty 'out' directory
run: mkdir out
- name: Run rustfmt check
run: cargo fmt --all -- --check
working-directory: src-tauri
- name: Run clippy check and deny warnings
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: src-tauri

View File

@@ -1,8 +1,8 @@
{
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "pnpm next-build",
"beforeDevCommand": "pnpm next-start",
"beforeBuildCommand": "bun next-build",
"beforeDevCommand": "bun next-start",
"frontendDist": "../out",
"devUrl": "http://localhost:3000"
},

View File

@@ -1,10 +1,9 @@
"use client"
import { appStore } from "@/store/app"
import { useEffect } from "react"
import { useSnapshot } from "valtio"
export default function Page() {
appStore.start()
void appStore.start()
const app = useSnapshot(appStore.state)
return (

View File

@@ -7,6 +7,7 @@ import {
CardTool,
} from "@/components/window/Card"
import { ToolButton } from "@/components/window/ToolButton"
import { cn } from "@heroui/react"
import {
AssemblyLine,
HardDisk,
@@ -14,7 +15,6 @@ import {
UploadOne,
Videocamera,
} from "@icon-park/react"
import { cn } from "@heroui/react"
import { usePathname, useRouter } from "next/navigation"
// import { platform } from "@tauri-apps/plugin-os"

View File

@@ -1,10 +1,9 @@
"use client"
import { currentUser, steamStore } from "@/store/steam"
import { useEffect } from "react"
import { useSnapshot } from "valtio"
export default function Page() {
steamStore.start()
void steamStore.start()
const steam = useSnapshot(steamStore.state)
return (

View File

@@ -1,8 +1,8 @@
"use client"
import React from "react"
import { useRouter } from "next/navigation"
import { open } from "@tauri-apps/plugin-dialog"
import { useRouter } from "next/navigation"
import React from "react"
const Home = () => {
const router = useRouter()
@@ -21,7 +21,9 @@ const Home = () => {
className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS </h1>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">
CS
</h1>
<button
type="button"
onClick={() => router.push("/home")}
@@ -29,7 +31,11 @@ const Home = () => {
>
</button>
<button type="button" onClick={openFile} className="px-4 py-1 text-white bg-blue-500 rounded">
<button
type="button"
onClick={openFile}
className="px-4 py-1 text-white bg-blue-500 rounded"
>
</button>
<p className="text-center bg-zinc-50">{file}</p>

View File

@@ -1,10 +1,9 @@
"use client"
import { steamStore, setDir, setCsDir, currentUser } from "@/store/steam"
import { useEffect } from "react"
import { currentUser, setCsDir, setDir, steamStore } from "@/store/steam"
import { useSnapshot } from "valtio"
export default function Page() {
steamStore.start()
void steamStore.start()
const steam = useSnapshot(steamStore.state)
return (
<div

View File

@@ -6,7 +6,7 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"
export default function Providers({ children }: { children: React.ReactNode }) {
return (
<HeroUIProvider className="h-full bg-transparent">
<NextThemesProvider attribute="class" defaultTheme="light" >
<NextThemesProvider attribute="class" defaultTheme="light">
<ToastProvider toastOffset={10} placement="top-center" />
{children}
</NextThemesProvider>

View File

@@ -1,12 +1,11 @@
import { toolStore, setLaunchOption, setLaunchIndex } from "@/store/tool"
import { setLaunchIndex, setLaunchOption, toolStore } from "@/store/tool"
import { Plus, SettingConfig, Switch } from "@icon-park/react"
import { useSnapshot } from "valtio"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
import { ToolButton } from "../window/ToolButton"
import { useSnapshot } from "valtio"
import { use, useEffect, useState } from "react"
const LaunchOption = () => {
toolStore.start()
void toolStore.start()
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
return (
@@ -33,7 +32,9 @@ const LaunchOption = () => {
<textarea
placeholder="请输入启动选项"
value={launchOptions[launchIndex] || ""}
onChange={(e) => launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)}
onChange={(e) =>
launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)
}
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
/>
</CardBody>

View File

@@ -1,12 +1,17 @@
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "@/components/window/Card"
import {
Card,
CardBody,
CardHeader,
CardIcon,
CardTool,
} from "@/components/window/Card"
import { appStore } from "@/store/app"
import { Refresh, VolumeNotice } from "@icon-park/react"
import { ToolButton } from "../window/ToolButton"
import { useSnapshot } from "valtio"
import { useEffect } from "react"
import { ToolButton } from "../window/ToolButton"
const Notice = () => {
appStore.start()
void appStore.start()
const app = useSnapshot(appStore.state)
return (
@@ -22,7 +27,9 @@ const Notice = () => {
</ToolButton>
</CardTool>
</CardHeader>
<CardBody>{app.notice || "不会真的有人要更新CSGO工具箱吧不会吧不会吧 xswl"}</CardBody>
<CardBody>
{app.notice || "不会真的有人要更新CSGO工具箱吧不会吧不会吧 xswl"}
</CardBody>
</Card>
)
}

View File

@@ -2,10 +2,18 @@
import { resetAppStore } from "@/store/app"
import { resetToolStore } from "@/store/tool"
import { addToast } from "@heroui/react"
import { Close, Minus, Moon, Refresh, RefreshOne, RocketOne, Square, Sun, SunOne } from "@icon-park/react"
import { useTheme } from "next-themes"
import {
Close,
Minus,
Moon,
Refresh,
RocketOne,
Square,
SunOne,
} from "@icon-park/react"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { /* relaunch, */ exit, relaunch } from "@tauri-apps/plugin-process"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { useTheme } from "next-themes"
// import { platform } from "@tauri-apps/plugin-os"
import { usePathname, useRouter } from "next/navigation"
@@ -41,7 +49,10 @@ const Nav = () => {
const pathname = usePathname()
return (
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
<nav
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
data-tauri-drag-region
>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
@@ -50,7 +61,7 @@ const Nav = () => {
resetToolStore()
addToast({
title: "重置成功",
color: 'success'
color: "success",
// description: "已重置所有设置",
})
}}
@@ -61,7 +72,9 @@ const Nav = () => {
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => (pathname !== "/prepare" ? router.push("/prepare") : router.back())}
onClick={() =>
pathname !== "/prepare" ? router.push("/prepare") : router.back()
}
>
<RocketOne size={16} />
</button>
@@ -69,7 +82,9 @@ const Nav = () => {
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => (theme === "light" ? setTheme("dark") : setTheme("light"))}
onClick={() =>
theme === "light" ? setTheme("dark") : setTheme("light")
}
>
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}
</button>

View File

@@ -1,8 +1,15 @@
"use client"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { Button, cn } from "@heroui/react"
import {
Home,
MonitorOne,
Movie,
Setting,
Terminal,
Toolkit,
} from "@icon-park/react"
import { usePathname, useRouter } from "next/navigation"
import { useEffect, type ReactNode } from "react"
import type { ReactNode } from "react"
// import { platform } from "@tauri-apps/plugin-os"
import { appStore, setVersion } from "@/store/app"
@@ -30,7 +37,7 @@ const SideButton = ({
className={cn(
className,
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
path.startsWith(route) && "bg-black/5"
path.startsWith(route) && "bg-black/5",
)}
{...rest}
>
@@ -38,7 +45,7 @@ const SideButton = ({
<div
className={cn(
path.startsWith(route) && "opacity-100",
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2"
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2",
)}
/>
</button>
@@ -54,7 +61,7 @@ const Avatar = () => {
onKeyUp={() => router.push("/users")}
className={cn(
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
path.startsWith("/users") && "shadow-sm"
path.startsWith("/users") && "shadow-sm",
)}
>
<img src="favicon.ico" alt="avatar" draggable={false} />
@@ -63,13 +70,13 @@ const Avatar = () => {
}
const SideBar = () => {
appStore.start()
void appStore.start()
const { version } = useSnapshot(appStore.state)
return (
<div
className={cn(
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5"
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5",
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
)}
data-tauri-drag-region
@@ -102,7 +109,10 @@ const SideBar = () => {
</SideButton>
</section>
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
<div
className="mx-auto text-sm text-center text-zinc-500"
data-tauri-drag-region
>
<p></p>
<Button
variant="light"

View File

@@ -1,5 +1,5 @@
import { store } from 'tauri-plugin-valtio';
import { DEFAULT_STORE_CONFIG } from '.';
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
// Usage:
// import {appStore} from "@/store/app"
@@ -13,16 +13,26 @@ const defaultValue = {
hasUpdate: false,
inited: false,
notice: "",
useMirror: true
useMirror: true,
}
export const appStore = store('app', { ...defaultValue }, DEFAULT_STORE_CONFIG);
export const appStore = store("app", { ...defaultValue }, DEFAULT_STORE_CONFIG)
export const setVersion = (version: string) => { appStore.state.version = version }
export const setHasUpdate = (hasUpdate: boolean) => { appStore.state.hasUpdate = hasUpdate }
export const setInited = (inited: boolean) => { appStore.state.inited = inited }
export const setNotice = (notice: string) => { appStore.state.notice = notice }
export const setUseMirror = (useMirror: boolean) => { appStore.state.useMirror = useMirror }
export const setVersion = (version: string) => {
appStore.state.version = version
}
export const setHasUpdate = (hasUpdate: boolean) => {
appStore.state.hasUpdate = hasUpdate
}
export const setInited = (inited: boolean) => {
appStore.state.inited = inited
}
export const setNotice = (notice: string) => {
appStore.state.notice = notice
}
export const setUseMirror = (useMirror: boolean) => {
appStore.state.useMirror = useMirror
}
export const resetAppStore = () => {
setVersion(defaultValue.version)
@@ -30,4 +40,4 @@ export const resetAppStore = () => {
setInited(defaultValue.inited)
setNotice(defaultValue.notice)
setUseMirror(defaultValue.useMirror)
}
}

View File

@@ -1,6 +1,6 @@
export const DEFAULT_STORE_CONFIG = {
saveOnChange: true,
saveOnExit: true,
saveStrategy: 'debounce' as const,
saveStrategy: "debounce" as const,
saveInterval: 3000,
};
}

View File

@@ -1,28 +1,44 @@
import type { SteamUser } from "@/types/steam"
import { store } from 'tauri-plugin-valtio';
import { DEFAULT_STORE_CONFIG } from '.';
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
const defaultValue = {
dir: "C:\\Program Files (x86)\\Steam",
csDir: "",
users: [{
steamID64: "76561198052315353",
steamID32: "STEAM_0:0:46157676",
accountName: "wrr",
personaName: "wrr",
recent: 0,
avatar: ""
}] as SteamUser[],
users: [
{
steamID64: "76561198052315353",
steamID32: "STEAM_0:0:46157676",
accountName: "wrr",
personaName: "wrr",
recent: 0,
avatar: "",
},
] as SteamUser[],
isDirValid: false,
isCsDirValid: false
isCsDirValid: false,
}
export const steamStore = store('steam', {...defaultValue}, DEFAULT_STORE_CONFIG);
export const steamStore = store(
"steam",
{ ...defaultValue },
DEFAULT_STORE_CONFIG,
)
export const setDir = (dir: string) => { steamStore.state.dir = dir }
export const setCsDir = (dir: string) => { steamStore.state.csDir = dir }
export const setUsers = (users: SteamUser[]) => { steamStore.state.users = users }
export const setIsDirValid = (valid: boolean) => { steamStore.state.isDirValid = valid }
export const setIsCsDirValid = (valid: boolean) => { steamStore.state.isCsDirValid = valid }
export const setDir = (dir: string) => {
steamStore.state.dir = dir
}
export const setCsDir = (dir: string) => {
steamStore.state.csDir = dir
}
export const setUsers = (users: SteamUser[]) => {
steamStore.state.users = users
}
export const setIsDirValid = (valid: boolean) => {
steamStore.state.isDirValid = valid
}
export const setIsCsDirValid = (valid: boolean) => {
steamStore.state.isCsDirValid = valid
}
export const currentUser = () => {
return steamStore.state.users[0] || defaultValue.users[0]
@@ -34,4 +50,4 @@ export const resetSteamStore = () => {
setUsers(defaultValue.users)
setIsDirValid(defaultValue.isDirValid)
setIsCsDirValid(defaultValue.isCsDirValid)
}
}

View File

@@ -1,23 +1,27 @@
import { store } from 'tauri-plugin-valtio';
import { DEFAULT_STORE_CONFIG } from '.';
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
const defaultValue = {
launchOptions: [
"-novid -high -freq 144 -fullscreen",
"-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder",
"-novid -high -freq 144 -fullscreen -allow_third_party_software"
"-novid -high -freq 144 -fullscreen -allow_third_party_software",
] as string[],
launchIndex: 0,
powerPlan: 0
powerPlan: 0,
}
export const toolStore = store('tool', { ...defaultValue }, DEFAULT_STORE_CONFIG);
export const toolStore = store(
"tool",
{ ...defaultValue },
DEFAULT_STORE_CONFIG,
)
export const setLaunchOption = (option: string, index: number) => {
toolStore.state.launchOptions = [
...toolStore.state.launchOptions.slice(0, index),
option,
...toolStore.state.launchOptions.slice(index + 1)
...toolStore.state.launchOptions.slice(index + 1),
]
}

View File

@@ -1,51 +0,0 @@
import { Store } from "@tauri-apps/plugin-store"
import { throttle } from "throttle-debounce"
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import type { StateStorage } from "zustand/middleware"
// import { useThrottleFn } from '@reactuses/core';
// 节流设置
export const THROTTLE_TIME = 300
export const THROTTLE_TIME_STORE = 2000
export const THROTTLE_LEADING = true
export const THROTTLE_TRAILING = true
// 自定义Store覆盖get, set等方法以适应tauri+zustand
export async function tauriStore(name: string) {
const store = await Store.load(`${name || "store"}.settings.json`, {
autoSave: THROTTLE_TIME_STORE,
})
const doSet = throttle(
THROTTLE_TIME,
async (key: string, value: unknown) => await store.set(key, value),
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING,
},
)
const set = (key: string, value: unknown) => {
doSet(key, value)
}
const get = async (key: string) => await store.get(key)
// 自定义存储对象
const storage: StateStorage = {
setItem: async (name: string, value: string): Promise<void> => {
await store.set(name, value)
// console.log(name, 'has been set to', value)
},
getItem: async (name: string): Promise<string | null> => {
// console.log(name, 'has been get')
return (await store.get(name)) || null
},
removeItem: async (name: string): Promise<void> => {
// console.log(name, 'has been deleted')
await store.delete(name)
},
}
return { store, get, set, storage }
}

View File

@@ -1,36 +0,0 @@
import { Store } from "@tauri-apps/plugin-store"
import { throttle } from "throttle-debounce"
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import type { StateStorage } from "zustand/middleware"
// import { useThrottleFn } from '@reactuses/core';
// 节流设置
export const THROTTLE_TIME = 300
export const THROTTLE_TIME_STORE = 2000
export const THROTTLE_LEADING = true
export const THROTTLE_TRAILING = true
// 自定义Store覆盖get, set等方法以适应tauri+zustand
export async function tauriStore(name: string) {
const store = await Store.load(`${name || "store"}.settings.json`, {
autoSave: THROTTLE_TIME_STORE,
})
const doSet = throttle(
THROTTLE_TIME,
async (key: string, value: unknown) => await store.set(key, value),
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING,
},
)
const set = (key: string, value: unknown) => {
doSet(key, value)
}
const get = async (key: string) => await store.get(key)
return { store, get, set }
}