Skip to content

Commit

Permalink
1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Mar 6, 2019
1 parent 737a4cd commit cd5285f
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 29 deletions.
8 changes: 4 additions & 4 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mishiro",
"version": "1.8.4",
"version": "1.8.5",
"description": "mishiro",
"main": "./public/mishiro.main.js",
"scripts": {
Expand Down Expand Up @@ -76,7 +76,7 @@
"electron-github-asar-updater": "^2.0.0",
"fs-extra": "^7.0.1",
"marked": "^0.5.2",
"mishiro-core": "^1.5.3",
"mishiro-core": "^1.5.6",
"request": "^2.88.0",
"sqlite3": "^4.0.6"
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/ts/main/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class Configurer {
this.configFile = configFile
if (!fs.existsSync(configFile)) {
this.config = {
latestResVer: 10040400,
latestResVer: 10052300,
language: 'zh'
}
} else {
this.config = fs.readJsonSync(configFile) || {}
this.config.latestResVer = this.config.latestResVer || 10040400
this.config.latestResVer = this.config.latestResVer || 10052300
this.config.language = this.config.language || 'zh'
}
fs.writeJsonSync(configFile, this.config, { spaces: 2 })
Expand Down
30 changes: 15 additions & 15 deletions app/src/ts/main/core.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import configurer from './config'
import { Client } from 'mishiro-core'
import * as core from 'mishiro-core'
import { execSync as system } from 'child_process'
import * as Updater from 'electron-github-asar-updater'
import { app, dialog } from 'electron'

let _$_$_
try {
_$_$_ = require('./_$_$_').default
} catch (err) {
dialog.showErrorBox('Error', 'Account not found.')
app.quit()
}
// import { app, dialog } from 'electron'

// let _$_$_
// try {
// _$_$_ = require('./_$_$_').default
// } catch (err) {
// dialog.showErrorBox('Error', 'Account not found.')
// app.quit()
// }

const updater = new Updater('toyobayashi/mishiro')

declare namespace global {
export let mishiroCore: typeof import('mishiro-core')
export let client: Client
export let client: core.Client
export let execSync: any
export let updater: Updater
}

global.mishiroCore = require('mishiro-core')
global.mishiroCore = core

let config = configurer.getConfig()

const confver = config.latestResVer
const confacc = config.account

global.client = new Client(
confacc || Buffer.from(_$_$_, 'base64').toString(),
confver !== void 0 ? confver.toString() : void 0
global.client = new core.Client(
confacc || '::',
confver !== void 0 ? (confver - 100).toString() : void 0
)

global.execSync = function (command: string) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/ts/renderer/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function check (progressing: (prog: ProgressInfo) => void) {
console.log('/load/check failed')
}

let versionFrom = config.latestResVer as number
let versionFrom = (config.latestResVer as number) - 100

return new Promise<number>((resolve, reject) => {
let resVer = versionFrom
Expand Down
34 changes: 29 additions & 5 deletions app/src/ts/renderer/mishiro-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import { MasterData } from '../main/on-master-read'
import ProgressBar from '../../vue/component/ProgressBar.vue'
import check from './check'

import { ipcRenderer, Event } from 'electron'
import { ipcRenderer, Event, remote } from 'electron'
import getPath from './get-path'
import MishiroIdol from './mishiro-idol'
import ThePlayer from './the-player'
// import { unpackTexture2D } from './unpack-texture-2d'

const { manifestPath, masterPath, bgmDir, iconDir } = getPath

let clientR: typeof client = remote.getGlobal('client')

@Component({
components: {
ProgressBar
Expand Down Expand Up @@ -147,8 +149,7 @@ export default class extends Vue {

mounted () {
this.$nextTick(() => {
this.text = this.$t('update.check') as string
this.event.$on('enter', async ($resver?: number) => { // 已从入口进入
this.event.$on('enter', async ($resver?: number) => {
ipcRenderer.on('readManifest', async (_event: Event, masterHash: string, resVer: number) => {
const masterFile = await this.getMaster(resVer, masterHash)
if (masterFile) ipcRenderer.send('readMaster', masterFile, resVer)
Expand Down Expand Up @@ -288,12 +289,35 @@ export default class extends Vue {
// console.log(failedList)
this.emitReady()
})
if (navigator.onLine) { // 判断网络是否连接
if (navigator.onLine) {
let resVer: number
if ($resver) {
resVer = $resver
} else {

if (!clientR.user) {
// try {
// this.text = 'Loading...'
// this.loading = 0
// const acc = await clientR.signup((step) => {
// this.loading = step
// })
// if (acc !== '') {
// this.configurer.configure('account', acc)
// } else {
// throw new Error('')
// }
// } catch (err) {
// console.log(err)
clientR.user = '506351535'
clientR.viewer = '141935962'
clientR.udid = 'edb05dd4-9d13-4f76-b860-95f7a79de44e'
// }
}

try {
this.text = this.$t('update.check') as string
this.loading = 0
resVer = await this.getResVer()
} catch (err) {
console.log(err)
Expand All @@ -309,7 +333,7 @@ export default class extends Vue {
this.$emit('input', this.appData)
const manifestFile = await this.getManifest(resVer)
if (manifestFile) ipcRenderer.send('readManifest', manifestFile, resVer)
} else { // 如果网络未连接则直接触发ready事件
} else {
let resVer = this.configurer.getConfig().latestResVer as number
this.appData.resVer = Number(resVer)
this.$emit('input', this.appData)
Expand Down

0 comments on commit cd5285f

Please sign in to comment.