andrewbrereton / obsidian-to-ical-plugin

This is a plugin for Obsidian that searches your vault for tasks that contain dates, and generates a calendar in iCal format that can be imported into your preferred calendar application.
MIT License
61 stars 13 forks source link

Difficulties with deploying the plugin #29

Closed jtof-dev closed 10 months ago

jtof-dev commented 10 months ago

Hey! I followed your instructions from the README.md and from this issue, but I still haven't had any luck with getting the plugin to work. I have filled out all the sections in both the gist and local saving sections, but can't get either to update. I have filled out every section in both the gist and local sections. Here are the tasks I am trying to get recognized (in a To Do.md file):

- [ ] #task 2023-12-04 work on stuff

- [ ] 2023-12-05 tasks

I am running Obsidian on Macos 14. What other information do I need to provide?

Screenshot 2023-12-04 at 11 42 06 AM

One interesting note is that every time I paste in my github personal access key, the field gets cleared. I'm not sure if this is intentional or part of the problem.

bepolymathe commented 10 months ago

One interesting note is that every time I paste in my github personal access key, the field gets cleared. I'm not sure if this is intentional or part of the problem.

For info. I just made a test yesterday... same behavior.

jtof-dev commented 10 months ago

I figured that my problem was that I was manually making tasks instead of using the official Obsidian Tasks plugin with due dates and scheduled dates etc, but still no dice.

bepolymathe commented 10 months ago

I figured that my problem was that I was manually making tasks instead of using the official Obsidian Tasks plugin with due dates and scheduled dates etc, but still no dice.

Did you include emoji before date ? 

jtof-dev commented 10 months ago

Yes, I have migrated over to using the standard Tasks format with emojis and dates now. (Don't know how it took me this long to find out about Tasks)

andrewbrereton commented 10 months ago

Hi @JJTofflemire, thanks for raising this issue.

- [ ] #task 2023-12-04 work on stuff
- [ ] 2023-12-05 tasks

This should absolutely be identified as a Task. The regular expression to find a date in a line is:

/(?<emoji>➕|⏳|🛫|📅|✅)?\s?(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{1,2})\b/gi

The <emoji> group is optional. A long as there is a "0000-00-00" or "0000-00-0" where 0 is any number, then it should be considered a date and therefore a valid task with a date.

In my test case I have:

image

And in the console I can see it was identified correctly:

image

So then I added your test case:

image

And it worked 😳:

image

I'm at a loss trying to understand how this could happen. I've added some additional logging and a new setting called "Debug mode" to print more logs to console. Perhaps that will assist me in working out what is going on here.

jtof-dev commented 10 months ago

That's really weird. I configured the plugin on my desktop running Arch Linux, and still no dice. Here's the output from Debug Mode.

image

Which failed to find these tasks:

- [ ] Module 1 and 2 review 📅 2023-12-08 ⏳ 2023-12-07 
- [ ] Section 17.2 # 1, 5, 15 p 979 🔼 ⏳ 2023-12-05
- [ ] Webwork Set 23 (4 problems) ⏫ ⏳ 2023-12-05 📅 2023-12-06
- [ ] Homework 11 📅 2023-12-11 ⏬ 

The link from the iCal settings successfully pulls up my gist, though there is still an error in the console. Also, when I tried to enter my Github token, every time I tried to type in the box it would immediately deselect (and pasting in the token would give me no feedback). Though, regardless, the primary issue appears to be identifying the tasks.

andrewbrereton commented 10 months ago

I'm wondering about the GitHub token. Can you confirm the details of the token?

I currently enforce the token to be either a classic token or a fine-grained token like this:

^ghp_[a-zA-Z0-9]{255}$

or

^github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}$

Can you check if your token looks like this or if it looks different? If it's different, then the code will throw an error. That would explain the token being cleared, and maybe even the plugin not working correctly from there on.

jtof-dev commented 10 months ago

Yes, that was the problem! I switched to a fine-grained access token, and now the plugin works as intended (both writing to a gist and to a .ical file locally). My classic token was only 40 characters long, which was causing all the problems. I'm not sure if I was failing to copy the whole token or if they are not always 255 characters long

andrewbrereton commented 10 months ago

That's great to hear. I will update the code to be a bit better about what should happen when there is a problem parsing the token. eg: Tell the user instead of simply clearing the textbox.

andrewbrereton commented 10 months ago

This has been fixed in 1.9.1

bepolymathe commented 10 months ago

I confirm it works for me too.