Add the list of available extensions.

This commit is contained in:
Alessandro Jean 2019-09-17 12:30:41 -03:00
parent c6ea68b370
commit 159f8c9e3d
5 changed files with 165 additions and 3 deletions

45
package-lock.json generated
View File

@ -1737,6 +1737,43 @@
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==",
"dev": true "dev": true
}, },
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
},
"is-buffer": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"babel-loader": { "babel-loader": {
"version": "8.0.6", "version": "8.0.6",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz",
@ -5585,6 +5622,11 @@
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true "dev": true
}, },
"iso-639-1": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-2.1.0.tgz",
"integrity": "sha512-8CTinLimb9ncAJ11wpCETWZ51qsQ3LS4vMHF2wxRRtR3+b7bvIxUlXOGYIdq0413+baWnbyG5dBluVcezOG/LQ=="
},
"isobject": { "isobject": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
@ -5784,8 +5826,7 @@
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
"dev": true
}, },
"lodash._reinterpolate": { "lodash._reinterpolate": {
"version": "3.0.0", "version": "3.0.0",

View File

@ -13,5 +13,10 @@
"devDependencies": { "devDependencies": {
"http-server": "^0.11.1", "http-server": "^0.11.1",
"vuepress": "^1.1.0" "vuepress": "^1.1.0"
},
"dependencies": {
"axios": "^0.19.0",
"iso-639-1": "^2.1.0",
"lodash": "^4.17.15"
} }
} }

View File

@ -0,0 +1,104 @@
<template>
<div>
<div v-for="extensionGroup in extensions" :key="extensionGroup[0].lang">
<h2>{{ langName(extensionGroup[0].lang) }}</h2>
<div class="extension" v-for="extension in extensionGroup" :key="extension.apk">
<img :src="iconUrl(extension.apk)" width="42" height="42">
<div class="extension-text">
<div class="upper">
<span class="bold">{{ extension.name.split(': ')[1] }}</span>
<Badge :text="'v' + extension.version"/>
</div>
<div class="down">
{{ extension.pkg }}
</div>
</div>
<a :href="apkUrl(extension.apk)" class="button" download>Download</a>
</div>
</div>
</div>
</template>
<script>
const axios = require('axios')
const groupBy = require('lodash/groupBy')
const sortBy = require('lodash/sortBy')
const ISO6391 = require('iso-639-1').default
const EXTENSION_JSON = 'https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/index.json'
export default {
data: function () {
return {
extensions: []
}
},
methods: {
langName: code => code === 'all' ? 'All' : ISO6391.getName(code),
iconUrl (pkg) {
const pkgName = pkg.substring(0, pkg.lastIndexOf('.'))
return `https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/icon/${pkgName}.png`
},
apkUrl: apk => `https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/apk/${apk}`
},
async beforeMount () {
const { data } = await axios.get(EXTENSION_JSON)
const values = Object.values(groupBy(data, 'lang'))
this.$data.extensions = sortBy(values, [g => this.langName(g[0].lang)])
}
}
</script>
<style>
.extension {
display: flex;
align-items: center;
padding: 0.4em 0.2em;
}
.extension:not(:last-child) {
border-bottom: 1px solid #eaecef;
}
.extension img {
margin-right: 0.5em;
}
.extension .extension-text {
flex: 1;
}
.extension .extension-text .down {
font-size: 0.8rem;
font-family: monospace;
color: #6c757d;
}
.extension .button {
display: inline-block;
font-size: 0.8em;
color: #fff;
background-color: #2e84bf;
padding: 0.3rem;
border-radius: 4px;
transition: background-color 0.1s ease;
box-sizing: border-box;
border-bottom: 1px solid #2977ac;
text-transform: uppercase;
}
.extension .button:hover {
background-color: #3992cf;
text-decoration: none !important;
}
.bold {
font-weight: bold;
}
@media (max-width: 767px) {
.extension .extension-text .down {
display: none;
}
}
</style>

View File

@ -10,13 +10,15 @@ module.exports = {
nav: [ nav: [
{ text: 'Guide', link: '/guide/' }, { text: 'Guide', link: '/guide/' },
{ text: 'FAQ', link: '/faq/' }, { text: 'FAQ', link: '/faq/' },
{ text: 'Extensions', link: '/extensions/' },
{ text: 'Wiki', link: 'https://github.com/inorichi/tachiyomi/wiki' }, { text: 'Wiki', link: 'https://github.com/inorichi/tachiyomi/wiki' },
{ text: 'Discord', link: 'https://discord.gg/tachiyomi' } { text: 'Discord', link: 'https://discord.gg/tachiyomi' }
], ],
sidebar: [ sidebar: [
'/', '/',
'/guide/', '/guide/',
'/faq/' '/faq/',
'/extensions/'
], ],
lastUpdated: 'Last Updated' lastUpdated: 'Last Updated'
} }

10
src/extensions/README.md Normal file
View File

@ -0,0 +1,10 @@
---
title: Available extensions
lang: en-US
---
# Extensions
Here is a list of all available extensions to download inside the app.
<ExtensionList/>