mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-24 15:51:49 +01:00
installation done
This commit is contained in:
parent
f16bead363
commit
5ddc087a6d
@ -207,6 +207,7 @@ class Main {
|
||||
|
||||
app.get("/api/v1/extensions/install/:apkName") { ctx ->
|
||||
val apkName = ctx.pathParam("apkName")
|
||||
println(apkName)
|
||||
ctx.status(
|
||||
downloadApk(apkName)
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Card from '@material-ui/core/Card';
|
||||
import CardContent from '@material-ui/core/CardContent';
|
||||
@ -36,16 +36,24 @@ interface IProps {
|
||||
extension: IExtension
|
||||
}
|
||||
|
||||
export default function ExtensionCard({
|
||||
export default function ExtensionCard(props: IProps) {
|
||||
const {
|
||||
extension: {
|
||||
name, lang, versionName, iconUrl,
|
||||
name, lang, versionName, iconUrl, installed, apkName,
|
||||
},
|
||||
}: IProps) {
|
||||
} = props;
|
||||
const [installedState, setInstalledState] = useState<string>((installed ? 'installed' : 'install'));
|
||||
|
||||
const classes = useStyles();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const bull = <span className={classes.bullet}>•</span>;
|
||||
const langPress = lang === 'all' ? 'All' : lang.toUpperCase();
|
||||
|
||||
function install() {
|
||||
setInstalledState('installing');
|
||||
fetch(`http://127.0.0.1:4567/api/v1/extensions/install/${apkName}`).then(() => {
|
||||
setInstalledState('installed');
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className={classes.root}>
|
||||
@ -68,7 +76,7 @@ export default function ExtensionCard({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button variant="outlined">install</Button>
|
||||
<Button variant="outlined" onClick={() => install()}>{installedState}</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
2
webUI/react/src/typings.d.ts
vendored
2
webUI/react/src/typings.d.ts
vendored
@ -3,4 +3,6 @@ interface IExtension {
|
||||
lang: string
|
||||
versionName: string
|
||||
iconUrl: string
|
||||
installed: boolean
|
||||
apkName: string
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user