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
source venv/bin/activate
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
```

View File

@@ -82,7 +82,7 @@ def d2_running() -> bool:
try:
if proc.cmdline()[0].endswith("D2R.exe"):
return True
except (IndexError, psutil.AccessDenied):
except (IndexError, psutil.AccessDenied, psutil.ZombieProcess):
pass
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">
<title>Shared Stash</title>
<link rel="stylesheet" href="/static/style.css" />
<script src="/static/helpers.js"></script>
<head>
<body>
<form action="/stash/{{stash_name}}/store" method="POST">
{% for tab in stash.tabs %}
{% set tabloop = loop %}
<h2>Tab {{tabloop.index}}</h2>
<div class="stash-tab">
<h2>Tab {{tabloop.index}} <button type="button" onclick="toggleSelectAll({{tabloop.index}})">Select All</button> </h2>
<div class="stash-tab" data-tab="{{tabloop.index}}">
{% for item in tab.items %}
{% set itemloop = loop %}
{% include "item.html" %}

View File

@@ -62,7 +62,7 @@ decode_tree = decodetree(code)
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))
return text, length