From 711d3673bcd8fb08f02067343897aad7de33968c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:21:57 +0100 Subject: [PATCH 01/10] Improve Docker, make local_art a volume binding --- .dockerignore | 3 +++ Dockerfile | 1 - Makefile | 18 +++++++++++++++++- README.md | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index cd74655ee..88d9f11f8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,6 +17,9 @@ dev/* /.idea /.git +# volume mounts +local_art + # misc .DS_Store .env.local diff --git a/Dockerfile b/Dockerfile index 0216fe5a4..613a80015 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,3 @@ FROM nginx:1.21-alpine as prod EXPOSE 4242 COPY . /usr/share/nginx/html/ COPY app.conf /etc/nginx/nginx.conf - diff --git a/Makefile b/Makefile index 5475649ed..8fe65d007 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,18 @@ start: - docker build -f Dockerfile --target "prod" . -t "cardconjurer-client" && docker run -dit -h 127.0.0.1 -p 4242:4242 "cardconjurer-client" + docker build \ + --file Dockerfile \ + --target "prod" \ + --tag "cardconjurer-client" \ + . \ + && \ + docker run \ + --detach \ + --hostname 127.0.0.1 \ + --publish 4242:4242 \ + --name "cardconjurer-client" \ + --volume ./local_art/:/usr/share/nginx/html/local_art/:ro \ + "cardconjurer-client" + +stop: + docker stop cardconjurer-client && \ + docker rm cardconjurer-client diff --git a/README.md b/README.md index 9c537de04..6fbd54caf 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,12 @@ Open your Browser with the following URL http://localhost:4242/ +When you're done making cards, run the following command to stop the application: + +```bash +$ make stop +``` + ### Important Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. From 5112ff651ba32e8552fbb3edd7194a7dc2a54938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:39:43 +0100 Subject: [PATCH 02/10] Refactor Docker setup to lightweight Docker Compose setup --- .dockerignore | 35 ----------------------------------- Dockerfile | 6 ------ Makefile | 18 ------------------ docker-compose.yml | 8 ++++++++ app.conf => docker/app.conf | 0 5 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 Makefile create mode 100644 docker-compose.yml rename app.conf => docker/app.conf (100%) diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 88d9f11f8..000000000 --- a/.dockerignore +++ /dev/null @@ -1,35 +0,0 @@ -debug.log -CORS.json -*.bat -dev/* - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build -/dist -/.idea -/.git - -# volume mounts -local_art - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* - -cardconjurer.iml -access.log -error.log diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 613a80015..000000000 --- a/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# syntax = docker/dockerfile:1.2 -FROM nginx:1.21-alpine as prod - -EXPOSE 4242 -COPY . /usr/share/nginx/html/ -COPY app.conf /etc/nginx/nginx.conf diff --git a/Makefile b/Makefile deleted file mode 100644 index 8fe65d007..000000000 --- a/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -start: - docker build \ - --file Dockerfile \ - --target "prod" \ - --tag "cardconjurer-client" \ - . \ - && \ - docker run \ - --detach \ - --hostname 127.0.0.1 \ - --publish 4242:4242 \ - --name "cardconjurer-client" \ - --volume ./local_art/:/usr/share/nginx/html/local_art/:ro \ - "cardconjurer-client" - -stop: - docker stop cardconjurer-client && \ - docker rm cardconjurer-client diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..7b33bcd4c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + cardconjurer: + image: nginx:stable-alpine + ports: + - "4242:4242" + volumes: + - ./:/usr/share/nginx/html/:ro + - ./docker/app.conf:/etc/nginx/nginx.conf:ro diff --git a/app.conf b/docker/app.conf similarity index 100% rename from app.conf rename to docker/app.conf From f19b586051b484b800170e521dbfae4798829155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:39:48 +0100 Subject: [PATCH 03/10] Remove unused .env --- .env | 1 - data/scripts/main.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 4218dc88b..000000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -config.hosts << "img.scryfall.com" \ No newline at end of file diff --git a/data/scripts/main.js b/data/scripts/main.js index 3649f2720..8bee490c7 100644 --- a/data/scripts/main.js +++ b/data/scripts/main.js @@ -824,7 +824,7 @@ function inputCardArtNameNumber(cardArtNameNumberInput) { temporaryCardArt.onload = function() { cardArt.src = this.src } - temporaryCardArt.src = cardArtUrlList[cardArtNameNumberInput - 1] //config.hosts << "img.scryfall.com" //environment configuration + temporaryCardArt.src = cardArtUrlList[cardArtNameNumberInput - 1] document.getElementById('inputInfoArtist').value = cardArtArtistList[cardArtNameNumberInput - 1] document.getElementById('inputInfoArtist2').value = document.getElementById('inputInfoArtist').value bottomInfoUpdated() From 13fae993bd8498c2bb62e2cbb1de45fb5c80f0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:40:09 +0100 Subject: [PATCH 04/10] Fix local_art not working when 'uploading' it via URL --- js/creator-23.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/creator-23.js b/js/creator-23.js index f4304ded2..32f151a09 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -4104,6 +4104,9 @@ async function addTextbox(textboxType) { } //ART TAB function uploadArt(imageSource, otherParams) { + if (!imageSource.startsWith('data:image') && !imageSource.startsWith('http')) { + imageSource = `/local_art/${imageSource}`; + } art.src = imageSource; if (otherParams && otherParams == 'autoFit') { art.onload = function() { From 537def1ddad259963e5d6f9f8132fcf0e27fbf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:43:19 +0100 Subject: [PATCH 05/10] Update README --- README.md | 66 +++++++------------------------------------------------ 1 file changed, 8 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 6fbd54caf..fd0e8610a 100644 --- a/README.md +++ b/README.md @@ -14,76 +14,26 @@ This repository is for the purpose of making the application usable on your loca ## Start with Docker (http://localhost:4242/) -
- Install Make on Ubuntu +This is an alternative way to run Card Conjurer locally for more technically inclined people. - ```bash - $ sudo apt update - ``` +A Docker Compose file is present to run the application in a lightweight Nginx context. - check is make installed +Starting: - ```bash - $ make -version - ``` - - after run this command, you got the following error? - - - **bash: /usr/bin/make: No such file or directory** - - then follow with the next step, otherwise skip the next commands - - ```bash - $ sudo apt install make - ``` - -### Troubleshooting's? - * Follow this guide https://linuxhint.com/install-make-ubuntu/ -
- -
- Install Make on Mac - - check is make installed - - ```bash - $ make -version - ``` - - after run this command, you got the following error? - - - **zsh: command not found: make** - - then follow with the next step, otherwise skip the next commands - - ```bash - $ (sudo) brew install make - ``` -
- -
- Install Make on Windows - - Follow this Guide - https://sp21.datastructur.es/materials/guides/make-install.html#windows-installation -
+```bash +docker-compose up -d +``` -* go to the downloaded/ cloned folder with your terminal/ powershell (windows) and run the following command +Stopping: ```bash -$ make start +docker-compose down ``` Open your Browser with the following URL http://localhost:4242/ -When you're done making cards, run the following command to stop the application: - -```bash -$ make stop -``` - ### Important Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. From 68e1ab8109d56f6c48cd7fc079bfd3f7ebe8527e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Tue, 5 Nov 2024 23:46:24 +0100 Subject: [PATCH 06/10] Update README --- README.md | 56 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index fd0e8610a..155b3f737 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,56 @@ # Card Conjurer -Card Conjurer was created by a passionate Magic the Gathering player and grew to become probably the most popular online card generator known to the game. -In November of 2022, Wizards of the Coast served the original creator and webhost of the site with Ceas and Desist paperwork, forcing the site offline. -This repository is for the purpose of making the application usable on your local machine and maintaining templates in perpetuity. +Card Conjurer was created by a passionate Magic the Gathering player and grew to +become probably the most popular online card generator known to the game. + +In November 2022, Wizards of the Coast served the original creator and webhost +of the site with Cease-and-Desist paperwork, forcing the site offline. + +This repository is for the purpose of making the application usable on your +local machine and maintaining templates in perpetuity. + + ## Setup + - Clone this repo somewhere on your system. (Or download the Zip with CODE > Download Zip above) - Run server.exe (or mac-server for MacOS, linux-server for linux) - You're good to go! You could also set up Card Conjurer in a more traditional method using WAMP, Docker, XAMPP, etc. - -[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?longCache=true&style=popout)](https://www.paypal.me/kyleburtondonate -) ← Help out Card Conjurer's original creator, Kyle. We love you buddy. +[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?longCache=true&style=popout)](https://www.paypal.me/kyleburtondonate) ← Help out Card Conjurer's original creator, Kyle. We love you buddy. -## Start with Docker (http://localhost:4242/) +## Alternative Setup (Docker) -This is an alternative way to run Card Conjurer locally for more technically inclined people. +This is an alternative way to run Card Conjurer locally for more technically +inclined people. -A Docker Compose file is present to run the application in a lightweight Nginx context. +A Docker Compose file is present to run the application in a lightweight Nginx +context. The port used is 4242 (http://localhost:4242/). Starting: ```bash -docker-compose up -d +$ docker-compose up -d ``` Stopping: ```bash -docker-compose down +$ docker-compose down ``` -Open your Browser with the following URL - -http://localhost:4242/ - -### Important - -Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. - ## Using Local Images -If you're saving a lot of cards custom images you might hit the data limit for uploaded images (about 2MB). +If you're saving a lot of cards custom images you might hit the data limit for +uploaded images (about 2MB). + +You can avoid this by putting the image files in the `local_art` directory of +this repo. Then, when selecting the image in the Art tab of the card creator, +instead of uploading the image you can type the file name in the "Via URL" +field. -You can avoid this by putting the image files in the `local_art` directory of this repo. Then, when selecting the image in the Art tab of the card creator, instead of uploading the image you can type the file name in the "Via URL" field. This will use the image directly from the `local_art` directory instead of needing to store the whole image in the save file. +This will use the image directly from the `local_art` directory instead of +needing to store the whole image in the save file. -For example if you add the file: -`cardconjurer/local_art/my_art.jpg` +For example if you add the file: `cardconjurer/local_art/my_art.jpg` -You can load it in the "Via URL" box by typing: -`my_art.jpg` -then hitting enter. +You can load it in the "Via URL" box by typing: `my_art.jpg` then hitting enter. From 3e8dcae77a4d4002d2ce03f474055647190117e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Wed, 6 Nov 2024 00:03:03 +0100 Subject: [PATCH 07/10] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 155b3f737..ce0a61d4b 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ context. The port used is 4242 (http://localhost:4242/). Starting: ```bash -$ docker-compose up -d +$ docker compose up -d ``` Stopping: ```bash -$ docker-compose down +$ docker compose down ``` ## Using Local Images From 84be3a77ab203c5ba48f07ff3f215a2199289911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Sat, 21 Dec 2024 14:12:40 +0100 Subject: [PATCH 08/10] Revert changes to README.md --- README.md | 106 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 73 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index ce0a61d4b..9c537de04 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,96 @@ # Card Conjurer -Card Conjurer was created by a passionate Magic the Gathering player and grew to -become probably the most popular online card generator known to the game. +Card Conjurer was created by a passionate Magic the Gathering player and grew to become probably the most popular online card generator known to the game. +In November of 2022, Wizards of the Coast served the original creator and webhost of the site with Ceas and Desist paperwork, forcing the site offline. +This repository is for the purpose of making the application usable on your local machine and maintaining templates in perpetuity. +## Setup +- Clone this repo somewhere on your system. (Or download the Zip with CODE > Download Zip above) +- Run server.exe (or mac-server for MacOS, linux-server for linux) +- You're good to go! You could also set up Card Conjurer in a more traditional method using WAMP, Docker, XAMPP, etc. -In November 2022, Wizards of the Coast served the original creator and webhost -of the site with Cease-and-Desist paperwork, forcing the site offline. -This repository is for the purpose of making the application usable on your -local machine and maintaining templates in perpetuity. +[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?longCache=true&style=popout)](https://www.paypal.me/kyleburtondonate +) ← Help out Card Conjurer's original creator, Kyle. We love you buddy. -## Setup +## Start with Docker (http://localhost:4242/) -- Clone this repo somewhere on your system. (Or download the Zip with CODE > Download Zip above) -- Run server.exe (or mac-server for MacOS, linux-server for linux) -- You're good to go! You could also set up Card Conjurer in a more traditional method using WAMP, Docker, XAMPP, etc. +
+ Install Make on Ubuntu -[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?longCache=true&style=popout)](https://www.paypal.me/kyleburtondonate) ← Help out Card Conjurer's original creator, Kyle. We love you buddy. + ```bash + $ sudo apt update + ``` + check is make installed -## Alternative Setup (Docker) + ```bash + $ make -version + ``` -This is an alternative way to run Card Conjurer locally for more technically -inclined people. + after run this command, you got the following error? + + - **bash: /usr/bin/make: No such file or directory** -A Docker Compose file is present to run the application in a lightweight Nginx -context. The port used is 4242 (http://localhost:4242/). + then follow with the next step, otherwise skip the next commands -Starting: + ```bash + $ sudo apt install make + ``` -```bash -$ docker compose up -d -``` +### Troubleshooting's? + * Follow this guide https://linuxhint.com/install-make-ubuntu/ +
+ +
+ Install Make on Mac + + check is make installed -Stopping: + ```bash + $ make -version + ``` + + after run this command, you got the following error? + + - **zsh: command not found: make** + + then follow with the next step, otherwise skip the next commands + + ```bash + $ (sudo) brew install make + ``` +
+ +
+ Install Make on Windows + + Follow this Guide + https://sp21.datastructur.es/materials/guides/make-install.html#windows-installation +
+ +* go to the downloaded/ cloned folder with your terminal/ powershell (windows) and run the following command ```bash -$ docker compose down +$ make start ``` -## Using Local Images +Open your Browser with the following URL + +http://localhost:4242/ + +### Important -If you're saving a lot of cards custom images you might hit the data limit for -uploaded images (about 2MB). +Be sure, that you are running Docker Desktop under Windows or Mac before you can run the make command. + +## Using Local Images -You can avoid this by putting the image files in the `local_art` directory of -this repo. Then, when selecting the image in the Art tab of the card creator, -instead of uploading the image you can type the file name in the "Via URL" -field. +If you're saving a lot of cards custom images you might hit the data limit for uploaded images (about 2MB). -This will use the image directly from the `local_art` directory instead of -needing to store the whole image in the save file. +You can avoid this by putting the image files in the `local_art` directory of this repo. Then, when selecting the image in the Art tab of the card creator, instead of uploading the image you can type the file name in the "Via URL" field. This will use the image directly from the `local_art` directory instead of needing to store the whole image in the save file. -For example if you add the file: `cardconjurer/local_art/my_art.jpg` +For example if you add the file: +`cardconjurer/local_art/my_art.jpg` -You can load it in the "Via URL" box by typing: `my_art.jpg` then hitting enter. +You can load it in the "Via URL" box by typing: +`my_art.jpg` +then hitting enter. From b2719bfb259868da98a1c8802354405207d0d122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Sat, 21 Dec 2024 14:12:51 +0100 Subject: [PATCH 09/10] Revert changes to creator-23.js --- js/creator-23.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/creator-23.js b/js/creator-23.js index 32f151a09..f4304ded2 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -4104,9 +4104,6 @@ async function addTextbox(textboxType) { } //ART TAB function uploadArt(imageSource, otherParams) { - if (!imageSource.startsWith('data:image') && !imageSource.startsWith('http')) { - imageSource = `/local_art/${imageSource}`; - } art.src = imageSource; if (otherParams && otherParams == 'autoFit') { art.onload = function() { From 795fd7c4f6d62f98926c40b017df86eeeadb51dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Asperen?= Date: Sat, 21 Dec 2024 14:13:33 +0100 Subject: [PATCH 10/10] Add docker-compose.override.yml to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9a552394c..7b8df3f39 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ access.log error.log fly.toml +docker-compose.override.yml