mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 00:01: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 ->
|
app.get("/api/v1/extensions/install/:apkName") { ctx ->
|
||||||
val apkName = ctx.pathParam("apkName")
|
val apkName = ctx.pathParam("apkName")
|
||||||
|
println(apkName)
|
||||||
ctx.status(
|
ctx.status(
|
||||||
downloadApk(apkName)
|
downloadApk(apkName)
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import Card from '@material-ui/core/Card';
|
import Card from '@material-ui/core/Card';
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
@ -36,16 +36,24 @@ interface IProps {
|
|||||||
extension: IExtension
|
extension: IExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExtensionCard({
|
export default function ExtensionCard(props: IProps) {
|
||||||
|
const {
|
||||||
extension: {
|
extension: {
|
||||||
name, lang, versionName, iconUrl,
|
name, lang, versionName, iconUrl, installed, apkName,
|
||||||
},
|
},
|
||||||
}: IProps) {
|
} = props;
|
||||||
|
const [installedState, setInstalledState] = useState<string>((installed ? 'installed' : 'install'));
|
||||||
|
|
||||||
const classes = useStyles();
|
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();
|
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 (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent className={classes.root}>
|
<CardContent className={classes.root}>
|
||||||
@ -68,7 +76,7 @@ export default function ExtensionCard({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button variant="outlined">install</Button>
|
<Button variant="outlined" onClick={() => install()}>{installedState}</Button>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</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
|
lang: string
|
||||||
versionName: string
|
versionName: string
|
||||||
iconUrl: string
|
iconUrl: string
|
||||||
|
installed: boolean
|
||||||
|
apkName: string
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user