Skip to content

Third-die #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ nbproject
/app/server/db
npm-debug.log*
*.*~*
package-lock.json
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Run Server",
"program": "${workspaceFolder}/app/server/server.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# Using alpine image, because it is super slim
FROM alpine

ARG USER=default
ENV HOME /home/$USER

# Install only bash and nodejs, then remove cached package data
RUN apk add --update bash && apk add --update nodejs nodejs-npm && rm -rf /var/cache/apk/*
RUN apk add --update bash && apk add --update nodejs npm git && rm -rf /var/cache/apk/*

# Create app directory. This is where source code will be copied to
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Create a user for running npm install
# add new user
RUN adduser -D $USER \
&& mkdir -p /etc/sudoers.d \
&& echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER \
&& chmod 0440 /etc/sudoers.d/$USER
# USER $USER
# WORKDIR $HOME

# Copy source from host to directory in container
COPY . /usr/src/app

Expand Down
42 changes: 22 additions & 20 deletions app/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap-theme.min.css">
<link href="http://fonts.googleapis.com/css?family=Raleway:400,300,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="style/backgammon.css">
<link rel="stylesheet" type="text/css" href="style/ribbons.css">
<script src="js/bundle.js"></script>

<script type="text/x-mustache" id="tmpl-board">
<div id="frame-top" class="frame"></div>
<div class="board cf">
Expand Down Expand Up @@ -54,13 +54,13 @@
<div id="dice" style="display: none"></div>
</div>
</script>

<script type="text/x-mustache" id="tmpl-rule-selector-item">
<label class="btn btn-default btn-lg {{active}}">
<input type="radio" name="rule-selected" value="{{name}}" autocomplete="off" {{checked}}> {{title}}
</label>
</script>

</head>
<body id="page-index">

Expand All @@ -69,25 +69,27 @@
<tr>
<td height="100%" valign="middle">
<div id="github-ribbon" class="ribbon right hidden-xs"><a href="https://github.com/quasoft/backgammonjs">Project at GitHub</a></div>
<div class="container-fluid">
<div class="row">
<h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</small></h1>
<div class="container-fluid center">
<div class="row text-center">
<h1 class="text-center">Upgammon<br>
<small>From Bangkok to Chang Mai to now</small>
</h1>
<div class="container-fluid">
<div class="row">
<div class="col col-xs-12 text-center">
<div id="rule-selector" class="btn-group" data-toggle="buttons">
<label class="btn btn-default btn-lg active">
<!-- <label class="btn btn-default btn-lg active">
<input type="radio" name="rule-selected" value="*" autocomplete="off" checked> Any
</label>
</label> -->
</div>
</div>
</div>
<div class="row">
<div class="col col-ts-12 col-xs-6 text-right">
<!-- <div class="col col-ts-12 col-xs-6 text-right">
<button id="btn-play-random" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>Random player</button>
</div>
<div class="col col-ts-12 col-xs-6 text-left">
<button id="btn-challenge-friend" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-user" aria-hidden="true"></span>Challenge friend</button>
</div> -->
<div class="col col-ts-12 col-xs-6 text-center">
<button id="btn-challenge-friend" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-user" aria-hidden="true"></span>Challenge friend</button>
</div>
</div>
</div>
Expand All @@ -96,7 +98,7 @@ <h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</sma
</td>
</tr>
</table>

<!-- Game menu -->
<nav class="navbar navbar-default collapse">
<div class="container-fluid">
Expand All @@ -107,7 +109,7 @@ <h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</sma
<div class="navbar-collapse">
<button type="button" class="btn btn-primary navbar-btn yourself" title="Your score in current match"><span id="yourself" class="player">Yourself</span><span id="yourscore" class="score badge">3</span></button>
<button type="button" class="btn btn-default navbar-btn opponent" title="Opponent's score in current match"><span id="oppscore" class="score badge left">3</span><span id="opponent" class="player">Opponent</span></button>

<ul class="nav navbar-nav navbar-right">
<li><a id="menu-resign" href="#" title="Resign from current game"><span class="glyphicon glyphicon-flag"></span>Resign</a></li>
<li><a id="menu-undo" href="#" title="Undo moves made"><span class="glyphicon glyphicon-repeat"></span>Undo</a></li>
Expand All @@ -116,7 +118,7 @@ <h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</sma
</div>
</div>
</nav>

<!-- Game board -->
<table id="game-view" width="100%" height="100%" style="display: none">
<tr>
Expand All @@ -125,12 +127,12 @@ <h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</sma
</td>
</tr>
</table>

<div id="game-result-overlay" class="game-result overlay" style="display: none">
<div class="text message">Message</div>
<div class="text score"><span class="state">State</span><br><strong><span class="yourscore">0</span>&nbsp;:&nbsp;<span class="oppscore">0</span></strong></div>
</div>

<div id="waiting-overlay" class="waiting overlay" style="display: none">
<div class="loader"><div class="inner"><span>Waiting another player...</span><br><img src="images/loader.gif"><br>
<br>
Expand All @@ -145,7 +147,7 @@ <h1 class="text-center">Backgammon.js<br><small>Extensible multiplayer game</sma
</div>
</div></div>
</div>

<div id="messages">
</div>
</body>
Expand Down
Loading