mail/fetchmail: New plugin (#2093)

This commit is contained in:
Michael
2021-04-10 10:06:16 +02:00
committed by GitHub
parent bf8329957a
commit b6530b6e62
23 changed files with 713 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
PLUGIN_NAME= fetchmail
PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= Remote-mail retrieval utility
PLUGIN_DEPENDS= fetchmail
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
.include "../../Mk/plugins.mk"
+15
View File
@@ -0,0 +1,15 @@
Fetchmail is a full-featured, robust, well-documented remote-mail retrieval and forwarding
utility intended to be used over on-demand TCP/IP links (such as SLIP or PPP connections).
It supports every remote-mail protocol now in use on the Internet: POP2, POP3, RPOP, APOP,
KPOP, all flavors of IMAP, ETRN, and ODMR.
Plugin Changelog
================
1.0
* Allow fetching IMAP mailboxes
* Allow fetching POP3 mailboxes
WWW: https://www.fetchmail.info/
@@ -0,0 +1,49 @@
<?php
/*
Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
function fetchmail_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['fetchmail']['general']['enabled']) && $config['OPNsense']['fetchmail']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Fetchmail'),
'configd' => array(
'restart' => array('fetchmail restart'),
'start' => array('fetchmail start'),
'stop' => array('fetchmail stop'),
),
'name' => 'fetchmail',
'pidfile' => '/var/run/fetchmail/fetchmail.pid'
);
}
return $services;
}
@@ -0,0 +1,37 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
class GeneralController extends ApiMutableModelControllerBase
{
protected static $internalModelClass = '\OPNsense\Fetchmail\General';
protected static $internalModelName = 'general';
}
@@ -0,0 +1,67 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
class MailboxController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'mailbox';
protected static $internalModelClass = '\OPNsense\Fetchmail\Mailbox';
public function searchMailboxAction()
{
return $this->searchBase('mailboxes.mailbox', array("enabled", "host", "protocol", "user", "password", "destinationmail", "destination"));
}
public function getMailboxAction($uuid = null)
{
return $this->getBase('mailbox', 'mailboxes.mailbox', $uuid);
}
public function addMailboxAction()
{
return $this->addBase('mailbox', 'mailboxes.mailbox');
}
public function delMailboxAction($uuid)
{
return $this->delBase('mailboxes.mailbox', $uuid);
}
public function setMailboxAction($uuid)
{
return $this->setBase('mailbox', 'mailboxes.mailbox', $uuid);
}
public function toggleMailboxAction($uuid)
{
return $this->toggleBase('mailboxes.mailbox', $uuid);
}
}
@@ -0,0 +1,43 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail\Api;
use OPNsense\Base\ApiMutableServiceControllerBase;
/**
* Class ServiceController
* @package OPNsense\Fetchmail
*/
class ServiceController extends ApiMutableServiceControllerBase
{
protected static $internalServiceClass = '\OPNsense\Fetchmail\General';
protected static $internalServiceTemplate = 'OPNsense/Fetchmail';
protected static $internalServiceEnabled = 'enabled';
protected static $internalServiceName = 'fetchmail';
}
@@ -0,0 +1,38 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail;
class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->generalForm = $this->getForm("general");
$this->view->pick('OPNsense/Fetchmail/general');
}
}
@@ -0,0 +1,38 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail;
class MailboxController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->formDialogEditFetchmailMailbox = $this->getForm("dialogEditFetchmailMailbox");
$this->view->pick('OPNsense/Fetchmail/mailbox');
}
}
@@ -0,0 +1,56 @@
<form>
<field>
<id>mailbox.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the mailbox retrieving.</help>
</field>
<field>
<id>mailbox.host</id>
<label>Host</label>
<type>text</type>
<help>Hostname of the mail server where mailbox is located.</help>
</field>
<field>
<id>mailbox.protocol</id>
<label>Protocol</label>
<type>dropdown</type>
<help>Choose the protocol to use.</help>
</field>
<field>
<id>mailbox.user</id>
<label>Username</label>
<type>text</type>
<help>Username to authenticate against remote mail server.</help>
</field>
<field>
<id>mailbox.password</id>
<label>Password</label>
<type>text</type>
<help>Password to authenticate against remote mail server.</help>
</field>
<field>
<id>mailbox.destinationmail</id>
<label>Destination Email</label>
<type>text</type>
<help>Set the mail address to deliver fetched mails to.</help>
</field>
<field>
<id>mailbox.destination</id>
<label>Destination Host</label>
<type>text</type>
<help>Set the mail server hostname or IP to deliver fetched mails to.</help>
</field>
<field>
<id>mailbox.usessl</id>
<label>Use SSL</label>
<type>checkbox</type>
<help>This will enable or disable usage of encrypted connections. For IMAP and POP3 it will switch the ports to 993 and 995.</help>
</field>
<field>
<id>mailbox.sslfingerprint</id>
<label>Certificate Fingerprint</label>
<type>text</type>
<help>If the server is using a self-signed certificate, the only option fetching mails is to enter the certficiate fingerprint here.</help>
</field>
</form>
@@ -0,0 +1,14 @@
<form>
<field>
<id>general.enabled</id>
<label>Enable</label>
<type>checkbox</type>
<help>This will activate the Fetchmail daemon.</help>
</field>
<field>
<id>general.interval</id>
<label>Interval</label>
<type>text</type>
<help>Interval in seconds how often to retrieve mails.</help>
</field>
</form>
@@ -0,0 +1,9 @@
<acl>
<page-services-fetchmail>
<name>Services: Fetchmail</name>
<patterns>
<pattern>ui/fetchmail/*</pattern>
<pattern>api/fetchmail/*</pattern>
</patterns>
</page-services-fetchmail>
</acl>
@@ -0,0 +1,34 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail;
use OPNsense\Base\BaseModel;
class General extends BaseModel
{
}
@@ -0,0 +1,15 @@
<model>
<mount>//OPNsense/fetchmail/general</mount>
<description>Fetchmail configuration</description>
<version>0.1</version>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<interval type="IntegerField">
<default>600</default>
<Required>Y</Required>
</interval>
</items>
</model>
@@ -0,0 +1,34 @@
<?php
/*
* Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Fetchmail;
use OPNsense\Base\BaseModel;
class Mailbox extends BaseModel
{
}
@@ -0,0 +1,45 @@
<model>
<mount>//OPNsense/fetchmail/mailbox</mount>
<description>Fetchmail configuration</description>
<version>0.1</version>
<items>
<mailboxes>
<mailbox type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<host type="HostnameField">
<Required>Y</Required>
</host>
<protocol type="OptionField">
<Required>Y</Required>
<OptionValues>
<pop3>POP3</pop3>
<imap>IMAP</imap>
</OptionValues>
</protocol>
<user type="TextField">
<Required>Y</Required>
</user>
<password type="TextField">
<Required>Y</Required>
</password>
<destinationmail type="EmailField">
<Required>Y</Required>
</destinationmail>
<destination type="HostnameField">
<Required>Y</Required>
</destination>
<usessl type="BooleanField">
<default>1</default>
<Required>Y</Required>
</usessl>
<sslfingerprint type="TextField">
<Required>N</Required>
<mask>/^[A-Fa-f0-9\:]$/</mask>
</sslfingerprint>
</mailbox>
</mailboxes>
</items>
</model>
@@ -0,0 +1,8 @@
<menu>
<Services>
<Fetchmail cssClass="fa fa-envelope fa-fw">
<General url="/ui/fetchmail/general/index" order="10"/>
<Mailbox url="/ui/fetchmail/mailbox/index" order="20"/>
</Fetchmail>
</Services>
</menu>
@@ -0,0 +1,61 @@
{#
#
# Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#}
<div class="tab-content content-box tab-content">
<div id="general" class="tab-pane fade in active">
<div class="content-box" style="padding-bottom: 1.5em;">
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
<div class="col-md-12">
<hr />
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
</div>
</div>
</div>
</div>
<script>
$( document ).ready(function () {
var data_get_map = {'frm_general_settings':"/api/fetchmail/general/get"};
mapDataToFormUI(data_get_map).done(function (data) {
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
updateServiceControlUI('fetchmail');
// link save button to API set action
$("#saveAct").click(function () {
saveFormToEndpoint(url="/api/fetchmail/general/set", formid='frm_general_settings',callback_ok=function () {
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/fetchmail/service/reconfigure", sendData={}, callback=function (data,status) {
updateServiceControlUI('fetchmail');
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
</script>
@@ -0,0 +1,91 @@
{#
#
# Copyright (C) 2020 Michael Muenz <m.muenz@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#}
<div class="tab-content content-box tab-content">
<div id="mailbox" class="tab-pane fade in active">
<table id="grid-mailbox" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="dialogEditFetchmailMailbox">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="host" data-type="string" data-visible="true">{{ lang._('Host') }}</th>
<th data-column-id="protocol" data-type="string" data-visible="true">{{ lang._('Protocol') }}</th>
<th data-column-id="user" data-type="string" data-visible="true">{{ lang._('Username') }}</th>
<th data-column-id="password" data-type="string" data-visible="true">{{ lang._('Password') }}</th>
<th data-column-id="destination" data-type="string" data-visible="true">{{ lang._('Destination') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
</td>
</tr>
</tfoot>
</table>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="saveAct_progress" class=""></i></button>
<br/><br/>
</div>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditFetchmailMailbox,'id':'dialogEditFetchmailMailbox','label':lang._('Edit Mailbox')])}}
<script>
$(function() {
$("#grid-mailbox").UIBootgrid(
{ 'search':'/api/fetchmail/mailbox/searchMailbox',
'get':'/api/fetchmail/mailbox/getMailbox/',
'set':'/api/fetchmail/mailbox/setMailbox/',
'add':'/api/fetchmail/mailbox/addMailbox/',
'del':'/api/fetchmail/mailbox/delMailbox/',
'toggle':'/api/fetchmail/mailbox/toggleMailbox/'
}
);
updateServiceControlUI('fetchmail');
$("#saveAct").click(function(){
saveFormToEndpoint(url="/api/fetchmail/mailbox/set", formid='frm_general_settings',callback_ok=function(){
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/fetchmail/service/reconfigure", sendData={}, callback=function(data,status) {
updateServiceControlUI('fetchmail');
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
</script>
@@ -0,0 +1,5 @@
#!/bin/sh
mkdir -p /var/run/fetchmail
chown fetchmail:wheel /var/run/fetchmail
chmod 755 /var/run/fetchmail
@@ -0,0 +1,24 @@
[start]
command:/usr/local/opnsense/scripts/OPNsense/Fetchmail/setup.sh;/usr/local/etc/rc.d/fetchmail start
parameters:
type:script
message:starting Fetchmail
[stop]
command:/usr/local/etc/rc.d/fetchmail stop; exit 0
parameters:
type:script
message:stopping Fetchmail
[restart]
command:/usr/local/opnsense/scripts/OPNsense/Fetchmail/setup.sh;/usr/local/etc/rc.d/fetchmail restart
parameters:
type:script
message:restarting Fetchmail
description:Restart Fetchmail service
[status]
command:/usr/local/etc/rc.d/fetchmail status;exit 0
parameters:
type:script_output
message:request Fetchmail status

Some files were not shown because too many files have changed in this diff Show More