var express = require('express')
var router = express.Router()
var session = require('express-session')
const MongoStore = require('connect-mongo')
require('dotenv').config()
router.use(session({
secret: process.env.SECRET_KEY,
resave: false,
saveUninitialized: false,
store: MongoStore.create({ mongoUrl: process.env.DATABASE_URI })
}))
const loginRoute = require('./users/login')
router.use('/', loginRoute)
const postRoute = require('./users/post')
router.use('/post', postRoute)
const categoryRoute = require('./users/category')
router.use('/category', categoryRoute)
const pageRoute = require('./users/page')
router.use('/page', pageRoute)
const bookRoute = require('./users/book')
router.use('/book', bookRoute)
const uploadRoute = require('./users/upload')
router.use('/upload', uploadRoute)
const userRoute = require('./users/user')
router.use('/user', userRoute)
module.exports = router
var express = require('express')
var router = express.Router()
var settings = require('../../settings')
router.get('/', async function(req, res, next) {
settings.dLogo = 'ទំព័រអ្នកប្រើប្រាស់'
if(req.session.user){
const today = new Date()
const date = today.toLocaleDateString('fr-CA')
const time = today.toLocaleTimeString('it-IT')
settings.datetime = date + 'T' + time
const count = await require('../../controllers/users/count')()
settings.message = `ចំនួនអ្នកប្រើប្រាស់សរុបៈ ${count}`
const read = await require('../../controllers/users/read')
settings.items = await read(settings.dItemLimit)
settings.route = 'user'
res.render('users/user', settings)
}else{
res.redirect('/users')
}
})
module.exports = router
<%- include('partials/header.ejs') %>
<link href="/styles/users/post.css" rel="stylesheet"></link>
<script src="/scripts/ckeditor/ckeditor.js"></script>
<script src="/scripts/users/post.js"></script>
<style>
.Main .content form .wrapper{
margin-top:5px;
display: grid;
grid-template-columns: auto 30% 15%;
}
</style>
<section class='Main region'>
<div class='sidebar'>
<%- include('partials/menu.ejs') %>
</div>
<div class='content'>
<form action='/users/user' method='post'>
<input type='text' name='title' placeholder='ឈ្មោះអ្នកប្រើប្រាស់' required />
<textarea name="content" id="editor" ></textarea>
<div class='wrapper'>
<input type='password' name='password' required />
<input type='email' name='email' required placeholder="email" />
<input type='text' name='role' required placeholder="មុខនាទី" />
<input type='text' name='thumb' required placeholder="តំណរភ្ជាប់រូបតំណាង" />
<input type='datetime-local' value='<%= datetime %>' name='datetime' required />
<input type='submit' value='បញ្ចូលទិន្នន័យ' />
</div>
<input name='entries' value='' type='hidden' />
</form>
<div class='form'>
<select name='type'>
<option>YouTube</option>
<option>YouTubePlaylist</option>
<option>Facebook</option>
<option>OK</option>
<option>Dailymotion</option>
<option>Vimeo</option>
</select>
<input name='id' type='text' placeholder="អត្តសញ្ញាណវីដេអូ" required />
<select name='ending'>
<option>ចប់ហើយ</option>
<option>មិនទាន់ចប់</option>
</select>
<input onclick='genJson()' type="button" value="បញ្ចូលវីដេអូ" />
</div>
<table class='viddata'></table>
<script src="/scripts/ckeditor/config.js"></script>
</div>
</section>
<%- include('partials/listing.ejs') %>
<style>
.List .item{
display: grid;
grid-template-columns: 12% auto 20%;
grid-gap: 10px;
align-items: center;
background: var(--background-light);
padding: 5px 0 5px 10px;
}
.List .item .thumb{
position: relative;
padding-top: 100%
}
.List .item .thumb img{
border-radius: 50%;
}
</style>
<%- include('partials/footer.ejs') %>
GitHub: https://github.com/Sokhavuth/tv
Vercel: https://tv-neon.vercel.app
Responsive: http://www.responsinator.com