1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-28 05:26:44 -05:00

Moved panel to API, removed minifying scripts, tidied up Makefile

This commit is contained in:
Jack Foltz 2017-01-27 18:32:25 -05:00
parent 7d4e3a6ea3
commit ee5770b7fe
6 changed files with 16 additions and 49 deletions

View File

@ -6,16 +6,16 @@ NPM="npm"
DESTDIR="./dist"
TMPDIR := $(shell mktemp -d)
all: builddirs npm-dependencies swig min-html min-css min-js copy-assets copy-includes
all: builddirs npm-dependencies swig copy-assets copy-includes
builddirs:
mkdir -p $(CURDIR)/build
mkdir -p $(CURDIR)/build/{assets,classes,includes,login,panel,register}
mkdir -p $(CURDIR)/build/{assets,classes,includes,login,register}
mkdir -p $(CURDIR)/build/assets/{css,js,fonts,img,tools}
installdirs:
mkdir -p $(DESTDIR)/
mkdir -p $(DESTDIR)/{assets,classes,includes,login,panel,register}
mkdir -p $(DESTDIR)/{assets,classes,includes,login,register}
mkdir -p $(CURDIR)/build/assets/{css,js,fonts,img,tools}
npm-dependencies:
@ -25,40 +25,22 @@ swig:
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/index.swig > $(CURDIR)/build/index.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/faq.swig > $(CURDIR)/build/faq.html
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/tools.swig > $(CURDIR)/build/tools.html
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/panel.swig > $(CURDIR)/build/includes/panel.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/invite.swig > $(CURDIR)/build/includes/invite.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/report.swig > $(CURDIR)/build/includes/report.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/reports.swig > $(CURDIR)/build/includes/reports.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/search.swig > $(CURDIR)/build/includes/search.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/shimapan.swig > $(CURDIR)/build/includes/shimapan.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json includes/footer.swig > $(CURDIR)/build/includes/footer.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/upload.swig > $(CURDIR)/build/upload.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/login/index.swig > $(CURDIR)/build/login/index.html
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/panel/index.swig > $(CURDIR)/build/panel/index.php
$(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/register/index.swig > $(CURDIR)/build/register/index.html
min-html:
$(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/index.php -o $(CURDIR)/build/index.php
$(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/faq.html -o $(CURDIR)/build/faq.html
$(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/tools.html -o $(CURDIR)/build/tools.html
$(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/login/index.html -o $(CURDIR)/build/login/index.html
$(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/register/index.html -o $(CURDIR)/build/register/index.html
min-css:
$(NODE) $(CURDIR)/node_modules/.bin/cleancss --s0 $(CURDIR)/assets/css/shimapan.css > $(CURDIR)/build/assets/css/shimapan.min.css
$(NODE) $(CURDIR)/node_modules/.bin/cleancss --s0 $(CURDIR)/assets/css/shimapan-panel.css > $(CURDIR)/build/assets/css/shimapan-panel.min.css
$(NODE) $(CURDIR)/node_modules/.bin/cleancss --s0 $(CURDIR)/assets/css/bootstrap.css > $(CURDIR)/build/assets/css/bootstrap.min.css
min-js:
$(NODE) $(CURDIR)/node_modules/.bin/uglifyjs --screw-ie8 ./assets/js/shimapan.js >> $(CURDIR)/build/assets/js/shimapan.min.js
$(NODE) $(CURDIR)/node_modules/.bin/uglifyjs --screw-ie8 ./assets/js/config.js >> $(CURDIR)/build/assets/js/config.min.js
copy-assets:
cp -vT $(CURDIR)/assets/js/bootstrap.min.js $(CURDIR)/build/assets/js/bootstrap.min.js
cp -vT $(CURDIR)/assets/js/skel.min.js $(CURDIR)/build/assets/js/skel.min.js
cp -vT $(CURDIR)/assets/js/jquery.min.js $(CURDIR)/build/assets/js/jquery.min.js
cp -rv $(CURDIR)/assets/js/* $(CURDIR)/build/assets/js/
cp -rv $(CURDIR)/assets/css/* $(CURDIR)/build/assets/css/
cp -rv $(CURDIR)/assets/fonts/* $(CURDIR)/build/assets/fonts/
cp -rv $(CURDIR)/assets/img/* $(CURDIR)/build/assets/img/
cp -rv $(CURDIR)/assets/tools/* $(CURDIR)/build/assets/tools
cp -rv $(CURDIR)/assets/tools/* $(CURDIR)/build/assets/tools/
copy-includes:
cp -v $(CURDIR)/includes/*.php $(CURDIR)/build/includes/
@ -79,4 +61,4 @@ install: installdirs
cp -rv $(CURDIR)/build/* $(DESTDIR)/
uninstall:
rm -rvf $(DESTDIR)/
rm -rvf $(DESTDIR)/

View File

@ -3,7 +3,7 @@
"allowErrors": false
},
"dest": "dist",
"pkgVersion": "2.0.0",
"pkgVersion": "3.0.0",
"src": [
"templates/faq.swig",
"templates/footer.swig",
@ -31,8 +31,8 @@
"max_upload_size": 128,
"production": false,
"siteName": "Shimapan",
"siteUrl": "http://www.shimapan.rocks/",
"imgUrl": "http://i.shimapan.rocks/",
"siteUrl": "https://www.shimapan.rocks/",
"imgUrl": "https://i.shimapan.rocks/",
"abuseContact": "abuse@shimapan.rocks",
"infoContact": "info@shimapan.rocks",
"paypalUrl": "",

3
includes/panel.swig Normal file
View File

@ -0,0 +1,3 @@
{% include "header.swig" %}
<p>Welcome, <?php echo $_SESSION['user']; ?></p>
{% include "footer.swig" %}

View File

@ -1,7 +1,7 @@
{
"name": "shimapan",
"version": "2.0.0",
"description": "File Host",
"version": "3.0.0",
"description": "Shimapan Sharing Service",
"homepage": "http://www.shimapan.rocks",
"repository": {
"type": "git",
@ -13,11 +13,6 @@
"url": "https://github.com/Foltik/shimapan/issues"
},
"devDependencies": {
"clean-css": "^3.4.18",
"uglify-js": "^2.6.2",
"swig": "^1.4.2"
},
"dependencies": {
"htmlmin": "0.0.6"
}
}

View File

@ -1,13 +0,0 @@
{% include "../../includes/locked.swig" %}
{% include "../../includes/header.swig" %}
<p>Welcome, <?php echo $_SESSION['user']; ?></p>
<?php
require_once '../includes/database.inc.php';
global $db;
$q = $db->prepare("SELECT apikey FROM accounts WHERE user = (:user)");
$q->bindValue(':user', $_SESSION['user']);
$q->execute();
$result = $q->fetch();
echo 'Your API key is '.$result['apikey'];
?>
{% include "../../includes/footer.swig" %}