Skip to content

Commit

Permalink
nc18, php 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl committed Mar 12, 2020
1 parent 1dd4f83 commit c8f9113
Show file tree
Hide file tree
Showing 27 changed files with 626 additions and 141 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ remove lines 34-37:
$ ./configure --with-php-config=/usr/bin/php-config
$ make
$ sudo make install
$ sudo echo "extension=mailparse.so" > /etc/php/7.0/mods-available/mailparse.ini
$ sudo ln -s /etc/php/7.0/mods-available/mailparse.ini /etc/php/7.0/apache2/conf.d/20-mailparse.ini
$ sudo echo "extension=mailparse.so" > /etc/php/7.3/mods-available/mailparse.ini
$ sudo ln -s /etc/php/7.3/mods-available/mailparse.ini /etc/php/7.3/apache2/conf.d/20-mailparse.ini
$ sudo apachectl restart
```

Expand All @@ -59,7 +59,7 @@ Recreate the aliases db:
$ sudo newaliases
```

_Edit **NextcloudMailCatcher.php** and edit the few settings:
Edit **NextcloudMailCatcher.php** and edit the few settings:


> $config = [
Expand All @@ -69,6 +69,7 @@ _Edit **NextcloudMailCatcher.php** and edit the few settings:
> 'debug' => false
> ];
_Note: the password needs to be a token generated from the webclient in **Settings** / **Security** / **Devices & session**_

You can test your setup by running:

Expand Down
6 changes: 5 additions & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php declare(strict_types=1);


/**
* Files_FromMail - Recover your email attachments from your cloud.
*
Expand All @@ -24,6 +26,8 @@
*
*/



namespace OCA\Files_FromMail\AppInfo;

require_once __DIR__ . '/autoload.php';
Expand Down
5 changes: 4 additions & 1 deletion appinfo/autoload.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php declare(strict_types=1);


/**
* Files_FromMail - Recover your email attachments from your cloud.
*
Expand All @@ -24,6 +26,7 @@
*
*/


namespace OCA\Files_FromMail\AppInfo;

$composerDir = __DIR__ . '/../vendor/';
Expand Down
8 changes: 6 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
]]>
</description>
<version>0.3.0</version>
<version>0.4.0</version>
<licence>agpl</licence>
<author>Maxence Lange</author>
<namespace>Files_FromMail</namespace>
Expand All @@ -27,9 +27,13 @@
<screenshot>https://raw.githubusercontent.com/nextcloud/files_frommail/master/screenshots/v0.1.0.png</screenshot>

<dependencies>
<nextcloud min-version="15" max-version="17"/>
<nextcloud min-version="18"/>
</dependencies>

<settings>
<admin>OCA\Files_FromMail\Settings\Admin</admin>
</settings>

<commands>
<command>OCA\Files_FromMail\Command\Addresses</command>
</commands>
Expand Down
11 changes: 9 additions & 2 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php declare(strict_types=1);


/**
* Files_FromMail - Recover your email attachments from your cloud.
*
Expand All @@ -24,8 +26,13 @@
*
*/


return [
'routes' => [
['name' => 'Remote#getContent', 'url' => '/remote', 'verb' => 'PUT']
['name' => 'Remote#getContent', 'url' => '/remote', 'verb' => 'PUT'],
['name' => 'Navigation#getMailbox', 'url' => '/admin/mailbox', 'verb' => 'GET'],
['name' => 'Navigation#newMailbox', 'url' => '/admin/mailbox', 'verb' => 'POST'],
['name' => 'Navigation#deleteMailbox', 'url' => '/admin/mailbox', 'verb' => 'DELETE']
]
];

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
],
"require": {
"php-mime-mail-parser/php-mime-mail-parser": "3.0.4"
"php-mime-mail-parser/php-mime-mail-parser": "5.0.5"
}
}
40 changes: 21 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.frommail-input {
padding: 10px;
}
136 changes: 136 additions & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/**
* Files_FromMail - Recover your email attachments from your cloud.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <[email protected]>
* @copyright 2020
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

(function() {
if (!OCA.FromMail) {
/**
* @namespace
*/
OCA.FromMail = {};
}

OCA.FromMail.Admin = {

collection: [],

init: function() {
var self = this;

self.getMailbox();

var create = $('#frommail_create');
create.on('click', function() {
var address = $('#frommail_address').val();
var password = $('#frommail_password').val();

$('#frommail_address').val('')
$('#frommail_password').val('')
if (address === '') {
return;
}

self.createMailbox(address, password);
});
},


getMailbox: function() {
var self = this;
$.ajax({
method: 'GET',
url: OC.generateUrl('/apps/files_frommail/admin/mailbox')
}).done(function(res) {
self.collection = res;
self.displayMailbox();
});
},


displayMailbox: function() {
if (this.collection === []) {
return;
}

var self = this;
var list = $('#frommail_list');
list.empty();

this.collection.forEach(function(item) {
var mailbox = item.address
if (item.password !== undefined && item.password !== '') {
mailbox += ' :' + item.password;
}

var entry = $('<div>', {class: 'frommail-input'});
entry.text(mailbox + ' ');
var button = $('<a>', {
id: 'frommail_submit',
class: 'button',
'data-mailbox': item.address
}).append($('<span>').text('Delete'));
button.on('click', function() {
self.deleteMailbox(item.address);
});
entry.append(button);
list.prepend(entry);
});

},


createMailbox: function(mailbox, password) {
var self = this;
$.ajax({
method: 'POST',
url: OC.generateUrl('/apps/files_frommail/admin/mailbox'),
data: {
address: mailbox,
password: password
}
}).done(function(res) {
self.getMailbox();
});

},


deleteMailbox: function(mailbox) {
var self = this;
$.ajax({
method: 'DELETE',
url: OC.generateUrl('/apps/files_frommail/admin/mailbox'),
data: {address: mailbox}
}).done(function(res) {
self.getMailbox();
});
}

};
})();

$(document).ready(function() {
OCA.FromMail.Admin.init();
});

13 changes: 12 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
<?php declare(strict_types=1);


/**
* Files_FromMail - Recover your email attachments from your cloud.
*
Expand All @@ -24,14 +26,23 @@
*
*/


namespace OCA\Files_FromMail\AppInfo;

use OCP\AppFramework\App;


/**
* Class Application
*
* @package OCA\Files_FromMail\AppInfo
*/
class Application extends App {


const APP_NAME = 'files_frommail';


/**
* @param array $params
*/
Expand Down
Loading

0 comments on commit c8f9113

Please sign in to comment.