dmarcuse / fvtt-adventure-bundler

Export and import Foundry adventures, assets included!
MIT License
3 stars 3 forks source link

Request: Adventures Bundled from forgevtt contain links to the forge server instead of downloading/bundling #6

Open hoshisabi opened 1 year ago

hoshisabi commented 1 year ago

If you prepare your adventure on the forge vtt server, the downloaded bundles still contain links to the server, instead of packaging up the assets like they do with local adventures.

For example: "name":"SJ-DC-DD-04 The Highest Bidder","img":"https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/!Cover.webp"

This would be a nice addition, to download those and include them in the assets.

Some assets from D&D Beyond are similar, the user may or may not want those assets downloaded as well, so perhaps an option to say "package up assets at this URL" or something similar?

(I'm going to probably write up a script to fix up the adventures I bundled already, but this strikes me as something you could easily do as well, and other folks might want.)

If it would be helpful to include one of these adventures, let me know, I have several.

dmarcuse commented 1 year ago

Hmm, I can look into it but I don't use Forge myself so I'm not able to troubleshoot it fully. In the meantime, there is a hidden setting you can enable to cause external URLs to be exported as well - paste this into a script macro or the devtools and run it to enable the setting for the world:

await game.settings.set("adventure-bundler", "bundleAssetExternalUrl", true)

If this doesn't work well for you, you can disable it with this snippet:

await game.settings.set("adventure-bundler", "bundleAssetExternalUrl", false)
hoshisabi commented 1 year ago

So that didn't work for me, but that sounds promising:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.dndbeyond.com/avatars/31312/507/638084408335649926.png. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200

Honestly, if you like, I think you could troubleshoot this by importing one of my adventures that points to my Forge account, which should work (since the assets are set to permit you to see them).

Obviously prioritize it however you will with all of the other things that you're working on, but let me know if it is of any use to you. :) Would be glad to assist however possible.

(apart from coding, because my lack of JS skills would make me useless to you there. hehe.)

Anyhow, I would prioritize this as a "when you can, if you can" sort of fix because everything DOES work for me, it's just that if I were to ever migrate from the forge, I'd not have access to those URLs anymore. (or if I ever wanted to remove the assets from my forge account to conserve space.)

hoshisabi commented 1 year ago

Here is some dump from the console of that one, just to show you what we're looking at for my case.

0: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/!Cover.webp" → "asset_0.webp"
​​
1: "https://www.dndbeyond.com/avatars/31312/507/638084408335649926.png" → "asset_1.png"
​​
2: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/animated_armor.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_2.webp"
​​
3: "https://www.dndbeyond.com/avatars/28079/804/637961800711077951.png" → "asset_3.png"
​​
4: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/autognome.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_4.webp"
​​
5: "https://www.dndbeyond.com/avatars/30788/720/638062180169334287.png" → "asset_5.png"
​​
6: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/helmed_horror.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_6.webp"
​​
7: "https://www.dndbeyond.com/avatars/30783/971/638062024854370869.png" → "asset_7.png"
​​
8: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/flesh_golem.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_8.webp"
​​
9: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/thug.Avatar.webp?1680378627351" → "asset_9.webp"
​​
10: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/thug.Token.webp?1680378627351" → "asset_10.webp"
​​
11: "https://www.dndbeyond.com/avatars/25746/222/637880557279107715.png" → "asset_11.png"
​​
12: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/clockwork_bronze_scout.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_12.webp"
​​
13: "https://www.dndbeyond.com/avatars/25265/558/637861450522280364.png" → "asset_13.png"
​​
14: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/clockwork_horror.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_14.webp"
​​
15: "https://www.dndbeyond.com/avatars/25746/228/637880557289778657.png" → "asset_15.png"
​​
16: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/clockwork_oaken_bolter.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_16.webp"
​​
17: "https://www.dndbeyond.com/avatars/21205/213/637707682434289941.png" → "asset_17.png"
​​
18: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/dragon_blessed.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_18.webp"
​​
19: "https://www.dndbeyond.com/avatars/21205/216/637707682438813528.png" → "asset_19.png"
​​
20: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/dragon_chosen.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_20.webp"
​​
21: "https://www.dndbeyond.com/avatars/21205/219/637707682441933719.png" → "asset_21.png"
​​
22: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/dragon_speaker.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_22.webp"
​​
23: "https://www.dndbeyond.com/avatars/30782/764/638061975215674200.png" → "asset_23.png"
​​
24: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/duergar.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_24.webp"
​​
25: "https://www.dndbeyond.com/avatars/25746/319/637880557441052656.png" → "asset_25.png"
​​
26: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/duergar_hammerer.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_26.webp"
​​
27: "https://www.dndbeyond.com/avatars/25746/329/637880557456563961.png" → "asset_27.png"
​​
28: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/duergar_stone_guard.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_28.webp"
​​
29: "https://www.dndbeyond.com/avatars/30761/835/638061095635621772.png" → "asset_29.png"
​​
30: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/flying_sword.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_30.webp"
​​
31: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/gnoll_hunter.Avatar.webp?1680345163540" → "asset_31.webp"
​​
32: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/gnoll_hunter.Token.webp?1680345163540" → "asset_32.webp"
​​
33: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/gnoll_pack_lord.Avatar.webp?1680345138478" → "asset_33.webp"
​​
34: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/gnoll_pack_lord.Token.webp?1680345138478" → "asset_34.webp"
​​
35: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hobgoblin_captain.Avatar.webp?1680345237159" → "asset_35.webp"
​​
36: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hobgoblin_captain.Token.webp?1680345237159" → "asset_36.webp"
​​
37: "https://www.dndbeyond.com/avatars/25746/448/637880557685255003.png" → "asset_37.png"
​​
38: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hobgoblin_devastator.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_38.webp"
​​
39: "https://www.dndbeyond.com/avatars/25746/451/637880557692765789.png" → "asset_39.png"
​​
40: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hobgoblin_iron_shadow.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_40.webp"
​​
41: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/huangfu_guard.Avatar.webp?1680345576724" → "asset_41.webp"
​​
42: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/huangfu_guard.Token.webp?1680345576724" → "asset_42.webp"
​​
43: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/ordo_melioris_kobold_inventor.Avatar.webp?1680344968076" → "asset_43.webp"
​​
44: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/ordo_melioris_kobold_inventor.Token.webp?1680344968076" → "asset_44.webp"
​​
45: "https://www.dndbeyond.com/avatars/25746/718/637880558103841698.png" → "asset_45.png"
​​
46: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/tortle.Token-world.ddb-monsters.webp" → "asset_46.webp"
​​
47: "https://www.dndbeyond.com/avatars/30836/511/638063938654619497.png" → "asset_47.png"
​​
48: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/wraith.Token-world.ddb-pandodnd-regular-game-ddb-monsters.webp" → "asset_48.webp"
​​
49: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/believer_azim.Avatar.webp?1680344750359" → "asset_49.webp"
​​
50: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/believer_azim.Token.webp?1680344750359" → "asset_50.webp"
​​
51: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/blessed_konstantin.Avatar.webp?1680344391851" → "asset_51.webp"
​​
52: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/blessed_konstantin.Token.webp?1680344391851" → "asset_52.webp"
​​
53: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/boxer_koreth.Avatar.webp?1680341560488" → "asset_53.webp"
​​
54: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/boxer_koreth.Token.webp?1680341560488" → "asset_54.webp"
​​
55: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hong_yu.Avatar.webp?1680342267138" → "asset_55.webp"
​​
56: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/hong_yu.Token.webp?1680342267138" → "asset_56.webp"
​​
57: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/si_tengiling.Avatar.webp?1680344617858" → "asset_57.webp"
​​
58: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/tokenizer/npc-images/si_tengiling.Token.webp?1680344617858" → "asset_58.webp"
​​
59: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/base64data/Scene/aa6e79e0f54954748808829c4ee277d9.webp" → "asset_59.webp"
​​
60: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/Appendix%201A_%20Auction%20House%20Day%20(37x28).webp" → "asset_60.webp"
​​
61: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/base64data/Scene/9187063c166f23c384ddafe19e013026.webp" → "asset_61.webp"
​​
62: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/Appendix%201B_%20Auction%20House%20Night%20(37x28).webp" → "asset_62.webp"
​​
63: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/base64data/Scene/6365d49851ced70f110d652599b91604.webp" → "asset_63.webp"
​​
64: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/Appendix%201D_%20Night%20Market%20(Huangfu%20villa)%20(43%20x%2032)%20.webp" → "asset_64.webp"
​​
65: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/base64data/Scene/3855f59a72ccb818265c52d5e21031e2.webp" → "asset_65.webp"
​​
66: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/adventures/SJ-DC-DD-04%20The%20Highest%20Bidder/Appendix%201E_%20Spelljammer%20Landing%20Pad%20(27x16).webp" → "asset_66.webp"
​​
67: "https://assets.forge-vtt.com/5e8b516891f93735fd1249d1/base64data/Scene/489c7081cc2ea88fcc391597eade904c.webp" → "asset_67.webp"
dmarcuse commented 1 year ago

Well, the good news is it looks like it's just DND beyond links causing issues here - not Forge. When I get some time, I'll look into detecting and bundling Forge assets.