Add: git hash
This commit is contained in:
parent
5694cbd945
commit
5007b70683
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -12,4 +12,11 @@ enq.md
|
|||
app/.tkn
|
||||
app/node_modules
|
||||
app/js/login/tkn.js
|
||||
app/package-lock.json
|
||||
app/package-lock.json
|
||||
app/view/en
|
||||
app/view/ja
|
||||
app/view/de
|
||||
app/view/bg
|
||||
app/view/cs
|
||||
app/view/ps
|
||||
app/git
|
||||
|
|
|
@ -11,6 +11,7 @@ before_deploy:
|
|||
- cd app
|
||||
- VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')
|
||||
- npm install
|
||||
- npm run construct
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ];then electron-builder --mac -p never;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then electron-builder --linux --x64 -p never;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then cd ../build;else :;fi
|
||||
|
|
|
@ -60,7 +60,7 @@ ipc.send("getPlatform", "")
|
|||
ipc.on('platform', function (event, args) {
|
||||
localStorage.setItem("platform", args[0])
|
||||
localStorage.setItem("bit", args[1])
|
||||
localStorage.setItem("about", JSON.stringify([args[2], args[3], args[4]]))
|
||||
localStorage.setItem("about", JSON.stringify([args[2], args[3], args[4], args[5]]))
|
||||
})
|
||||
|
||||
ipc.on('reload', function (event, arg) {
|
||||
|
|
|
@ -25,7 +25,7 @@ function tips(mode) {
|
|||
clearInterval(spotStart);
|
||||
if (mode == "ver") {
|
||||
tipsToggle()
|
||||
$("#tips-text").html('<img src="../../img/desk.png" width="20" onclick="todo(\'!TheDesk! It\\\'s a nice client!\')"><span style="font-size:20px">TheDesk</span> ' + localStorage.getItem("ver") + '[<i class="material-icons" style="font-size:1.2rem;top: 3px;position: relative;">supervisor_account</i><span id="persons">1+</span>]')
|
||||
$("#tips-text").html('<img src="../../img/desk.png" width="20" onclick="todo(\'TheDesk is a nice client!: TheDesk ' + localStorage.getItem("ver") + ' git: '+ gitHash +'\')"><span style="font-size:20px">TheDesk</span> <span title="git: '+ gitHash +'">' + localStorage.getItem("ver") + '</span>[<i class="material-icons" style="font-size:1.2rem;top: 3px;position: relative;">supervisor_account</i><span id="persons">1+</span>]')
|
||||
localStorage.setItem("tips", "ver")
|
||||
} else if (mode == "clock") {
|
||||
tipsToggle()
|
||||
|
|
|
@ -42,7 +42,12 @@ function system(mainWindow, dir, lang, dirname) {
|
|||
});
|
||||
//プラットフォーム
|
||||
ipc.on('getPlatform', function (e, arg) {
|
||||
e.sender.webContents.send('platform', [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron]);
|
||||
try {
|
||||
var gitHash = fs.readFileSync("git", 'utf8')
|
||||
} catch{
|
||||
var gitHash = null
|
||||
}
|
||||
e.sender.webContents.send('platform', [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron, gitHash]);
|
||||
})
|
||||
//言語
|
||||
ipc.on('lang', function (e, arg) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"construct": "cd view/make && node make",
|
||||
"construct": "cd view/make && node make --automatic && cd ../../",
|
||||
"dev": "electron ./ --dev",
|
||||
"dist": "build --linux snap",
|
||||
"build:js": "node build.js",
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<body>
|
||||
<script>
|
||||
var ver = "@@versionLetter@@";
|
||||
var gitHash = "@@gitHash@@"
|
||||
//betaを入れるとバージョンチェックしない
|
||||
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
|
||||
//var ver="beta";
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
const fs = require("fs")
|
||||
const readlineSync = require('readline-sync');
|
||||
const readlineSync = require('readline-sync')
|
||||
let ver = "Usamin (18.8.3)"
|
||||
let input = readlineSync.question('version string [empty: '+ ver +' (default)]? ');
|
||||
if (input){
|
||||
ver = input
|
||||
const execSync = require('child_process').execSync;
|
||||
let gitHash = execSync("git rev-parse HEAD").toString().trim()
|
||||
fs.writeFileSync("../../git", gitHash)
|
||||
if (process.argv.indexOf("--automatic") === -1) {
|
||||
let input = readlineSync.question('version string [empty: ' + ver + ' (default)]? ');
|
||||
if (input) {
|
||||
ver = input
|
||||
}
|
||||
}
|
||||
console.log("Constructing view files " + ver + ": make sure to update package.json")
|
||||
const langs = ["ja", "en", "ps", "bg", "cs", "de"]
|
||||
|
@ -22,7 +27,7 @@ for (let i = 0; i < samples.length; i++) {
|
|||
for (let j = 0; j < langs.length; j++) {
|
||||
let source = sourceParent
|
||||
let lang = langs[j]
|
||||
let target = JSON.parse(fs.readFileSync("language/" + lang + "/" + simples[i] + ".json", 'utf8'))
|
||||
let target = JSON.parse(fs.readFileSync("language/" + lang + "/" + simples[i] + ".json", 'utf8'))
|
||||
Object.keys(target).forEach(function (key) {
|
||||
let str = target[key]
|
||||
str = str.replace(/"/g, '\\"')
|
||||
|
@ -37,6 +42,7 @@ for (let i = 0; i < samples.length; i++) {
|
|||
source = source.replace(/@@comment-end@@/g, "-->")
|
||||
}
|
||||
source = source.replace(/@@versionLetter@@/g, ver)
|
||||
source = source.replace(/@@gitHash@@/g, gitHash)
|
||||
source = source.replace(/@@lang@@/g, lang)
|
||||
source = source.replace(/@@langlist@@/g, langstr)
|
||||
fs.writeFileSync("../" + lang + "/" + pages[i], source)
|
||||
|
|
Loading…
Reference in New Issue
Block a user