fix: Prevent importing calendar tasks if coming from taskwarrior cli
This commit is contained in:
parent
f63e2d0e2e
commit
bf9a55de0e
@ -6,10 +6,10 @@ composer require aerex/baikal-storage-plugin
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
Copy sample configuration to your baikal installation. Make sure that the folder is *writable* by your webserver (e.g Apache, Nginx)
|
Create the `config.yaml` to your webserver. Make sure the file is *writable* by your webserver (e.g Apache, Nginx). For more details on the configuration details see the wiki page.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
- Add the plugin to `Core/Frameworks/Baikal/Core/Server.php`
|
- Add the plugin to `Core/Frameworks/Baikal/Core/Server.php`
|
||||||
```
|
```
|
||||||
$this->server->addPlugin(new \Aerex\BaikalStorage\Plugin(<path-of-config-file>))
|
$this->server->addPlugin(new \Aerex\BaikalStorage\Plugin(<absolute/path/of/config/file>))
|
||||||
```
|
```
|
||||||
|
@ -117,6 +117,7 @@ class Plugin extends ServerPlugin {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method handles the PUT method.
|
* This method handles the PUT method.
|
||||||
*
|
*
|
||||||
@ -127,6 +128,7 @@ class Plugin extends ServerPlugin {
|
|||||||
function httpPut(RequestInterface $request){
|
function httpPut(RequestInterface $request){
|
||||||
$body = $request->getBodyAsString();
|
$body = $request->getBodyAsString();
|
||||||
$vCal = \Sabre\VObject\Reader::read($body);
|
$vCal = \Sabre\VObject\Reader::read($body);
|
||||||
|
if (!stristr($vCal->PRODID, 'taskwarrior')) {
|
||||||
try {
|
try {
|
||||||
$this->storageManager->import($vCal);
|
$this->storageManager->import($vCal);
|
||||||
} catch(BadRequest $e){
|
} catch(BadRequest $e){
|
||||||
@ -134,6 +136,7 @@ class Plugin extends ServerPlugin {
|
|||||||
} catch(\Exception $e){
|
} catch(\Exception $e){
|
||||||
throw new \Exception($e->getMessage(), null, $e);
|
throw new \Exception($e->getMessage(), null, $e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$request->setBody($body);
|
$request->setBody($body);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user