cached response for source list iconUrl

This commit is contained in:
Aria Moradi 2021-02-04 14:53:34 +03:30
parent 7284e0d4ae
commit 22bf49078f
4 changed files with 8 additions and 4 deletions

View File

@ -166,3 +166,7 @@ fun getExtensionIcon(apkName: String): Pair<InputStream, String> {
).execute()
}
}
fun getExtensionIconUrl(apkName: String): String {
return "http://127.0.0.1:4567/api/v1/extension/icon/$apkName"
}

View File

@ -80,7 +80,7 @@ fun getExtensionList(offline: Boolean = false): List<ExtensionDataClass> {
it[ExtensionsTable.lang],
it[ExtensionsTable.isNsfw],
it[ExtensionsTable.apkName],
it[ExtensionsTable.iconUrl],
getExtensionIconUrl(it[ExtensionsTable.apkName]),
it[ExtensionsTable.installed],
it[ExtensionsTable.classFQName]
)

View File

@ -78,7 +78,7 @@ fun getSourceList(): List<SourceDataClass> {
it[SourceTable.id].value.toString(),
it[SourceTable.name],
Locale(it[SourceTable.lang]).getDisplayLanguage(Locale(it[SourceTable.lang])),
ExtensionsTable.select { ExtensionsTable.id eq it[SourceTable.extension] }.first()[ExtensionsTable.iconUrl],
getExtensionIconUrl(ExtensionsTable.select { ExtensionsTable.id eq it[SourceTable.extension] }.first()[ExtensionsTable.apkName]),
getHttpSource(it[SourceTable.id].value).supportsLatest
)
}

View File

@ -43,7 +43,7 @@ interface IProps {
export default function ExtensionCard(props: IProps) {
const {
extension: {
name, lang, versionName, installed, apkName,
name, lang, versionName, installed, apkName, iconUrl,
},
} = props;
const [installedState, setInstalledState] = useState<string>((installed ? 'uninstall' : 'install'));
@ -81,7 +81,7 @@ export default function ExtensionCard(props: IProps) {
variant="rounded"
className={classes.icon}
alt={name}
src={`http://127.0.0.1:4567/api/v1/extension/icon/${apkName}`}
src={iconUrl}
/>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<Typography variant="h5" component="h2">