Skip to content

Commit

Permalink
Merge branch 'release/2022.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein committed Jun 18, 2022
2 parents 4ab53e6 + f3d3e65 commit bc00cd3
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 24 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ tech changes will usually be stripped from release notes for the public

## Unreleased

## [2022.2.2] - 2022-06-17

### Changed

- [tech] Use WAL mode for database

### Fixed

- Auras giving light when light source is turned off
- Ghost initiative entries showing up as ? that cannot be removed
- Database lock errors while importing during load
- [server] Server not being able to start due to ModuleNotFoundError

## [2022.2.1] - 2022-06-13

This hides the export/import behind a server config option as I found an important underlying concurrency problem,
Expand Down
2 changes: 1 addition & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "2022.2.0",
"version": "2022.2.2",
"private": true,
"scripts": {
"dev": "vite",
Expand Down
14 changes: 7 additions & 7 deletions client/src/game/systems/auras/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ class AuraSystem implements System {

Object.assign(aura, delta);

if (oldAuraActive) {
if (!aura.active || (oldAuraVisionSource && !aura.visionSource)) {
visionState.removeVisionSource(shape.floor.id, aura.uuid);
} else if (!oldAuraVisionSource && aura.visionSource) {
visionState.addVisionSource({ aura: aura.uuid, shape: id }, shape.floor.id);
}
} else if (!oldAuraActive && aura.active) {
if (oldAuraVisionSource && !aura.visionSource && aura.active) {
visionState.removeVisionSource(shape.floor.id, aura.uuid);
} else if (!oldAuraVisionSource && aura.visionSource && aura.active) {
visionState.addVisionSource({ aura: aura.uuid, shape: id }, shape.floor.id);
} else if (oldAuraActive && !aura.active && aura.visionSource) {
visionState.removeVisionSource(shape.floor.id, aura.uuid);
} else if (!oldAuraActive && aura.active && aura.visionSource) {
visionState.addVisionSource({ aura: aura.uuid, shape: id }, shape.floor.id);
}

Expand Down
7 changes: 6 additions & 1 deletion client/src/game/ui/initiative/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ class InitiativeStore extends Store<InitiativeState> {
}

setData(data: InitiativeSettings): void {
const initiativeData = data.data.map((d) => ({ ...d, shape: getLocalId(d.shape)! }));
const initiativeData: InitiativeData<LocalId>[] = [];
for (const d of data.data) {
const shape = getLocalId(d.shape);
if (shape === undefined) continue;
initiativeData.push({ ...d, shape });
}
if (this._state.editLock !== -1) this._state.newData = initiativeData;
else this._state.locationData = initiativeData;

Expand Down
13 changes: 11 additions & 2 deletions server/VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2022.2.0
2022.2.2

### Added

Expand All @@ -7,6 +7,9 @@
- [DM] UI export campaign option in room details
- [DM] Import campaign support
- Can import older saves (if the migration code is still available (i.e. < 1 year old))
- [2022.2.1][server] server config option to enable import/export, defaulting to False
- given the experimental nature, it's better to not enable this by default
- it's strongly recommended to only enable this if you run a private server for the moment

### Changed

Expand Down Expand Up @@ -46,4 +49,10 @@
- Asset socket was not cleaning up past connections
- Auras that are light sources, no longer appear as a black circle of doom when FOW is not turned on
- Undo/Redo not persisting to server for movement and rotation
- [server] Admin client was not built in docker
- [server] Admin client was not built in docker
- [2022.2.1] Note export failing
- [2022.2.1] Markers not being exported
- [2022.2.2] Auras giving light when light source is turned off
- [2022.2.2] Ghost initiative entries showing up as ? that cannot be removed
- [2022.2.2] Database lock errors while importing during load
- [2022.2.2][server] Server not being able to start due to ModuleNotFoundError
2 changes: 1 addition & 1 deletion server/server_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ max_log_backups = 5

allow_signups = true

enable_export = false
enable_export = true

[APIserver]
# The API server is an administration server on which some API calls can be made.
Expand Down
2 changes: 0 additions & 2 deletions server/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import aiohttp_security
import aiohttp_session
import aiojobs.aiohttp
from aiohttp import web
from aiohttp_security import SessionIdentityPolicy
from aiohttp_session.cookie_storage import EncryptedCookieStorage
Expand All @@ -23,7 +22,6 @@ def setup_app(middlewares: Iterable[Callable] = ()) -> web.Application:
app["AuthzPolicy"] = auth.AuthPolicy()
aiohttp_security.setup(app, SessionIdentityPolicy(), app["AuthzPolicy"])
aiohttp_session.setup(app, EncryptedCookieStorage(auth.get_secret_token()))
aiojobs.aiohttp.setup(app)
return app


Expand Down
19 changes: 11 additions & 8 deletions server/src/export/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ def __init__(self, user: User, pac: BytesIO) -> None:
self.target_db = ACTIVE_DB

self.unpack(pac)
with self.migrator.to_db.atomic():
for room in self.migrator.rooms:
self.import_users(room)
self.migrator.migrate_room(room)
self.migrator.migrate_label_selections(room)
self.migrator.migrate_locations(room)
self.migrator.migrate_players(room)
self.migrator.migrate_notes(room)
# with self.migrator.to_db.atomic():
for room in self.migrator.rooms:
self.import_users(room)
self.migrator.migrate_room(room)
self.migrator.migrate_label_selections(room)
self.migrator.migrate_locations(room)
self.migrator.migrate_players(room)
self.migrator.migrate_notes(room)
print("Completed campaign import")
self.db.close()

Expand Down Expand Up @@ -283,6 +283,9 @@ def import_users(self, room: Room):
creator = cast(User, room.creator)
self.migrator.user_mapping[creator.id] = self.root_user.id

with self.migrator.from_db.bind_ctx([Room, User, Label]):
self.migrator.migrate_labels(self.root_user.id, room.creator.labels)


class CampaignMigrator:
def __init__(
Expand Down
4 changes: 3 additions & 1 deletion server/src/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@


def open_db(path: Path) -> SqliteExtDatabase:
return SqliteExtDatabase(path, pragmas={"foreign_keys": 1})
return SqliteExtDatabase(
path, pragmas={"foreign_keys": 1, "journal_mode": "wal", "synchronous": 0}
)


db = open_db(SAVE_FILE)

0 comments on commit bc00cd3

Please sign in to comment.