Skip to content

Commit

Permalink
Fix LFM encoding files (#267)
Browse files Browse the repository at this point in the history
* Fix LFM encodign JSON files.

* rebase 1

* rebase 2
  • Loading branch information
pedrofaria authored Jan 22, 2024
1 parent 8484245 commit b3c3234
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Accweb Frontend",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"cwd": "${workspaceFolder}/public"
},
{
"name": "Accweb Backend",
"type": "go",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.23.0
* Feature: token timeout in configuration file [#262](https://github.com/assetto-corsa-web/accweb/issues/262)
* Fix setTyreSetCount default value to 50. [#227](https://github.com/assetto-corsa-web/accweb/issues/227)
* Fix LFM files encoding [#265](https://github.com/assetto-corsa-web/accweb/issues/265) [#266](https://github.com/assetto-corsa-web/accweb/issues/266)

## 1.22.2
* bump some go libs
* first test with wine killing processes issue
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func Load(file string) *Config {
}

if config.Auth.Timeout == nil {
m5 := 5 * time.Minute
config.Auth.Timeout = &m5
m := 20 * time.Minute
config.Auth.Timeout = &m
}

skipWine = config.SkipWine
Expand Down
17 changes: 14 additions & 3 deletions public/src/components/collapsible.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<i class="collapse-icon" v-bind:class="{fas: true, 'fa-chevron-down': !expanded, 'fa-chevron-up': expanded}"></i>
</div>
<div class="collapsible-content" v-show="expanded">
<div v-show="loadError" class="alert">
This is an invalid JSON file or maybe there is encoding issues.
</div>
<slot></slot>
</div>
</div>
Expand All @@ -22,13 +25,21 @@ export default {
components: { filereader },
data() {
return {
expanded: false
expanded: false,
loadError: ''
};
},
methods: {
onLoadContent: function (e) {
this.$emit("load", JSON.parse(e));
this.expanded = true
this.expanded = true;
this.loadError = false;
try {
const obj = JSON.parse(e.replaceAll('\x00', ''));
this.$emit("load", obj);
} catch (err) {
this.loadError = true;
}
}
}
}
Expand Down

0 comments on commit b3c3234

Please sign in to comment.