Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.

Commit 58d44d4

Browse files
committed
MazeAuth System + Electron 8
1 parent e7d2305 commit 58d44d4

File tree

11 files changed

+1395
-1574
lines changed

11 files changed

+1395
-1574
lines changed

app/assets/js/mojang.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,42 @@ const minecraftAgent = {
1414
name: 'Minecraft',
1515
version: 1
1616
}
17-
const authpath = 'https://authserver.mojang.com'
17+
const authpath = 'https://mazeauth.mazecity.fr' //'https://authserver.mojang.com'
1818
const statuses = [
1919
{
20-
service: 'sessionserver.mojang.com',
20+
service: 'sessionserver.mazecity.fr',
2121
status: 'grey',
22-
name: 'Multiplayer Session Service',
22+
name: 'MazeServers',
2323
essential: true
2424
},
2525
{
26-
service: 'authserver.mojang.com',
26+
service: 'authserver.mazecity.fr',
2727
status: 'grey',
28-
name: 'Authentication Service',
28+
name: 'MazeAuth Service',
2929
essential: true
3030
},
3131
{
32-
service: 'textures.minecraft.net',
32+
service: 'skin.mazecity.fr',
3333
status: 'grey',
34-
name: 'Minecraft Skins',
34+
name: 'MazeSkins System',
3535
essential: false
3636
},
3737
{
38-
service: 'api.mojang.com',
38+
service: 'api.mazecity.fr',
3939
status: 'grey',
40-
name: 'Public API',
40+
name: 'Public MazeAPI',
4141
essential: false
4242
},
4343
{
44-
service: 'minecraft.net',
44+
service: 'mazecity.fr',
4545
status: 'grey',
46-
name: 'Minecraft.net',
46+
name: 'Mazecity.fr',
4747
essential: false
4848
},
4949
{
50-
service: 'account.mojang.com',
50+
service: 'forum.mazecity.fr',
5151
status: 'grey',
52-
name: 'Mojang Accounts Website',
52+
name: 'Mazecity Forum',
5353
essential: false
5454
}
5555
]
@@ -79,25 +79,25 @@ exports.statusToHex = function(status){
7979
}
8080

8181
/**
82-
* Retrieves the status of Mojang's services.
82+
* Retrieves the status of Mazecity's services.
8383
* The response is condensed into a single object. Each service is
8484
* a key, where the value is an object containing a status and name
8585
* property.
8686
*
87-
* @see http://wiki.vg/Mojang_API#API_Status
87+
* @see http://wiki.vg/Mojang_API#API_Status -> NOW Mazecity
8888
*/
8989
exports.status = function(){
9090
return new Promise((resolve, reject) => {
91-
request.get('https://status.mojang.com/check',
91+
request.get('https://status.mazecity.fr/check/',
9292
{
9393
json: true,
9494
timeout: 2500
9595
},
9696
function(error, response, body){
9797

9898
if(error || response.statusCode !== 200){
99-
logger.warn('Unable to retrieve Mojang status.')
100-
logger.debug('Error while retrieving Mojang statuses:', error)
99+
logger.warn('Unable to retrieve Mazecity status.')
100+
logger.debug('Error while retrieving Mazecity statuses:', error)
101101
//reject(error || response.statusCode)
102102
for(let i=0; i<statuses.length; i++){
103103
statuses[i].status = 'grey'
@@ -143,8 +143,7 @@ exports.authenticate = function(username, password, clientToken, requestUser = t
143143
if(clientToken != null){
144144
body.clientToken = clientToken
145145
}
146-
147-
request.post(authpath + '/authenticate',
146+
request.post(authpath + '/authserver/authenticate',
148147
{
149148
json: true,
150149
body
@@ -175,7 +174,7 @@ exports.authenticate = function(username, password, clientToken, requestUser = t
175174
*/
176175
exports.validate = function(accessToken, clientToken){
177176
return new Promise((resolve, reject) => {
178-
request.post(authpath + '/validate',
177+
request.post(authpath + '/authserver/validate',
179178
{
180179
json: true,
181180
body: {
@@ -210,7 +209,7 @@ exports.validate = function(accessToken, clientToken){
210209
*/
211210
exports.invalidate = function(accessToken, clientToken){
212211
return new Promise((resolve, reject) => {
213-
request.post(authpath + '/invalidate',
212+
request.post(authpath + '/authserver/invalidate',
214213
{
215214
json: true,
216215
body: {
@@ -246,7 +245,7 @@ exports.invalidate = function(accessToken, clientToken){
246245
*/
247246
exports.refresh = function(accessToken, clientToken, requestUser = true){
248247
return new Promise((resolve, reject) => {
249-
request.post(authpath + '/refresh',
248+
request.post(authpath + '/authserver/refresh',
250249
{
251250
json: true,
252251
body: {

app/assets/js/processbuilder.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ class ProcessBuilder {
306306
args = args.concat(ConfigManager.getJVMOptions())
307307
args.push('-Djava.library.path=' + tempNativePath)
308308

309+
args.push('-Duuid=' +this.authUser.uuid.trim())
310+
args.push('-Dtoken=' +this.authUser.accessToken)
311+
args.push('-D' +this.authUser.accessToken)
312+
309313
// Main Java Class
310314
args.push(this.forgeData.mainClass)
311315

@@ -503,7 +507,7 @@ class ProcessBuilder {
503507
val = this.authUser.accessToken
504508
break
505509
case 'user_type':
506-
val = 'mojang'
510+
val = 'mazecity'
507511
break
508512
case 'version_type':
509513
val = this.versionData.type

app/assets/js/scripts/landing.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,13 @@ function dlAsync(login = true){
519519
loggerAEx.log(data)
520520
})
521521
aEx.on('error', (err) => {
522-
loggerLaunchSuite.error('Error during launch', err)
523-
showLaunchFailure('Error During Launch', err.message || 'See console (CTRL + Shift + i) for more details.')
522+
loggerLaunchSuite.error('Error during launch 1', err)
523+
showLaunchFailure('Error During Launch 1', err.message || 'See console (CTRL + Shift + i) for more details.')
524524
})
525525
aEx.on('close', (code, signal) => {
526526
if(code !== 0){
527527
loggerLaunchSuite.error(`AssetExec exited with code ${code}, assuming error.`)
528-
showLaunchFailure('Error During Launch', 'See console (CTRL + Shift + i) for more details.')
528+
showLaunchFailure('Error During Launch 1', 'See console (CTRL + Shift + i) for more details.')
529529
}
530530
})
531531

@@ -633,8 +633,8 @@ function dlAsync(login = true){
633633
if(m.result.forgeData == null || m.result.versionData == null){
634634
loggerLaunchSuite.error('Error during validation:', m.result)
635635

636-
loggerLaunchSuite.error('Error during launch', m.result.error)
637-
showLaunchFailure('Error During Launch', 'Please check the console (CTRL + Shift + i) for more details.')
636+
loggerLaunchSuite.error('Error during launch 2, No Forge downloaded', m.result.error)
637+
showLaunchFailure('Error during launch 2, No Forge downloaded', 'Please check the console (CTRL + Shift + i) for more details.')
638638

639639
allGood = false
640640
}
@@ -707,8 +707,8 @@ function dlAsync(login = true){
707707

708708
} catch(err) {
709709

710-
loggerLaunchSuite.error('Error during launch', err)
711-
showLaunchFailure('Error During Launch', 'Please check the console (CTRL + Shift + i) for more details.')
710+
loggerLaunchSuite.error('Error during launch 3', err)
711+
showLaunchFailure('Error During Launch 3', 'Please check the console (CTRL + Shift + i) for more details.')
712712

713713
}
714714
}

app/assets/js/scripts/login.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ loginButton.addEventListener('click', () => {
261261

262262
// Show loading stuff.
263263
loginLoading(true)
264-
265264
AuthManager.addAccount(loginUsername.value, loginPassword.value).then((value) => {
266265
updateSelectedAccount(value)
267266
loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.success'))
@@ -294,7 +293,7 @@ loginButton.addEventListener('click', () => {
294293
toggleOverlay(false)
295294
})
296295
toggleOverlay(true)
297-
loggerLogin.log('Error while logging in.', err)
296+
loggerLogin.log('Error while logging in.', err, loginUsername.value, loginPassword.value)
298297
})
299298

300299
})

app/assets/js/scripts/uicore.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ window.eval = global.eval = function () {
2626

2727
// Display warning when devtools window is opened.
2828
remote.getCurrentWebContents().on('devtools-opened', () => {
29-
console.log('%cThe console is dark and full of terrors.', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
29+
console.log('%cNe regardez pas la console si on ne vous l\'a pas demandé', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
3030
console.log('%cIf you\'ve been told to paste something here, you\'re being scammed.', 'font-size: 16px')
3131
console.log('%cUnless you know exactly what you\'re doing, close this window.', 'font-size: 16px')
3232
})
3333

3434
// Disable zoom, needed for darwin.
3535
webFrame.setZoomLevel(0)
3636
webFrame.setVisualZoomLevelLimits(1, 1)
37-
webFrame.setLayoutZoomLevelLimits(0, 0)
3837

3938
// Initialize auto updates in production environments.
4039
let updateCheckListener

app/assets/js/serverstatus.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const net = require('net')
1+
//const net = require('net')
22
const request = require('request')
33

44
/**
@@ -80,29 +80,27 @@ exports.getStatus = function(address, port = 25565){
8080

8181
exports.getStatus = function(address){
8282
return new Promise((resolve, reject) => {
83-
request.get('https://mcapi.us/server/status?ip=mazecity.boxtoplay.com',
83+
request.get('https://api.mcsrvstat.us/2/mazecraft.mine.gg',
8484
{
8585
json: true,
8686
timeout: 2500
8787
},
8888
function(error, response, body){
8989

9090
if(error || response.statusCode !== 200){
91-
logger.warn('Unable to retrieve Mazecity status.')
92-
logger.debug('Error while retrieving Mazecity statuses:', error)
93-
//reject(error || response.statusCode)
91+
reject(error || response.statusCode)
9492
resolve({
9593
online: false
9694
})
9795
} else {
9896
resolve({
9997
online: true,
100-
version: body.server.name.replace(/\u0000/g, ''),
101-
motd: body.motd.replace(/\u0000/g, ''),
102-
onlinePlayers: body.players.now,
98+
version: body.version,
99+
onlinePlayers: body.players.online,
103100
maxPlayers: body.players.max
104101
})
105102
}
106103
})
104+
console.log(request)
107105
})
108106
}

app/landing.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
</div>
102102
<div class="bot_divider"></div>
103103
<div id="mojangStatusWrapper">
104-
<span class="bot_label">MOJANG STATUS</span>
104+
<span class="bot_label">MAZECITY STATUS</span>
105105
<span id="mojang_status_icon">&#8226;</span>
106106
<div id="mojangStatusTooltip">
107107
<div id="mojangStatusTooltipTitle">Services</div>

app/login.ejs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,44 @@
22
<div id="loginCancelContainer" style="display: none;">
33
<button id="loginCancelButton">
44
<div id="loginCancelIcon">X</div>
5-
<span id="loginCancelText">Cancel</span>
5+
<span id="loginCancelText">Annule</span>
66
</button>
77
</div>
88
<div id="loginContent">
99
<form id="loginForm">
1010
<img id="loginImageSeal" src="assets/images/discord.png"/>
11-
<span id="loginSubheader">MINECRAFT LOGIN</span>
11+
<span id="loginSubheader">MAZECITY LOGIN</span>
1212
<div class="loginFieldContainer">
1313
<svg id="profileSVG" class="loginSVG" viewBox="40 37 65.36 61.43">
1414
<g>
1515
<path d="M86.77,58.12A13.79,13.79,0,1,0,73,71.91,13.79,13.79,0,0,0,86.77,58.12M97,103.67a3.41,3.41,0,0,0,3.39-3.84,27.57,27.57,0,0,0-54.61,0,3.41,3.41,0,0,0,3.39,3.84Z"/>
1616
</g>
1717
</svg>
1818
<span class="loginErrorSpan" id="loginEmailError">* Invalid Value</span>
19-
<input id="loginUsername" class="loginField" type="text" placeholder="EMAIL OR USERNAME"/>
19+
<input id="loginUsername" class="loginField" type="text" placeholder="Pseudo"/>
2020
</div>
2121
<div class="loginFieldContainer">
2222
<svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
2323
<g>
2424
<path d="M86.16,54a16.38,16.38,0,1,0-32,0H44V102.7H96V54Zm-25.9-3.39a9.89,9.89,0,1,1,19.77,0A9.78,9.78,0,0,1,79.39,54H60.89A9.78,9.78,0,0,1,60.26,50.59ZM70,96.2a6.5,6.5,0,0,1-6.5-6.5,6.39,6.39,0,0,1,3.1-5.4V67h6.5V84.11a6.42,6.42,0,0,1,3.39,5.6A6.5,6.5,0,0,1,70,96.2Z"/>
2525
</g>
2626
</svg>
27-
<span class="loginErrorSpan" id="loginPasswordError">* Required</span>
28-
<input id="loginPassword" class="loginField" type="password" placeholder="PASSWORD"/>
27+
<span class="loginErrorSpan" id="loginPasswordError">* Requis</span>
28+
<input id="loginPassword" class="loginField" type="password" placeholder="Mot de passe"/>
2929
</div>
3030
<div id="loginOptions">
3131
<span class="loginSpanDim">
32-
<a href="https://help.mojang.com/customer/en/portal/articles/329524-change-or-forgot-password">forgot password?</a>
32+
<a href="https://mazecity.fr/forgot">Mot de passe oublié ?</a>
3333
</span>
3434
<label id="checkmarkContainer">
3535
<input id="loginRememberOption" type="checkbox" checked>
36-
<span id="loginRememberText" class="loginSpanDim">remember me?</span>
36+
<span id="loginRememberText" class="loginSpanDim">Rester connecté ?</span>
3737
<span class="loginCheckmark"></span>
3838
</label>
3939
</div>
4040
<button id="loginButton" disabled>
4141
<div id="loginButtonContent">
42-
LOGIN
42+
Connexion
4343
<svg id="loginSVG" viewBox="0 0 24.87 13.97">
4444
<defs>
4545
<style>.arrowLine{fill:none;stroke:#FFF;stroke-width:2px;transition: 0.25s ease;}</style>
@@ -54,10 +54,10 @@
5454
</button>
5555
<div id="loginDisclaimer">
5656
<span class="loginSpanDim" id="loginRegisterSpan">
57-
<a href="https://minecraft.net/en-us/store/minecraft/">Need an Account?</a>
57+
<a href="https://mazeauth.mazecity.fr/authserver/register">Besoin d'un compte?</a>
5858
</span>
59-
<p class="loginDisclaimerText">Your password is sent directly to mojang and never stored.</p>
60-
<p class="loginDisclaimerText">MazeLauncher is not affiliated with Mojang AB.</p>
59+
<p class="loginDisclaimerText">Si c'est votre premiere fois, veuillez créer votre compte.</p>
60+
<p class="loginDisclaimerText">Mazecity et ses services ne sont pas affiliés à Mojang AB ou Microsoft.</p>
6161
</div>
6262
</form>
6363
</div>

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ ipcMain.on('distributionIndexDone', (event, res) => {
8686
// https://electronjs.org/docs/tutorial/offscreen-rendering
8787
app.disableHardwareAcceleration()
8888

89+
app.allowRendererProcessReuse = true
90+
8991
// Keep a global reference of the window object, if you don't, the window will
9092
// be closed automatically when the JavaScript object is garbage collected.
9193
let win
@@ -119,7 +121,7 @@ function createWindow() {
119121

120122
win.removeMenu()
121123

122-
win.setResizable(true)
124+
win.resizable = true
123125

124126
win.on('closed', () => {
125127
win = null

0 commit comments

Comments
 (0)