omnivore-app / obsidian-omnivore

Obsidian plugin to fetch articles and highlights from Omnivore
MIT License
720 stars 39 forks source link

[BUG] The date at `syncAt` is always empty #227

Closed juanbretti closed 2 months ago

juanbretti commented 2 months ago

Hello, This is my data.json:

{
  "dateHighlightedFormat": "yyyy-MM-dd HH:mm:ss",
  "dateSavedFormat": "yyyy-MM-dd HH:mm:ss",
  "apiKey": "xxxxxxxxxx",
  "filter": "HIGHLIGHTS",
  "syncAt": "",
  "customQuery": "in:all has:highlights",
  "template": "# {{{title}}}\n## Meta\n@[{{siteName}}]({{{originalUrl}}})\n@[Omnivore]({{{omnivoreUrl}}})\n\n{{#highlights.length}}\n\n{{#note}}\n\n## Note\n{{{note}}}\n{{/note}}\n\n## Highlights\n\n{{#highlights}}\n>[!{{color}}]+ {{dateHighlighted}} [⤴️]({{{highlightUrl}}})\n>{{#labels}} ==tags:== **#{{name}}** {{/labels}}\n> {{{text}}}\n{{#note}}\n>>[!abstract]+ Notes\n>>{{note}}\n{{/note}}\n\n{{/highlights}}\n{{/highlights.length}}\n\n## Content\n\n{{{content}}}",
  "highlightOrder": "LOCATION",
  "syncing": false,
  "folder": "Omnivore/{{{date}}}",
  "folderDateFormat": "yyyy-MM-dd",
  "endpoint": "https://api-prod.omnivore.app/api/graphql",
  "filename": "{{{title}}}",
  "filenameDateFormat": "yyyy-MM-dd",
  "attachmentFolder": "Omnivore/Attachments",
  "version": "1.10.1",
  "isSingleFile": false,
  "frequency": 0,
  "intervalId": 0,
  "frontMatterVariables": [],
  "frontMatterTemplate": "id: {{{id}}}\ntitle: >\n  {{{title}}}\n{{#author}}\nauthor: >\n  {{{author}}}\n{{/author}}\ntags:\n{{#labels.length}}\n{{#labels}} - {{{name}}} \n{{/labels}}\n{{/labels.length}}\n - omnivore\ndate_saved: {{{dateSaved}}}\n{{#datePublished}}\ndate_published: {{{datePublished}}}\n{{/datePublished}}",
  "syncOnStart": false,
  "enableHighlightColorRender": false,
  "highlightManagerId": "omni",
  "highlightColorMapping": {
    "yellow": "#fff3a3",
    "red": "#ff5582",
    "blue": "#adccff",
    "green": "#bbfabb"
  }
}

I just installed the latest version 1.10.1 and to fix the badly formed folders, I manually removed the syncAt value. But now, when I press the Omnivore icon to start sync, the process runs, but this syncAt is always empty.

image

Also tested restoring the frontMatterTemplate to default, and I now have this json:

{
  "dateHighlightedFormat": "yyyy-MM-dd HH:mm:ss",
  "dateSavedFormat": "yyyy-MM-dd HH:mm:ss",
  "apiKey": "xxxxxxxx",
  "filter": "HIGHLIGHTS",
  "syncAt": "",
  "customQuery": "in:all has:highlights",
  "template": "# {{{title}}}\n#Omnivore\n\n[Read on Omnivore]({{{omnivoreUrl}}})\n[Read Original]({{{originalUrl}}})\n\n{{#highlights.length}}\n## Highlights\n\n{{#highlights}}\n> {{{text}}} [⤴️]({{{highlightUrl}}}) {{#labels}} #{{name}} {{/labels}} ^{{{highlightID}}}\n{{#note}}\n\n{{{note}}}\n{{/note}}\n\n{{/highlights}}\n{{/highlights.length}}",
  "highlightOrder": "LOCATION",
  "syncing": false,
  "folder": "Omnivore/{{{date}}}",
  "folderDateFormat": "yyyy-MM-dd",
  "endpoint": "https://api-prod.omnivore.app/api/graphql",
  "filename": "{{{title}}}",
  "filenameDateFormat": "yyyy-MM-dd",
  "attachmentFolder": "Omnivore/Attachments",
  "version": "1.10.1",
  "isSingleFile": false,
  "frequency": 0,
  "intervalId": 0,
  "frontMatterVariables": [],
  "frontMatterTemplate": "id: {{{id}}}\ntitle: >\n  {{{title}}}\n{{#author}}\nauthor: >\n  {{{author}}}\n{{/author}}\ntags:\n{{#labels.length}}\n{{#labels}} - {{{name}}} \n{{/labels}}\n{{/labels.length}}\n - omnivore\ndate_saved: {{{dateSaved}}}\n{{#datePublished}}\ndate_published: {{{datePublished}}}\n{{/datePublished}}",
  "syncOnStart": false,
  "enableHighlightColorRender": true,
  "highlightManagerId": "omni",
  "highlightColorMapping": {
    "yellow": "#fff3a3",
    "red": "#ff5582",
    "blue": "#adccff",
    "green": "#bbfabb"
  }
}

But, still not writing any syntAt time, so is downloading all the notes every single time.

Anything I could try to fix it? Thanks!

jmiba commented 2 months ago

I can confirm. Prior to version 1.10, if I recall correctly, 'syncAt' used to update during synchronization, preventing changes to notes from being overwritten. However, with the introduction of the new highlighting synchronization, it appears that this technique has been suspended?

merlinuwe commented 2 months ago

Perhaps this has something to do with these issues:

When I use update_at:

I get a leading "24":

updated_at: 242024-04-20T17:47:57.641+02:00

juanbretti commented 2 months ago

Fixed on #233. Thanks!