mirror of
https://github.com/YunoHost-Apps/thelounge_ynh.git
synced 2024-09-03 20:35:54 +02:00
[enh] Add config.js
This commit is contained in:
parent
82d5a911c0
commit
e4101b0a6c
8 changed files with 47 additions and 15 deletions
|
@ -64,6 +64,17 @@ module.exports = {
|
||||||
//
|
//
|
||||||
prefetch: true,
|
prefetch: true,
|
||||||
|
|
||||||
|
// Serving path
|
||||||
|
//
|
||||||
|
// The path at which shout is available.
|
||||||
|
// For example if you set this to /chat,
|
||||||
|
// shout will be available at http://0.0.0.0:9000/chat
|
||||||
|
//
|
||||||
|
// @type string
|
||||||
|
// @default "/"
|
||||||
|
//
|
||||||
|
rootpath: "PATHTOCHANGE",
|
||||||
|
|
||||||
//
|
//
|
||||||
// Display network
|
// Display network
|
||||||
//
|
//
|
||||||
|
|
|
@ -3,4 +3,9 @@ location LOCATIONTOCHANGE {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
proxy_pass http://127.0.0.1:9191/;
|
proxy_pass http://127.0.0.1:9191/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,11 @@ sudo useradd -d $final_path shout \
|
||||||
# Modify the random username
|
# Modify the random username
|
||||||
user=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
user=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
sed -i "s@USERTOCHANGE@$user@g" ../conf/user.json
|
sed -i "s@USERTOCHANGE@$user@g" ../conf/user.json
|
||||||
|
sed -i "s@PATHTOCHANGE@$path/@g" ../conf/config.js
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
sudo mkdir -p $final_path/.shout/users
|
sudo mkdir -p $final_path/.shout/users
|
||||||
|
sudo cp ../conf/config.js $final_path/.shout/
|
||||||
sudo cp ../conf/user.json $final_path/.shout/users/$user.json
|
sudo cp ../conf/user.json $final_path/.shout/users/$user.json
|
||||||
sudo cp -a ../sources/* $final_path/
|
sudo cp -a ../sources/* $final_path/
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ path=${path%/}
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
sudo mkdir -p $final_path/.shout/users
|
sudo mkdir -p $final_path/.shout/users
|
||||||
|
sed -i "s@PATHTOCHANGE@$path/@g" ../conf/config.js
|
||||||
|
sudo cp ../conf/config.js $final_path/.shout/
|
||||||
sudo cp -a ../sources/* $final_path/
|
sudo cp -a ../sources/* $final_path/
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
|
|
||||||
<title>Shout</title>
|
<title>Shout</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/bootstrap.css">
|
<link rel="stylesheet" href="<%= rootpath %>css/bootstrap.css">
|
||||||
<link rel="stylesheet" href="css/style.css">
|
<link rel="stylesheet" href="<%= rootpath %>css/style.css">
|
||||||
<link id="theme" rel="stylesheet" href="<%= theme %>">
|
<link id="theme" rel="stylesheet" href="<%= theme %>">
|
||||||
|
|
||||||
<link rel="shortcut icon" href="/img/favicon.png">
|
<link rel="shortcut icon" href="<%= rootpath %>img/favicon.png">
|
||||||
<link rel="icon" sizes="192x192" href="/img/touch-icon-192x192.png">
|
<link rel="icon" sizes="192x192" href="<%= rootpath %>img/touch-icon-192x192.png">
|
||||||
<link rel="apple-touch-icon" sizes="120x120" href="/img/apple-touch-icon-120x120.png">
|
<link rel="apple-touch-icon" sizes="120x120" href="<%= rootpath %>img/apple-touch-icon-120x120.png">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="<%= public ? "public" : "" %>">
|
<body class="<%= public ? "public" : "" %>">
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h1 class="title">Connect</h1>
|
<h1 class="title">Connect</h1>
|
||||||
</div>
|
</div>
|
||||||
<div <%= typeof(displayNetwork) !== "undefined" && !displayNetwork ? 'style="display: none;"' : ''%>>
|
<div <%= typeof(displayNetwork) !== "undefined" && !displayNetwork ? 'style="display: none;"' : ''%> >
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2>Network settings</h2>
|
<h2>Network settings</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -285,9 +284,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/libs.min.js"></script>
|
<script src="<%= rootpath %>js/libs.min.js"></script>
|
||||||
<script src="js/shout.templates.js"></script>
|
<script src="<%= rootpath %>js/shout.templates.js"></script>
|
||||||
<script src="js/shout.js"></script>
|
<script src="<%= rootpath %>js/shout.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -37,7 +37,7 @@ $(function() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var pop = new Audio();
|
var pop = new Audio();
|
||||||
pop.src = "/audio/pop.ogg";
|
pop.src = config.rootpath + "audio/pop.ogg";
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
var pop = {
|
var pop = {
|
||||||
play: $.noop
|
play: $.noop
|
||||||
|
|
|
@ -64,6 +64,18 @@ module.exports = {
|
||||||
//
|
//
|
||||||
prefetch: true,
|
prefetch: true,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Serving path
|
||||||
|
//
|
||||||
|
// The path at which shout is available.
|
||||||
|
// For example if you set this to /chat,
|
||||||
|
// shout will be available at http://0.0.0.0:9000/chat
|
||||||
|
//
|
||||||
|
// @type string
|
||||||
|
// @default "/"
|
||||||
|
//
|
||||||
|
rootpath: "/",
|
||||||
|
|
||||||
//
|
//
|
||||||
// Display network
|
// Display network
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,8 +16,8 @@ module.exports = function(options) {
|
||||||
config = _.extend(config, options);
|
config = _.extend(config, options);
|
||||||
|
|
||||||
var app = express()
|
var app = express()
|
||||||
.use(index)
|
.use(config.rootpath, index)
|
||||||
.use(express.static("client"));
|
.use(config.rootpath, express.static("client"));
|
||||||
|
|
||||||
app.enable("trust proxy");
|
app.enable("trust proxy");
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ module.exports = function(options) {
|
||||||
server = server.createServer({
|
server = server.createServer({
|
||||||
key: fs.readFileSync(https.key),
|
key: fs.readFileSync(https.key),
|
||||||
cert: fs.readFileSync(https.certificate)
|
cert: fs.readFileSync(https.certificate)
|
||||||
}, app).listen(port, host)
|
}, app).listen(port, host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config.identd || {}).enable) {
|
if ((config.identd || {}).enable) {
|
||||||
|
@ -46,10 +46,11 @@ module.exports = function(options) {
|
||||||
sockets = io(server, {
|
sockets = io(server, {
|
||||||
transports: transports
|
transports: transports
|
||||||
});
|
});
|
||||||
|
sockets.path(config.rootpath + 'socket.io');
|
||||||
|
|
||||||
sockets.on("connect", function(socket) {
|
sockets.on("connect", function(socket) {
|
||||||
var authHeader = socket.client.request.headers.authorization;
|
var authHeader = socket.client.request.headers.authorization;
|
||||||
config.public = authHeader == undefined;
|
config.public = (authHeader == undefined);
|
||||||
if (config.public) {
|
if (config.public) {
|
||||||
auth.call(socket);
|
auth.call(socket);
|
||||||
} else if (authHeader) {
|
} else if (authHeader) {
|
||||||
|
|
Loading…
Reference in a new issue