Commit 4710b05f6fe9812cae35daf81217917c785dd220

Authored by Adhidarma Hadiwinoto
1 parent 0936a661ad
Exists in master

buang yg gak perlu di html

Showing 2 changed files with 3 additions and 3 deletions Inline Diff

views/starter-template.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="en"> 2 <html lang="en">
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 7 <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
8 8
9 <title>{{ title }}</title> 9 <title>{{ title }}</title>
10 10
11 <!-- Bootstrap core CSS --> 11 <!-- Bootstrap core CSS -->
12 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> 12 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
13 13
14 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 14 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
15 <link href="/ie10-viewport-bug-workaround.css" rel="stylesheet"> 15 <link href="/ie10-viewport-bug-workaround.css" rel="stylesheet">
16 16
17 <!-- Custom styles for this template --> 17 <!-- Custom styles for this template -->
18 <link href="/starter-template.css" rel="stylesheet"> 18 <link href="/starter-template.css" rel="stylesheet">
19 19
20 <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> 20 <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
21 <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> 21 <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
22 <script src="/ie-emulation-modes-warning.js"></script> 22 <script src="/ie-emulation-modes-warning.js"></script>
23 23
24 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 24 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
25 <!--[if lt IE 9]> 25 <!--[if lt IE 9]>
26 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> 26 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
27 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 27 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
28 <![endif]--> 28 <![endif]-->
29 </head> 29 </head>
30 30
31 <body> 31 <body>
32 32
33 <nav class="navbar navbar-inverse navbar-fixed-top"> 33 <nav class="navbar navbar-inverse navbar-fixed-top">
34 <div class="container"> 34 <div class="container">
35 <div class="navbar-header"> 35 <div class="navbar-header">
36 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> 36 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
37 <span class="sr-only">Toggle navigation</span> 37 <span class="sr-only">Toggle navigation</span>
38 <span class="icon-bar"></span> 38 <span class="icon-bar"></span>
39 <span class="icon-bar"></span> 39 <span class="icon-bar"></span>
40 <span class="icon-bar"></span> 40 <span class="icon-bar"></span>
41 </button> 41 </button>
42 <a class="navbar-brand" href="/">{{ title }}</a> 42 <a class="navbar-brand" href="/">{{ title }}</a>
43 </div> 43 </div>
44 <div id="navbar" class="collapse navbar-collapse"> 44 <div id="navbar" class="collapse navbar-collapse">
45 <ul class="nav navbar-nav"> 45 <ul class="nav navbar-nav">
46 <li><a href="/">Home</a></li> 46 <!-- <li><a href="/">Home</a></li> -->
47 </ul> 47 </ul>
48 </div><!--/.nav-collapse --> 48 </div><!--/.nav-collapse -->
49 </div> 49 </div>
50 </nav> 50 </nav>
51 51
52 <div class="container"> 52 <div class="container">
53 53
54 <div class="starter-template"> 54 <div class="starter-template">
55 55
56 <h1>{{ title }}</h1> 56 <!-- <h1>{{ title }}</h1> -->
57 57
58 {% block content %} 58 {% block content %}
59 59
60 <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p> 60 <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>
61 61
62 {% endblock %} 62 {% endblock %}
63 63
64 </div> 64 </div>
65 65
66 </div><!-- /.container --> 66 </div><!-- /.container -->
67 67
68 <!-- Bootstrap core JavaScript 68 <!-- Bootstrap core JavaScript
69 ================================================== --> 69 ================================================== -->
70 <!-- Placed at the end of the document so the pages load faster --> 70 <!-- Placed at the end of the document so the pages load faster -->
71 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 71 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
72 <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> 72 <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
73 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> 73 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
74 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 74 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
75 <script src="/ie10-viewport-bug-workaround.js"></script> 75 <script src="/ie10-viewport-bug-workaround.js"></script>
76 </body> 76 </body>
77 </html> 77 </html>
78 78
1 var express = require('express'); 1 var express = require('express');
2 var nunjucks = require('nunjucks'); 2 var nunjucks = require('nunjucks');
3 var bodyParser = require('body-parser'); 3 var bodyParser = require('body-parser');
4 4
5 var config; 5 var config;
6 var logger; 6 var logger;
7 7
8 var app = express(); 8 var app = express();
9 9
10 function pageHome(req, res, next) { 10 function pageHome(req, res, next) {
11 res.render('restart.html', {title: config.globals.smsc}); 11 res.render('restart.html', {title: config.globals.smsc});
12 } 12 }
13 13
14 function doRestart(req, res, next) { 14 function doRestart(req, res, next) {
15 if (config.webadmin.password.trim() && config.webadmin.password.trim() == req.body.password) { 15 if (config.webadmin.password.trim() && config.webadmin.password.trim() == req.body.password) {
16 res.end('Restarting'); 16 res.end('Restarting....');
17 process.exit(1); 17 process.exit(1);
18 } else { 18 } else {
19 res.redirect('/'); 19 res.redirect('/');
20 } 20 }
21 } 21 }
22 22
23 function init(options) { 23 function init(options) {
24 config = options.config; 24 config = options.config;
25 logger = options.logger; 25 logger = options.logger;
26 26
27 app.set('views', './views'); 27 app.set('views', './views');
28 app.use(express.static('public', {maxAge: 24 * 3600 * 1000})); 28 app.use(express.static('public', {maxAge: 24 * 3600 * 1000}));
29 app.use(bodyParser.urlencoded({extended: true})); 29 app.use(bodyParser.urlencoded({extended: true}));
30 nunjucks.configure('views', { 30 nunjucks.configure('views', {
31 autoescape: true, 31 autoescape: true,
32 express: app 32 express: app
33 }); 33 });
34 34
35 app.get('/', pageHome); 35 app.get('/', pageHome);
36 app.post('/', doRestart); 36 app.post('/', doRestart);
37 37
38 app.listen(config.webadmin.listen_port, function () { 38 app.listen(config.webadmin.listen_port, function () {
39 logger.info('Webadmin listening on port ' + config.webadmin.listen_port); 39 logger.info('Webadmin listening on port ' + config.webadmin.listen_port);
40 }); 40 });
41 }; 41 };
42 42
43 exports.init = init; 43 exports.init = init;
44 44