Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

php scripts not looking for configuration in new location #8

Closed
codycodes opened this issue Jun 10, 2019 · 3 comments
Closed

php scripts not looking for configuration in new location #8

codycodes opened this issue Jun 10, 2019 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@codycodes
Copy link
Contributor

Describe the bug:
After setting up macos-ifttt-control I learned that while my IFTTT applets were writing commands to my mac's hash, the commands weren't being executed. After digging into the code I found the daemon and tried invoking it:
can't find config 2019-06-09 at 8 01 01 PM

I noticed that there's a recent update to this program in which configuration files were moved. I did some testing with service.php and sure enough when I pointed to the correct path for the configuration file my macos hash file was correctly read and the program works. Here's the changes I made to get services.php and the functionality I needed to work:

$config = file_get_contents(APPDIR . 'assets' . DS . 'json' . DS . 'config.json');
changed to:
$config = file_get_contents($_SERVER['HOME'] . DS . '.mic_config.json');

and

$webhooks = @file_get_contents(APPDIR . 'assets' . DS . 'json' . DS . 'events.json');
changed to:
$webhooks = @file_get_contents(APPDIR . 'assets' . DS . 'json' . DS . 'events.json');

I've forked and updated the service.php, update.php, and triggers.php files with the changes. Feel free to accept/reject them. I only tested services.php though the changes for the other files are similar.

To Reproduce:

  1. Download v1.1.4
  2. Configure Dropbox, macOS IFTTT Control, and create an IFTTT applet with the dropbox action
  3. Trigger said applet
  4. Ensure that the file in your macOS hash is appended with the correctly formatted string for macOS IFTTT Control and that the "action" is not carried out by macOS IFTTT Control

Expected behavior:
Applet actions should be carried out after command is successfully received on the macOS host running the service.php daemon.

Screenshots:
Same as above:
can't find config 2019-06-09 at 8 01 01 PM

System Information:

  • macOS Version: Mojave 10.14.3
  • macOS IFTTT Version: 1.1.4
  • Involved Applet (link to IFTTT): The one I was using before/after macOS IFTTT Control began working:

Additional context
I read over the codebase, and I'm not a seasoned PHP dev, but I did attempt to understand how this works. I noticed that the config files in were copied to the new path in the index.html (/Applications/macOSIFTTTControl.app/Contents/Resources/app/index.html), but that service.php, update.php, and triggers.php seem to not be configured to point at these new locations, hence the filenotfound error. As to if you're having the same issue I'm not sure. Love this app! I'm using it in a google routine when I'm leaving to shut everything off. Time saver ⏲🙌

@codycodes codycodes added the bug Something isn't working label Jun 10, 2019
@codycodes codycodes changed the title service.php not looking for configuration in new location php scripts not looking for configuration in new location Jun 10, 2019
@codycodes
Copy link
Contributor Author

I created a pull request for this: #9

@abdyfranco
Copy link
Owner

abdyfranco commented Jun 14, 2019

Thanks @codycodes! I was able to reproduce the error, and your pull request works as expected. I will merge the pull request to the dev branch and release an update with the fix soon.

@abdyfranco abdyfranco added the good first issue Good for newcomers label Jun 14, 2019
@abdyfranco
Copy link
Owner

This issue has been resolved on v1.1.5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants