Skip to content

Commit

Permalink
Update to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-luchack authored Jul 5, 2022
2 parents 02c3708 + 995a9ac commit 94ff10c
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 54 deletions.
184 changes: 178 additions & 6 deletions app/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ body, button {
}
.settingsFieldDesc {
font-size: 12px;
color: rgba(255, 255, 255, .95);
color: gray;
margin-top: 5px;
}
.settingsDivider {
Expand Down Expand Up @@ -1428,13 +1428,185 @@ input:checked + .toggleSwitchSlider:before {
.settingsFileSelDesc {
font-size: 10px;
margin: 20px 0px;
color: lightgrey;
color: gray;
width: 89%;
}
.settingsFileSelDesc strong {
font-family: 'Avenir Medium';
}

/* Server code */
.settingsServerCodeContainer {
display: flex;
flex-direction: column;
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
margin-bottom: 20px;
margin-top: 20px;
width: 75%;
}

/* Server Code title. */
.settingsServerCodesTitle {
margin-bottom: 10px;
font-size: 14px;
font-family: 'Avenir Medium';
}

/* Wrapper container for the actionable elements. */
.settingsServerCodeActions {
display: flex;
width: 60%;
}

/* Enabled text field which stores the secret code if available. */
.settingsInputServerCodeVal {
border-radius: 0px 3px 3px 0px !important;
width: 100%;
padding: 5px 10px;
font-size: 12px;
}

/* File selector icon settings. */
.settingsServerCodeIcon {
display: flex;
align-items: center;
background: rgba(126, 126, 126, 0.57);
border-radius: 3px 0px 0px 3px;
padding: 5px;
transition: 0.25s ease;
}
.settingsServerCodeSVG {
width: 20px;
height: 20px;
fill: white;
}

.settingsInputServerCodeButton {
border: 0px;
border-radius: 3px 3px 3px 3px;
font-size: 12px;
padding: 0px 5px;
margin-left: 10px;
cursor: pointer;
background: rgba(126, 126, 126, 0.57);
transition: 0.25s ease;
white-space: nowrap;
outline: none;
}
.settingsInputServerCodeButton:hover,
.settingInputServerCodeButton:focus {
text-shadow: 0px 0px 20px white;
}
.settingsInputServerCodeButton:active {
text-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
color: rgba(255, 255, 255, 0.75);
}

/* Description for the file selector. */
.settingsServerCodesDesc {
margin: 20px 0px;
color: grey;
font-size: 12px;
width: 90%;
}


.settingsServerCodesDesc strong {
font-family: 'Avenir Medium';
}

#settingsServerCodesListContent {
font-size: 16px;
background: rgba(0, 0, 0, 0.25);
border-radius: 3px;
color: white;
margin-top: 10px;
}

.settingsServerCode {
padding: 8px 0px 8px 8px;
}

/* Main content container for server code element information. */
.settingsServerCodeContent {
display: flex;
align-items: center;
justify-content: space-between;
transition: opacity 0.25s ease;
}

/* Wrapper container for the left side of a server code element. */
.settingsServerCodeMainWrapper {
display: flex;
align-items: center;
}

.settingsServerCodeRemoveWrapper {
margin-right: 25px;
}

/* Server code valid/invalid status. */
.settingsServerCodeStatus {
width: 7px;
height: 7px;
border-radius: 50%;
background-color: #c32625;
margin-right: 15px;
transition: 0.25s ease;
}

.settingsServerCode[valid] > .settingsServerCodeContent > .settingsServerCodeMainWrapper > .settingsServerCodeStatus {
background-color: #4ddd19;
}

/* Mod details container. */
.settingsServerCodeDetails {
display: flex;
flex-direction: column;
}

.settingsServerCodeName {
display: flex;
flex-direction: column;
font-size: 14px;
font-weight: bold;
}

.settingsServerCodeServerNamesContent {
max-width: 650px;
}

.settingsServerCodeServerName {
margin-right: 35px;
font-size: 12px;
}

.settingsServerCode:not([valid]) > .settingsServerCodeContent > .settingsServerCodeMainWrapper > .settingsServerCodeDetails > .settingsServerCodeServerNamesContent > .settingsServerCodeServerName {
color: red;
}

/* Button to remove drop-in mods. */
.settingsServerCodeRemoveButton {
background: none;
border: none;
font-size: 14px;
text-align: right;
padding: 0px;
color: grey;
cursor: pointer;
outline: none;
transition: 0.25s ease;
font-weight: bold;
}

.settingsServerCodeRemoveButton:hover,
.settingsServerCodeRemoveButton:focus {
color: red;
}
.settingsServerCodeRemoveButton:active {
color: #9b1f1f;
}

/* * *
* Settings View (Account Tab)
* * */
Expand Down Expand Up @@ -2866,8 +3038,9 @@ input:checked + .toggleSwitchSlider:before {
/* Logo container styles. */
#image_seal_container {
position: relative;
height: 70px;
width: 70px;
left: 15%;
height: 100px;
width: 100px;
border-radius: 50%;
margin-top: 50px;
}
Expand Down Expand Up @@ -2900,7 +3073,7 @@ input:checked + .toggleSwitchSlider:before {
visibility: hidden;
opacity: 0;
width: 100px;
height: 15px;
height: 30px;
background-color: rgb(0, 0, 0);
color: #fff;
text-align: center;
Expand All @@ -2909,7 +3082,6 @@ input:checked + .toggleSwitchSlider:before {
position: absolute;
z-index: 1;
top: 115%;
left: -17.5px;
font-family: 'Avenir Medium';
font-size: 12px;
transition: visibility 0s linear 0.25s, opacity 0.25s ease;
Expand Down
21 changes: 20 additions & 1 deletion app/assets/js/configmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ exports.setDataDirectory = function(dataDirectory){
config.settings.launcher.dataDirectory = dataDirectory
}

/**
* Get the launcher's available server codes. This will be used to load hidden servers.
*
* @returns {string[]} The server codes list that has been put into the launcher's configuration
*/
exports.getServerCodes = function(){
return config.settings.launcher.serverCodes
}

/**
* Set the new server code
*
* @param {string[]} serverCodes The new server code list.
*/
exports.setServerCodes = function(serverCodes){
config.settings.launcher.serverCodes = serverCodes
}

const configPath = path.join(exports.getLauncherDirectory(), 'config.json')
const configPathLEGACY = path.join(dataPath, 'config.json')
const firstLaunch = !fs.existsSync(configPath) && !fs.existsSync(configPathLEGACY)
Expand Down Expand Up @@ -93,7 +111,8 @@ const DEFAULT_CONFIG = {
launcher: {
allowPrerelease: false,
discordIntegration: true,
dataDirectory: dataPath
dataDirectory: dataPath,
serverCodes: []
}
},
newsCache: {
Expand Down
30 changes: 28 additions & 2 deletions app/assets/js/discordwrapper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Work in progress
const logger = require('./loggerutil')('%c[DiscordWrapper]', 'color: #7289da; font-weight: bold')

const {Client} = require('discord-rpc-patch')

let client
let activity

exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting for Client..'){
exports.initRPC = function(genSettings, initialDetails = 'Attente du client..'){
client = new Client({ transport: 'ipc' })

activity = {
Expand Down Expand Up @@ -49,6 +48,33 @@ exports.clearState = function(){
logger.log('Cleared the activity state!')
}

exports.startGamePresence = function(genSettings, servSettings){
activity = {
details: 'Chargement du jeu...',
state: '> Sur ' + servSettings.shortId,
largeImageKey: servSettings.largeImageKey,
largeImageText: servSettings.largeImageText,
smallImageKey: genSettings.smallImageKey,
smallImageText: genSettings.smallImageText,
startTimestamp: new Date().getTime(),
instance: activity.instance
}
client.setActivity(activity)
logger.log('Started game presence!')
}

exports.stopGamePresence = function(genSettings, initialDetails){
activity = {
details: initialDetails,
largeImageKey: genSettings.smallImageKey,
largeImageText: genSettings.smallImageText,
startTimestamp: new Date().getTime(),
instance: activity.instance
}
client.setActivity(activity)
logger.log('Cleared the game activity!')
}

exports.updateDetails = function(details){
activity.details = details
client.setActivity(activity)
Expand Down
25 changes: 25 additions & 0 deletions app/assets/js/distromanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ class Server {
return this.mainServer
}

/**
* @returns {string} The server code for this server
*/
getServerCode(){
return this.serverCode
}

/**
* @returns {boolean} Whether or not the server is autoconnect.
* by default.
Expand Down Expand Up @@ -499,6 +506,24 @@ class DistroIndex {
return null
}

/**
* Get a server configuration by its ID. If it does not
* exist, null will be returned.
*
* @param {string} id The ID of the server.
*
* @returns {Server[]} The server configuration with the given ID or null.
*/
getServersFromCode(code){
let servs = []
for(let serv of this.servers){
if(serv.serverCode === code){
servs.push(serv)
}
}
return servs
}

/**
* Get the main server.
*
Expand Down
Loading

0 comments on commit 94ff10c

Please sign in to comment.