Skip to content

Commit

Permalink
更新本地配方数据、版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
Tnze committed Dec 7, 2023
1 parent e80f08e commit 940bc88
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffxiv-best-craft",
"private": true,
"version": "0.13.2",
"version": "0.13.3",
"scripts": {
"dev": "VITE_BESTCRAFT_TARGET=tauri vite",
"build": "VITE_BESTCRAFT_TARGET=tauri vite build",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "AGPL-3.0-or-later"
name = "app"
repository = "https://github.com/Tnze/ffxiv-best-craft"
rust-version = "1.71"
version = "0.13.2"
version = "0.13.3"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
Binary file modified src-tauri/assets/xiv.db
Binary file not shown.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "BestCraft",
"version": "0.13.2"
"version": "0.13.3"
},
"build": {
"distDir": "../dist",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if (isOnTauri) {
<el-form-item :label="$t('data-source')">
<el-select v-model="store.dataSource">
<el-option v-if="isOnTauri" :label="$t('ds-local')" value="local" />
<el-option v-else :label="$t('ds-yyyygames')" value="yyyy.games" />
<el-option :label="$t('ds-yyyygames')" value="yyyy.games" />
<el-option :label="$t('ds-xivapi')" value="xivapi" />
<el-option :label="$t('ds-cafe')" value="cafe" />
</el-select>
Expand Down
5 changes: 3 additions & 2 deletions src/components/recipe-manager/CustomizeRecipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,16 @@ let recipeLevelPromise: Promise<RecipeLevel> | null = null
watch(
[
autoLoad,
() => settingStore.getDataSource,
() => settingStore.dataSource,
() => customRecipe.value.rlv
],
async ([autoLoad, dataSource, rlv]) => {
console.log("dataSource", dataSource)
if (!autoLoad) return;
try {
autoLoadLoading.value = true
if (recipeLevelPromise != null) await recipeLevelPromise
recipeLevelPromise = (await dataSource).recipeLevelTable(rlv ?? 0)
recipeLevelPromise = (await settingStore.getDataSource).recipeLevelTable(rlv ?? 0)
recipeLevel.value = await recipeLevelPromise
recipeLevelPromise = null
} catch {
Expand Down
25 changes: 11 additions & 14 deletions src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,20 @@ export default defineStore('settings', {
})
},
async getDataSource(): Promise<DataSource> {
let dataSources: Record<string, () => DataSource> = {
'yyyy.games': () => new WebSource(YYYYGamesApiBase),
'xivapi': () => new XivApiRecipeSource(XivapiBase, this.dataSourceLang),
'cafe': () => new XivApiRecipeSource(CafeMakerApiBase),
}
let defaultSource: () => DataSource = dataSources['yyyy.games']
if (import.meta.env.VITE_BESTCRAFT_TARGET == "tauri") {
var { LocalRecipeSource } = await import('../components/recipe-manager/local-source')
switch (this.dataSource) {
case 'local':
return new LocalRecipeSource()
case 'xivapi': return new XivApiRecipeSource(XivapiBase, this.dataSourceLang)
case 'cafe': return new XivApiRecipeSource(CafeMakerApiBase)
default: return new LocalRecipeSource()
}
} else {
switch (this.dataSource) {
case 'yyyy.games': return new WebSource(YYYYGamesApiBase)
case 'xivapi': return new XivApiRecipeSource(XivapiBase, this.dataSourceLang)
case 'cafe': return new XivApiRecipeSource(CafeMakerApiBase)
default: return new XivApiRecipeSource(CafeMakerApiBase)
}
let localSource = () => new LocalRecipeSource()
dataSources['local'] = localSource
defaultSource = localSource
}

return (dataSources[this.dataSource] ?? defaultSource)()
}
},
actions: {
Expand Down

0 comments on commit 940bc88

Please sign in to comment.