Metadata-Version: 2.4
Name: aa-shop
Version: 0.3.0
Summary: A public asset shop plugin for Alliance Auth.
Keywords: allianceauth,eveonline,django
Author-email: Daniel Onisoru <daniel.onisoru@gmail.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
License-File: LICENSE
Requires-Dist: allianceauth>=5,<6
Requires-Dist: allianceauth-corptools>=3
Requires-Dist: django-eveuniverse>=2
Requires-Dist: markdown
Requires-Dist: requests
Requires-Dist: coverage ; extra == "test"
Requires-Dist: factory_boy ; extra == "test"
Project-URL: Changelog, https://gitlab.com/daniel.onisoru/aa-shop/-/blob/master/CHANGELOG.md
Project-URL: Homepage, https://gitlab.com/daniel.onisoru/aa-shop
Project-URL: Issues, https://gitlab.com/daniel.onisoru/aa-shop/-/issues
Project-URL: Source, https://gitlab.com/daniel.onisoru/aa-shop
Provides-Extra: test

# aa-shop

An [Alliance Auth](https://gitlab.com/allianceauth/allianceauth) plugin that lets auth
members run a public shop stocked automatically from their own EVE assets.

## Features

- Create and manage your own shops from the **Shop** entry in the auth sidebar.
- Every published shop has a public storefront anyone can browse — no login required.
  Unpublished shops stay private to you as a preview until you're ready to share.
- Sell **ships**, **modules** (rigs, drones, implants), and **blueprint copies**, kept in
  stock automatically from your
  [allianceauth-corptools](https://pypi.org/project/allianceauth-corptools/) assets and
  priced however you choose — a fixed price, "Ask", or a percentage of Jita.
- Run **personal** shops from your own characters or **corporation** shops sourced from
  corp hangar divisions (needs the relevant corptools access).
- Shoppers browse, search, and open a detail page for anything you list; you can feature
  and hide individual items.

## Requirements

- Alliance Auth >= 5
- [allianceauth-corptools](https://pypi.org/project/allianceauth-corptools/) >= 3,
  installed and syncing character (and, for corp shops, corporation) assets

## Installation

1. Install into your Alliance Auth virtual environment:

   ```bash
   pip install aa-shop
   ```

2. Add `"shop"` to `INSTALLED_APPS` in your auth project's `local.py`:

   ```python
   INSTALLED_APPS += ["shop"]
   ```

3. Let the storefront serve its public pages — **required**, or anonymous visitors are
   redirected to login:

   ```python
   APPS_WITH_PUBLIC_VIEWS = ["storefront"]
   ```

4. Run migrations and collect static files, then restart your AA services:

   ```bash
   python manage.py migrate
   python manage.py collectstatic
   ```

5. **EVE universe data:** the ship and blueprint pickers read from
   [django-eveuniverse](https://gitlab.com/ErikKalkoken/django-eveuniverse), so make sure
   its data is populated (load the full EVE universe, or at least the Ship category, with
   eveuniverse's load tooling). Types that aren't loaded won't be selectable.

6. Grant the `shop.basic_access` permission (Django admin, or via groups/states) to
   members who should be able to run shops.

7. Selling **blueprint copies** additionally needs a `read_blueprints` ESI token: the
   character's `esi-characters.read_blueprints.v1` for personal shops, or a director's
   `esi-corporations.read_blueprints.v1` for corporation shops. Registering the character
   with corptools already covers the character scope.

## Scheduled tasks

Add these to your `local.py` so stock and prices stay current:

```python
from celery.schedules import crontab

# Recompute stock for every shop, hourly (ships, modules, blueprint copies).
CELERYBEAT_SCHEDULE["shop_refresh_all_stock"] = {
    "task": "shop.tasks.refresh_all_stock",
    "schedule": crontab(minute=0),
}
# Re-price anything set to a percentage of Jita, every 6 hours.
CELERYBEAT_SCHEDULE["shop_refresh_pct_prices"] = {
    "task": "shop.tasks.refresh_pct_prices",
    "schedule": crontab(minute=0, hour="*/6"),
}
```

Stock is read from your corptools assets; the hourly task also nudges corptools to pull
fresh assets first, so you don't need to tune its update rings. ESI caches assets and
blueprints for about an hour, so hourly is as often as is useful. Optional settings:
`SHOP_REFRESH_CORPTOOLS_ASSETS = False` skips the asset nudge, and `SHOP_TASKS_PRIORITY`
(1 = urgent … 9 = idle, default 7) sets the priority of these background tasks.

## Usage

Members with access get a **Shop** entry in the auth sidebar. From there you can create a
personal or corporation shop, name it and give it a short link, choose what it sells
(ships, modules, blueprint copies), and publish it. While a shop is unpublished only you
can see it, as a preview; once published, share its link with anyone.

Stock and prices fill in automatically from your assets on the schedule above — you just
set your pricing rules and pick which items to feature or hide.

## Contributing

Design docs and implementation plans live in `docs/superpowers/`. The storefront stylesheet
ships compiled (`shop/static/shop/storefront.css`); to rebuild it after changing storefront
templates, use the standalone Tailwind v4 CLI + daisyUI (no Node required):

```bash
bash scripts/build-css.sh        # add --watch during development
```

Releasing (maintainers, needs `pip install build twine`):

```bash
bash scripts/release.sh          # build + twine check
bash scripts/release.sh --test   # ...then upload to TestPyPI
bash scripts/release.sh --pypi   # ...then upload to PyPI
```

## License

MIT

