diff --git a/README.md b/README.md
index a55c782..c0e495a 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# LNReader Plugins
-
+
diff --git a/host.ps1 b/host.ps1
index 62ea012..890de22 100644
--- a/host.ps1
+++ b/host.ps1
@@ -1,5 +1,6 @@
$current=$(git rev-parse --abbrev-ref HEAD)
-$dist='dist'
+$version=$(node -e "console.log(require('./package.json').version);")
+$dist="plugins/v$($version)"
$exists=$(git show-ref refs/heads/$dist)
if ($exists){
diff --git a/host.sh b/host.sh
index 7a4d0ab..899b336 100755
--- a/host.sh
+++ b/host.sh
@@ -1,5 +1,6 @@
current=`git rev-parse --abbrev-ref HEAD`
-dist=dist
+version=`node -e "console.log(require('./package.json').version);"`
+dist="plugins/v$version"
exists=`git show-ref refs/heads/$dist`
if [ -n "$exists" ]; then
diff --git a/scripts/json_plugins.ts b/scripts/json_plugins.ts
index f1c3389..55e980b 100644
--- a/scripts/json_plugins.ts
+++ b/scripts/json_plugins.ts
@@ -12,14 +12,9 @@ const { execSync } = require('child_process');
const REMOTE = execSync('git remote get-url origin')
.toString()
.replace(/[\s\n]/g, '');
-let CURRENT_BRANCH = 'dist';
-try {
- CURRENT_BRANCH = execSync('git rev-parse --abbrev-ref HEAD')
- .toString()
- .replace(/[\s\n]/g, '');
-} catch {
- //
-}
+const CURRENT_BRANCH = execSync('git branch --show-current')
+ .toString()
+ .replace(/[\s\n]/g, '');
const matched = REMOTE.match(/([^:/]+?)\/([^/.]+)(\.git)?$/);
if (!matched) throw Error('Cant parse git url');
const USERNAME = matched[1];
@@ -90,13 +85,14 @@ for (let lang in json) json[lang].sort((a, b) => a.id.localeCompare(b.id));
fs.writeFileSync(jsonMinPath, JSON.stringify(json));
fs.writeFileSync(jsonPath, JSON.stringify(json, null, '\t'));
-if (CURRENT_BRANCH === 'dist') {
- fetch(`https://img.shields.io/badge/Plugins-${totalPlugins}-blue`)
- .then(res => res.text())
- .then(data => {
- fs.writeFileSync('total.svg', data, { encoding: 'utf-8' });
- });
-}
+fetch(`https://img.shields.io/badge/Plugins-${totalPlugins}-blue`)
+ .then(res => res.text())
+ .then(data => {
+ fs.writeFileSync('total.svg', data, { encoding: 'utf-8' });
+ })
+ .catch(error => {
+ fs.writeFileSync('total.svg', '', { encoding: 'utf-8' });
+ });
// check for broken plugins
for (let language in languages) {