-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add react *.js to the project, instad of load from external - CSP support #84
Comments
Hi @GAS85, One of the things I've always tried to do is keep it as only requiring one file. Even though there are multiple files in the repo, once it's built it's all in the one index.php, so I'm not keep on having separate js files. Ideally I'd not want to embed those js files into the finished result, either, as I'll always have to maintain the current version rather than letting unpkg.com do it for me. There's nothing stopping you doing that, though. With a couple small tweaks to the template you should be able to do what you need. For example, what you could possibly do is fork the repo and in your fork add the js files to the top-level. Then update This should also keep your changes to a minimum, so that whenever I make changes to the origin you can replay your changes on top of them pretty easily. As I'm writing this, I'm thinking that it shouldn't be too difficult for me to add that functionality into the little build script... 🤔 I'm a little busy for the next week or two, but I'll see if I can come up with anything. In the meantime, give the idea a go yourself and see if it helps you out. |
Basically I solved it by simple script - It should be run once, will download JSs and replace all links directly in #!/bin/bash
# By Georgiy Sitnikov.
#
# AS-IS without any warranty
file="index.php"
getJSLinks="$(grep "script src" $file | awk -F'["]' '{ print $2 }')"
echo "Backup $file to $file.origin"
cp $file $file.origin
while read JSLinks; do
JSName="$(echo $JSLinks | awk -F'[/]' '{ print $NF }')"
echo "Downloading $JSName from https:$JSLinks"
curl -fsSL -m 10 https:$JSLinks -o $JSName
echo "Replacing $JSLinks with $JSName in $file"
sed -i "s,$JSLinks,$JSName," "$file"
done <<< "$getJSLinks" # Read from variable
echo "Done."
exit 0
|
Nice one! I took a basically the same approach, but wanted to keep it all the PHP that was already there, so am doing it in the Currently in branch |
Now merged into master |
Hey, like your product much.
I have server with CSP enabled and opcache UI will not be opened without whitelisting of
unpkg.com
.Is this possible to add js files to the project so that it will be loaded from the same FQDN as UI?
Or is there is an easy way to re-configure it locally?
The text was updated successfully, but these errors were encountered: