Git Product home page Git Product logo

Comments (15)

goldenages1989 avatar goldenages1989 commented on May 25, 2024 1

It is a plugin that pulls out articles from the Omnivore archive that you have read on a given day and writes them into your Obsidian journal. I wrote it based on this plugin. If anyone is interested, I would be happy to share it.

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Hi, you'll need to provide some more details so we can diagnose this. Search API definitely works on mobile you can open https://omnivore.app on mobile to verify. Do you have some sample code we could look at?

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

I apologize for not providing enough information. Here is the code

async function fetchTraces(authToken) {
  let mappedResults = [];
  try {
    const cursor = 0;
    const limit = 10;
    const data = JSON.stringify({
    variables: {
      after: "0",
      first: 30,
      format: "",
      includeContent: false,
      query: "sort:updated-desc"
    },
    query: `query Search(
      $after: String
      $first: Int
      $query: String
      $includeContent: Boolean
      $format: String
    ) {
      search(
        first: $first,
        after: $after,
        query: $query,
        includeContent: $includeContent,
        format: $format
      ) {
        ... on SearchSuccess {
          edges {
            node {
                id
                title
                  slug
                  siteName
                  originalArticleUrl
                  url
                  author
                  updatedAt
                  description
                  savedAt
                  pageType
                  content
                  publishedAt
                  readAt
                  wordsCount
                  isArchived
                  readingProgressPercent
                  archivedAt
                  contentReader
            }
          }
          pageInfo {
            hasNextPage
            endCursor
            totalCount
          }
        }
        ... on SearchError {
          errorCodes
        }
      }
    }
  `,
  });
    const url = `https://api-prod.omnivore.app/api/graphql`;
    const completedTraceMetadata = await fetch(url, {
      method: 'POST',
      headers: {
        "Content-Type": "application/json",
        "Authorization": "${authToken}",
        "X-OmnivoreClient": "obsidian"
      },
      body: data
    }).then(function(response) {
      return response.json();
    });

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

OK, my guess is what you are hitting here is a CORs error. Can you look in the developer console and on the network tab?

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

I can only access console information on my Mac computer. The console information on the mobile device cannot be obtained within Obsidian.

image

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Thanks, I didn't understand that you were running within Obsidian. I am still guessing this is related to CORS somehow. I wonder if on Mac Obsidian is proxying the fetch request to avoid CORs but on iOS its running through the browser.

Is this installed as a plugin?

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

Yes, this is a obsidian plugin I wrote myself. In this plugin, I fetch data from Omnivore for processing.
I searched for some information about Obsidian CORS, and one suggestion was to switch the request api from fetch to requestUrl to handle CORS. After trying this, I found that it now throws a 500 error.

image
   const url = `https://api-prod.omnivore.app/api/graphql`;
    const RequestUrlParam = {
       url: url,
       method: 'POST',
       headers: {
        "Content-Type": "application/json",
        "Authorization": "${authToken}",
        "X-OmnivoreClient": "obsidian"
       },
       body: data
    };
    try {
       console.log("before http request");
       const response = await requestUrl(RequestUrlParam);
       console.log(response);
    } catch (e) {
      console.log(JSON.stringify(e));  
    }

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Can you paste the full stack here? (Make sure it doesn't have your token in it)

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

Do you means the result of console.log(e.stack)?

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Do you means the result of console.log(e.stack)?

Yeah

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

That's the only information available

image

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Long shot because its hard to tell from our logs, but there was a request right around that time with an invalid API key. Maybe in the code update the authToken variable was changed?

Also, your key was visible in a previous screenshot, so you should probably delete that key on our API keys page.

from omnivore.

goldenages1989 avatar goldenages1989 commented on May 25, 2024

Indeed, it was indeed the token error that caused the problem. Now the API calls are working correctly. Thank you so much for your guidance!

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

Awesome, please let us know more about your tool when you have it ready to demo...if you plan on sharing it. Might want to checkout our Discord also.

I'll close this one out, but let me know if there are still issues

from omnivore.

jacksonh avatar jacksonh commented on May 25, 2024

I think people would really like this actually

from omnivore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.