-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
800 additions
and
798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# lrcdb | ||
|
||
libreforge config database | ||
|
||
An open online database of config for all [libreforge](https://github.com/Auxilor/libreforge)-based plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,72 @@ | ||
import { Button } from "@mui/joy" | ||
import { useState } from "react" | ||
import { FaShare, FaSpinner, FaTrash } from "react-icons/fa" | ||
import {Button} from "@mui/joy" | ||
import {useState} from "react" | ||
import {FaShare, FaSpinner, FaTrash} from "react-icons/fa" | ||
|
||
export default function AdminOptions(props) { | ||
const [deleting, setDeleting] = useState(false) | ||
const [publicizing, setPublicizing] = useState(false) | ||
const [deleting, setDeleting] = useState(false) | ||
const [publicizing, setPublicizing] = useState(false) | ||
|
||
const config = props.config | ||
const apiKey = props.apiKey | ||
const updateConfigs = props.updateConfigs | ||
const config = props.config | ||
const apiKey = props.apiKey | ||
const updateConfigs = props.updateConfigs | ||
|
||
return ( | ||
<div className="self-center flex flex-row gap-4"> | ||
{config.isPrivate && | ||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="text-l" | ||
color="success" | ||
onClick={() => { | ||
setPublicizing(true) | ||
return ( | ||
<div className="self-center flex flex-row gap-4"> | ||
{config.isPrivate && | ||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="text-l" | ||
color="success" | ||
onClick={() => { | ||
setPublicizing(true) | ||
|
||
fetch(`/api/v1/publicizeConfig`, { | ||
method: 'PATCH', | ||
body: JSON.stringify({ | ||
apiKey: apiKey, | ||
id: config.id | ||
}), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
.then(() => updateConfigs()) | ||
.catch(err => console.error(err)) | ||
.finally(() => setPublicizing(false)) | ||
}} | ||
> | ||
{publicizing ? <FaSpinner className="animate-spin" /> : <FaShare />} | ||
</Button> | ||
} | ||
fetch(`/api/v1/publicizeConfig`, { | ||
method: 'PATCH', | ||
body: JSON.stringify({ | ||
apiKey: apiKey, | ||
id: config.id | ||
}), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
.then(() => updateConfigs()) | ||
.catch(err => console.error(err)) | ||
.finally(() => setPublicizing(false)) | ||
}} | ||
> | ||
{publicizing ? <FaSpinner className="animate-spin"/> : <FaShare/>} | ||
</Button> | ||
} | ||
|
||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="text-l" | ||
color="danger" | ||
onClick={() => { | ||
setDeleting(true) | ||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="text-l" | ||
color="danger" | ||
onClick={() => { | ||
setDeleting(true) | ||
|
||
fetch(`/api/v1/deleteConfig`, { | ||
method: 'DELETE', | ||
body: JSON.stringify({ | ||
apiKey: apiKey, | ||
id: config.id | ||
}), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
.then(() => updateConfigs()) | ||
.catch(err => { | ||
console.error(err) | ||
}) | ||
.finally(() => setDeleting(false)) | ||
}} | ||
> | ||
{deleting ? <FaSpinner className="animate-spin" /> : <FaTrash />} | ||
</Button> | ||
</div> | ||
) | ||
fetch(`/api/v1/deleteConfig`, { | ||
method: 'DELETE', | ||
body: JSON.stringify({ | ||
apiKey: apiKey, | ||
id: config.id | ||
}), | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
.then(() => updateConfigs()) | ||
.catch(err => { | ||
console.error(err) | ||
}) | ||
.finally(() => setDeleting(false)) | ||
}} | ||
> | ||
{deleting ? <FaSpinner className="animate-spin"/> : <FaTrash/>} | ||
</Button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,86 @@ | ||
import { Button, Card, Typography } from "@mui/joy"; | ||
import { useState } from "react"; | ||
import { FaDownload, FaEye, FaSpinner } from "react-icons/fa"; | ||
import { getPluginByName } from "../lib/plugins"; | ||
import {Button, Card, Typography} from "@mui/joy"; | ||
import {useState} from "react"; | ||
import {FaDownload, FaEye, FaSpinner} from "react-icons/fa"; | ||
import {getPluginByName} from "../lib/plugins"; | ||
import AdminCardOptions from "./AdminCardOptions" | ||
|
||
export default function ConfigCard(props) { | ||
const [loadingPreview, setLoadingPreview] = useState(false) | ||
const [loadingPreview, setLoadingPreview] = useState(false) | ||
|
||
const config = props.config | ||
const plugin = getPluginByName(config.plugin) | ||
const apiKey = props.apiKey | ||
const authorized = props.authorized | ||
const setConfigPreview = props.setConfigPreview | ||
const updateConfigs = props.updateConfigs | ||
const config = props.config | ||
const plugin = getPluginByName(config.plugin) | ||
const apiKey = props.apiKey | ||
const authorized = props.authorized | ||
const setConfigPreview = props.setConfigPreview | ||
const updateConfigs = props.updateConfigs | ||
|
||
return ( | ||
<Card variant="outlined transition ease-in-out hover:-translate-y-1 hover:shadow-lg"> | ||
<div className="flex flex-row gap-4"> | ||
<img src={plugin.image} className="h-0 w-0 md:h-16 md:w-16 col-span-3" /> | ||
<div className="flex flex-col place-content-center mb-1 col-span-7 overflow-hidden"> | ||
<div className="flex"> | ||
<Typography className="text-xl"> | ||
{config.name} | ||
</Typography> | ||
<Typography className="text-slate-400 text-xl"> | ||
.yml | ||
</Typography> | ||
</div> | ||
<div className="flex gap-2"> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
> | ||
by {config.author} | ||
</Typography> | ||
</div> | ||
</div> | ||
<div className="flex flex-row gap-4 ml-auto"> | ||
<div className="flex flex-col place-content-center items-end"> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
endDecorator={<FaEye />} | ||
> | ||
{config.views} | ||
</Typography> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
endDecorator={<FaDownload />} | ||
> | ||
{config.downloads} | ||
</Typography> | ||
</div> | ||
return ( | ||
<Card variant="outlined transition ease-in-out hover:-translate-y-1 hover:shadow-lg"> | ||
<div className="flex flex-row gap-4"> | ||
<img src={plugin.image} className="h-0 w-0 md:h-16 md:w-16 col-span-3"/> | ||
<div className="flex flex-col place-content-center mb-1 col-span-7 overflow-hidden"> | ||
<div className="flex"> | ||
<Typography className="text-xl"> | ||
{config.name} | ||
</Typography> | ||
<Typography className="text-slate-400 text-xl"> | ||
.yml | ||
</Typography> | ||
</div> | ||
<div className="flex gap-2"> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
> | ||
by {config.author} | ||
</Typography> | ||
</div> | ||
</div> | ||
<div className="flex flex-row gap-4 ml-auto"> | ||
<div className="flex flex-col place-content-center items-end"> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
endDecorator={<FaEye/>} | ||
> | ||
{config.views} | ||
</Typography> | ||
<Typography | ||
className="text-slate-600 text-sm" | ||
endDecorator={<FaDownload/>} | ||
> | ||
{config.downloads} | ||
</Typography> | ||
</div> | ||
|
||
{ | ||
authorized && <AdminCardOptions | ||
updateConfigs={updateConfigs} | ||
apiKey={apiKey} | ||
config={config} | ||
/> | ||
} | ||
{ | ||
authorized && <AdminCardOptions | ||
updateConfigs={updateConfigs} | ||
apiKey={apiKey} | ||
config={config} | ||
/> | ||
} | ||
|
||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="self-center text-l" | ||
onClick={() => { | ||
setLoadingPreview(true) | ||
<Button | ||
variant="outlined" | ||
size="md" | ||
className="self-center text-l" | ||
onClick={() => { | ||
setLoadingPreview(true) | ||
|
||
fetch(`/api/v1/getConfigByID?id=${config.id}`) | ||
.then(res => res.json()) | ||
.then(data => { | ||
setConfigPreview(data.config) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
}) | ||
.finally(() => setLoadingPreview(false)) | ||
}} | ||
> | ||
{loadingPreview ? <FaSpinner className="animate-spin" /> : "Preview"} | ||
</Button> | ||
</div> | ||
</div> | ||
</Card> | ||
) | ||
fetch(`/api/v1/getConfigByID?id=${config.id}`) | ||
.then(res => res.json()) | ||
.then(data => { | ||
setConfigPreview(data.config) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
}) | ||
.finally(() => setLoadingPreview(false)) | ||
}} | ||
> | ||
{loadingPreview ? <FaSpinner className="animate-spin"/> : "Preview"} | ||
</Button> | ||
</div> | ||
</div> | ||
</Card> | ||
) | ||
} |
Oops, something went wrong.