diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 10c4b48b..ef2692ed 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -5,6 +5,6 @@ current_version = 0.3.5 [bumpversion:file:README.md] -[bumpversion:file:pyproject.toml] +[bumpversion:file:lambda-src/api-render-pdf/pyproject.toml] search = version = "{current_version}" replace = version = "{new_version}" diff --git a/.gitignore b/.gitignore index 7bcb8671..fdeef40f 100644 --- a/.gitignore +++ b/.gitignore @@ -308,3 +308,5 @@ terraform/poetry-version.json templates/generated.css .envrc test-results.xml +generated.css +builds/ diff --git a/Makefile b/Makefile index 928cb748..1c3a2964 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.ONESHELL: # Applies to every targets in the file! + INPUT_FILE= .PHONY: all @@ -13,7 +15,9 @@ variations: install-dev clean: @find . -type f \( -iname "*.pdf" -o -iname "*.html" \) -exec rm -vf {} \; +APP_DIR=lambda-src/api-render-pdf POETRY=poetry +POETRY_QUIET=--verbose POETRY_OK:=$(shell command -v $(POETRY) 2> /dev/null) PYSRC=botcpdf MAKE_PDF=bin/make-pdf --format sample @@ -25,7 +29,7 @@ endif install-dev: poetry @$(POETRY) config virtualenvs.in-project true - @$(POETRY) install --quiet + @$(POETRY) --directory=$(APP_DIR) $(POETRY_QUIET) install fmt: install-dev @$(POETRY) run black -t py311 $(PYSRC) @@ -34,10 +38,16 @@ lint: install-dev @$(POETRY) run pylint $(PYSRC) test: install-dev - @$(POETRY) run poetry run pytest -v --junit-xml=test-results.xml botcpdf/tests/ + # for some reason -C doesn't work here + cd $(APP_DIR) && \ + pwd && \ + $(POETRY) run pytest -v --junit-xml=test-results.xml botcpdf/tests/ test-json: install-dev - @$(POETRY) run poetry run pytest -v botcpdf/tests/test_external_json.py + # for some reason -C doesn't work here + cd $(APP_DIR) && \ + pwd && \ + $(POETRY) run pytest -v botcpdf/tests/test_external_json.py # some quick helpers to (quickly) generate some pdfs script-tb: TARGET:="Trouble Brewing" @@ -47,7 +57,7 @@ script-cs: TARGET:="Clean Sweep" script-jinx: TARGET="Let's Test Some Jinxes" script-tb script-nrb script-gmv script-cs script-jinx: poetry - $(MAKE_PDF) scripts/$(TARGET).json + $(MAKE_PDF) ../../scripts/$(TARGET).json ifeq ($(shell uname),Darwin) @open -a Preview "pdfs/just-baked.pdf" endif @@ -101,7 +111,7 @@ release: fmt lint changelog @git push --tags fetch-combined-json: - @curl --silent --create-dirs -o data/imported/roles-combined.json https://raw.githubusercontent.com/chizmw/json-on-the-clocktower/main/data/generated/roles-combined.json + @curl --silent --create-dirs -o lambda-src/api-render-pdf/data/imported/roles-combined.json https://raw.githubusercontent.com/chizmw/json-on-the-clocktower/main/data/generated/roles-combined.json grab-some-scripts: # make certain we have a scripts directory diff --git a/bin/make-pdf b/bin/make-pdf index af0b993b..8455151e 100755 --- a/bin/make-pdf +++ b/bin/make-pdf @@ -1,2 +1,3 @@ #!/usr/bin/env bash +cd "$(dirname "$0")/../lambda-src/api-render-pdf" || exit 1 poetry run python -m botcpdf.cli make-pdf "$@" diff --git a/botcpdf/__init__.py b/lambda-src/api-render-pdf/README.md similarity index 100% rename from botcpdf/__init__.py rename to lambda-src/api-render-pdf/README.md diff --git a/data/imported/.gitkeep b/lambda-src/api-render-pdf/botcpdf/__init__.py similarity index 100% rename from data/imported/.gitkeep rename to lambda-src/api-render-pdf/botcpdf/__init__.py diff --git a/botcpdf/benchmark.py b/lambda-src/api-render-pdf/botcpdf/benchmark.py similarity index 100% rename from botcpdf/benchmark.py rename to lambda-src/api-render-pdf/botcpdf/benchmark.py diff --git a/botcpdf/cli.py b/lambda-src/api-render-pdf/botcpdf/cli.py similarity index 100% rename from botcpdf/cli.py rename to lambda-src/api-render-pdf/botcpdf/cli.py diff --git a/botcpdf/cli_make_many.py b/lambda-src/api-render-pdf/botcpdf/cli_make_many.py similarity index 100% rename from botcpdf/cli_make_many.py rename to lambda-src/api-render-pdf/botcpdf/cli_make_many.py diff --git a/botcpdf/jinx.py b/lambda-src/api-render-pdf/botcpdf/jinx.py similarity index 100% rename from botcpdf/jinx.py rename to lambda-src/api-render-pdf/botcpdf/jinx.py diff --git a/botcpdf/lambda.py b/lambda-src/api-render-pdf/botcpdf/lambda.py similarity index 100% rename from botcpdf/lambda.py rename to lambda-src/api-render-pdf/botcpdf/lambda.py diff --git a/botcpdf/main.py b/lambda-src/api-render-pdf/botcpdf/main.py similarity index 100% rename from botcpdf/main.py rename to lambda-src/api-render-pdf/botcpdf/main.py diff --git a/botcpdf/multipart.py b/lambda-src/api-render-pdf/botcpdf/multipart.py similarity index 100% rename from botcpdf/multipart.py rename to lambda-src/api-render-pdf/botcpdf/multipart.py diff --git a/botcpdf/optimise_pdf.py b/lambda-src/api-render-pdf/botcpdf/optimise_pdf.py similarity index 100% rename from botcpdf/optimise_pdf.py rename to lambda-src/api-render-pdf/botcpdf/optimise_pdf.py diff --git a/botcpdf/role.py b/lambda-src/api-render-pdf/botcpdf/role.py similarity index 100% rename from botcpdf/role.py rename to lambda-src/api-render-pdf/botcpdf/role.py diff --git a/botcpdf/roledata.py b/lambda-src/api-render-pdf/botcpdf/roledata.py similarity index 100% rename from botcpdf/roledata.py rename to lambda-src/api-render-pdf/botcpdf/roledata.py diff --git a/botcpdf/script.py b/lambda-src/api-render-pdf/botcpdf/script.py similarity index 100% rename from botcpdf/script.py rename to lambda-src/api-render-pdf/botcpdf/script.py diff --git a/botcpdf/script_options.py b/lambda-src/api-render-pdf/botcpdf/script_options.py similarity index 100% rename from botcpdf/script_options.py rename to lambda-src/api-render-pdf/botcpdf/script_options.py diff --git a/botcpdf/tests/test_external_json.py b/lambda-src/api-render-pdf/botcpdf/tests/test_external_json.py similarity index 100% rename from botcpdf/tests/test_external_json.py rename to lambda-src/api-render-pdf/botcpdf/tests/test_external_json.py diff --git a/botcpdf/tests/test_multipart.py b/lambda-src/api-render-pdf/botcpdf/tests/test_multipart.py similarity index 100% rename from botcpdf/tests/test_multipart.py rename to lambda-src/api-render-pdf/botcpdf/tests/test_multipart.py diff --git a/botcpdf/tests/test_script_options.py b/lambda-src/api-render-pdf/botcpdf/tests/test_script_options.py similarity index 100% rename from botcpdf/tests/test_script_options.py rename to lambda-src/api-render-pdf/botcpdf/tests/test_script_options.py diff --git a/botcpdf/util.py b/lambda-src/api-render-pdf/botcpdf/util.py similarity index 100% rename from botcpdf/util.py rename to lambda-src/api-render-pdf/botcpdf/util.py diff --git a/botcpdf/version.py b/lambda-src/api-render-pdf/botcpdf/version.py similarity index 100% rename from botcpdf/version.py rename to lambda-src/api-render-pdf/botcpdf/version.py diff --git a/lambda-src/api-render-pdf/data/imported/.gitkeep b/lambda-src/api-render-pdf/data/imported/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/data/imported/roles-combined.json b/lambda-src/api-render-pdf/data/imported/roles-combined.json similarity index 100% rename from data/imported/roles-combined.json rename to lambda-src/api-render-pdf/data/imported/roles-combined.json diff --git a/poetry.lock b/lambda-src/api-render-pdf/poetry.lock similarity index 100% rename from poetry.lock rename to lambda-src/api-render-pdf/poetry.lock diff --git a/pyproject.toml b/lambda-src/api-render-pdf/pyproject.toml similarity index 100% rename from pyproject.toml rename to lambda-src/api-render-pdf/pyproject.toml diff --git a/templates/full-fat-night-order.jinja b/lambda-src/api-render-pdf/templates/full-fat-night-order.jinja similarity index 100% rename from templates/full-fat-night-order.jinja rename to lambda-src/api-render-pdf/templates/full-fat-night-order.jinja diff --git a/templates/images/qrcode-arcane-scripts-4mpd96.png b/lambda-src/api-render-pdf/templates/images/qrcode-arcane-scripts-4mpd96.png similarity index 100% rename from templates/images/qrcode-arcane-scripts-4mpd96.png rename to lambda-src/api-render-pdf/templates/images/qrcode-arcane-scripts-4mpd96.png diff --git a/templates/night-extras.jinja b/lambda-src/api-render-pdf/templates/night-extras.jinja similarity index 100% rename from templates/night-extras.jinja rename to lambda-src/api-render-pdf/templates/night-extras.jinja diff --git a/templates/night-fabled.jinja b/lambda-src/api-render-pdf/templates/night-fabled.jinja similarity index 100% rename from templates/night-fabled.jinja rename to lambda-src/api-render-pdf/templates/night-fabled.jinja diff --git a/templates/night-jinx.jinja b/lambda-src/api-render-pdf/templates/night-jinx.jinja similarity index 100% rename from templates/night-jinx.jinja rename to lambda-src/api-render-pdf/templates/night-jinx.jinja diff --git a/templates/night-traveler.jinja b/lambda-src/api-render-pdf/templates/night-traveler.jinja similarity index 100% rename from templates/night-traveler.jinja rename to lambda-src/api-render-pdf/templates/night-traveler.jinja diff --git a/templates/options.jinja b/lambda-src/api-render-pdf/templates/options.jinja similarity index 100% rename from templates/options.jinja rename to lambda-src/api-render-pdf/templates/options.jinja diff --git a/templates/player-reference-back-or-nothing.jinja b/lambda-src/api-render-pdf/templates/player-reference-back-or-nothing.jinja similarity index 100% rename from templates/player-reference-back-or-nothing.jinja rename to lambda-src/api-render-pdf/templates/player-reference-back-or-nothing.jinja diff --git a/templates/player-reference-easyloop.jinja b/lambda-src/api-render-pdf/templates/player-reference-easyloop.jinja similarity index 100% rename from templates/player-reference-easyloop.jinja rename to lambda-src/api-render-pdf/templates/player-reference-easyloop.jinja diff --git a/templates/player-reference.jinja b/lambda-src/api-render-pdf/templates/player-reference.jinja similarity index 100% rename from templates/player-reference.jinja rename to lambda-src/api-render-pdf/templates/player-reference.jinja diff --git a/templates/script.jinja b/lambda-src/api-render-pdf/templates/script.jinja similarity index 100% rename from templates/script.jinja rename to lambda-src/api-render-pdf/templates/script.jinja diff --git a/templates/simple-night-order.jinja b/lambda-src/api-render-pdf/templates/simple-night-order.jinja similarity index 100% rename from templates/simple-night-order.jinja rename to lambda-src/api-render-pdf/templates/simple-night-order.jinja diff --git a/templates/style.css b/lambda-src/api-render-pdf/templates/style.css similarity index 100% rename from templates/style.css rename to lambda-src/api-render-pdf/templates/style.css diff --git a/serverless.yml b/serverless.yml deleted file mode 100644 index f4ebd31e..00000000 --- a/serverless.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -service: botc-custom-script-json2pdf - -provider: - name: aws - region: eu-west-2 - iam: - role: arn:aws:iam::436158765452:role/botc/deploy_json2pdf - ecr: - scanOnPush: true - images: - json2pdf: - path: ./ - file: Dockerfile - stackTags: - Name: botc-custom-script-json2pdf - Owner: chisel - Product: botc-custom-script-json2pdf - InfoURL: https://github.com/chizmw/botc-custom-script-json2pdf - environment: - BUCKET_NAME: 436158765452-botc-pdf-bucket-${self:custom.stage} - BOTC_DEBUG: 1 - BOTC2JSON_WEBHOOK_URL: ${self:custom.discord_webhook} - # Note: API Gateway has a maximum timeout of 30 seconds - timeout: 90 - logRetentionInDays: 7 - stage: ${self:custom.stage} - apiGateway: - shouldStartNameWithService: true - minimumCompressionSize: 1024 - binaryMediaTypes: - - application/pdf - memorySize: 3008 - tracing: - lambda: true - -plugins: - - serverless-docker - -functions: - render-pdf: - timeout: 90 - image: - name: json2pdf - -custom: - stage: ${opt:stage, 'dev'} - # yamllint disable-line rule:line-length - discord_webhook: ${ssm:/aws/reference/secretsmanager/pdf-api/discord-webhook-url/dev} diff --git a/terraform/_data.tf b/terraform/_data.tf index 66b91a50..c6c0a97c 100644 --- a/terraform/_data.tf +++ b/terraform/_data.tf @@ -1,3 +1,6 @@ +data "aws_caller_identity" "current" {} +data "aws_region" "current" {} + # the dummy file we used when working through the CORS api # https://mrponath.medium.com/terraform-and-aws-api-gateway-a137ee48a8ac @@ -9,34 +12,34 @@ data "archive_file" "lambda" { # this allows us to rely on existing information to specify the lambda function name # supporting serverless config options and terraform workspaces -data "aws_lambda_function" "api_render_pdf" { - provider = aws.default - function_name = "${var.sls_service_name}-${terraform.workspace}-${var.sls_function_name}" -} - -data "aws_lambda_function" "lambda_invalidate_cache" { - provider = aws.default - function_name = "invalidate-cache" -} - -data "aws_iam_role" "iam_for_lambda" { - provider = aws.default - name = "deploy_json2pdf" -} - - -data "aws_lambda_function" "invalidate_cache" { - provider = aws.default - function_name = "invalidate-cache" -} - -data "aws_api_gateway_rest_api" "json2pdf_api" { - provider = aws.default - name = local.pdf_api_name -} - -data "aws_api_gateway_resource" "json2pdf_resource" { - provider = aws.default - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - path = "/${local.pdf_render_path}" -} +#data "aws_lambda_function" "api_render_pdf" { +#provider = aws.default +#function_name = "${var.sls_service_name}-${terraform.workspace}-${var.sls_function_name}" +#} + +#data "aws_lambda_function" "lambda_invalidate_cache" { +#provider = aws.default +#function_name = "invalidate-cache" +#} + +#data "aws_iam_role" "iam_for_lambda" { +#provider = aws.default +#name = "deploy_json2pdf" +#} + + +#data "aws_lambda_function" "invalidate_cache" { +#provider = aws.default +#function_name = "invalidate-cache" +#} + +#data "aws_api_gateway_rest_api" "json2pdf_api" { +#provider = aws.default +#name = local.pdf_api_name +#} + +#data "aws_api_gateway_resource" "json2pdf_resource" { +#provider = aws.default +#rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id +#path = "/${local.pdf_render_path}" +#} diff --git a/terraform/_locals.tf b/terraform/_locals.tf index c3bf15ef..ed1e9ce7 100644 --- a/terraform/_locals.tf +++ b/terraform/_locals.tf @@ -1,3 +1,23 @@ +locals { + project_name = "arcane-scripts-api" + + aws_default_region = "eu-west-2" + + # we want a lookup of region to secrets lambda ARN + # https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_lambda.html#retrieving-secrets_lambda_ARNs + secrets_layer_arns = { + "eu-west-1" = "arn:aws:lambda:eu-west-1:015030872274:layer:AWS-Parameters-and-Secrets-Lambda-Extension:10" + "eu-west-2" = "arn:aws:lambda:eu-west-2:133256977650:layer:AWS-Parameters-and-Secrets-Lambda-Extension:10" + } + + # secret_layer_arn is the lookup for the current region, or a default message of "ARN Missing For Region" + secrets_layer_arn = lookup(local.secrets_layer_arns, data.aws_region.current.name, "ARN Missing For Region") +} + + + + +## ORIGINAL LOCALS - CLEANUP REQUIRED locals { tag_defaults = { @@ -10,8 +30,9 @@ locals { # wkspc_site_name is based on the workspace name; if it's 'prod' we use 'make', if it's 'dev' we use 'preview' wkspc_site_name = { - prod = "make" - dev = "beta" + prod = "make" + dev = "beta" + default = "alpha" } # get the lookup value from the wkspc_site_name map based on the workspace name diff --git a/terraform/_outputs.tf b/terraform/_outputs.tf index e530fcc7..97e657a9 100644 --- a/terraform/_outputs.tf +++ b/terraform/_outputs.tf @@ -10,16 +10,3 @@ output "commit_version" { output "project_dir" { value = data.external.useful_version_info.result.project_dir } - -output "stage_function_name" { - value = "${var.sls_service_name}-${terraform.workspace}-${var.sls_function_name}" -} - -output "stage_url" { - value = aws_api_gateway_deployment.deployment.invoke_url -} - - -output "www-a" { - value = aws_route53_record.wkspc_www-a.fqdn -} diff --git a/terraform/api-pdf.tf b/terraform/api-pdf.tf deleted file mode 100644 index 5852eac3..00000000 --- a/terraform/api-pdf.tf +++ /dev/null @@ -1,118 +0,0 @@ -# https://mrponath.medium.com/terraform-and-aws-api-gateway-a137ee48a8ac -# SETUP and "OPTIONS - - -# POST method - - -# a request validator is required for API Gateway to accept the request body - -# we can't crteate this nicely and use a data lookup, so we'll have to assume we've created this already, and just use the ID -# resource "aws_api_gateway_request_validator" "request_validator" { -# provider = aws.default -# name = "json2pdf_request_validator-core" -# rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id -# validate_request_body = true -# validate_request_parameters = false -# } -locals { - request_validator_id = "bsnt9c" -} - -resource "aws_api_gateway_method" "json2pdf_method" { - provider = aws.default - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - resource_id = data.aws_api_gateway_resource.json2pdf_resource.id - http_method = "POST" - authorization = "NONE" - api_key_required = true - request_validator_id = local.request_validator_id -} - -resource "aws_api_gateway_method_response" "json2pdf_method_response_200" { - provider = aws.default - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - resource_id = data.aws_api_gateway_resource.json2pdf_resource.id - http_method = aws_api_gateway_method.json2pdf_method.http_method - status_code = "200" - response_parameters = { - "method.response.header.Access-Control-Allow-Origin" = true - "method.response.header.Access-Control-Allow-Headers" = true - } - depends_on = [aws_api_gateway_method.json2pdf_method] -} - - - -resource "aws_api_gateway_integration" "integration" { - provider = aws.default - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - resource_id = data.aws_api_gateway_resource.json2pdf_resource.id - http_method = aws_api_gateway_method.json2pdf_method.http_method - integration_http_method = "POST" - type = "AWS_PROXY" - uri = "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:436158765452:function:$${stageVariables.lambda}/invocations" - depends_on = [aws_api_gateway_method.json2pdf_method, data.aws_lambda_function.api_render_pdf] -} - - -resource "aws_api_gateway_deployment" "deployment" { - provider = aws.default - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - stage_name = local.api_stage - - lifecycle { - create_before_destroy = true - } - - depends_on = [ - #data.aws_api_gateway_gateway_response.json2pdf_gateway_response, - aws_api_gateway_integration.integration, - #aws_api_gateway_integration.options_integration, - #aws_api_gateway_integration_response.options_integration_response, - data.external.useful_version_info, - ] - - triggers = { - redeployment = sha1(jsonencode([ - #data.aws_api_gateway_gateway_response.json2pdf_gateway_response.id, - #data.aws_api_gateway_gateway_response.json2pdf_gateway_response.response_templates, - aws_api_gateway_integration.integration.id, - aws_api_gateway_integration.integration.uri, - #aws_api_gateway_integration.options_integration.id, - #aws_api_gateway_integration_response.options_integration_response.id, - #aws_api_gateway_integration_response.options_integration_response.response_parameters, - #aws_api_gateway_integration_response.options_integration_response.response_templates, - #local.gatewayresponses, - data.external.useful_version_info.result - ])) - } - - variables = { - #"lambda_arn" = aws_lambda_function.lambda.arn - "lambda" = local.lambda_stage_function_name - "stage" = local.api_stage - } -} - -resource "aws_api_gateway_stage" "api_stage" { - stage_name = local.api_stage - rest_api_id = data.aws_api_gateway_rest_api.json2pdf_api.id - deployment_id = aws_api_gateway_deployment.deployment.id - xray_tracing_enabled = local.xray_tracingenabled - variables = { - "env" = local.api_stage - "stage" = local.api_stage - "lambda" = local.lambda_stage_function_name - #"lambda_arn" = aws_lambda_function.lambda.arn - "lambda_function" = data.aws_lambda_function.api_render_pdf.arn - } -} - -resource "aws_lambda_permission" "apigateway" { - statement_id = "AllowExecutionFromAPIGateway-${local.api_stage}-v3" - action = "lambda:InvokeFunction" - function_name = data.aws_lambda_function.api_render_pdf.function_name - principal = "apigateway.amazonaws.com" - source_arn = "${data.aws_api_gateway_rest_api.json2pdf_api.execution_arn}/*/*" -} diff --git a/terraform/get-useful-information.sh b/terraform/get-useful-information.sh index 078366ba..d438dd44 100755 --- a/terraform/get-useful-information.sh +++ b/terraform/get-useful-information.sh @@ -3,7 +3,7 @@ set -e commit_version="$(git describe --tags --always)" project_dir="$(basename "$(git rev-parse --show-toplevel)")" -poetry_version="$(poetry version --short)" +poetry_version="$(cd "../lambda-src/api-render-pdf/" && poetry version --short)" jq -n \ --arg commit_version "$commit_version" \ diff --git a/terraform/infra/_config.tf b/terraform/infra/_config.tf deleted file mode 100644 index 0ae76a54..00000000 --- a/terraform/infra/_config.tf +++ /dev/null @@ -1,25 +0,0 @@ -terraform { - backend "s3" { - bucket = "436158765452-terraform-state" - key = "states/chizography-botc-infra" - region = "eu-west-2" - } - - required_version = "~> 1.2" - - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.0" - } - } -} - -provider "aws" { - region = "eu-west-2" -} - -provider "aws" { - alias = "acm_provider" - region = "us-east-1" -} diff --git a/terraform/infra/_locals.tf b/terraform/infra/_locals.tf deleted file mode 100644 index 066066c0..00000000 --- a/terraform/infra/_locals.tf +++ /dev/null @@ -1 +0,0 @@ -locals {} diff --git a/terraform/infra/groups.tf b/terraform/infra/groups.tf deleted file mode 100644 index b1871120..00000000 --- a/terraform/infra/groups.tf +++ /dev/null @@ -1,5 +0,0 @@ -# create an IAM user group called BOTC_json2pdf which attaches an existing policy called AllowAssumeJson2PdfRole -resource "aws_iam_group" "group-botc_json2pdf" { - name = "BOTC_json2pdf" - path = "/botc/" -} diff --git a/terraform/infra/policy.tf b/terraform/infra/policy.tf deleted file mode 100644 index 80c53322..00000000 --- a/terraform/infra/policy.tf +++ /dev/null @@ -1,13 +0,0 @@ -# create an IAM policy called AllowAssumeJson2PdfRole -resource "aws_iam_policy" "policy-AllowAssumeJson2PdfRole" { - name = "AllowAssumeJson2PdfRole" - path = "/botc/" - description = "Allow Chizography Admin to assume the Json2Pdf role" - policy = data.aws_iam_policy_document.policydoc-AllowAssumeJson2PdfRole.json -} - -resource "aws_iam_policy" "policy-Deploy_FineGrainedExtras_policy" { - name = "AllowBOTCDeployExtras" - path = "/botc/" - policy = data.aws_iam_policy_document.policydoc-deploy_json2pdf_finegrained_extras.json -} diff --git a/terraform/infra/policy_attachment.tf b/terraform/infra/policy_attachment.tf deleted file mode 100644 index 76638cd0..00000000 --- a/terraform/infra/policy_attachment.tf +++ /dev/null @@ -1,19 +0,0 @@ -# attach the AllowAssumeJson2PdfRole policy to the BOTC_json2pdf group -resource "aws_iam_group_policy_attachment" "AllowAssumeJson2PdfRole" { - group = aws_iam_group.group-botc_json2pdf.name - policy_arn = aws_iam_policy.policy-AllowAssumeJson2PdfRole.arn -} - -/* no longer attaching this policy to the BOTC_json2pdf group - we'll attach it to the deploy_json2pdf role instead -resource "aws_iam_group_policy_attachment" "Deploy_FineGrainedExtras" { - group = aws_iam_group.group-botc_json2pdf.name - policy_arn = aws_iam_policy.policy-Deploy_FineGrainedExtras_policy.arn -} -*/ - -# attach Deploy_FineGrainedExtras_policy to the deploy_json2pdf role -resource "aws_iam_role_policy_attachment" "Deploy_FineGrainedExtras" { - role = aws_iam_role.role-deploy_json2pdf.name - policy_arn = aws_iam_policy.policy-Deploy_FineGrainedExtras_policy.arn -} diff --git a/terraform/infra/policy_document.tf b/terraform/infra/policy_document.tf deleted file mode 100644 index e42e9306..00000000 --- a/terraform/infra/policy_document.tf +++ /dev/null @@ -1,108 +0,0 @@ -# the policy data to use for the assume role policy -data "aws_iam_policy_document" "policydoc-trust_relationships_deploy_json2pdf" { - statement { - effect = "Allow" - principals { - type = "AWS" - identifiers = ["arn:aws:iam::436158765452:root"] - } - actions = ["sts:AssumeRole"] - } - - statement { - effect = "Allow" - principals { - type = "Service" - identifiers = ["lambda.amazonaws.com"] - } - actions = ["sts:AssumeRole"] - } -} - -# create a policy called deploy_json2pdf_finegrained_extras -data "aws_iam_policy_document" "policydoc-deploy_json2pdf_finegrained_extras" { - statement { - effect = "Allow" - actions = [ - "acm:AddTagsToCertificate", - "acm:DescribeCertificate", - "acm:ListTagsForCertificate", - "acm:RequestCertificate", - "cloudfront:CreateInvalidation", - "cloudfront:GetDistribution", - "cloudfront:ListTagsForResource", - "iam:CreatePolicy", - "iam:CreatePolicyVersion", - "iam:DeletePolicyVersion", - "iam:DetachRolePolicy", - "iam:GetGroup", - "iam:GetUser", - "iam:ListAttachedGroupPolicies", - "iam:ListGroupsForUser", - "iam:TagPolicy", - "kms:DescribeCustomKeyStores", - "kms:ListAliases", - "kms:ListKeys", - "route53:ChangeResourceRecordSets", - "route53:GetChange", - "route53:GetHostedZone", - "route53:ListHostedZones", - "route53:ListResourceRecordSets", - "route53:ListTagsForResource", - "s3:PutBucketAcl", - "s3:PutBucketPolicy", - ] - resources = ["*"] - } - - statement { - effect = "Allow" - actions = [ - "kms:GetParametersForImport", - "kms:GetPublicKey", - "kms:ListKeyPolicies", - "kms:ListRetirableGrants", - "kms:GetKeyRotationStatus", - "kms:GetKeyPolicy", - "kms:DescribeKey", - "kms:ListResourceTags", - "kms:ListGrants" - ] - resources = ["arn:aws:kms:*:436158765452:key/*"] - } -} - -data "aws_iam_policy_document" "policydoc-trust_relationships_apig_json2pdf" { - statement { - effect = "Allow" - principals { - type = "Service" - identifiers = ["apigateway.amazonaws.com"] - } - actions = ["sts:AssumeRole"] - } -} - -data "aws_iam_policy_document" "policydoc-trust_relationships_lambda_json2pdf" { - statement { - effect = "Allow" - principals { - type = "Service" - identifiers = ["lambda.amazonaws.com"] - } - actions = ["sts:AssumeRole"] - } -} - -data "aws_iam_policy_document" "policydoc-AllowAssumeJson2PdfRole" { - statement { - sid = "AllowAssumeJson2PdfRole" - effect = "Allow" - actions = [ - "sts:AssumeRole", - "sts:TagSession", - "sts:GetSessionToken" - ] - resources = [aws_iam_role.role-deploy_json2pdf.arn] - } -} diff --git a/terraform/infra/role.tf b/terraform/infra/role.tf deleted file mode 100644 index dee054ac..00000000 --- a/terraform/infra/role.tf +++ /dev/null @@ -1,37 +0,0 @@ - -# create an IAM role called deploy_json2pdf -resource "aws_iam_role" "role-deploy_json2pdf" { - name = "deploy_json2pdf" - description = "Allows Lambda functions to call AWS services on your behalf." - path = "/botc/" - managed_policy_arns = [ - "arn:aws:iam::aws:policy/AWSCloudFormationFullAccess", - "arn:aws:iam::aws:policy/AWSLambdaExecute", - "arn:aws:iam::aws:policy/AWSLambda_FullAccess", - "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess", - "arn:aws:iam::aws:policy/AmazonS3FullAccess", - ] - assume_role_policy = data.aws_iam_policy_document.policydoc-trust_relationships_deploy_json2pdf.json -} - -resource "aws_iam_role" "role-apig_json2pdf" { - name = "apig_json2pdf" - description = "Allows API Gateway to call AWS services on your behalf." - path = "/botc/" - managed_policy_arns = [ - "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess", - ] - assume_role_policy = data.aws_iam_policy_document.policydoc-trust_relationships_apig_json2pdf.json -} - - -resource "aws_iam_role" "roleXXXXXX-lambda_json2pdf" { - name = "lambda_json2pdf" - description = "Allows Lambda to call AWS services on your behalf." - path = "/botc/" - managed_policy_arns = [ - "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess", - "arn:aws:iam::aws:policy/AWSLambdaExecute", - ] - assume_role_policy = data.aws_iam_policy_document.policydoc-trust_relationships_lambda_json2pdf.json -} diff --git a/terraform/infra/users.tf b/terraform/infra/users.tf deleted file mode 100644 index ba3bc91f..00000000 --- a/terraform/infra/users.tf +++ /dev/null @@ -1,11 +0,0 @@ -# create an IAM user called botc.json2pdf -resource "aws_iam_user" "user-botc_json2pdf" { - name = "botc.json2pdf" - path = "/botc/" -} - -# add botc.json2pdf to the BOTC_json2pdf group -resource "aws_iam_user_group_membership" "BOTC_json2pdf" { - user = aws_iam_user.user-botc_json2pdf.name - groups = [aws_iam_group.group-botc_json2pdf.name] -} diff --git a/terraform/lambda_api-render-pdf.tf b/terraform/lambda_api-render-pdf.tf new file mode 100644 index 00000000..cd7a6921 --- /dev/null +++ b/terraform/lambda_api-render-pdf.tf @@ -0,0 +1,51 @@ +module "lambda_function_api-render_pdf" { + source = "terraform-aws-modules/lambda/aws" + + function_name = "${local.project_name}__render_handler" + description = "Manage the ${local.project_name} lambda function for /render endpoint" + handler = "lambda.handler" + runtime = "python3.11" + publish = true + timeout = 30 + + source_path = [ + { + path = "${path.module}/../lambda-src/api-render-pdf" + poetry_install = true + } + ] + + layers = [ + local.secrets_layer_arn, + ] + + attach_policy_json = true + policy_json = < { - match.addEventListener('change', (event) => { - /* find the .needsEasyPrint class elements */ - document.querySelectorAll('.needs-easyprint').forEach((dependant) => { - /* if the selected value is "EasyPrint" */ - if ( - event.target.value == 'easyprint' || - event.target.value == 'sample' - ) { - /* enable the element */ - dependant.disabled = false; - } else { - /* disable the element */ - dependant.disabled = true; - } - }); - }); - - /* do something sensible if we haven't got a value in localStorage */ - if (!localStorage.getItem('scriptFormat')) { - console.debug('✎ setting scriptFormat to sample'); - // set to "regular" by default; it's not what Chisel uses, but it's - // probably the least surprising - match.value = 'sample'; - - // selector and default value to choose - const defaults = { - '#scriptFormat': 'sample', - '#printFormat': 'doubleSided', - '#playerNightInfo': 'yes', - '#playerCount': 'sample', - }; - - // loop through the defaults and set them - for (const [selector, value] of Object.entries(defaults)) { - document.querySelector(selector).value = value; - // match the item, store the value in localStorage, and trigger a change event - let itemname = document.querySelector(selector).name; - localStorage.setItem(itemname, value); - document.querySelector(selector).dispatchEvent(new Event('change')); - } - } - }); - - /* set an event listener on each form element in the form id=customScript */ - document - .querySelectorAll('#customScript input, #customScript select') - .forEach((match) => { - console.debug('✎ setting event listener for ' + match.name); - - /* if we have a value in localStorage for this element */ - if (localStorage.getItem(match.name)) { - /* set the value of the element to the value in localStorage */ - match.value = localStorage.getItem(match.name); - /* log the change */ - console.debug( - '✅ setting ' + match.name + ' to ' + localStorage.getItem(match.name) - ); - } else { - /* say we didn't find a value in localStorage */ - console.debug('❌ no value found for ' + match.name); - } - - /* when the element changes ... */ - match.addEventListener('change', (event) => { - /* log the change */ - console.debug( - '✎ ' + event.target.name + ' changed to ' + event.target.value - ); - /* store the value in localStorage */ - localStorage.setItem(event.target.name, event.target.value); - }); - }); - console.info('⭐ arcane scripts loaded…'); -}); diff --git a/www/dropzone.css b/www/dropzone.css deleted file mode 100644 index 1114d658..00000000 --- a/www/dropzone.css +++ /dev/null @@ -1,480 +0,0 @@ -/* local copy of dropzone.css - modified to meet my desires - */ - -@-webkit-keyframes passing-through { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30%, - 70% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } - 100% { - opacity: 0; - -webkit-transform: translateY(-40px); - -moz-transform: translateY(-40px); - -ms-transform: translateY(-40px); - -o-transform: translateY(-40px); - transform: translateY(-40px); - } -} -@-moz-keyframes passing-through { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30%, - 70% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } - 100% { - opacity: 0; - -webkit-transform: translateY(-40px); - -moz-transform: translateY(-40px); - -ms-transform: translateY(-40px); - -o-transform: translateY(-40px); - transform: translateY(-40px); - } -} -@keyframes passing-through { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30%, - 70% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } - 100% { - opacity: 0; - -webkit-transform: translateY(-40px); - -moz-transform: translateY(-40px); - -ms-transform: translateY(-40px); - -o-transform: translateY(-40px); - transform: translateY(-40px); - } -} -@-webkit-keyframes slide-in { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } -} -@-moz-keyframes slide-in { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } -} -@keyframes slide-in { - 0% { - opacity: 0; - -webkit-transform: translateY(40px); - -moz-transform: translateY(40px); - -ms-transform: translateY(40px); - -o-transform: translateY(40px); - transform: translateY(40px); - } - 30% { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - -o-transform: translateY(0px); - transform: translateY(0px); - } -} -@-webkit-keyframes pulse { - 0% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } - 10% { - -webkit-transform: scale(1.1); - -moz-transform: scale(1.1); - -ms-transform: scale(1.1); - -o-transform: scale(1.1); - transform: scale(1.1); - } - 20% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } -} -@-moz-keyframes pulse { - 0% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } - 10% { - -webkit-transform: scale(1.1); - -moz-transform: scale(1.1); - -ms-transform: scale(1.1); - -o-transform: scale(1.1); - transform: scale(1.1); - } - 20% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } -} -@keyframes pulse { - 0% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } - 10% { - -webkit-transform: scale(1.1); - -moz-transform: scale(1.1); - -ms-transform: scale(1.1); - -o-transform: scale(1.1); - transform: scale(1.1); - } - 20% { - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } -} -.dropzone, -.dropzone * { - box-sizing: border-box; -} - -.dropzone { - min-height: 150px; - border: 2px solid rgba(0, 0, 0, 0.3); - background: white; - padding: 20px 20px; -} -.dropzone.dz-clickable { - cursor: pointer; -} -.dropzone.dz-clickable * { - cursor: default; -} -.dropzone.dz-clickable .dz-message, -.dropzone.dz-clickable .dz-message * { - cursor: pointer; -} -.dropzone.dz-started .dz-message { - display: none; -} -.dropzone.dz-drag-hover { - border-style: solid; -} -.dropzone.dz-drag-hover .dz-message { - opacity: 0.5; -} -.dropzone .dz-message { - text-align: center; - margin: 2em 0; -} -.dropzone .dz-message .dz-button { - background: none; - color: inherit; - border: none; - padding: 0; - font: inherit; - cursor: pointer; - outline: inherit; -} -.dropzone .dz-preview { - position: relative; - display: inline-block; - vertical-align: top; - margin: 16px; - min-height: 100px; -} -.dropzone .dz-preview:hover { - z-index: 1000; -} -.dropzone .dz-preview:hover .dz-details { - opacity: 1; -} -.dropzone .dz-preview.dz-file-preview .dz-image { - border-radius: 20px; - background: #999; - background: linear-gradient(to bottom, #eee, #ddd); -} -.dropzone .dz-preview.dz-file-preview .dz-details { - opacity: 1; -} -.dropzone .dz-preview.dz-image-preview { - background: white; -} -.dropzone .dz-preview.dz-image-preview .dz-details { - -webkit-transition: opacity 0.2s linear; - -moz-transition: opacity 0.2s linear; - -ms-transition: opacity 0.2s linear; - -o-transition: opacity 0.2s linear; - transition: opacity 0.2s linear; -} -.dropzone .dz-preview .dz-remove { - font-size: 14px; - text-align: center; - display: block; - cursor: pointer; - border: none; -} -.dropzone .dz-preview .dz-remove:hover { - text-decoration: underline; -} -.dropzone .dz-preview:hover .dz-details { - opacity: 1; -} -.dropzone .dz-preview .dz-details { - z-index: 20; - position: absolute; - top: 0; - left: 0; - opacity: 0; - font-size: 13px; - min-width: 100%; - max-width: 100%; - padding: 1em 1em; - text-align: center; - color: rgba(0, 0, 0, 0.9); - line-height: 150%; -} -.dropzone .dz-preview .dz-details .dz-size { - margin-bottom: 1em; - font-size: 12px; -} -.dropzone .dz-preview .dz-details .dz-filename { - white-space: nowrap; -} -.dropzone .dz-preview .dz-details .dz-filename:hover span { - border: 1px solid rgba(200, 200, 200, 0.8); - background-color: rgba(255, 255, 255, 0.8); -} -.dropzone .dz-preview .dz-details .dz-filename:not(:hover) { - overflow: hidden; - text-overflow: ellipsis; -} -.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span { - border: 1px solid transparent; -} -.dropzone .dz-preview .dz-details .dz-filename span, -.dropzone .dz-preview .dz-details .dz-size span { - background-color: rgba(255, 255, 255, 0.4); - padding: 0 0.4em; - border-radius: 3px; -} -.dropzone .dz-preview:hover .dz-image img { - -webkit-transform: scale(1.05, 1.05); - -moz-transform: scale(1.05, 1.05); - -ms-transform: scale(1.05, 1.05); - -o-transform: scale(1.05, 1.05); - transform: scale(1.05, 1.05); - -webkit-filter: blur(8px); - filter: blur(8px); -} -.dropzone .dz-preview .dz-image { - border-radius: 20px; - overflow: hidden; - width: 200px; - height: 80px; - position: relative; - display: block; - z-index: 10; -} -.dropzone .dz-preview .dz-image img { - display: block; -} -.dropzone .dz-preview.dz-success .dz-success-mark { - -webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); - -moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); - -ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); - -o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); - animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); -} -.dropzone .dz-preview.dz-error .dz-error-mark { - opacity: 1; - -webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); - -moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); - -ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); - -o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); - animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); -} -.dropzone .dz-preview .dz-success-mark, -.dropzone .dz-preview .dz-error-mark { - pointer-events: none; - opacity: 0; - z-index: 500; - position: absolute; - display: block; - top: 50%; - left: 50%; - margin-left: -27px; - margin-top: -27px; -} -.dropzone .dz-preview .dz-success-mark svg, -.dropzone .dz-preview .dz-error-mark svg { - display: block; - width: 54px; - height: 54px; -} -.dropzone .dz-preview.dz-processing .dz-progress { - opacity: 1; - -webkit-transition: all 0.2s linear; - -moz-transition: all 0.2s linear; - -ms-transition: all 0.2s linear; - -o-transition: all 0.2s linear; - transition: all 0.2s linear; -} -.dropzone .dz-preview.dz-complete .dz-progress { - opacity: 0; - -webkit-transition: opacity 0.4s ease-in; - -moz-transition: opacity 0.4s ease-in; - -ms-transition: opacity 0.4s ease-in; - -o-transition: opacity 0.4s ease-in; - transition: opacity 0.4s ease-in; -} -.dropzone .dz-preview:not(.dz-processing) .dz-progress { - -webkit-animation: pulse 6s ease infinite; - -moz-animation: pulse 6s ease infinite; - -ms-animation: pulse 6s ease infinite; - -o-animation: pulse 6s ease infinite; - animation: pulse 6s ease infinite; -} -.dropzone .dz-preview .dz-progress { - opacity: 1; - z-index: 1000; - pointer-events: none; - position: absolute; - height: 16px; - left: 50%; - top: 50%; - margin-top: -8px; - width: 80px; - margin-left: -40px; - background: rgba(255, 255, 255, 0.9); - -webkit-transform: scale(1); - border-radius: 8px; - overflow: hidden; -} -.dropzone .dz-preview .dz-progress .dz-upload { - background: #333; - background: linear-gradient(to bottom, #666, #444); - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 0; - -webkit-transition: width 300ms ease-in-out; - -moz-transition: width 300ms ease-in-out; - -ms-transition: width 300ms ease-in-out; - -o-transition: width 300ms ease-in-out; - transition: width 300ms ease-in-out; -} -.dropzone .dz-preview.dz-error .dz-error-message { - display: block; -} -.dropzone .dz-preview.dz-error:hover .dz-error-message { - opacity: 1; - pointer-events: auto; -} -.dropzone .dz-preview .dz-error-message { - pointer-events: none; - z-index: 1000; - position: absolute; - display: block; - display: none; - opacity: 0; - -webkit-transition: opacity 0.3s ease; - -moz-transition: opacity 0.3s ease; - -ms-transition: opacity 0.3s ease; - -o-transition: opacity 0.3s ease; - transition: opacity 0.3s ease; - border-radius: 8px; - font-size: 13px; - top: 130px; - left: -10px; - width: 140px; - background: #be2626; - background: linear-gradient(to bottom, #be2626, #a92222); - padding: 0.5em 1.2em; - color: white; -} -.dropzone .dz-preview .dz-error-message:after { - content: ''; - position: absolute; - top: -6px; - left: 64px; - width: 0; - height: 0; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #be2626; -} diff --git a/www/favicon/about.txt b/www/favicon/about.txt deleted file mode 100644 index 106c948d..00000000 --- a/www/favicon/about.txt +++ /dev/null @@ -1,6 +0,0 @@ -This favicon was generated using the following graphics from Twitter Twemoji: - -- Graphics Title: 1f4c4.svg -- Graphics Author: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji) -- Graphics Source: https://github.com/twitter/twemoji/blob/master/assets/svg/1f4c4.svg -- Graphics License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/) diff --git a/www/favicon/android-chrome-192x192.png b/www/favicon/android-chrome-192x192.png deleted file mode 100644 index 005c07a4..00000000 Binary files a/www/favicon/android-chrome-192x192.png and /dev/null differ diff --git a/www/favicon/android-chrome-512x512.png b/www/favicon/android-chrome-512x512.png deleted file mode 100644 index bfdab658..00000000 Binary files a/www/favicon/android-chrome-512x512.png and /dev/null differ diff --git a/www/favicon/apple-touch-icon.png b/www/favicon/apple-touch-icon.png deleted file mode 100644 index d78e6480..00000000 Binary files a/www/favicon/apple-touch-icon.png and /dev/null differ diff --git a/www/favicon/favicon-16x16.png b/www/favicon/favicon-16x16.png deleted file mode 100644 index 2f0731c0..00000000 Binary files a/www/favicon/favicon-16x16.png and /dev/null differ diff --git a/www/favicon/favicon-32x32.png b/www/favicon/favicon-32x32.png deleted file mode 100644 index 45393983..00000000 Binary files a/www/favicon/favicon-32x32.png and /dev/null differ diff --git a/www/favicon/favicon.ico b/www/favicon/favicon.ico deleted file mode 100644 index d36f4cf2..00000000 Binary files a/www/favicon/favicon.ico and /dev/null differ diff --git a/www/favicon/site.webmanifest b/www/favicon/site.webmanifest deleted file mode 100644 index 8cf97482..00000000 --- a/www/favicon/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/favicon/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/favicon/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/www/images/background.png b/www/images/background.png deleted file mode 100644 index 1698bdf3..00000000 Binary files a/www/images/background.png and /dev/null differ diff --git a/www/images/download.png b/www/images/download.png deleted file mode 100644 index b486c532..00000000 Binary files a/www/images/download.png and /dev/null differ diff --git a/www/images/infobutton.png b/www/images/infobutton.png deleted file mode 100644 index bb7428e4..00000000 Binary files a/www/images/infobutton.png and /dev/null differ diff --git a/www/images/storyteller.png b/www/images/storyteller.png deleted file mode 100644 index 68aa9475..00000000 Binary files a/www/images/storyteller.png and /dev/null differ diff --git a/www/index.html b/www/index.html deleted file mode 100644 index 71796a72..00000000 --- a/www/index.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - - - - Arcane Scripts - - - - - - -
-
- -
-
-
- Storyteller -
- Drag your - custom script - json file here to upload it to the server. After a few seconds you - should receive the generated PDF. -
-
-
-
-
-
-
- Script Options - -
-
Paper size:
- - info -
- -
-
Night Info:
- - info -
- -
-
Format:
- - info -
- -
-
Print Format:
- - info -
- -
-
Players see Night Info:
- - info -
- -
-
Player Count:
- - info -
-
-
-
- Drop files here or click to upload.
- Choose your options above before uploading.
- Uploads are immediately processed.
-
-
-
-
- - -
-
- - - - - - diff --git a/www/script.js b/www/script.js deleted file mode 100644 index 0f9ba106..00000000 --- a/www/script.js +++ /dev/null @@ -1,69 +0,0 @@ -const API_KEY = 'plTBNe7lT95DmuPMyBm2w8bK4cMbwIQk4ci547Kc'; - -Dropzone.options.customScript = { - url: API_GATEWAY_URL + '/render', - previewTemplate: document.querySelector('#preview-template').innerHTML, - parallelUploads: 2, - thumbnailHeight: 120, - thumbnailWidth: 120, - maxFilesize: 5, - filesizeBase: 1000, - uploadMultiple: false, - acceptedFiles: 'application/json', - headers: { - 'Content-Type': 'application/json', - 'access-control-allow-origin': '*', - 'x-api-key': API_KEY, - }, - - thumbnail: function (file, dataUrl) { - if (file.previewElement) { - file.previewElement.classList.remove('dz-file-preview'); - const images = file.previewElement.querySelectorAll( - '[data-dz-thumbnail]' - ); - for (const element of images) { - let thumbnailElement = element; - thumbnailElement.alt = file.name; - thumbnailElement.src = dataUrl; - } - setTimeout(function () { - file.previewElement.classList.add('dz-image-preview'); - }, 1); - } - }, - //}); - // - init: function () { - this.on('success', (file) => { - const obj = JSON.parse(file.xhr.response); - console.log(obj); - window.location.href = obj.url; - // find span data-dz-name and replace with obj.url - const span = file.previewElement.querySelector('[data-dz-name]'); - span.innerHTML = - '' + obj.script_name + ''; - // hide .dz-size - const dzsize = file.previewElement.querySelector('.dz-size'); - dzsize.innerHTML = - ''; - }); - - this.on('error', (file, message, xhr) => { - console.error(message); - if (file.previewElement) { - file.previewElement.classList.add('dz-error'); - const dzerror = file.previewElement.querySelector('.dz-error-message'); - if (typeof message !== 'string' && message.error) { - message = message.error; - dzerror.style.opacity = 1; - } - for (let node of file.previewElement.querySelectorAll( - '[data-dz-errormessage]' - )) { - node.textContent = message; - } - } - }); - }, -}; diff --git a/www/styled.html b/www/styled.html deleted file mode 100644 index 6650e31b..00000000 --- a/www/styled.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - Simple Elegant Webpage - - - - -
-
-

Article Title

-

- Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium, - asperiores at autem consectetur culpa cumque debitis, delectus - dignissimos dolore doloremque eveniet excepturi exercitationem fugiat, - id ipsam iure labore nesciunt nihil non nulla odio officia placeat - quas quasi, quibusdam repellat sapiente ullam vero. Commodi cum - doloremque enim, eos explicabo fugit impedit incidunt iusto, libero - minima molestiae nobis non odit perferendis quas quod repellat - suscipit, ullam voluptate voluptatibus. Aliquam animi aperiam - aspernatur at aut cumque, delectus deleniti dolore ea eos error eum - exercitationem, explicabo fugiat illum in incidunt iusto maiores nemo - neque non odit optio perferendis praesentium quae quam quas quia - quidem quo rem repudiandae saepe tempore tenetur totam ullam ut - veritatis, vitae voluptates. Dolore, odit. -

-
- -
Drop files here
- - - - diff --git a/www/styles.css b/www/styles.css deleted file mode 100644 index 41d64ab3..00000000 --- a/www/styles.css +++ /dev/null @@ -1,203 +0,0 @@ -/* General */ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Fira Sans', sans-serif; - line-height: 1.6; - background-color: #0b1317; - color: #333; - padding: 20px; - text-rendering: optimizeLegibility; -} - -/* Headings */ -h1, -h2, -h3, -h4, -h5, -h6 { - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - font-weight: bold; -} - -h1 { - font-size: 2.2em; - margin-bottom: 20px; -} - -/* Links */ -a { - color: #1c87c9; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -/* Containers */ -.container { - max-width: 800px; - margin: 0 auto; -} - -/* Navigation */ -div .nav { - background-color: #333; - padding: 5px; -} - -div .nav ul { - list-style-type: none; -} - -div .nav ul li { - display: inline; - margin-right: 10px; -} - -div .nav ul li a { - color: #fff; - font-size: 0.9em; -} - -/* Main Content */ -div .article { - padding: 20px; - background-color: #fff; - border-radius: 5px; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); - margin-bottom: 20px; - display: flex; - flex-direction: row; -} - -div .article img { - max-width: 100%; - height: auto; -} - -div .article p { - margin-bottom: 10px; -} - -div .article div { - margin-left: 20px; -} - -/* Footer */ -footer { - text-align: center; - margin-top: 20px; -} - -.dropzone { - background: white; - border-radius: 5px; - border: 2px dashed rgb(0, 135, 247); - border-image: none; - min-width: 210px; - max-width: 520px; - margin-left: auto; - margin-right: auto; -} - -.dropzone:hover { - border: 4px dashed rgb(0, 135, 247); - background-color: #e0e0e0; -} - -.float-left { - float: left; -} - -.leadin-image { - width: 100px; - height: auto; - background-color: #fff; - border-radius: 5px; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); - margin-bottom: 20px; -} - -.background-container { - background-color: #3a6b3a; /* Set your desired background color here */ -} - -.background-image { - background-image: url('images/background.png'); - background-size: 100% auto; /* Scale the image to 100% width and auto height */ - - background-position: top; - /* Adjust the following properties as needed */ - background-repeat: no-repeat; - height: 100vh; /* Set the height of the background div */ - width: 100%; /* Set the width of the background div */ -} - -.footer { - position: center bottom; - right: 0; - bottom: 0; - left: 0; - padding: 5px; - background-color: #efefef; - text-align: center; - font-size: small; -} - -@media (max-width: 768px) { - .background-image { - background-position: center bottom; - background-size: 100%; - } -} - -div.ul-options { - font-size: smaller; - border-width: 0.5px; - border-style: dashed; - border-color: #333; - padding: 3px; - background-color: lightslategray; - color: white; -} - -div.script-option > div { - font-weight: 700; - color: white; - padding-left: 6px; -} - -div.script-option > select { - margin-left: 15px; - width: 100%; - min-width: 15ch; - max-width: 30ch; - border: 1px solid var(--select-border); - border-radius: 0.25em; - padding: 0.25em 0.5em; - cursor: pointer; - background-color: #fff; - background-image: linear-gradient(to top, #f9f9f9, #fff 33%); - margin-bottom: 5px; -} - -.select--disabled { - cursor: not-allowed; - background-color: #eee; - background-image: linear-gradient(to top, #ddd, #eee 33%); -} - -#customScript > div.ul-options > details > div.script-option > img { - width: 20px; - height: 20px; - margin-left: 10px; - margin-right: 10px; - vertical-align: middle; -}