
➕ Better scrollarea definition for messages area ➕ Logging http errors in catch statement on auth init
145 lines
5.0 KiB
HTML
145 lines
5.0 KiB
HTML
<!-- Keep in mind basically all the major components of the app are held together here -->
|
|
<!-- The reason for this is because ~~~~~ I'm actually just lazy -->
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
|
<!-- required bs for bootstrap -->
|
|
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css"/>
|
|
|
|
<link rel="stylesheet" href="css/style.css"/>
|
|
<title>Freechat</title>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
|
<a class="navbar-brand">
|
|
<img src="../assets/logo.png" width="30" height="30" class="d-inline-block align-top" loading="lazy">
|
|
Freechat
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-opts" aria-controls="navbar-opts" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbar-opts">
|
|
<ul class="navbar-nav mr-auto" style="display: inline-block;">
|
|
<button class="btn btn-outline-secondary btn-nav-settings me-2" type="button" id="settings-btn">Settings</button>
|
|
<button class="btn btn-outline-secondary btn-nav-settings" type="button" id="join-btn" data-toggle="modal", data-target="#joinform">Join</button>
|
|
</ul>
|
|
<!-- SERVER LIST -->
|
|
<ul class="navbav-nav mr-auto", id="server-list" style="display: inline-block;"></ul>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="wrapper" id="content-container">
|
|
<nav>
|
|
<div class="channels-list-header"><h3 id="server-name"></h3></div>
|
|
<ul class="list-unstyled components" id="channels-list">
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="container" style="max-width: 100%;">
|
|
<div class="channel-list-header">
|
|
<h4 id="channel-name"><h4>
|
|
<p id="channel-description"></p>
|
|
</div>
|
|
|
|
<ul class="scrollarea list-unstyled components" id="messages-list"></ul>
|
|
|
|
<div class="container" id="send-container">
|
|
<form class="form-inline">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" id="message-box" placehold="Message">
|
|
<button class="btn btn-primary" type="button">Send</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- Message box -->
|
|
</div>
|
|
|
|
<div id="joinform" class="modal fade" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content join-style">
|
|
<div class="modal-header"> <h5 class="modal-title">Paste an invite link below</h5> </div>
|
|
<div class="modal-body">
|
|
<form>
|
|
<input type="text" class="form-text join-form-label" id="invite-link-text">
|
|
<label for="submit-invite-link" class="form-label">Example: https://sample-domain.io:4536/invite/42069</label>
|
|
<button class="btn btn-outline-success" type="button" id="invite-link-button">Join</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Warning Toast -->
|
|
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
|
<div class="toast-header">
|
|
<!-- <img src="..." class="rounded mr-2" alt="..."> -->
|
|
<strong class="mr-auto">Warning</strong>
|
|
<small class="text-muted">just now</small>
|
|
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="toast-body" id="warning-toast"></div>
|
|
</div>
|
|
|
|
|
|
</body>
|
|
<!-- JQuery doesn't load so our squishy boi of the the collapsable menu literally doesn't work-->
|
|
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
|
|
<script>window.jQuery = window.$ = require('jquery')</script>
|
|
|
|
<script type="text/javascript" src="../node_modules/popper.js/dist/umd/popper.js"></script>
|
|
<script type="text/javascript" src="../node_modules/popper.js/dist/umd/popper-utils.js"></script>
|
|
<script type="text/javascript" src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
|
|
<script>
|
|
const { ipcRenderer } = require('electron')
|
|
const config = ipcRenderer.sendSync('config-request')
|
|
const auth = require('../src/auth.js')
|
|
const channels = require('../src/channels.js')
|
|
|
|
// used for basic styling on server buttons
|
|
const classes = 'btn btn-outline-secondary btn-nav-settings'
|
|
|
|
// NOTE: this will probably take minute if your in a lot of servers
|
|
// even worse if server owners are running debug builds like tards
|
|
// get a new jwt from each server on startup
|
|
auth.init(config)
|
|
.then(updated_cfg => {
|
|
for(const server_cfg of updated_cfg['servers']) {
|
|
const remote = server_cfg['server']
|
|
const user = server_cfg['user']
|
|
|
|
// html generation
|
|
const id = remote['hostname']
|
|
const txt = remote['name']
|
|
|
|
$('#server-list').append(
|
|
$('<input>').attr({
|
|
type: 'button',
|
|
'class' : classes,
|
|
id: id,
|
|
value: txt
|
|
})
|
|
)
|
|
console.log(user)
|
|
$(`#${id}`).on('click', () => {
|
|
channels.list(remote, user)
|
|
})
|
|
}
|
|
})
|
|
.catch(err => {
|
|
console.log(err, err.options)
|
|
$('#server-list').append(
|
|
$('<input>').attr({
|
|
type: 'button',
|
|
'class': classes + ' disabled',
|
|
value: `${err.options.url.hostname}`
|
|
})
|
|
)
|
|
})
|
|
</script>
|
|
</html>
|
|
|