Compare commits
No commits in common. "master" and "d9b9e10d56161ad14868627e1f2ad51efb913610" have entirely different histories.
master
...
d9b9e10d56
@ -1,4 +0,0 @@
|
|||||||
.git/
|
|
||||||
db-importer/
|
|
||||||
# poetry
|
|
||||||
poetry.lock
|
|
144
.gitignore
vendored
144
.gitignore
vendored
@ -1,144 +0,0 @@
|
|||||||
#### joe made this: http://goel.io/joe
|
|
||||||
|
|
||||||
#### python ####
|
|
||||||
# Byte-compiled / optimized / DLL files
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
MANIFEST
|
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
# Usually these files are written by a python script from a template
|
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.nox/
|
|
||||||
.coverage
|
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
*.py,cover
|
|
||||||
.hypothesis/
|
|
||||||
.pytest_cache/
|
|
||||||
cover/
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
*.mo
|
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
*.log
|
|
||||||
local_settings.py
|
|
||||||
db.sqlite3
|
|
||||||
db.sqlite3-journal
|
|
||||||
|
|
||||||
# Flask stuff:
|
|
||||||
instance/
|
|
||||||
.webassets-cache
|
|
||||||
|
|
||||||
# Scrapy stuff:
|
|
||||||
.scrapy
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
.pybuilder/
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
# For a library or package, you might want to ignore these files since the code is
|
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
|
||||||
# .python-version
|
|
||||||
|
|
||||||
# pipenv
|
|
||||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
||||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
||||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
||||||
# install all needed dependencies.
|
|
||||||
#Pipfile.lock
|
|
||||||
|
|
||||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
||||||
__pypackages__/
|
|
||||||
|
|
||||||
# Celery stuff
|
|
||||||
celerybeat-schedule
|
|
||||||
celerybeat.pid
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Spyder project settings
|
|
||||||
.spyderproject
|
|
||||||
.spyproject
|
|
||||||
|
|
||||||
# Rope project settings
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
.dmypy.json
|
|
||||||
dmypy.json
|
|
||||||
|
|
||||||
# Pyre type checker
|
|
||||||
.pyre/
|
|
||||||
|
|
||||||
# pytype static type analyzer
|
|
||||||
.pytype/
|
|
||||||
|
|
||||||
# Cython debug symbols
|
|
||||||
cython_debug/
|
|
||||||
|
|
||||||
# poetry
|
|
||||||
poetry.lock
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "db-importer/vendor/foundry-vtt---pathfinder-2e"]
|
[submodule "db-importer/foundry-vtt---pathfinder-2e"]
|
||||||
path = db-importer/vendor/foundry-vtt---pathfinder-2e
|
path = db-importer/foundry-vtt---pathfinder-2e
|
||||||
url = https://gitlab.com/hooking/foundry-vtt---pathfinder-2e.git
|
url = https://gitlab.com/hooking/foundry-vtt---pathfinder-2e.git
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 2,
|
|
||||||
"dockerfilePath": "./db_explorer/Dockerfile"
|
|
||||||
}
|
|
@ -28,15 +28,11 @@ def main():
|
|||||||
if obj_type not in collections:
|
if obj_type not in collections:
|
||||||
collections[obj_type] = []
|
collections[obj_type] = []
|
||||||
collections[obj_type].append(obj)
|
collections[obj_type].append(obj)
|
||||||
# print("Inserting all data")
|
print("Inserting all data")
|
||||||
# mongo[DB][COLLECTION].insert_many(items)
|
mongo[DB][COLLECTION].insert_many(items)
|
||||||
with mongo.start_session() as s:
|
for collection in collections:
|
||||||
s.start_transaction()
|
print(f"Inserting collection: {collection}")
|
||||||
mongo.drop_database(DB)
|
mongo[DB][collection].insert_many(collections[collection])
|
||||||
for collection in collections:
|
|
||||||
print(f"Inserting collection: {collection}")
|
|
||||||
mongo[DB][collection].insert_many(collections[collection])
|
|
||||||
s.commit_transaction()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 7d3b5dbb4541cbe1d7df15bb36283057533adb50
|
|
@ -1,16 +0,0 @@
|
|||||||
FROM python:3
|
|
||||||
|
|
||||||
RUN python3 -m pip install poetry
|
|
||||||
|
|
||||||
EXPOSE 5000
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY db_explorer/pyproject.toml /app/
|
|
||||||
|
|
||||||
RUN poetry update
|
|
||||||
RUN poetry run pip install setuptools
|
|
||||||
|
|
||||||
COPY db_explorer/ /app/
|
|
||||||
|
|
||||||
ENTRYPOINT [ "poetry", "run" ]
|
|
||||||
CMD [ "gunicorn", "-b=0.0.0.0:5000", "db_explorer:app" ]
|
|
@ -1 +0,0 @@
|
|||||||
from db_explorer.app import app
|
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
import json
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -11,32 +10,16 @@ app = Flask(__name__)
|
|||||||
app.config["MONGO_URI"] = os.environ["MONGO_URI"]
|
app.config["MONGO_URI"] = os.environ["MONGO_URI"]
|
||||||
mongo = PyMongo(app)
|
mongo = PyMongo(app)
|
||||||
|
|
||||||
LOCALIZATION_JSON = {}
|
|
||||||
with open("./db_explorer/en.json") as f:
|
|
||||||
LOCALIZATION_JSON = json.load(f)
|
|
||||||
|
|
||||||
@app.template_filter('filter_vtt')
|
@app.template_filter('filter_vtt')
|
||||||
def filter_vtt(text):
|
def filter_vtt(text):
|
||||||
compendium_re = re.compile(r"@Compendium\[(?P<ref>[^\]]+)\]\{(?P<value>[^\}]+)\}")
|
compendium_re = re.compile(r"@Compendium\[([^\]]+)\]\{([^\}]+)\}")
|
||||||
def compendium_return(m):
|
def compendium_return(m):
|
||||||
# TODO: Actually add links
|
return f"<a>{m.group(2)}</a>"
|
||||||
return f"<a>{m.group('value')}</a>"
|
macro_re = re.compile(r"\[\[\/\S?r\s(?:(?P<sdice>[^\{\] ]+)[^\{\]]*|(?:\{(?P<ldice>[^\}]+)\}\[[^\]]+\])?)\]\](?:\{(?P<alt>[^\}]+)\})?")
|
||||||
macro_re = re.compile(r"\[\[\/\S*?r(?:oll)?\s(?:(?P<sdice>[^\{\] ]+)[^\{\]]*|(?:\{(?P<ldice>[^\}]+)\}\[[^\]]+\])?)\]\](?:\{(?P<alt>[^\}]+)\})?")
|
|
||||||
def macro_return(m):
|
def macro_return(m):
|
||||||
if m.group('alt') is not None:
|
if m.group('alt') is not None:
|
||||||
return m.group('alt')
|
return m.group('alt')
|
||||||
return m.group('sdice')
|
return m.group('sdice')
|
||||||
localize_re = re.compile(r"@Localize\[([^\]]+)\]")
|
|
||||||
def localize_return(m):
|
|
||||||
path = m.group(1)
|
|
||||||
output = LOCALIZATION_JSON
|
|
||||||
for chunk in path.split('.'):
|
|
||||||
output = output.get(chunk, {})
|
|
||||||
if type(output) != str:
|
|
||||||
output = f"[LOCALIZATION LOOKUP ERROR - {m.group(0)}]"
|
|
||||||
return output
|
|
||||||
# Template
|
|
||||||
text = localize_re.sub(localize_return, text) # Has to be run before Compendium and Macro replacement
|
|
||||||
text = compendium_re.sub(compendium_return, text)
|
text = compendium_re.sub(compendium_return, text)
|
||||||
text = macro_re.sub(macro_return, text)
|
text = macro_re.sub(macro_return, text)
|
||||||
return text
|
return text
|
||||||
@ -54,7 +37,7 @@ def list_actions():
|
|||||||
@app.route("/action/<name>")
|
@app.route("/action/<name>")
|
||||||
def show_action(name):
|
def show_action(name):
|
||||||
item = mongo.db.action.find_one_or_404({"name": name})
|
item = mongo.db.action.find_one_or_404({"name": name})
|
||||||
# Actions
|
print(item)
|
||||||
if item["data"]["actions"]["value"] == None:
|
if item["data"]["actions"]["value"] == None:
|
||||||
if item["data"]["actionType"]["value"] == 'passive':
|
if item["data"]["actionType"]["value"] == 'passive':
|
||||||
item['_action_icon'] = None
|
item['_action_icon'] = None
|
||||||
@ -68,13 +51,7 @@ def show_action(name):
|
|||||||
item['_action_icon'] = item["data"]["actions"]["value"]
|
item['_action_icon'] = item["data"]["actions"]["value"]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Unknown action: {item["data"]["actionType"]["value"]} - {item["data"]["actions"]["value"]}')
|
raise ValueError(f'Unknown action: {item["data"]["actionType"]["value"]} - {item["data"]["actions"]["value"]}')
|
||||||
# Traits
|
|
||||||
_traits = item.get("data", {}).get("traits", {})
|
|
||||||
item["_all_traits"] = []
|
|
||||||
item["_all_traits"].append(_traits.get("rarity", {}).get("value", "unkown rarity"))
|
|
||||||
item["_all_traits"] += _traits.get("value", [])
|
|
||||||
item["_all_traits"] += _traits.get("custom").split(',')
|
|
||||||
item["_all_traits"] = list(filter(lambda x: x != '', item["_all_traits"]))
|
|
||||||
return render_template("action.html", action=item)
|
return render_template("action.html", action=item)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,3 @@
|
|||||||
body {
|
|
||||||
background: #efece9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-icon {
|
.action-icon {
|
||||||
height: 26px;
|
height: 26px;
|
||||||
@ -11,20 +8,3 @@ body {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.traits {
|
|
||||||
padding-left: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
li.trait {
|
|
||||||
display: inline;
|
|
||||||
font-size: 0.9em;
|
|
||||||
font-variant: small-caps;
|
|
||||||
color: #fefefe;
|
|
||||||
background-color: #5e0000;
|
|
||||||
border-color: #d8ce83;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 2px;
|
|
||||||
padding: 0.1em 0.25em;
|
|
||||||
margin: 0 0;
|
|
||||||
}
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% block head %}
|
{% block head %}
|
||||||
<title>{% block title %}PF2 DB{% endblock %}</title>
|
<title>{% block title %}PF2 DB{% endblock %}</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/base.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/base.css') }}"
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
{% block title %}{{action.name}} - PF2 DB{% endblock %}
|
{% block title %}{{action.name}} - PF2 DB{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>{{action["name"]}}{{c.actions[action["_action_icon"]]|safe}}</h1>
|
<h1>{{action["name"]}}{{c.actions[action["_action_icon"]]|safe}}</h1>
|
||||||
<ul class="traits">
|
<p>{{action["data"]["description"]["value"]|filter_vtt|safe}}</p>
|
||||||
{%- for trait in action["_all_traits"] -%}
|
|
||||||
<li class="trait">{{trait|capitalize}}</li>
|
|
||||||
{%- endfor -%}
|
|
||||||
</ul>
|
|
||||||
{{action["data"]["description"]["value"]|filter_vtt|safe}}
|
|
||||||
<p class="sourcebook">{{action["data"]["source"]["value"]}}</p>
|
<p class="sourcebook">{{action["data"]["source"]["value"]}}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -10,7 +10,6 @@ packages = [{include = "db_explorer"}]
|
|||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
Flask = "^2.0.2"
|
Flask = "^2.0.2"
|
||||||
Flask-PyMongo = "^2.3.0"
|
Flask-PyMongo = "^2.3.0"
|
||||||
gunicorn = "^20.1.0"
|
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
|
Loading…
Reference in New Issue
Block a user