Merge branch 'cryptomilk-master-htaccess'

This commit is contained in:
El RIDO 2019-09-20 07:06:38 +02:00
commit ced5f30280
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
6 changed files with 35 additions and 9 deletions

View File

@ -2,3 +2,11 @@ RewriteEngine on
RewriteCond !%{HTTP_USER_AGENT} "Let's Encrypt validation server" [NC] RewriteCond !%{HTTP_USER_AGENT} "Let's Encrypt validation server" [NC]
RewriteCond %{HTTP_USER_AGENT} ^.*(bot|spider|crawl|https?://|WhatsApp|SkypeUriPreview|facebookexternalhit) [NC] RewriteCond %{HTTP_USER_AGENT} ^.*(bot|spider|crawl|https?://|WhatsApp|SkypeUriPreview|facebookexternalhit) [NC]
RewriteRule .* - [R=403,L] RewriteRule .* - [R=403,L]
<IfModule mod_php7.c>
php_value max_execution_time 30
php_value post_max_size 10M
php_value upload_max_size 10M
php_value upload_max_filesize 10M
php_value max_file_uploads 100
</IfModule>

View File

@ -5,6 +5,7 @@
* CHANGED: Improved mobile UI - obscured send button and hard to click shortener button (#477) * CHANGED: Improved mobile UI - obscured send button and hard to click shortener button (#477)
* CHANGED: Enhanced URL shortener integration (#479) * CHANGED: Enhanced URL shortener integration (#479)
* CHANGED: Improved file upload drag & drop UI (#317) * CHANGED: Improved file upload drag & drop UI (#317)
* CHANGED: Increased default size limit from 2 to 10 MiB, switch data from BLOB to MEDIUMBLOB in MySQL (#458)
* CHANGED: Upgrading libraries to: DOMpurify 2.0.1 * CHANGED: Upgrading libraries to: DOMpurify 2.0.1
* FIXED: Enabling browsers without WASM to create pastes and read uncompressed ones (#454) * FIXED: Enabling browsers without WASM to create pastes and read uncompressed ones (#454)
* FIXED: Cloning related issues (#489, #491, #493, #494) * FIXED: Cloning related issues (#489, #491, #493, #494)

View File

@ -139,7 +139,7 @@ For reference or if you want to create the table schema for yourself to avoid ha
```sql ```sql
CREATE TABLE prefix_paste ( CREATE TABLE prefix_paste (
dataid CHAR(16) NOT NULL, dataid CHAR(16) NOT NULL,
data BLOB, data MEDIUMBLOB,
postdate INT, postdate INT,
expiredate INT, expiredate INT,
opendiscussion INT, opendiscussion INT,

View File

@ -29,8 +29,8 @@ defaultformatter = "plaintext"
; (optional) set a syntax highlighting theme, as found in css/prettify/ ; (optional) set a syntax highlighting theme, as found in css/prettify/
; syntaxhighlightingtheme = "sons-of-obsidian" ; syntaxhighlightingtheme = "sons-of-obsidian"
; size limit per paste or comment in bytes, defaults to 2 Mebibytes ; size limit per paste or comment in bytes, defaults to 10 Mebibytes
sizelimit = 2097152 sizelimit = 10485760
; template to include, default is "bootstrap" (tpl/bootstrap.php) ; template to include, default is "bootstrap" (tpl/bootstrap.php)
template = "bootstrap" template = "bootstrap"

View File

@ -45,7 +45,7 @@ class Configuration
'burnafterreadingselected' => false, 'burnafterreadingselected' => false,
'defaultformatter' => 'plaintext', 'defaultformatter' => 'plaintext',
'syntaxhighlightingtheme' => null, 'syntaxhighlightingtheme' => null,
'sizelimit' => 2097152, 'sizelimit' => 10485760,
'template' => 'bootstrap', 'template' => 'bootstrap',
'notice' => '', 'notice' => '',
'languageselection' => false, 'languageselection' => false,

View File

@ -597,6 +597,8 @@ class Database extends AbstractData
/** /**
* get the data type, depending on the database driver * get the data type, depending on the database driver
* *
* PostgreSQL uses a different API for BLOBs then SQL, hence we use TEXT
*
* @access private * @access private
* @static * @static
* @return string * @return string
@ -609,6 +611,8 @@ class Database extends AbstractData
/** /**
* get the attachment type, depending on the database driver * get the attachment type, depending on the database driver
* *
* PostgreSQL uses a different API for BLOBs then SQL, hence we use TEXT
*
* @access private * @access private
* @static * @static
* @return string * @return string
@ -628,16 +632,17 @@ class Database extends AbstractData
{ {
list($main_key, $after_key) = self::_getPrimaryKeyClauses(); list($main_key, $after_key) = self::_getPrimaryKeyClauses();
$dataType = self::_getDataType(); $dataType = self::_getDataType();
$attachmentType = self::_getAttachmentType();
self::$_db->exec( self::$_db->exec(
'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' . 'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' .
"dataid CHAR(16) NOT NULL$main_key, " . "dataid CHAR(16) NOT NULL$main_key, " .
"data $dataType, " . "data $attachmentType, " .
'postdate INT, ' . 'postdate INT, ' .
'expiredate INT, ' . 'expiredate INT, ' .
'opendiscussion INT, ' . 'opendiscussion INT, ' .
'burnafterreading INT, ' . 'burnafterreading INT, ' .
'meta TEXT, ' . 'meta TEXT, ' .
'attachment ' . self::_getAttachmentType() . ', ' . "attachment $attachmentType, " .
"attachmentname $dataType$after_key );" "attachmentname $dataType$after_key );"
); );
} }
@ -711,6 +716,7 @@ class Database extends AbstractData
private static function _upgradeDatabase($oldversion) private static function _upgradeDatabase($oldversion)
{ {
$dataType = self::_getDataType(); $dataType = self::_getDataType();
$attachmentType = self::_getAttachmentType();
switch ($oldversion) { switch ($oldversion) {
case '0.21': case '0.21':
// create the meta column if necessary (pre 0.21 change) // create the meta column if necessary (pre 0.21 change)
@ -722,7 +728,7 @@ class Database extends AbstractData
// SQLite only allows one ALTER statement at a time... // SQLite only allows one ALTER statement at a time...
self::$_db->exec( self::$_db->exec(
'ALTER TABLE ' . self::_sanitizeIdentifier('paste') . 'ALTER TABLE ' . self::_sanitizeIdentifier('paste') .
' ADD COLUMN attachment ' . self::_getAttachmentType() . ';' " ADD COLUMN attachment $attachmentType;"
); );
self::$_db->exec( self::$_db->exec(
'ALTER TABLE ' . self::_sanitizeIdentifier('paste') . " ADD COLUMN attachmentname $dataType;" 'ALTER TABLE ' . self::_sanitizeIdentifier('paste') . " ADD COLUMN attachmentname $dataType;"
@ -732,7 +738,7 @@ class Database extends AbstractData
if (self::$_type !== 'sqlite') { if (self::$_type !== 'sqlite') {
self::$_db->exec( self::$_db->exec(
'ALTER TABLE ' . self::_sanitizeIdentifier('paste') . 'ALTER TABLE ' . self::_sanitizeIdentifier('paste') .
' ADD PRIMARY KEY (dataid), MODIFY COLUMN data $dataType;' " ADD PRIMARY KEY (dataid), MODIFY COLUMN data $dataType;"
); );
self::$_db->exec( self::$_db->exec(
'ALTER TABLE ' . self::_sanitizeIdentifier('comment') . 'ALTER TABLE ' . self::_sanitizeIdentifier('comment') .
@ -754,6 +760,17 @@ class Database extends AbstractData
self::_sanitizeIdentifier('comment') . '(pasteid);' self::_sanitizeIdentifier('comment') . '(pasteid);'
); );
// no break, continue with updates for 0.22 and later // no break, continue with updates for 0.22 and later
case '1.3':
// SQLite doesn't support MODIFY, but it allows TEXT of similar
// size as BLOB and PostgreSQL uses TEXT, so there is no need
// to change it there
if (self::$_type !== 'sqlite' && self::$_type !== 'pgsql') {
self::$_db->exec(
'ALTER TABLE ' . self::_sanitizeIdentifier('paste') .
" MODIFY COLUMN data $attachmentType;"
);
}
// no break, continue with updates for 1.3.1 and later
default: default:
self::_exec( self::_exec(
'UPDATE ' . self::_sanitizeIdentifier('config') . 'UPDATE ' . self::_sanitizeIdentifier('config') .