For store only build

This commit is contained in:
cutls 2020-09-09 16:59:18 +09:00
parent bdf2b9be71
commit 051dbb3b1b
7 changed files with 22 additions and 12 deletions

View File

@ -62,6 +62,6 @@ deploy:
skip_cleanup: true skip_cleanup: true
on: on:
repo: cutls/TheDesk repo: cutls/TheDesk
tags: false tags: true
#branches: branches:
# only: "/^v?[0-9\\.]+/" only: "/^v?[0-9\\.]+/"

View File

@ -143,8 +143,8 @@ function css(mainWindow) {
";--bottom:" + bottom + ";--accent:" + accent + ";" + ";--emphasized:" + emphasized + ";--his-data:" + ";--bottom:" + bottom + ";--accent:" + accent + ";" + ";--emphasized:" + emphasized + ";--his-data:" +
hisData + hisData +
";--active:" + active + ";--postbox:" + postbox + ";--modalfooter:" + ";--active:" + active + ";--postbox:" + postbox + ";--modalfooter:" +
modalFooter + ";--selected:" + selected + ";--selectedWithShare:" + selectedWithShare + "}" + modalFooter + ";--selected:" + selected + ";--selectedWithShare:" + selectedWithShare +
"--gray:" + gray + ";" + "--gray:" + gray + ";}" +
".customtheme #imagemodal{background: url(\"../img/pixel.svg\");}"; ".customtheme #imagemodal{background: url(\"../img/pixel.svg\");}";
} else { } else {
var css = compatibleTheme(json) var css = compatibleTheme(json)

View File

@ -1,6 +1,6 @@
{ {
"name": "thedesk", "name": "thedesk",
"version": "21.1.1", "version": "21.2.0",
"codename": "Mayu", "codename": "Mayu",
"description": "TheDesk is a Mastodon client for PC.", "description": "TheDesk is a Mastodon client for PC.",
"repository": "https://github.com/cutls/TheDesk", "repository": "https://github.com/cutls/TheDesk",

View File

@ -26,7 +26,7 @@
</script> </script>
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script> <script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
@@comment-end@@ @@comment-end@@
@@pwa@@ @@pwa@@ @@store@@
</head> </head>
<body id="mainView" class="@@pwaClass@@"> <body id="mainView" class="@@pwaClass@@">

View File

@ -31,7 +31,7 @@
_jipt.push(['project', 'thedesk']) _jipt.push(['project', 'thedesk'])
</script> </script>
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script> <script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
@@comment-end@@ @@pwa@@ @@comment-end@@ @@pwa@@ @@store@@
</head> </head>
<body class="@@pwaClass@@"> <body class="@@pwaClass@@">

View File

@ -16,8 +16,12 @@ var pwa = false
if (process.argv.indexOf('--pwa') > 0) { if (process.argv.indexOf('--pwa') > 0) {
var pwa = true var pwa = true
} }
var store = false
if (process.argv.indexOf('--store') > 0) {
var store = true
}
function main(ver, basefile, pwa) { function main(ver, basefile, pwa, store) {
const execSync = require('child_process').execSync const execSync = require('child_process').execSync
let gitHash = execSync('git rev-parse HEAD') let gitHash = execSync('git rev-parse HEAD')
.toString() .toString()
@ -144,7 +148,7 @@ function main(ver, basefile, pwa) {
source = source.replace(/@@lang@@/g, lang) source = source.replace(/@@lang@@/g, lang)
source = source.replace(/@@langlist@@/g, langstr) source = source.replace(/@@langlist@@/g, langstr)
if(pwa) { if(pwa) {
source = source.replace(/@@pwa@@/g, `<link rel="manifest" href="/manifest.json" /> source = source.replace(/@@pwa@@/g, `<link rel="manifest" href="../../manifest.json" />
<script>var pwa = true;"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.pwa.js").then(e=>{});</script>`) <script>var pwa = true;"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.pwa.js").then(e=>{});</script>`)
source = source.replace(/@@node_base@@/g, 'dependencies') source = source.replace(/@@node_base@@/g, 'dependencies')
source = source.replace(/@@pwaClass@@/g, 'pwaView') source = source.replace(/@@pwaClass@@/g, 'pwaView')
@ -153,11 +157,16 @@ function main(ver, basefile, pwa) {
source = source.replace(/@@node_base@@/g, 'node_modules') source = source.replace(/@@node_base@@/g, 'node_modules')
source = source.replace(/@@pwaClass@@/g, '') source = source.replace(/@@pwaClass@@/g, '')
} }
if (store) {
source = source.replace(/@@store@@/g, '<script>var store = true;</script>')
} else {
source = source.replace(/@@store@@/g, '<script>var store = false;</script>')
}
fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source) fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source)
} }
} }
} }
main(ver, basefile, pwa) main(ver, basefile, pwa, store)
//if --watch, to yarn dev //if --watch, to yarn dev
if (process.argv.indexOf('--watch') !== -1) { if (process.argv.indexOf('--watch') !== -1) {

View File

@ -31,6 +31,7 @@
} }
</style> </style>
@@pwa@@ @@pwa@@
@@store@@
</head> </head>
<body id="mainView" style="overflow-y:scroll" class="@@pwaClass@@"> <body id="mainView" style="overflow-y:scroll" class="@@pwaClass@@">
@ -107,7 +108,7 @@
<br> <br>
</div> </div>
</li> </li>
<li> <li class="pwa">
<div class="collapsible-header"> <div class="collapsible-header">
<i class="material-icons">color_lens</i>@@theme@@ <i class="material-icons">color_lens</i>@@theme@@
</div> </div>