Skip to content

Commit

Permalink
Merge 'dev' for v0.6.17 release
Browse files Browse the repository at this point in the history
  • Loading branch information
daveajones committed Jul 4, 2017
2 parents b2389de + b1e3ddc commit c57ef78
Show file tree
Hide file tree
Showing 20 changed files with 5,835 additions and 664 deletions.
37 changes: 36 additions & 1 deletion includes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


//A list of database schema updates for each version
$cg_database_version = 69;
$cg_database_version = 72;
$cg_database_updates = array();


Expand Down Expand Up @@ -981,6 +981,41 @@
CGDB0209;
//----------------------------------------------------------------------------------------------------------------

//Version 69 to 70 -----------------------------------------------------------------------------------------------
$cg_database_updates[69][] = <<<CGDB0210
ALTER TABLE `recentfiles` ADD `private` TINYINT NOT NULL AFTER `ipfshash`
CGDB0210;
$cg_database_updates[69][] = <<<CGDB0211
ALTER TABLE `recentfiles_versions` ADD `private` TINYINT NOT NULL AFTER `ipfshash`
CGDB0211;
$cg_database_updates[69][] = <<<CGDB0212
INSERT INTO `dbversion` ( `version` ) VALUES ( '70' )
CGDB0212;
//----------------------------------------------------------------------------------------------------------------

//Version 70 to 71 -----------------------------------------------------------------------------------------------
$cg_database_updates[70][] = <<<CGDB0213
ALTER TABLE `recentfiles` ADD `privtoken` VARCHAR( 80 ) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT 'token for private access'
CGDB0213;
$cg_database_updates[70][] = <<<CGDB0214
ALTER TABLE `recentfiles_versions` ADD `privtoken` VARCHAR( 80 ) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT 'token for private access'
CGDB0214;
$cg_database_updates[70][] = <<<CGDB0215
INSERT INTO `dbversion` ( `version` ) VALUES ( '71' )
CGDB0215;
//----------------------------------------------------------------------------------------------------------------

//Version 70 to 71 -----------------------------------------------------------------------------------------------
$cg_database_updates[71][] = <<<CGDB0216
ALTER TABLE `recentfiles` ADD INDEX (`privtoken`)
CGDB0216;
$cg_database_updates[71][] = <<<CGDB0217
ALTER TABLE `recentfiles_versions` ADD INDEX (`privtoken`)
CGDB0217;
$cg_database_updates[71][] = <<<CGDB0218
INSERT INTO `dbversion` ( `version` ) VALUES ( '72' )
CGDB0218;
//----------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------


Expand Down
209 changes: 181 additions & 28 deletions includes/opml.php

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions includes/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,83 @@ function putInS3old($content, $filename, $bucket, $key, $secret, $headers = NULL
}


//Put a string of data into an S3 file
function deleteFromS3($filename, $bucket, $key, $secret)
{

//Check parameters
if (empty($filename)) {
loggit(2, "Filename missing from S3 put call: [$filename].");
return (FALSE);
}
if (empty($bucket)) {
loggit(2, "Bucket missing from S3 put call: [$bucket].");
return (FALSE);
}
if (empty($key)) {
loggit(2, "Key missing from S3 put call: [$key].");
return (FALSE);
}
if (empty($secret)) {
loggit(2, "Secret missing from S3 put call: [$secret].");
return (FALSE);
}

//Includes
include get_cfg_var("cartulary_conf") . '/includes/env.php';
//Set up
require_once "$confroot/$libraries/aws/aws-autoloader.php";

$s3 = new \Aws\S3\S3MultiRegionClient([
'version' => 'latest',
'signature' => 'v4',
'credentials' => array(
'key' => $key,
'secret' => $secret
)
]);


//Construct bucket subfolder path, if any
$s3bucket = $bucket;
if (stripos($s3bucket, '/', 1) === FALSE) {
$subpath = "";
} else {
$spstart = stripos($s3bucket, '/', 1);
$bucket = str_replace('/', '', substr($s3bucket, 0, stripos($s3bucket, '/', 1)));
$subpath = rtrim(substr($s3bucket, $spstart + 1), '/') . "/";
}
$keyname = $subpath.$filename;

//Assemble object to delete
$s3object = array(
'Bucket' => $bucket,
'Key' => $keyname
);

try {
$s3res = $s3->deleteObject($s3object);

// Log some stuff
loggit(3, "Deleted file from S3: [".print_r($s3res, TRUE)."].");
} catch (S3Exception $e) {
loggit(2, "S3 Error: [".$e->getMessage()."].");
loggit(2, "Could not delete S3 file: [$bucket/$keyname].");
return (FALSE);
}

if (!$s3res) {
loggit(2, "Could not delete S3 file: [$bucket/$subpath$filename].");
return (FALSE);
} else {
$s3url = "http://s3.amazonaws.com/$bucket/$subpath$filename";
loggit(1, "Deleted file from S3: [$s3url].");
}

return (TRUE);
}


//Put a string of data into an S3 file
function putInS3($content, $filename, $bucket, $key, $secret, $headers = NULL, $private = FALSE)
{
Expand Down Expand Up @@ -2372,6 +2449,62 @@ function putFileInS3($file, $filename, $bucket, $key, $secret, $contenttype = NU
}


//Get an access url for a private file in an s3 bucket
function get_s3_authenticated_url($key, $secret, $bucket, $filekey, $minutes = 20)
{
//Check parameters
if (empty($key)) {
loggit(2, "Key missing from S3 call: [$key].");
return (FALSE);
}
if (empty($secret)) {
loggit(2, "Secret missing from S3 call: [$secret].");
return (FALSE);
}
if (empty($bucket)) {
loggit(2, "Bucket missing from S3 call: [$bucket].");
return (FALSE);
}
if (empty($filekey)) {
loggit(2, "File missing from S3 call: [$filekey].");
return (FALSE);
}
if( empty($minutes) || !is_numeric($minutes) || $minutes > 10080 || $minutes < 1 ) {
$minutes = 20;
}

$s3 = new \Aws\S3\S3MultiRegionClient([
'version' => 'latest',
'signature' => 'v4',
'credentials' => array(
'key' => $key,
'secret' => $secret
)
]);

//Get an authenticated url
try {
$cmd = $s3->getCommand('GetObject', [
'Bucket' => $bucket,
'Key' => $filekey
]);

$request = $s3->createPresignedRequest($cmd, "+$minutes minutes");

// Get the actual presigned-url
$s3authurl = (string) $request->getUri();

} catch (S3Exception $e) {
loggit(3, "Error getting authenticated url: " . $e->getMessage());
return (FALSE);
}

//Give back the result
loggit(3, "S3 Got authenticated url: [$s3authurl]");
return($s3authurl);
}


//Calculate the next short url code in a sequence
function get_next_short_url($previousNumber)
{
Expand Down
45 changes: 45 additions & 0 deletions releases/v0.6.17-apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

##: This script needs to be run with sudo
ROOT_UID="0"

#Check if run as root
if [ "$UID" -ne "$ROOT_UID" ] ; then
echo "You must run this script with sudo."
exit 1
fi
export CARTROOT=`echo "<?echo rtrim(get_cfg_var('cartulary_conf'), '/');?>" | php`

echo Side-loading packages up through version 0.6.10...

##: Refresh apt
echo Updating apt-get repos...
apt-get update

##: Install any new modules needed for this release
echo Installing php5 imap library...
apt-get install -y php5-imap
apt-get install -y php-imap
php5enmod imap
phpenmod imap

echo Installing php5 xsl library...
apt-get install -y php5-xsl
apt-get install -y php-xsl
php5enmod xsl
phpenmod xsl

echo Installing node.js...
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
apt-get install -y nodejs
cd $CARTROOT/aggrivate
sudo npm -g install npm@latest
sudo npm -g install npm@latest
npm install

echo Correcting feed database prior to upgrade...
echo " This could take a while. Please wait..."
sudo php /opt/cartulary/bin/clean_nonfqdn_feeds.php
sudo php /opt/cartulary/bin/clean_duplicate_feeds.php

##: This file should be EXEcutable!
29 changes: 29 additions & 0 deletions releases/v0.6.17-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Release Notes - Freedom Controller v0.6.17



- Bug Fixes (the notable ones)
- We should have been checking HTTP status code when adding enclosures to RSS feeds in the editor. If the enclosure
url HEAD check returns a greater than 399 status code then error out.
- Change domain refs in blank RSS outline template to point to a subdomain we own to prevent hijacking in the future.

- New Feature: Editor - private outlines
- There is now an option in the editor toolbar to make an outline private. Default is always "public" in the S3 bucket.
- Just click on the circle with the slash through it and then save the outline. The OPML will be marked private in S3 and the HTML
will be removed from S3.
- The HTML link will then be replaced with a server-referenced url with a 75 character random token. This can be shared
for private viewing.

- New Feature Editor - Unarchive nodes
- If you have an "include" type node selected, you can click the unarchive button on the toolbar to suck the included outlines
nodes back into this outline and remove the include reference.
- If you have multiple include nodes selected they will all be sucked back in.
- This is very useful if you produce a search outline with the 'OPML:' search keyword and want to turn it into a single large
outline without all the includes.


- Improvements:
- Editor now prompts if you want to "save as..." when you save after changing the title of an outline.
- Editor prompts if you're sure you want to leave the page if you have unsaved changes.
- Updated Font-awesome to latest version.
- Removed morse code tool from editor.
Loading

0 comments on commit c57ef78

Please sign in to comment.