feat(client): added a Version command to display the current version of Isaiah in the browser

This commit is contained in:
Will Moss
2024-05-08 09:51:45 +07:00
parent 5614249b83
commit 93725d1327
5 changed files with 29 additions and 23 deletions

View File

@@ -715,27 +715,6 @@ html {
}
}
// Mobile blocker
.mobile-blocker {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 99;
pointer-events: none;
background: var(--color-terminal-background);
display: flex;
align-items: center;
justify-content: center;
text-align: center;
p {
padding: 0 24px;
line-height: 125%;
}
@media screen and (min-width: 920px) {
display: none;
}
*.has-accent {
color: var(--color-terminal-accent) !important;
}

View File

@@ -756,6 +756,10 @@
<span class="cell">G </span>
<span class="cell">open project on Github</span>
</div>
<div class="row is-not-interactive">
<span class="cell">V </span>
<span class="cell">show version</span>
</div>
<div class="row is-not-interactive"></div>
<div class="row is-not-interactive">
<span class="cell">T </span>
@@ -3556,10 +3560,28 @@
websocketSend({ action: `enumerate`, Host: host }, true);
}
},
/**
* Public - Display current version
*/
version: function () {
state.message.category = 'report';
state.message.type = 'success';
state.message.title = 'Version';
state.message.content = `You are currently running the version <em class="has-accent">${VERSION}</em> of Isaiah.`;
state.message.isEnabled = true;
state.helper = 'message';
cmdRun(cmds._showPopup, 'message');
},
};
// === Variables
/**
* @type {string}
*/
const VERSION = '-VERSION-';
/**
* @type {string}
*/
@@ -3650,6 +3672,7 @@
'?': 'help',
'/': 'search',
J: 'jump',
V: 'version',
// Appearance
'+': 'nextLayout', // Next layout

View File

@@ -26,6 +26,7 @@ npx --yes terser ./client/assets/js/isaiah.js -o ./client/assets/js/isaiah.js
VERSION=$(git describe --tags --abbrev=0)
sed -i.bak "s/isaiah.js/isaiah.js?v=$VERSION/" ./client/index.html
sed -i.bak "s/style.css/style.css?v=$VERSION/" ./client/index.html
sed -i.bak "s/-VERSION-/$VERSION/" ./client/assets/js/isaiah.js
# Build the app
go build -o isaiah main.go
@@ -37,6 +38,7 @@ mv ./client/assets/js/isaiah.backup.js ./client/assets/js/isaiah.js
# Remove backup files
rm -f ./client/index.html.bak
rm -f ./client/assets/js/isaiah.js.bak
DESTINATION="/usr/bin"
if [ -d "/usr/local/bin" ]; then

View File

@@ -11,6 +11,7 @@ mv ./client/assets/js/isaiah.backup.js ./client/assets/js/isaiah.js
# Remove the version parameter from the main JS & CSS linked files
sed -i.bak -E 's/\?v=[0-9.]+//' ./client/index.html
rm -f ./client/index.html.bak
rm -f ./client/assets/js/isaiah.js.bak
# Remove dist folder generated by goreleaser
rm -rf ./dist/

View File

@@ -25,3 +25,4 @@ npx --yes terser ./client/assets/js/isaiah.js -o ./client/assets/js/isaiah.js
VERSION=$(git describe --tags --abbrev=0)
sed -i.bak "s/isaiah.js/isaiah.js?v=$VERSION/" ./client/index.html
sed -i.bak "s/style.css/style.css?v=$VERSION/" ./client/index.html
sed -i.bak "s/-VERSION-/$VERSION/" ./client/assets/js/isaiah.js