Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create license.txt file #2

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1d6299f
Fixed colliding hashes bug
Umkus Apr 5, 2014
74eb966
Space char slipped in somehow where it didn't belong.
Umkus Apr 7, 2014
02c737e
Removed Mongo related build scripts
Umkus Jul 5, 2014
914293b
Storing images in Redis
Umkus Jul 6, 2014
c481395
Bugfixes
Umkus Jul 7, 2014
a9e4620
Updated Travis script
Umkus Jul 7, 2014
bd0dc78
Not waiting for the hash record to expire on it's own
Umkus Jul 7, 2014
4a5499a
TTL setting from main page is ignored
Umkus Jul 8, 2014
65baee9
Code style cleanup
Umkus Jul 8, 2014
16c7436
Fixed unit-tests
Umkus Jul 8, 2014
0c747f9
Added TTL for the ticket records
Umkus Jul 8, 2014
1c123a0
Warding off headless webkit / schreenshot bots
Umkus Jul 8, 2014
d25b1cb
Response code fore deleted pages should be 410, not 310
Umkus Jul 8, 2014
662074c
Updated unit-tests
Umkus Jul 8, 2014
ebcf4b0
Forcing the removal of uploaded image
Umkus Jul 9, 2014
9db3c8a
Changed the layout of image sharing settings on the viewing page
Umkus Jul 10, 2014
0b4da08
Fixed unittests
Umkus Jul 10, 2014
0629d0a
Added shadows to images
Umkus Jul 10, 2014
9e881a8
Added shadows to images
Umkus Jul 10, 2014
84fe86f
Added image chat
Umkus Jul 11, 2014
c84d594
Fixed protocols and ips for websocket connections
Umkus Jul 11, 2014
6344a55
Chat fixes
Umkus Jul 12, 2014
7a261dc
Fixed unittests
Umkus Jul 12, 2014
d589726
Updated nginx server config
Umkus Jul 12, 2014
c5ca1bb
More fixes to chat
Umkus Jul 12, 2014
7c40535
Added a startup script
Umkus Jul 12, 2014
8ad0c43
Added number of users in chat
Umkus Jul 12, 2014
f1da0a6
Fixed num of users in chat
Umkus Jul 12, 2014
86c7513
Chat fix
Umkus Jul 12, 2014
66b655f
Chat fix
Umkus Jul 12, 2014
6b8c9cd
Fixed ip watermarking
Umkus Jul 12, 2014
c848544
Raised single max file size to 10mb
Umkus Jul 12, 2014
3fc59e0
Removing event handlers in case we're reconnecting
Umkus Jul 12, 2014
d1f22a9
Added supervisor
Umkus Jul 12, 2014
d813c7a
Set longer timeout for proxy reads
Umkus Jul 12, 2014
82065f0
Added a new chat message notification
Umkus Jul 12, 2014
da8564b
Updated chat placeholder text
Umkus Jul 12, 2014
c984b04
Passing client ip header to node
Umkus Jul 13, 2014
c8797aa
Updated some configs
Umkus Jul 13, 2014
28429d7
Extra checks for uploading images
Umkus Jul 14, 2014
b964f6a
Added unsee link detection in chat window
Umkus Jul 14, 2014
e489926
It's now possible to update shares with new images
Umkus Jul 16, 2014
4d86297
Lowered max allowed image size
Umkus Jul 16, 2014
40eab4c
Resizing large images before inserting them to redis
Umkus Jul 17, 2014
815e3b4
Increased ttl for tickets
Umkus Jul 17, 2014
678cb59
Added upload animation on view page
Umkus Jul 23, 2014
7f7dc2a
Added chat member colors
Umkus Jul 26, 2014
d6f5975
Increased max length of chat message by 400 chars
Umkus Jul 26, 2014
485b41d
Added image pinning
Umkus Jul 27, 2014
549ebbe
Fixed redis 2.8 dependency
Umkus Jul 28, 2014
cf7ad47
Fixed bug when some images weren't loading if there were a lot of them
Umkus Aug 4, 2014
3dbe205
Fixed ugly rtl in chat messages
Umkus Aug 4, 2014
25e5eb6
Fixed pinned chat message position
Umkus Aug 5, 2014
31f58da
Lazyloading added images
Umkus Aug 5, 2014
fc60423
Hiding images when window looses focus
Umkus Aug 11, 2014
660ae7a
Slight fixes
Umkus Aug 11, 2014
b96652f
fixing typo
waako Oct 8, 2014
09be23e
added a ten and thirty minutes delay intervals
waako Oct 8, 2014
9c23b62
added option for 10 and 30 minute increments
waako Oct 8, 2014
cda4ccf
added select option items for 10 and 30 minute increments
waako Oct 8, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ install:
- printf "\n" | pecl install imagick
before_script:
- phpenv config-add scripts/build/phpconf.ini
- ./scripts/build/prepare.sh
script: phpunit -c tests/phpunit.xml
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@

Unsee.cc - Secure and private image hosting
==============

This is the official Git repository for the Unsee image hosting. The deployment on production server is as simple as:
```
git fetch
git reset --hard origin/master
rm application/configs/env.php
```
This is done for the sake of ease and transparency.


Installation
---------
To run your copy of Unsee locally you'll probably need

Requirements
-----
- *nix environment
- Nginx
- Secure link module
- Php
- Redis module
- Imagick module
- Redis
- Image magick
4 changes: 4 additions & 0 deletions application/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ protected function _initEnv()
if (empty($_SERVER['HTTP_USER_AGENT'])) {
$_SERVER['HTTP_USER_AGENT'] = 'cli';
}

if (empty($_SERVER['SERVER_NAME'])) {
$_SERVER['SERVER_NAME'] = 'unsee.cc';
}
}

protected function _initDocType()
Expand Down
7 changes: 3 additions & 4 deletions application/configs/application.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ redis.port = '6379'

hash.vovels = 'aiueo';
hash.consonants = 'stnmrgzdbp';
hash.syllables = 3;
hash.syllables = 4;

timezone = 'Europe/Kiev';

storagePath = APPLICATION_PATH "/../storage/"

; Image config
settings.info.title.type = 'text';
settings.info.description.type = 'textarea';
Expand Down Expand Up @@ -78,4 +76,5 @@ resources.frontController.params.displayExceptions = 1
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
domainName = "unsee.cc.local"
domainName = "unsee.cc.local"
combineAssets = 0;
24 changes: 20 additions & 4 deletions application/configs/lang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
<tuv xml:lang="ru"><seg>после просмотра</seg></tuv>
<tuv xml:lang="en"><seg>after first view</seg></tuv>
</tu>
<tu tuid="after_ten">
<tuv xml:lang="ru"><seg>10 минут</seg></tuv>
<tuv xml:lang="en"><seg>in 10 minutes</seg></tuv>
</tu>
<tu tuid="after_thirty">
<tuv xml:lang="ru"><seg>30 минут</seg></tuv>
<tuv xml:lang="en"><seg>in 30 minutes</seg></tuv>
</tu>
<tu tuid="after_hour">
<tuv xml:lang="ru"><seg>через час</seg></tuv>
<tuv xml:lang="en"><seg>in one hour</seg></tuv>
Expand Down Expand Up @@ -292,7 +300,7 @@
</tu>
<tu tuid="click_settings">
<tuv xml:lang="ru"><seg>Нажмите здесь, чтобы изменить настройки</seg></tuv>
<tuv xml:lang="en"><seg>Click to change settings</seg></tuv>
<tuv xml:lang="en"><seg>Click here to change settings</seg></tuv>
</tu>

<!-- Image settings translations -->
Expand Down Expand Up @@ -362,7 +370,7 @@
</tu>
<tu tuid="settings_security_no_download_caption">
<tuv xml:lang="ru"><seg>Не позволять пользователям совершать правый клик по картинке чтобы сохранить её</seg></tuv>
<tuv xml:lang="en"><seg>Restrict right-clicking images to save them</seg></tuv>
<tuv xml:lang="en"><seg>Restrict right-clicking images to save them, can't be disabled for single-view images</seg></tuv>
</tu>

<tu tuid="settings_security_password">
Expand Down Expand Up @@ -535,7 +543,7 @@
</tu>

<tu tuid="minute_one">
<tuv xml:lang="ru"><seg>минута</seg></tuv>
<tuv xml:lang="ru"><seg>минуту</seg></tuv>
<tuv xml:lang="en"><seg>minute</seg></tuv>
</tu>
<tu tuid="minute_couple">
Expand All @@ -559,5 +567,13 @@
<tuv xml:lang="ru"><seg>Применить</seg></tuv>
<tuv xml:lang="en"><seg>Apply</seg></tuv>
</tu>
<tu tuid="upload_more_owner">
<tuv xml:lang="ru"><seg>Можно загрузить ещё картинок перетащив их на страницу</seg></tuv>
<tuv xml:lang="en"><seg>You can upload more images by dropping them on the page</seg></tuv>
</tu>
<tu tuid="upload_more_anonymous">
<tuv xml:lang="ru"><seg>Можно загрузить свои изображения перетащив их на страницу</seg></tuv>
<tuv xml:lang="en"><seg>You can add your own images by dropping them on the page</seg></tuv>
</tu>
</body>
</tmx>
</tmx>
10 changes: 8 additions & 2 deletions application/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/
class IndexController extends Zend_Controller_Action
{

public function init()
{

$this->view->headScript()->appendFile('js/vendor/jquery-1.8.3.min.js');
$this->view->headScript()->appendFile('js/vendor/modernizr-2.6.2.min.js');
$this->view->headScript()->appendFile('js/vendor/jquery.iframe-transport.js');
Expand All @@ -21,4 +22,9 @@ public function init()
$this->view->headLink()->appendStylesheet('css/main.css');
$this->view->headLink()->appendStylesheet('css/sizes.css');
}
}

public function indexAction()
{

}
}
90 changes: 69 additions & 21 deletions application/controllers/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,95 @@ public function indexAction()

$upload->addValidator('Count', false, array('min' => 1, 'max' => 100));
$upload->addValidator('IsImage', false);
$upload->addValidator('Size', false, array('max' => '8MB', 'bytestring' => false));
$upload->addValidator('Size', false, array('max' => '10MB', 'bytestring' => false));
$translate = Zend_Registry::get('Zend_Translate');
$updating = false;

try {
if (!$upload->receive()) {
throw new Exception();
throw new Exception($translate->translate('error_uploading'));
} else {
$files = $upload->getFileInfo();

// Tell the page the name of the new hash
$response->hash = $this->getNewHashName();

foreach ($files as $file => &$info) {
if (!$upload->isUploaded($file)) {
$info = null;
} else {
$imgDoc = new Unsee_Image();
$imgDoc->hash = $response->hash;
$imgDoc->setFile($info['tmp_name']);
// Updating hash with new images
if (!empty($_POST['hash']) && Unsee_Hash::isValid($_POST['hash'])) {
$hashDoc = new Unsee_Hash($_POST['hash']);
$updating = true;
$response = array();

if (!Unsee_Session::isOwner($hashDoc) && !$hashDoc->allow_anonymous_images) {
die('[]');
}
} else {
// Creating a new hash
$hashDoc = new Unsee_Hash();
$this->setExpiration($hashDoc);
$response->hash = $hashDoc->key;
}

$imageAdded = false;

foreach ($files as $file => $info) {
if ($upload->isUploaded($file)) {
$imgDoc = new Unsee_Image($hashDoc);
$res = $imgDoc->setFile($info['tmp_name']);
$imgDoc->setSecureParams(); //hack to populate correct secureTtd

if ($updating) {
$ticket = new Unsee_Ticket();
$ticket->issue($imgDoc);

$newImg = new stdClass();
$newImg->hashKey = $hashDoc->key;
$newImg->key = $imgDoc->key;
$newImg->src = '/image/' . $imgDoc->key . '/' . $imgDoc->secureMd5 . '/' . $imgDoc->secureTtd . '/';
$newImg->width = $imgDoc->width;
$newImg->ticket = md5(Unsee_Session::getCurrent() . $hashDoc->key);

$response[] = $newImg;
}

if ($res) {
$imageAdded = true;
}

// Remove uploaded file from temporary dir if it wasn't removed
if (file_exists($info['tmp_name'])) {
@unlink($info['tmp_name']);
}
}
}

if (!$imageAdded) {
throw new Exception('No images were added');
}
}
} catch (Exception $e) {
$response->error = $translate->translate('error_uploading');
$response->error = $e->getMessage();
}
$this->_helper->json->sendJson($response);
}

/**
* Creates a new hash document and returns it's name
* @return type
* Sets the TTL for the provided hash
* @param Unsee_Hash $hashDoc
* @return boolean
*/
private function getNewHashName()
private function setExpiration($hashDoc)
{
// Creating a new hash item (/bababa/)
$hashDoc = new Unsee_Hash();

if (isset($_POST['time']) && in_array($_POST['time'], Unsee_Hash::$_ttlTypes)) {
$hashDoc->ttl = $_POST['time'];
// Custom ttl was set
if (!empty($_POST['time']) && in_array($_POST['time'], Unsee_Hash::$ttlTypes)) {
$amount = array_search($_POST['time'], Unsee_Hash::$ttlTypes);
if ($amount > 0) {
// Disable single view, which is ON by default
$hashDoc->max_views = 0;
$hashDoc->ttl = $_POST['time'];
// Expire in specified interval, instead of a day
$hashDoc->expireAt(time() + $amount);
}
}

return $hashDoc->key;
return true;
}
}
Loading