Commit a5c643f8 authored by Luís's avatar Luís 👺

Initial commit

parent f71c0166
node_modules/*
*.log
data/*.json
data/**/*.json
data/lists/*-active.json
data/lists/*-top100.json
data/lists/*-wikicap.json
\ No newline at end of file
# WikiStats
Wiki Stats is based on the original [Wiki-Fi](https://web.archive.org/web/20160802192949/http://stats.wiki.tf/).
It currently only supports the [Official Team Fortress Wiki](https://wiki.tf) but may support other [Valve Wiki Network](https://wiki.teamfortress.com/wiki/Valve_Wiki_Network) wikis at some point in the future.
# Running
WikiStats is built using [Node.js](https://nodejs.org/en/).
Due to a limitation in the worker-nodes library, WikiStats currently only runs on Linux. To run it on Windows, [install WSL with your Linux distribution of choice](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (if you don't have one, it's probably Ubuntu), make sure you [install Node on this subsystem](https://nodejs.org/en/download/package-manager/), and run node/NPM through bash in the Windows command line.
\ No newline at end of file
/** * (c) Espacorede Project * **/
const bodyParser = require("body-parser");
const engines = require("consolidate");
const express = require("express");
const logger = require("./scripts/logger");
const db = require("./scripts/mongooseConnect");
const app = express();
db.on("error", (err) => {
if (err) {
logger.mongooseerror(`Falha ao conectar-se ao MongoDB: ${err}`);
}
});
app.engine("html", engines.mustache);
app.set("view engine", "html");
app.set("views", `${__dirname}/views`);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use("/", require(`${__dirname}/routes/main`));
app.use("/public", express.static(`${__dirname}/public`));
app.use(function (req, res) {
res.status(404).render("error", {
errorCode: 404,
errorTitle: "Not Found",
errorReturnToMain: true,
partials: {
header: "common/header"
}
});
});
module.exports = app;
\ No newline at end of file
/** * (c) Espacorede Project * **/
const logger = require("../scripts/logger");
const WSConfig = require("../configs/wikistats-config.json");
require("../scripts/checkfiles");
const http = require("http");
const app = require("../app");
const server = http.createServer(app);
const port = process.env.PORT || WSConfig["port"];
app.set("port", port);
const socketio = require("socket.io")(server);
require("../scripts/socket")(socketio);
require("../scripts/cronjob");
server.listen(port);
server.on("error", onError);
server.on("listening", () => {
logger.info(`WikiStats running on port ${port}!`);
});
function onError(error) {
if (error.syscall !== "listen") {
throw error;
}
if (error.code === "EACCES") {
logger.error(`Port ${port} requires elevated privileges!`);
process.exit(1);
} else if (error.code === "EADDRINUSE") {
logger.error(`Port ${port} is already in use!`);
process.exit(1);
} else {
throw error;
}
}
{
"protocol": "https",
"server": "artifact.gamepedia.com",
"path": "/"
}
\ No newline at end of file
{
"protocol": "https",
"server": "dota2.gamepedia.com",
"path": "/"
}
\ No newline at end of file
{
"protocol": "https",
"server": "dota2-pt.gamepedia.com",
"path": "/"
}
\ No newline at end of file
{
"protocol": "https",
"server": "theportalwiki.com",
"path": "/w"
}
\ No newline at end of file
{
"protocol": "https",
"server": "wiki.teamfortress.com",
"path": "/w"
}
\ No newline at end of file
{
"enabled": [
"tf",
"dotapt",
"portal",
"dota",
"artifact"
],
"aliases": [
"tf",
"dota",
"dotapt",
"portal",
"artifact"
],
"name": {
"tf": "Team Fortress Wiki",
"dota": "Dota 2 Wiki",
"dotapt": "Dota 2 Wiki (PT)",
"portal": "The Portal Wiki",
"artifact": "Artifact Wiki"
},
"creation": {
"tf": "2010-06-01",
"dota": "2011-11-03",
"dotapt": "2017-01-24",
"portal": "2011-04-20",
"artifact": "2017-08-09"
},
"url": {
"tf": "https://wiki.teamfortress.com",
"dota": "https://dota2.gamepedia.com",
"dotapt": "https://dota2-pt.gamepedia.com",
"portal": "https://theportalwiki.com",
"artifact": "https://artifact.gamepedia.com"
}
}
\ No newline at end of file
{
"mongoose": {
"hostm": "",
"user": "",
"password": "",
"db": ""
},
"logger": "info",
"maxCPUs": 4,
"port": "3000"
}
\ No newline at end of file
/** * (c) Espacorede Project * **/
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const userModel = new Schema({
u_sourcewiki: String,
u_name: String,
u_userid: Number,
u_edits: Number,
u_registration: String,
u_contribs: Array,
u_pagecreations: Number,
u_uniquepages: Number,
u_uploads: Number,
u_alluploads: Number,
u_minoredits: Number,
u_blockcount: Number,
u_deletecount: Number,
u_namespaceedits: Array,
u_topeditedpages: Array,
dataLastUpdated: String,
updateComplete: Boolean
});
module.exports = mongoose.model("user", userModel);
\ No newline at end of file
/** * (c) Espacorede Project * **/
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const wikiModel = new Schema({
alias: String,
w_name: String,
w_pages: Number,
w_articles: Number,
w_edits: Number,
w_images: Number,
w_users: Number,
w_activeusers: Number,
w_admins: Number,
w_last30: Number,
w_last7: Number,
w_age: String,
dataLastUpdated: String
});
module.exports = mongoose.model("wiki", wikiModel);
\ No newline at end of file
{
"verbose": false,
"delay": "300000",
"ignore": [
"logs/*",
"public/*",
"views/*",
"configs/*",
"data/*.json"
]
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "wikistats",
"version": "1.0.0",
"description": "OTFWiki Stats",
"main": "app.js",
"scripts": {
"start": "nodemon ./bin/www"
},
"contributors": [
{
"name": "Luís",
"email": "luis@espacore.de"
},
{
"name": "Gabriel",
"email": "gabriel@espacore.de"
}
],
"license": "MIT",
"dependencies": {
"body-parser": "^1.18.3",
"cachegoose": "^7.1.0",
"consolidate": "^0.15.1",
"express": "^4.16.4",
"moment": "^2.22.2",
"mongoose": "^5.3.10",
"mustache": "^2.3.1",
"nodemon": "^1.18.7",
"nodemw": "^0.12.2",
"socket.io": "^2.1.1",
"socket.io-client": "^2.1.1",
"tabletojson": "^0.9.8",
"winston": "^3.1.0",
"worker-nodes": "^1.6.1"
}
}
/* Fundos */
.mui-appbar,
footer {
background-color: #b7914f !important;
}
/* Tooltip e botões */
button {
color: white !important;
background-color: #745b30 !important;
}
button:hover {
background-color: #745530 !important;
}
input:focus {
border-color: #745b30 !important;
}
/* Cores */
#userBig::placeholder {
color: rgba(255,255,255,.56) !important;
}
.user-bot {
background-color: #FE48AA;
color: white;
}
.user-staff {
background-color: #3F56AD;
color: white;
}
.user-curse {
background-color: #f26122;
color: white;
}
.user-normal {
color: #3F56AD;
}
\ No newline at end of file
/* Fundos */
.mui-appbar,
footer {
background-color: #B44335 !important;
}
/* Tooltip e botões */
button {
color: white;
background-color: #a53d31 !important;
}
button:hover {
background-color: #96372d !important;
}
input:focus {
border-color: #a53d31 !important;
}
/* Cores */
#userBig::placeholder {
color: rgba(255,255,255,.26) !important;
}
header>div>table>tbody>tr>td.mui--text-right>ul>li:nth-child(2)>button,
#user-content-top>div.mui--text-right>button {
color: whitesmoke !important;
}
.user-bot {
background-color: #FE48AA;
color: white;
}
.user-staff {
background-color: #52D017;
color: white;
}
.user-curse {
background-color: #f26122;
color: white;
}
.user-normal {
color: #3F56AD;
}
\ No newline at end of file
/* Fundos */
.mui-appbar,
footer {
background-color: #B44335 !important;
}
/* Tooltip e botões */
button {
color: white;
background-color: #a53d31 !important;
}
button:hover {
background-color: #96372d !important;
}
input:focus {
border-color: #a53d31 !important;
}
/* Cores */
#userBig::placeholder {
color: rgba(255,255,255,.26) !important;
}
header>div>table>tbody>tr>td.mui--text-right>ul>li:nth-child(2)>button,
#user-content-top>div.mui--text-right>button {
color: whitesmoke !important;
}
.user-bot {
background-color: #FE48AA;
color: white;
}
.user-staff {
background-color: #52D017;
color: white;
}
.user-curse {
background-color: #f26122;
color: white;
}
.user-normal {
color: #3F56AD;
}
\ No newline at end of file
/* Header */
header {
top: 0;
right: 0;
left: 0;
z-index: 2;
}
header ul.mui-list--inline {
margin-bottom: 0;
}
header a {
color: white;
vertical-align: middle;
}
header table {
width: 100%;
}
.header-separator {
margin-top: 1%;
}
#userBig {
color: white !important;
}
/* Avisos */
.header-notice {
background-color: #ee6e73;
color: white
}
.header-notice a {
color: #2b2b2b;
text-decoration: none;
}
.header-notice a:hover {
color: #2b2b2bd6;
}
.header-notice>noscript>p.mui--text-headline {
margin-top: 1%
}
.header-notice button,
.header-notice button:hover,
.header-notice button:visited {
color: white;
}
.notice-cache-image {
width: 25px;
vertical-align: middle;
}
#cache-plsdont {
background-color: #a00e0e94 !important
}
#notice-cache {
display: none;
}
/* Homepage */
#homepage-links {
margin: 0 auto;
font-size: 16px;
}
.wiki-icon {
width: 2em;
height: 2em;
}
#homepage-links b {
vertical-align: 50%;
}
/* Listas */
thead tr th:not(.sorttable_nosort) {
cursor: pointer;
}
.list-curlist {
padding: 15px;
float: left;
}
.list-user-active {
color: green;
}
.list-user-inactive {
color: red;
}
/* Erro */
.error-title {
margin-top: 2%;
}
.error-message {
margin-top: 1%;
}
.error-goback {
margin-top: 2%;
font-size: 150%;
}
/* Tooltip e botões */
input {
color: black !important;
}
.tooltip {
border-bottom: 1px dotted;
}
/* Página principal */
.wlogo {
width: 15%;
/* Edge*/
margin: 0 auto;
}
.otfwlogo {
display: none;
width: 15%;
animation: spin 20s linear infinite;
/* Edge*/
margin: 0 auto;
}
.otfwlogo.active:hover {
animation: spin 1s linear infinite;
}
.otfwlogo.active {
display: unset;
animation: spin 20s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Fontes */
body {
font-size: 16px;
}
.user-normal,
.user-bot,
.user-wikicap,
.user-valve,
.user-staff,
.user-staff-former,
.user-curse {
font-weight: 200;
padding: 3px 3px 3px 3px;
}
/* Cores */
body {
background-color: #eeeeee;
}
/* Preloader */
#preloader.partial {
margin-top: 15%;
}
/* Página "compare" */
.compare-main,
#main-updating {
color: #d84931;
}
.compare-target,
#target-updating {
color: #04749e;
}
.list-truncate {
width: 250px;
text-overflow: ellipsis;
overflow: hidden;
}
/* Footer */
footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
text-align: center;
}
\ No newline at end of file
This diff is collapsed.
/* Fundos */
.mui-appbar,
footer {
background-color: #3498DB !important;
}
/* Tooltip e botões */
button {
color: white !important;
background-color: #347cdb !important;
}
button:hover {
background-color: #3460db !important;
}
input:focus {
border-color: #347cdb !important;
}
/* Cores */
.user-bot {
background-color: #FE48AA;
color: white;
}
.user-staff {
background-color: #52D017;
color: white;
}
.user-normal {
color: #3F56AD;
}
\ No newline at end of file
/* Fundos */
.mui-appbar,
footer {
background-color: #F3A957 !important;
}
/* Tooltip e botões */