Compare commits

...

4 Commits

5 changed files with 34 additions and 5 deletions

View File

@@ -1,8 +1,23 @@
Quick & dirty commit of current progress to share with others. # Installation
Don't.
# Development installation
Create a virtual environment and install the development set:
``` ```
python -m venv venv python -m venv venv
source venv/bin/activate source venv/bin/activate
pip install --editable .[dev] pip install --editable .[dev]
```
Set your save path and run the webserver to interact with the storage system:
```
export D2SAVE_PATH="/path/to/saves"
flask --app d2warehouse.app run
```
Some debug tooling:
```
d2dump /path/to/stash.d2i d2dump /path/to/stash.d2i
``` ```

View File

@@ -82,7 +82,7 @@ def d2_running() -> bool:
try: try:
if proc.cmdline()[0].endswith("D2R.exe"): if proc.cmdline()[0].endswith("D2R.exe"):
return True return True
except (IndexError, psutil.AccessDenied): except (IndexError, psutil.AccessDenied, psutil.ZombieProcess):
pass pass
return False return False

View File

@@ -0,0 +1,13 @@
function toggleSelectAll(tabIndex) {
const tab = document.querySelector(`[data-tab="${tabIndex}"]`);
const checkboxes = tab.querySelectorAll('input[type="checkbox"]');
if (checkboxes.length === 0)
return;
const allSelected = Array.from(checkboxes).every(cb => cb.checked);
checkboxes.forEach(cb => {
cb.checked = !allSelected;
});
}

View File

@@ -4,13 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Shared Stash</title> <title>Shared Stash</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<script src="/static/helpers.js"></script>
<head> <head>
<body> <body>
<form action="/stash/{{stash_name}}/store" method="POST"> <form action="/stash/{{stash_name}}/store" method="POST">
{% for tab in stash.tabs %} {% for tab in stash.tabs %}
{% set tabloop = loop %} {% set tabloop = loop %}
<h2>Tab {{tabloop.index}}</h2> <h2>Tab {{tabloop.index}} <button type="button" onclick="toggleSelectAll({{tabloop.index}})">Select All</button> </h2>
<div class="stash-tab"> <div class="stash-tab" data-tab="{{tabloop.index}}">
{% for item in tab.items %} {% for item in tab.items %}
{% set itemloop = loop %} {% set itemloop = loop %}
{% include "item.html" %} {% include "item.html" %}

View File

@@ -62,7 +62,7 @@ decode_tree = decodetree(code)
def decode(bits: bitarray, n) -> tuple[str, int]: def decode(bits: bitarray, n) -> tuple[str, int]:
text = "".join(itertools.islice(bits.iterdecode(decode_tree), n)) text = "".join(itertools.islice(bits.decode(decode_tree), n))
length = len(encode(text)) length = len(encode(text))
return text, length return text, length