sawhney17 / logseq-calendars-plugin

MIT License
130 stars 18 forks source link

Toolbar icon only importing "Calendar 2". #50

Open jasonandersen opened 1 year ago

jasonandersen commented 1 year ago

I have Calendar 1, Calendar 2 and Calendar 3 defined in the settings. All calendar URLs resolve correctly to .ics files in an Incognito browser. But only Calendar 2 will import when I click the toolbar.

I first setup only Calendar 1 and it wouldn't import because the toolbar button would only import Calendar 2 and it wasn't setup. Once I setup Calendar 2, it imports correctly but Calendar 1 and Calendar 3 do not.

image

I don't see any setting to control which calendar gets imported from the toolbar icon?

jasonandersen commented 1 year ago

App Version: 0.9.19 Git Revision: bd36efe Platform: Mozilla/5.0 (Macintosh Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML like Gecko) Logseq/0.9.19 Chrome/112.0.5615.204 Electron/24.6.3 Safari/537.36 Language: en-US Plugins: logseq-awesome-styler (v3.7.1), logseq-awesome-ui (v2.3.1), logseq-calendars-plugin (2.2.2), logseq-tabs (v1.19.3)

taapsa-visma commented 1 year ago

Got similar problem but none of the calendars import. Plugin just says: "Calendar not found: Check your URL"

jasonandersen commented 1 year ago

Got similar problem but none of the calendars import. Plugin just says: "Calendar not found: Check your URL"

For what it's worth @taapsa-visma - I got that same error until I populated Calendar 2 settings.

monsterfurby commented 1 year ago

Same issue here, even if all calendar settings are populated. The .ics download using the direct URL works fine.

Torainodor commented 12 months ago

Hi guys. Using the following config:

Investigation

What happened for me was that after inserting links to my calendars using settings GUI, I got the same error "Calendar not found: Check your URL". After checking the console I've seen plugin sends a single request (recall that I have 2 calendars configured). The request URL was https://calendar.google.com/calendar/ical/.... I first thought that replacing proper address with ... is some privacy measure done by the console, but it's not the case.

I went to check plugin's settings (for me on MacOS - should be the same on Linux - it was ~/.logseq/settings/logseq-calendars-plugin.json). From there the cause of the issue was clear: accountsDetails had the single block for Calendar1, and link was the same default https://calendar.google.com/calendar/ical/...:

{
  "template": "{Start} - {End}: {Title}",
  "useJSON": false,
  "IndentCommonBlock": true,
  "templateLine2": "{Description}",
  "timeFormat": [
    "12 hour time",
    "24 hour time"
  ],
  "calendar1Name": "Google",
  "calendar1URL": "https://calendar.google.com/calendar/ical/path/to/correct.ics",
  "calendar2Name": "Outlook",
  "calendar2URL": "https://outlook.office365.com/owa/calendar/path/to/correct.ics",
  "calendar3Name": "",
  "calendar3URL": "",
  "calendar4Name": "",
  "calendar4URL": "",
  "calendar5Name": "",
  "calendar5URL": "",
  "disabled": false,
  "accountsDetails": {
    "Calendar 1": "https://calendar.google.com/calendar/ical/..."
  }

Possible workaround

The workaround is simple: fix accountsDetails section. For example, in my case I have two calendars:

Steps to workaround:

  1. Open logseq-calendars-plugin.json with a text editor.
  2. Replace "Calendar 1" in "accountsDetails" with calendar name e.g., "Google".
  3. Replace link in "accountsDetails" with the link from "calendar1URL" e.g., "https://calendar.google.com/calendar/ical/path/to/correct.ics"
    • Make sure the link is in the double quotes (""), and there is a comma at the end of the line describing Calendar 1.
  4. Add new line for other calendar following the same pattern e.g.,"Outlook": "https://outlook.office365.com/owa/calendar/path/to/correct.ics" The result looked like this in my case:
    "template": "{Start} - {End}: {Title}",
    "useJSON": false,
    "IndentCommonBlock": true,
    "templateLine2": "{Description}",
    "timeFormat": [
    "12 hour time",
    "24 hour time"
    ],
    "calendar1Name": "Google",
    "calendar1URL": "https://calendar.google.com/calendar/ical/path/to/correct.ics",
    "calendar2Name": "Outlook",
    "calendar2URL": "https://outlook.office365.com/owa/calendar/path/to/correct.ics",
    "calendar3Name": "",
    "calendar3URL": "",
    "calendar4Name": "",
    "calendar4URL": "",
    "calendar5Name": "",
    "calendar5URL": "",
    "disabled": false,
    "accountsDetails": {
    "Google": "https://calendar.google.com/calendar/ical/path/to/correct.ics",
    "Outlook": "https://outlook.office365.com/owa/calendar/path/to/correct.ics"
    }
  5. Turn the plugin off, turn the plugin on.

If you have more calendars, repeat step 4 for other calendars, adding comma after each new calendar.


I can't read typescript well, but for my money the code in index.ts that creates accountsDetails looks correct. I couldn't find the reason why accountDetails did not update after I changed the settings.

SM-26 commented 11 months ago

Thanks @Torainodor , Your workaround solved half of the problem for me.

I also set mine up via GUI, and got the same problem with the account details. but after fixing it manually, still the toolbar icon say "Open-calendar-2", not that big of a deal for me. just as long as it works.

MegaKeegMan commented 11 months ago

This workaround also worked for me. Thanks very much for documenting this. I had the same results where it still says "Open-calendar-2", and while that is a bit funny, I am just glad it works. Before looking through the issues, I feared that this was somehow a problem with getting my ics from Nextcloud, which maybe does not make sense, but that was what I was thinking. Glad I checked the issue queue.