From a92961f24072bc4c3881bf0e2f609562f3703471 Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 10:27:07 +1000 Subject: Add text response class This allows for text only output which removes the complexity of many bash uploader scripts. --- static/classes/Response.class.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/static/classes/Response.class.php b/static/classes/Response.class.php index e9f647d..c44230d 100755 --- a/static/classes/Response.class.php +++ b/static/classes/Response.class.php @@ -12,6 +12,11 @@ class Response header('Content-Type: text/plain; charset=UTF-8'); $this->type = $response_type; break; + case 'text': + header('Content-Type: text/plain; charset=UTF-8'); + $this->type = $response_type; + break; + case 'html': header('Content-Type: text/html;charset=utf-8'); $this->type = 'html'; @@ -34,6 +39,9 @@ class Response case 'gyazo': $response = $this->gyazo_error($code, $desc); break; + case 'text': + $response = $this->text_error($code, $desc); + break; case 'html': $response = $this->html_error($code, $desc); break; @@ -60,6 +68,9 @@ class Response case 'gyazo': $response = $this->gyazo_success($files); break; + case 'text': + $response = $this->text_success($files); + break; default: $response = $this->json_success($files); break; @@ -96,6 +107,20 @@ class Response { return POMF_URL.$files[0]['url']; } + private static function txt_error($code, $description) + { + return 'ERROR: ('.$code.') '.$description; + } + + private static function text_success($files) + { + foreach ($files as $file) { + $result .= POMF_URL.$files[0]['url']; + } + + return $result; + } + private static function html_error($code, $description) { return 'ERROR: ('.$code.') '.$description; -- cgit v1.2.3 From 5453c413bebee48a90a45dcfeda79f1557ab3f4d Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 10:40:22 +1000 Subject: Fix no html output on upload.php --- dist.zip | Bin 0 -> 173304 bytes pages/ca.swig | 2 +- pages/upload_form_nojs.swig | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 dist.zip diff --git a/dist.zip b/dist.zip new file mode 100644 index 0000000..89690f7 Binary files /dev/null and b/dist.zip differ diff --git a/pages/ca.swig b/pages/ca.swig index af16901..68c7b97 100644 --- a/pages/ca.swig +++ b/pages/ca.swig @@ -1,4 +1,4 @@ -{% extends "layout.swig" %} +{% extends "layoutca.swig" %} {% block body %}
diff --git a/pages/upload_form_nojs.swig b/pages/upload_form_nojs.swig index 323fc0e..73b331b 100644 --- a/pages/upload_form_nojs.swig +++ b/pages/upload_form_nojs.swig @@ -1,4 +1,4 @@ -
+
-- cgit v1.2.3 From 4b86867c0ee0ddb21d33a412ebda8cd4e65893fc Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 10:41:55 +1000 Subject: Add dist.zip to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f06235c..f1cf600 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules dist +dist.zip -- cgit v1.2.3 From a8216dfebedbb0739a423873cd86a82e4b15fdac Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 10:44:45 +1000 Subject: Remove unnecessary paragraphs --- pages/check_script.swig | 2 +- pages/check_scriptca.swig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/check_script.swig b/pages/check_script.swig index 2463580..6ebaea8 100644 --- a/pages/check_script.swig +++ b/pages/check_script.swig @@ -1,3 +1,3 @@ diff --git a/pages/check_scriptca.swig b/pages/check_scriptca.swig index b15897d..0a5f0ea 100644 --- a/pages/check_scriptca.swig +++ b/pages/check_scriptca.swig @@ -1,3 +1,3 @@ -- cgit v1.2.3 From 5ad07e817a65d058b493bbeaaf00b8d60fe13f27 Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Fri, 18 Sep 2015 00:45:58 +0000 Subject: Revert ShareX / URL change commits These commits are ShareX issues, not Pomf issues. Allowing these commits to be in the source reduces maintainability. This reverts commits bbcffe8d745937677352edf25e6a250ca8fd507b, 943e7e62a8ca814d47168bcebf2cc92dbce9a45a and partially 1411bce1dc13bf6fea66b5899ba29d50d5c53bb0. --- js/pomf.js | 3 +-- static/classes/Response.class.php | 2 +- static/upload.php | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/js/pomf.js b/js/pomf.js index 29ef20b..5496284 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -122,10 +122,9 @@ $(function () { break } eachRow(res.files, function (row, file, files) { - var url = 'https://i.pantsu.cat/' + file.url var link = $('') - link.attr('href', url) + link.attr('href', file.url) .attr('target', '_BLANK') .text(file.url.replace("http://","").replace("https://","")) diff --git a/static/classes/Response.class.php b/static/classes/Response.class.php index c44230d..4f18a12 100755 --- a/static/classes/Response.class.php +++ b/static/classes/Response.class.php @@ -129,7 +129,7 @@ class Response private static function html_success($files) { foreach ($files as $file) { - $result .= "".$file['url']."
"; + $result .= "".$file['url']."
"; } return $result; diff --git a/static/upload.php b/static/upload.php index 21ae386..0504e54 100644 --- a/static/upload.php +++ b/static/upload.php @@ -93,10 +93,11 @@ function upload_file($file) $result = $q->fetch(); if ($result['count'] > 0) { unlink($file->tempfile); + return array( 'hash' => $file->get_sha1(), 'name' => $file->name, - 'url' => $result['filename'], + 'url' => POMF_URL.$result['filename'], 'size' => $file->size, ); } @@ -131,10 +132,11 @@ function upload_file($file) $q->bindValue(':exp', null, PDO::PARAM_STR); $q->bindValue(':del', sha1($file->tempfile), PDO::PARAM_STR); $q->execute(); + return array( 'hash' => $file->get_sha1(), 'name' => $file->name, - 'url' => $newname, + 'url' => POMF_URL.$newname, 'size' => $file->size, ); } else { @@ -194,7 +196,6 @@ function refiles($files) } $type = isset($_GET['output']) ? $_GET['output'] : 'json'; - $response = new Response($type); if (isset($_FILES['files'])) { @@ -211,5 +212,3 @@ if (isset($_FILES['files'])) { } else { $response->error(400, 'No input file(s)'); } - - -- cgit v1.2.3 From 25b7f821e9a572c2bded5f7a95785e5fde592c82 Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 11:36:51 +1000 Subject: Fix url generation bug --- static/classes/Response.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/classes/Response.class.php b/static/classes/Response.class.php index 4f18a12..951e39e 100755 --- a/static/classes/Response.class.php +++ b/static/classes/Response.class.php @@ -115,7 +115,7 @@ class Response private static function text_success($files) { foreach ($files as $file) { - $result .= POMF_URL.$files[0]['url']; + $result .= $file['url']."\n"; } return $result; -- cgit v1.2.3 From 82aadfd72bec82fb7a95fa2c0d1eb5b5b2021aaf Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 11:51:35 +1000 Subject: Change sharex setting url --- pages/tools.swig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/tools.swig b/pages/tools.swig index db8a51d..f82e8e4 100644 --- a/pages/tools.swig +++ b/pages/tools.swig @@ -46,7 +46,7 @@
Download
https://code.google.com/p/sharex/
Settings
-
https://p.pantsu.cat/view/raw/977674be
+
https://p.pantsu.cat/view/raw/b79ea507

Scotty

Download
-- cgit v1.2.3 From 1c8a736c7dbb9a736b67ae1d76ef324df54bbae8 Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Fri, 18 Sep 2015 03:32:38 +0000 Subject: Refactored whitespace for improved readability --- moe/panel/index.php | 119 ++++++++++++++++++++-------------------- pages/tools.swig | 153 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 154 insertions(+), 118 deletions(-) diff --git a/moe/panel/index.php b/moe/panel/index.php index 1c0cc6b..7a8bceb 100644 --- a/moe/panel/index.php +++ b/moe/panel/index.php @@ -1,64 +1,61 @@ - - Moe Panel - - - - - - - - - - - - - -
- - - - - -
- - -
-
-

- -
- - - -
-
- - - -
- - + + Moe Panel + + + + + + + + + + + + +
+ + + +
+ +
+
+

+ +

+ +
+ + + +
+
+ + +
+ diff --git a/pages/tools.swig b/pages/tools.swig index f82e8e4..2632f5f 100644 --- a/pages/tools.swig +++ b/pages/tools.swig @@ -6,83 +6,122 @@

Pomf Tools

{% include "nav.swig" %}
-

Pomfit

-
Download
-
https://github.com/pantsucat/pomfit
-
Contact
+
+

Pomfit

+
+
Download
+
https://github.com/pantsucat/pomfit
+
Contact
https://twitter.com/Senketsu_Dev
-
-

Bash Pomf Uploader

-
Download
+
+
+
+

Bash Pomf Uploader

+
+
Download
https://gist.github.com/pantsucat/b46320a4103afda4e0ff
-
Contact
+
Contact
https://twitter.com/AnonymousLink
-
-

Simple Bash Pomf Uploader

-
Download
+
+
+
+

Simple Bash Pomf Uploader

+
+
Download
https://gist.github.com/pantsucat/da46d56e22063704604a
-
Contact
+
Contact
https://twitter.com/dev_console
-
-

limf

-
Download
-
https://github.com/lich/limf
-
Contact
-
http://lich.github.io//
-
-

1339secure

-
Download
-
https://github.com/pantsucat/1339secure
-
Contact
-
adriankoshcha@teknik.io
-
-

Python Pomf Uploader

-
Download
+
+
+
+

limf

+
+
Download
+
https://github.com/lich/limf
+
Contact
+
http://lich.github.io//
+
+
+
+

1339secure

+
+
Download
+
https://github.com/pantsucat/1339secure
+
Contact
+
adriankoshcha@teknik.io
+
+
+
+

Python Pomf Uploader

+
+
Download
https://github.com/pantsucat/POMF
-
Contact
+
Contact
https://twitter.com/FuzzyPomf
-
-

Sharex

-
Download
+
+
+
+

Sharex

+
+
Download
https://code.google.com/p/sharex/
-
Settings
+
Settings
https://p.pantsu.cat/view/raw/b79ea507
-
-

Scotty

-
Download
+
+
+
+

Scotty

+
+
Download
https://github.com/pantsucat/Scotty
-
Contact
+
Contact
https://twitter.com/mavanmanenDev
-
-

Gyazo Client (Puush like client)

-
Download
+
+
+
+

Gyazo Client (Puush like client)

+
+
Download
https://github.com/pantsucat/gyazowin
-
Contact
+
Contact
https://twitter.com/4vailable
-
-

Bash Screenshot Uploader

-
Download
+
+
+
+

Bash Screenshot Uploader

+
+
Download
https://gist.github.com/aki--aki/6258422
-
Contact
+
Contact
https://twitter.com/__akiaki
-
-

Pomf.se Windows Client Dead

-
Download
+
+
+
+

Pomf.se Windows Client Dead

+
+
Download
http://mavanmanen.nl/index.php?page=projects
-
Contact
+
Contact
https://twitter.com/mavanmanenDev
-
-

ScrotUP Dead

-
Download
+
+
+
+

ScrotUP Dead

+
+
Download
https://github.com/mavanmanen/ScrotUP
-
Contact
+
Contact
https://twitter.com/mavanmanenDev
-
-

Perl Pomf Uploaer Dead

-
Download
+
+
+
+

Perl Pomf Uploaer Dead

+
+
Download
http://p.pomf.se/624
-
Contact
+
Contact
Kori
-
+
+
{% endblock %} -- cgit v1.2.3 From 1ce9eb2566574f651599b77271f7b8027d54d041 Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Fri, 18 Sep 2015 03:32:38 +0000 Subject: Fix README.md outline --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++--------------------- wub.patch | 18 +++++++++++++++++ 2 files changed, 64 insertions(+), 22 deletions(-) create mode 100644 wub.patch diff --git a/README.md b/README.md index 4cf35fe..2ba1ed4 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,70 @@ # Pomf -Original development environment is Nginx + PHP5.5 + MySQL, but is confirmed to work with Apache 2.4 -and newer PHP versions. Should work with any other PDO-compatible database. -# Install +## Install + For the purposes of this guide, we won't cover setting up Nginx, PHP, MySQL, -Node, or NPM. So we'll just assume you already have them all running well. +Node, or NPM. So we'll just assume you already have them all running well. + +### Compiling -## Compiling The assets are minified and combined using [Grunt](http://gruntjs.com/). -Assuming you already have Node and NPM working, compilation is easy: -``` -$ npm install -g grunt-cli -$ git clone git://github.com/pantsucat/pomf.git -$ cd pomf/ -$ npm install -$ grunt -``` -After this, the pomf site is now compressed and set up inside `dist/`. +Assuming you already have Node and NPM working, compilation is easy. Use the +following shell code: -### Apache +#### Apache If you are running Apache and want to compress your output when serving files, add to your `.htaccess` file: +======= ``` -AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/x-javascript application/json +npm install -g grunt-cli +git clone git://github.com/pantsucat/pomf.git +cd pomf/ +npm install +grunt ``` -Remember to enable `deflate_module` and `filter_module` modules in your Apache configuration file. + +After this, the pomf site is now compressed and set up inside `dist/`. ## Configuring -The majority of settings are in `static/includes/settings.inc.php`. Read the + +The majority of settings are in `static/includes/settings.inc.php`. Read the comments in that file for more information. -For file size configuration, there is no server-side verification: we assume -that PHP and Nginx provide ample protection in this department. There is, +For file size configuration, there is no server-side verification: we assume +that PHP and Nginx provide ample protection in this department. There is, however, client-side configuration for max size, the `data-max-size` attribute on the file input in `pages/upload_form.swig`. -Make sure to disable PHP from being executed on the file download domain/directory (e.g a.site.com), otherwise a attacker can upload a malicious .php file and execute it on your server. +Make sure to disable PHP from being executed on the file download +domain/directory (e.g a.site.com), otherwise a attacker can upload a malicious +.php file and execute it on your server. + +### Apache + +If you are running Apache and want to compress your output when serving files, +add to your `.htaccess` file: + +``` +AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/x-javascript application/json +``` + +Remember to enable `deflate_module` and `filter_module` modules in your Apache +configuration file. ## Todo * Clean up Moe code, a lot.. * API keys? -# Contact +## Contact I can be contacted via hostmaster@pantsu.cat. +======= +## License + +Pomf is free software, and is released under the terms of the MIT (Expat) +license. See LICENSE. + +## Contact + +The maintainer can be contacted via hostmaster@pantsu.cat. + diff --git a/wub.patch b/wub.patch new file mode 100644 index 0000000..7f0e620 --- /dev/null +++ b/wub.patch @@ -0,0 +1,18 @@ +diff --git a/README.md b/README.md +index 646bea3..213bf90 100644 +--- a/README.md ++++ b/README.md +@@ -30,11 +30,11 @@ After this, the pomf site is now compressed and set up inside `dist/`. + + ## Configuring + +-The majority of settings are in `static/includes/settings.inc.php`. Read the ++The majority of settings are in `static/includes/settings.inc.php`. Read the + comments in that file for more information. + + For file size configuration, there is no server-side verification: we assume +-that PHP and Nginx provide ample protection in this department. There is, ++that PHP and Nginx provide ample protection in this department. There is, + however, client-side configuration for max size, the `data-max-size` attribute + on the file input in `pages/upload_form.swig`. + -- cgit v1.2.3 From 8574c83cc5043ff9d5951e36d98eab85563e0503 Mon Sep 17 00:00:00 2001 From: pantsucat Date: Fri, 18 Sep 2015 18:00:33 +1000 Subject: Fix typo --- pages/ca.swig | 7 ++++--- pages/layoutca.swig | 24 ++++++++++++------------ wub.patch | 18 ------------------ 3 files changed, 16 insertions(+), 33 deletions(-) delete mode 100644 wub.patch diff --git a/pages/ca.swig b/pages/ca.swig index 68c7b97..7a51e13 100644 --- a/pages/ca.swig +++ b/pages/ca.swig @@ -2,9 +2,10 @@ {% block body %}
-
-

Roba Interior~

-
+ +
+

Ropa Interior~

+

Màxima grandària de pujada {{max_upload_size}}MiB, read the FAQ

{% include "check_scriptca.swig" %} {% include "check_fileapica.swig" %} diff --git a/pages/layoutca.swig b/pages/layoutca.swig index 92f9824..e522319 100644 --- a/pages/layoutca.swig +++ b/pages/layoutca.swig @@ -1,15 +1,15 @@ - - - - Roba Interior.cat · {% block title %}Allotjament d'arxius valent{% endblock %} - - - - -
- {% block body %}What the fuck are you doing here, baka?{% endblock %} -
- + + + + Ropa Interior.cat · {% block title %}Allotjament d'arxius valent{% endblock %} + + + + +
+ {% block body %}What the fuck are you doing here, baka?{% endblock %} +
+ diff --git a/wub.patch b/wub.patch deleted file mode 100644 index 7f0e620..0000000 --- a/wub.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/README.md b/README.md -index 646bea3..213bf90 100644 ---- a/README.md -+++ b/README.md -@@ -30,11 +30,11 @@ After this, the pomf site is now compressed and set up inside `dist/`. - - ## Configuring - --The majority of settings are in `static/includes/settings.inc.php`. Read the -+The majority of settings are in `static/includes/settings.inc.php`. Read the - comments in that file for more information. - - For file size configuration, there is no server-side verification: we assume --that PHP and Nginx provide ample protection in this department. There is, -+that PHP and Nginx provide ample protection in this department. There is, - however, client-side configuration for max size, the `data-max-size` attribute - on the file input in `pages/upload_form.swig`. - -- cgit v1.2.3