Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

World Anvil API changes have caused downstream failures in the Foundry VTT module for content import and image URLs. #54

Closed
anathemamask opened this issue Jun 10, 2022 · 19 comments
Assignees
Labels
bug Functionality which is not working as intended wa-input Issues which need input from the World Anvil team

Comments

@anathemamask
Copy link

image
image

Numerous users on reddit and the FVTT discord are reporting issues similar to this one. Suspect there may have been an API change at WA, may need a reach out to Dimitris.

@anathemamask anathemamask added bug Functionality which is not working as intended wa-input Issues which need input from the World Anvil team labels Jun 10, 2022
@AnotherXeo
Copy link

I'm having the same exact issue too, yesterday.

@KnoepfchenFulla
Copy link

Yes, the module is no longer working since the latest update for me, either. Images don't get imported at all, and texts are missing everywhere. Please fix. :-(

@FoolishFrost
Copy link

Ditto. Not working in the exact same way.

@aaclayton
Copy link
Contributor

I have raised some questions with the World Anvil team to get a bit of clarification on this matter:

I am seeing a number of reports of issues with the World Anvil module for Foundry VTT that seem to be due to some API changes where I probably need some help to understand what has changed.

  1. I am seeing issues with content failing to import that seems to be due to a change in naming convention for article sections from content_parsed to contentParsed. Is this known/intentional and are there any other field name changes that I should be aware of when making a correction for this?

  2. I am also seeing issues with images failing to be imported because the URLs which are coming back from World Anvil do not have an image file extension but are rather returning the World Anvil image page, for example https://www.worldanvil.com/i/2743785 instead of https://www.worldanvil.com/uploads/images/b280f95886e744082b568409d9d420c3.jpg which was previously provided.

@aaclayton aaclayton changed the title Users reporting all imports failing with errors or delivering content laden with "undefined" World Anvil API changes have caused downstream failures in the Foundry VTT module for content import and image URLs. Jun 11, 2022
@aaclayton
Copy link
Contributor

In particular for the second issue about images, I am seeing that article.portrait has the following data structure:

{
    "id": 2664497,
    "title": "character_test",
    "slug": null,
    "state": "public",
    "url": "http://www.worldanvil.com/i/2664497",
    "entityClass": "Image",
    "icon": "fas fa-image",
    "subscribergroups": []
}

I was previously using article.portrait.url to obtain the the image file itself which would be downloaded and saved locally for the Foundry VTT user when the content is imported. Now the url field links to an HTML page rather than the image file. I'm not sure of a good resolution to this except to request that if the portrait schema must change it should also include a src field which would provide the source image URL for the url page.

@aaclayton aaclayton self-assigned this Jun 11, 2022
@aaclayton
Copy link
Contributor

aaclayton commented Jun 11, 2022

The content import issues are fixed with release 1.3.3 which I have just pushed. There are still some issues with image import that the WA team is aware of and they will be working to fix on their side in the coming days. Leaving this issue open until that fix is confirmed.

@FoolishFrost
Copy link

Confirmed working, but with a note:
Section headings, like "Relationshipsideals" are missing spaces and caps. Seems may be using category IDs as opposed to name strings?

@AnotherXeo
Copy link

This is the message I am receiving this morning. BTW I am not a clever person and understand all this code. Just a humble DM :) but I thought I would post the error message again.

image

@KnoepfchenFulla
Copy link

This is the message I am receiving this morning. BTW I am not a clever person and understand all this code. Just a humble DM :) but I thought I would post the error message again.

image

Same here. And texts still don't get imported. Compare:

2022-06-12_11-28-54

2022-06-12_11-28-36

@AnotherXeo
Copy link

Just seen an update to 1.3.3 but still get the same message.

image

image

@aaclayton
Copy link
Contributor

Article content import should be working with the new 1.3.3 release, but the issue with images is still a problem on the World Anvil side where either they need to roll back a change they made or provide a new pathway to getting the embedded image URL for things like article portaits.

@KnoepfchenFulla
Copy link

Content import is still not working for me after the latest update.

@AnotherXeo
Copy link

Huzzah! It's working again :).. huge THANK YOU ! :)

image

@FoolishFrost
Copy link

image
Still seems to be pulling the wrong subheader string?

@aaclayton
Copy link
Contributor

image Still seems to be pulling the wrong subheader string?

This is due to a limitation of the World Anvil API which is documented in #15. Merging your comment over there as additional evidence.

@wdawson
Copy link
Contributor

wdawson commented Nov 10, 2022

I'm using v1.4.1 of this module and assuming that this issue is tracking what I see where the sections are not showing up at all. World Anvil's templates (like "organization") have pre-defined sections, which I've found to be useful prompts while world-building. However, it doesn't appear that this integration parses that data into the journal entries like I'd expect. Looking at the API response from World Anvil, I can guess at why and it seems to be related to this.

article response

In the screenshot above, we see several of these section objects (like "culture" and "demonym") each with a content and contentParsed property. I don't see them show up anywhere in the journal entry that is created in Foundry.

Related to the titles (which seems to be what much of this Issue is describing), interestingly, the title property of these section objects is an empty string on all of what I've been able to see from my data. Furthermore, the naming conventions from these properties seem to be a mix of camelCase (e.g. "alternativeNames") and lowercase (e.g. "economicsystem"). This means that even if you were to get clever with your code and introduce some heuristics, you'd have some screwed-up titles. The only way I see forward (without a change on the World Anvil side) is to hardcode all of these sections, relations, etc. And I don't suspect that is an ideal solution.

My questions here are:

  1. Is it expected behavior that the sections content is completely missing from the Journal Entries in Foundry? If so, why, and is that never going to change?
  2. Is there any hope from World Anvil to update their API to be more friendly for displaying this content? If it's little hope, is there a way we can go give them feedback or contribute?
  3. Would this module consider hardcoding these titles for now until World Anvil updates its API so that we have a temporary solution? I'd be happy to try my hand at contributing if you can give me some pointers for where to start looking at the code.

Thank you and looking forward to your reply!

@aaclayton
Copy link
Contributor

Hey @wdawson - this is interesting. I'm not sure why those sections (culture and demonym) would not be included in the created article.

The code to handle this is here: https://github.com/foundryvtt/world-anvil/blob/master/module/framework.js#L273

It tries to include everything under sections. There are some sections the code is designed to ignore, but these sections should certainly not be ignored by the current logic.

If you have a bit of proficiency with JavaScript or web development, I would suggest you try debugging in the framework.js file at the line indicated above and ensure that your culture and demonym sections end up in the filteredEntries array - or figure out why they are omitted.

@wdawson
Copy link
Contributor

wdawson commented Nov 10, 2022

@aaclayton I think I found the bug. The sections were being added to filteredEntries just fine. The problem is here, where I assume we're trying to append each section to the page: https://github.com/foundryvtt/world-anvil/blob/master/module/framework.js#L331

As written, it's looking in the wrong place for existing page data. I think it should be:

pages.html[pageName] = pages.html[pageName] ?? "";

Easy mistake I've made many times. I'd be happy to submit a PR for this but will take me a while to get setup with the environment and everything. Any chance for a quick fix on your side? Also happy to open a separate issue for this if you need.

wdawson added a commit to wdawson/world-anvil that referenced this issue Nov 10, 2022
aaclayton pushed a commit that referenced this issue Nov 11, 2022
aaclayton pushed a commit that referenced this issue Nov 11, 2022
@aaclayton
Copy link
Contributor

Resolved in release 1.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality which is not working as intended wa-input Issues which need input from the World Anvil team
Projects
None yet
Development

No branches or pull requests

6 participants