Skip to content

Commit

Permalink
feat: Hide admin password and add Event metadata (#240)
Browse files Browse the repository at this point in the history
* feat: Hide admin password and add Event metadata

* fix typo

* CR changes

* Add change log

* add to lower

---------

Co-authored-by: Pedro Faria <predofaria@gmail.com>
  • Loading branch information
pedrofaria and pedrofaria authored Apr 21, 2023
1 parent ed3f46d commit 19f6f9e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.20.1
* Add event metadata field #223
* Hide /admin on chat command #233

## 1.20.0
* Changes for DLC 1.19 #238
* Update golang dep versions
Expand All @@ -10,7 +14,7 @@
* Fix float point handling for rain and cloud. #211
* Introducing the advance windows features as Firewall management, custom core affinity and cpu priority. #213
* Add accserver auto update before start instance.

## 1.18.0
* Add sorting by number of players.
* Add session remaining time in the servers list.
Expand Down
3 changes: 3 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,9 @@ const docTemplate = `{
"isFixedConditionQualification": {
"type": "integer"
},
"metaData": {
"type": "string"
},
"postQualySeconds": {
"type": "integer"
},
Expand Down
3 changes: 3 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,9 @@
"isFixedConditionQualification": {
"type": "integer"
},
"metaData": {
"type": "string"
},
"postQualySeconds": {
"type": "integer"
},
Expand Down
2 changes: 2 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ definitions:
type: integer
isFixedConditionQualification:
type: integer
metaData:
type: string
postQualySeconds:
type: integer
postRaceSeconds:
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/instance/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type EventJson struct {
Rain float64 `json:"rain"`
WeatherRandomness int `json:"weatherRandomness"`
Sessions []SessionSettings `json:"sessions"`
MetaData string `json:"metaData"`
PostQualySeconds int `json:"postQualySeconds"`
PostRaceSeconds int `json:"postRaceSeconds"`
SimracerWeatherConditions int `json:"simracerWeatherConditions"`
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/instance/livestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package instance

import (
"sort"
"strings"
"time"
)

Expand Down Expand Up @@ -318,6 +319,11 @@ func (l *LiveState) recalculatePositions() {
}

func (l *LiveState) addChat(name, message string) {
// skip /admin message
if len(message) > 6 && strings.ToLower(message[0:6]) == "/admin" {
return
}

l.Chats = append(l.Chats, ServerChat{
Timestamp: time.Now().UTC(),
Name: name,
Expand Down
15 changes: 10 additions & 5 deletions public/src/components/server_config/event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<field type="number" :label="$t('sessionovertimeseconds_label')" v-model="sessionOverTimeSeconds"></field>
<field type="number" :label="$t('postqualyseconds_label')" v-model="postQualySeconds"></field>
<field type="number" :label="$t('postraceseconds_label')" v-model="postRaceSeconds"></field>
<field :label="$t('metadata_label')" v-model="metaData"></field>
</div>
</div>
<session v-for="session in sessions"
Expand All @@ -44,7 +45,7 @@ import tracks from "../../data/tracks";
export default {
components: {collapsible, field, selection, session, checkbox},
data() {
return {
return {
tracks: tracks,
track: "barcelona",
preRaceWaitingTimeSeconds: 15,
Expand All @@ -59,7 +60,8 @@ export default {
simracerWeatherConditions: false,
isFixedConditionQualification: false,
sessionIndex: 0,
sessions: []
sessions: [],
metaData: ""
};
},
methods: {
Expand All @@ -77,6 +79,7 @@ export default {
this.simracerWeatherConditions = data.simracerWeatherConditions;
this.isFixedConditionQualification = data.isFixedConditionQualification;
this.setSessionData(data.sessions);
this.metaData = data.metaData;
},
setSessionData(data) {
for(let i = 0; i < data.length; i++) {
Expand All @@ -91,8 +94,8 @@ export default {
this.sessionIndex++;
}
},
getData() {
return {
getData() {
return {
track: this.track,
preRaceWaitingTimeSeconds: parseInt(this.preRaceWaitingTimeSeconds),
sessionOverTimeSeconds: parseInt(this.sessionOverTimeSeconds),
Expand All @@ -105,7 +108,8 @@ export default {
postRaceSeconds: parseInt(this.postRaceSeconds),
simracerWeatherConditions: this.simracerWeatherConditions ? 1 : 0,
isFixedConditionQualification: this.isFixedConditionQualification ? 1 : 0,
sessions: this.getSessionData()
sessions: this.getSessionData(),
metaData: this.metaData
};
},
getSessionData() {
Expand Down Expand Up @@ -209,6 +213,7 @@ export default {
"postraceseconds_label": "Post Race Seconds",
"simracerWeatherConditions_label": "Simracer Weather Conditions",
"isFixedConditionQualification_label": "Is Fixed Weather Conditions in Qualification",
"metadata_label": "Metadata",
"add_session_button": "Add session",
"add_sessions_q_r_button": "Add sessions (Q/R)",
"add_sessions_p_q_r_button": "Add sessions (P/Q/R)",
Expand Down

0 comments on commit 19f6f9e

Please sign in to comment.