1
0
Fork 0
forked from aiolabs/libra

Rename Castle Accounting extension to Libra

Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).

Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).

No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-05 10:24:46 +02:00
commit c174cda48d
44 changed files with 953 additions and 953 deletions

View file

@ -1,32 +1,32 @@
from .crud import (
create_castle_settings,
create_libra_settings,
create_user_wallet_settings,
get_castle_settings,
get_libra_settings,
get_or_create_user_account,
get_user_wallet_settings,
update_castle_settings,
update_libra_settings,
update_user_wallet_settings,
)
from .models import AccountType, CastleSettings, UserWalletSettings
from .models import AccountType, LibraSettings, UserWalletSettings
async def get_settings(user_id: str) -> CastleSettings:
settings = await get_castle_settings(user_id)
async def get_settings(user_id: str) -> LibraSettings:
settings = await get_libra_settings(user_id)
if not settings:
settings = await create_castle_settings(user_id, CastleSettings())
settings = await create_libra_settings(user_id, LibraSettings())
return settings
async def update_settings(user_id: str, data: CastleSettings) -> CastleSettings:
async def update_settings(user_id: str, data: LibraSettings) -> LibraSettings:
from loguru import logger
from .fava_client import init_fava_client
settings = await get_castle_settings(user_id)
settings = await get_libra_settings(user_id)
if not settings:
settings = await create_castle_settings(user_id, data)
settings = await create_libra_settings(user_id, data)
else:
settings = await update_castle_settings(user_id, data)
settings = await update_libra_settings(user_id, data)
# Reinitialize Fava client with new settings
try: