diff --git a/Dockerfile b/Dockerfile
index 5f3896e..7c6fa15 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,4 +17,4 @@ ADD . .
RUN pip install .
EXPOSE 8001
-CMD ["/bin/bash", "-c", "pagehub init;pagehub server"]
\ No newline at end of file
+CMD ["/bin/bash", "-c", "pagesaver init;pagesaver server"]
\ No newline at end of file
diff --git a/README.md b/README.md
index 1cf411e..3c2e99d 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-# Pagehub
-[![Python version](https://img.shields.io/pypi/pyversions/pagehub.svg?logo=python)](https://pypi.python.org/pypi/pagehub)
-[![PyPI package](https://img.shields.io/pypi/v/pagehub.svg)](https://pypi.python.org/pypi/pagehub)
-[![PyPI download](https://img.shields.io/pypi/dm/pagehub.svg)](https://pypi.python.org/pypi/pagehub)
-[![GitHub](https://img.shields.io/github/license/ZhaoQi99/pagehub)](https://github.com/ZhaoQi99/pagehub/blob/main/LICENSE)
-![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/ZhaoQi99/pagehub)
+# PageSaver
+[![Python version](https://img.shields.io/pypi/pyversions/pagesaver.svg?logo=python)](https://pypi.python.org/pypi/pagesaver)
+[![PyPI package](https://img.shields.io/pypi/v/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)
+[![PyPI download](https://img.shields.io/pypi/dm/pagesaver.svg)](https://pypi.python.org/pypi/pagesaver)
+[![GitHub](https://img.shields.io/github/license/ZhaoQi99/pagesaver)](https://github.com/ZhaoQi99/pagesaver/blob/main/LICENSE)
+![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/ZhaoQi99/pagesaver)
Archive your web page.
@@ -15,10 +15,10 @@ Archive your web page.
pip
```shell
-pip install pagehub
+pip install pagesaver
✨🍰✨
```
-Or you can use `pip install git+https://github.com/ZhaoQi99/PageHub.git
+Or you can use `pip install git+https://github.com/ZhaoQi99/PageSaver.git
` install latest version.
@@ -26,16 +26,16 @@ Or you can use `pip install git+https://github.com/ZhaoQi99/PageHub.git
docker
```shell
-docker run -d --name pagehub -p 8001:8001 zhaoqi99/pagehub
+docker run -d --name pagesaver -p 8001:8001 zhaoqi99/pagesaver
```
## Quick Start
### HTTP API
-1. Init PageHub: `pagehub init`
-2. Start HTTP Server: `pagehub server`
- > `nohup pagehub server >> server.log 2>&1 &`
+1. Init PageSaver: `pagesaver init`
+2. Start HTTP Server: `pagesaver server`
+ > `nohup pagesaver server >> server.log 2>&1 &`
3. Examples:
```shell
~$ curl http://127.0.0.1:8001/api/record/https://www.baidu.com/?format=MHTML&format=PDF -H 'Authorization: '
@@ -44,7 +44,7 @@ docker run -d --name pagehub -p 8001:8001 zhaoqi99/pagehub
### CLI
```shell
-pagehub export https://www.baidu.com -o . -f MHTML,PDF
+pagesaver export https://www.baidu.com -o . -f MHTML,PDF
```
## HTTP Usage
@@ -85,8 +85,8 @@ Using the Authorization header, format is: `Authorization: `
## CLI Usage
### Export
```shell
-~$ pagehub export -h
-Usage: pagehub export [OPTIONS] URL
+~$ pagesaver export -h
+Usage: pagesaver export [OPTIONS] URL
Export page to the output file
@@ -98,11 +98,11 @@ Options:
```
### Server
```shell
-~$ pagehub init
-~$ pagehub server -h
-Usage: pagehub server [OPTIONS]
+~$ pagesaver init
+~$ pagesaver server -h
+Usage: pagesaver server [OPTIONS]
- Run PageHub HTTP server
+ Run PageSaver HTTP server
Options:
-h, --help Show this message and exit.
@@ -110,7 +110,7 @@ Options:
```
## Configuration
-Pagehub will read the configuration from `config.py` automatically.
+PageSaver will read the configuration from `config.py` automatically.
### STORAGE
* type: storage type. Currently supported values are "local".
@@ -137,7 +137,7 @@ The property name in Notion to use for the MHTML file of a page.
Default: `mhtml`
## License
-[GNU General Public License v3.0](https://github.com/ZhaoQi99/PageHub/blob/main/LICENSE)
+[GNU General Public License v3.0](https://github.com/ZhaoQi99/PageSaver/blob/main/LICENSE)
## Author
* Qi Zhao([zhaoqi99@outlook.com](mailto:zhaoqi99@outlook.com))
diff --git a/pagesaver/authorization/apps.py b/pagesaver/authorization/apps.py
index c580177..f6d44b2 100644
--- a/pagesaver/authorization/apps.py
+++ b/pagesaver/authorization/apps.py
@@ -3,4 +3,4 @@
class AuthorizationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
- name = 'pagehub.authorization'
+ name = 'pagesaver.authorization'
diff --git a/pagesaver/authorization/migrations/0001_initial.py b/pagesaver/authorization/migrations/0001_initial.py
index cf950d6..2ad7b41 100644
--- a/pagesaver/authorization/migrations/0001_initial.py
+++ b/pagesaver/authorization/migrations/0001_initial.py
@@ -1,8 +1,9 @@
# Generated by Django 5.0.7 on 2024-08-12 05:28
-import pagehub.authorization.models
from django.db import migrations, models
+import pagesaver.authorization.models
+
class Migration(migrations.Migration):
@@ -18,7 +19,7 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated', models.DateTimeField(auto_now=True, db_index=True)),
- ('expired', models.DateTimeField(default=pagehub.authorization.models._default_expire_time, verbose_name='token expire time')),
+ ('expired', models.DateTimeField(default=pagesaver.authorization.models._default_expire_time, verbose_name='token expire time')),
('token', models.TextField(blank=True, verbose_name='token')),
],
options={
diff --git a/pagesaver/authorization/models.py b/pagesaver/authorization/models.py
index 7d3fc7c..cf307cd 100644
--- a/pagesaver/authorization/models.py
+++ b/pagesaver/authorization/models.py
@@ -6,7 +6,7 @@
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
-from pagehub.lib.base.models import BaseModel
+from pagesaver.lib.base.models import BaseModel
def _default_expire_time():
diff --git a/pagesaver/cli/__init__.py b/pagesaver/cli/__init__.py
index 41805be..d6bbcc5 100644
--- a/pagesaver/cli/__init__.py
+++ b/pagesaver/cli/__init__.py
@@ -1,6 +1,6 @@
import click
-from pagehub import __version__
+from pagesaver import __version__
VERSION = rf"""
____ _ _ _ _
diff --git a/pagesaver/cli/export.py b/pagesaver/cli/export.py
index e84d3a3..747c551 100644
--- a/pagesaver/cli/export.py
+++ b/pagesaver/cli/export.py
@@ -2,10 +2,10 @@
import click
-from pagehub.cli.types import MultipleChoice
-from pagehub.constants import SUPPORT_FORMATS
-from pagehub.enums import ExportFormat
-from pagehub.utils import export_utils
+from pagesaver.cli.types import MultipleChoice
+from pagesaver.constants import SUPPORT_FORMATS
+from pagesaver.enums import ExportFormat
+from pagesaver.utils import export_utils
SUCCESS_ANSI = click.style("successfully", fg="green")
diff --git a/pagesaver/cli/init.py b/pagesaver/cli/init.py
index a5a326f..4bde922 100644
--- a/pagesaver/cli/init.py
+++ b/pagesaver/cli/init.py
@@ -4,14 +4,14 @@
from django.core.management import call_command
from django.utils import timezone
-from pagehub import __version__
+from pagesaver import __version__
@click.command("init")
@click.help_option("-h", "--help")
def init_command(*args, **kwargs):
- """Initialize PageHub"""
- click.secho(f"[+] Initializing PageHub v{__version__}...", fg="green")
+ """Initialize PageSaver"""
+ click.secho(f"[+] Initializing PageSaver v{__version__}...", fg="green")
click.secho("{}\n".format("-" * 30), fg="green")
click.secho("[+] Creating database and running initial migrations...", fg="green")
@@ -20,7 +20,7 @@ def init_command(*args, **kwargs):
click.secho("\n{}".format("-" * 30), fg="green")
click.secho("[√] Init successfully.", fg="green")
- from pagehub.authorization.models import APIToken
+ from pagesaver.authorization.models import APIToken
expired = timezone.now().astimezone() + timedelta(days=365 * 100)
token = APIToken.objects.create(expired=expired)
@@ -33,7 +33,7 @@ def init_command(*args, **kwargs):
click.echo(
"""
-{hint} To using PageHub, Please install dependencies with the following command:
+{hint} To using PageSaver, Please install dependencies with the following command:
playwright install # browsers
playwright install-deps # dependencies to run browsers""".format(
hint=click.style("Hint:", fg="magenta")
@@ -42,8 +42,8 @@ def init_command(*args, **kwargs):
click.echo(
"""
-{hint} To start PageHub, run:
- pagehub server # then visit http://127.0.0.1:8000
+{hint} To start PageSaver, run:
+ pagesaver server # then visit http://127.0.0.1:8000
""".format(
hint=click.style("Hint:", fg="magenta")
)
diff --git a/pagesaver/cli/server.py b/pagesaver/cli/server.py
index b5f0a77..4fdc34f 100644
--- a/pagesaver/cli/server.py
+++ b/pagesaver/cli/server.py
@@ -4,8 +4,8 @@
from hypercorn.asyncio import serve
from hypercorn.config import Config
-from pagehub.core.asgi import application
-from pagehub.settings import pagehub_settings
+from pagesaver.core.asgi import application
+from pagesaver.settings import pagesaver_settings
@click.command("server")
@@ -15,10 +15,10 @@
"--bind",
"bind",
show_default=True,
- default=pagehub_settings.SERVER_BIND,
+ default=pagesaver_settings.SERVER_BIND,
help="The TCP host/address to bind to.",
)
def server_command(*args, **kwargs):
- """Run PageHub HTTP server"""
- config = Config.from_mapping({"bind": pagehub_settings.SERVER_BIND}, **kwargs)
+ """Run PageSaver HTTP server"""
+ config = Config.from_mapping({"bind": pagesaver_settings.SERVER_BIND}, **kwargs)
asyncio.run(serve(application, config))
diff --git a/pagesaver/constants.py b/pagesaver/constants.py
index 0f560d8..7d3161c 100644
--- a/pagesaver/constants.py
+++ b/pagesaver/constants.py
@@ -1,3 +1,3 @@
-from pagehub.enums import ExportFormat
+from pagesaver.enums import ExportFormat
SUPPORT_FORMATS = list(ExportFormat.__members__)
diff --git a/pagesaver/core/api.py b/pagesaver/core/api.py
index 355f096..6a3733a 100644
--- a/pagesaver/core/api.py
+++ b/pagesaver/core/api.py
@@ -1,8 +1,8 @@
from ninja import NinjaAPI, errors
from ninja.security import APIKeyHeader
-from pagehub.authorization.models import APIToken
-from pagehub.record.api import router as record_router
+from pagesaver.authorization.models import APIToken
+from pagesaver.record.api import router as record_router
class APIKey(APIKeyHeader):
diff --git a/pagesaver/core/asgi.py b/pagesaver/core/asgi.py
index 790f7a9..c7cbdec 100644
--- a/pagesaver/core/asgi.py
+++ b/pagesaver/core/asgi.py
@@ -11,6 +11,6 @@
from django.core.asgi import get_asgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pagehub.core.settings')
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pagesaver.core.settings')
application = get_asgi_application()
diff --git a/pagesaver/core/settings.py b/pagesaver/core/settings.py
index 413696c..82b9030 100644
--- a/pagesaver/core/settings.py
+++ b/pagesaver/core/settings.py
@@ -37,8 +37,8 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- "pagehub.record",
- "pagehub.authorization",
+ "pagesaver.record",
+ "pagesaver.authorization",
]
MIDDLEWARE = [
@@ -51,7 +51,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
-ROOT_URLCONF = 'pagehub.core.urls'
+ROOT_URLCONF = 'pagesaver.core.urls'
TEMPLATES = [
{
@@ -69,7 +69,7 @@
},
]
-WSGI_APPLICATION = 'pagehub.core.wsgi.application'
+WSGI_APPLICATION = 'pagesaver.core.wsgi.application'
# Database
diff --git a/pagesaver/core/wsgi.py b/pagesaver/core/wsgi.py
index b116714..7660ff6 100644
--- a/pagesaver/core/wsgi.py
+++ b/pagesaver/core/wsgi.py
@@ -11,6 +11,6 @@
from django.core.wsgi import get_wsgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pagehub.core.settings')
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pagesaver.core.settings')
application = get_wsgi_application()
diff --git a/pagesaver/lib/notion/client.py b/pagesaver/lib/notion/client.py
index 027c03a..3a6d2d8 100644
--- a/pagesaver/lib/notion/client.py
+++ b/pagesaver/lib/notion/client.py
@@ -2,7 +2,7 @@
import os
from pathlib import Path
-from pagehub.lib.base.client import RequestsBaseClient
+from pagesaver.lib.base.client import RequestsBaseClient
API_BASE_URL = "https://api.notion.com/v1/"
UNOFFICIAL_BASE_URL = "https://www.notion.so/api/v3/"
diff --git a/pagesaver/record/api.py b/pagesaver/record/api.py
index 5272bc9..ef0e19d 100644
--- a/pagesaver/record/api.py
+++ b/pagesaver/record/api.py
@@ -2,10 +2,10 @@
from ninja import Field, Query, Router, Schema
-from pagehub.enums import ExportFormat
-from pagehub.record.models import Snapshot
-from pagehub.record.runner import BackgroundThreadRunner
-from pagehub.record.tasks import export_task, notion_push_task
+from pagesaver.enums import ExportFormat
+from pagesaver.record.models import Snapshot
+from pagesaver.record.runner import BackgroundThreadRunner
+from pagesaver.record.tasks import export_task, notion_push_task
router = Router()
diff --git a/pagesaver/record/models.py b/pagesaver/record/models.py
index b596b25..28f8f4a 100644
--- a/pagesaver/record/models.py
+++ b/pagesaver/record/models.py
@@ -2,8 +2,8 @@
from django.db import models
-from pagehub.enums import ExportFormat
-from pagehub.lib.base.models import BaseModelWithUUID
+from pagesaver.enums import ExportFormat
+from pagesaver.lib.base.models import BaseModelWithUUID
class Snapshot(BaseModelWithUUID):
diff --git a/pagesaver/record/runner/thread.py b/pagesaver/record/runner/thread.py
index ec4bf47..dc291d9 100644
--- a/pagesaver/record/runner/thread.py
+++ b/pagesaver/record/runner/thread.py
@@ -1,6 +1,6 @@
import threading
-from pagehub.record.runner.base import BaseRunner
+from pagesaver.record.runner.base import BaseRunner
class BackgroundThreadRunner(BaseRunner):
diff --git a/pagesaver/record/tasks.py b/pagesaver/record/tasks.py
index 840be15..1b06fe3 100644
--- a/pagesaver/record/tasks.py
+++ b/pagesaver/record/tasks.py
@@ -1,14 +1,14 @@
from pathlib import Path
from typing import Optional
-from pagehub.constants import SUPPORT_FORMATS
-from pagehub.enums import ExportFormat
-from pagehub.record.models import Snapshot, SnapshotResult
-from pagehub.settings import pagehub_settings
-from pagehub.utils import export_utils, notion_utils
-from pagehub.utils.datetime_utils import get_now_str
+from pagesaver.constants import SUPPORT_FORMATS
+from pagesaver.enums import ExportFormat
+from pagesaver.record.models import Snapshot, SnapshotResult
+from pagesaver.settings import pagesaver_settings
+from pagesaver.utils import export_utils, notion_utils
+from pagesaver.utils.datetime_utils import get_now_str
-STORAGE = pagehub_settings.STORAGE
+STORAGE = pagesaver_settings.STORAGE
def export_task(snapshot_id: int, url: str, format: list[str]):
@@ -64,7 +64,7 @@ def notion_push_task(
if __name__ == "__main__":
import os
- from pagehub.record.models import Snapshot
+ from pagesaver.record.models import Snapshot
url = "https://www.baidu.com"
snapshot = Snapshot.objects.create(url=url)
diff --git a/pagesaver/settings.py b/pagesaver/settings.py
index 2bf9d1f..0a8a345 100644
--- a/pagesaver/settings.py
+++ b/pagesaver/settings.py
@@ -20,7 +20,7 @@ def __init__(self, user_settings=None, defaults=None) -> None:
def __getattr__(self, attr):
if attr not in self.defaults:
- raise AttributeError("Invalid pagehub setting: '%s'" % attr)
+ raise AttributeError("Invalid pagesaver setting: '%s'" % attr)
try:
val = self.user_settings[attr]
except KeyError:
@@ -63,4 +63,4 @@ def __getattr__(self, attr):
return getattr(self._wrapped, attr)
-pagehub_settings = LazySetting()
+pagesaver_settings = LazySetting()
diff --git a/pagesaver/utils/export_utils.py b/pagesaver/utils/export_utils.py
index dbbbfdc..d53a6a0 100644
--- a/pagesaver/utils/export_utils.py
+++ b/pagesaver/utils/export_utils.py
@@ -3,7 +3,7 @@
from playwright.sync_api import Page, sync_playwright
-from pagehub.enums import ExportFormat
+from pagesaver.enums import ExportFormat
def _export_pdf(page: Page, path: Path) -> str:
diff --git a/pagesaver/utils/notion_utils.py b/pagesaver/utils/notion_utils.py
index 2e83f50..264209f 100644
--- a/pagesaver/utils/notion_utils.py
+++ b/pagesaver/utils/notion_utils.py
@@ -1,12 +1,12 @@
from pathlib import Path
-from pagehub.lib.notion import block, property
-from pagehub.lib.notion.client import NotionClient, NotionUnofficialClient
-from pagehub.settings import pagehub_settings
+from pagesaver.lib.notion import block, property
+from pagesaver.lib.notion.client import NotionClient, NotionUnofficialClient
+from pagesaver.settings import pagesaver_settings
-TITLE_KEY = pagehub_settings.TITLE_PROPERTY
-LINK_KEY = pagehub_settings.LINK_PROPERTY
-MHTML_KEY = pagehub_settings.MHTML_PROPERTY
+TITLE_KEY = pagesaver_settings.TITLE_PROPERTY
+LINK_KEY = pagesaver_settings.LINK_PROPERTY
+MHTML_KEY = pagesaver_settings.MHTML_PROPERTY
def create_page(database_id: str, token: str, title: str, link: str) -> str:
diff --git a/setup.cfg b/setup.cfg
index f2c395b..ea6c911 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,13 +1,13 @@
[metadata]
-name = pagehub
-version = attr: pagehub.__version__
-url = https://github.com/ZhaoQi99/PageHub
+name = pagesaver
+version = attr: pagesaver.__version__
+url = https://github.com/ZhaoQi99/PageSaver
project_urls =
- Homepage = https://github.com/ZhaoQi99/PageHub
- Changelog = https://github.com/ZhaoQi99/PageHub/releases
- Source = https://github.com/ZhaoQi99/PageHub
- Issue Tracker = https://github.com/ZhaoQi99/PageHub/issues
- # Documentation = https://github.com/ZhaoQi99/PageHub
+ Homepage = https://github.com/ZhaoQi99/PageSaver
+ Changelog = https://github.com/ZhaoQi99/PageSaver/releases
+ Source = https://github.com/ZhaoQi99/PageSaver
+ Issue Tracker = https://github.com/ZhaoQi99/PageSaver/issues
+ # Documentation = https://github.com/ZhaoQi99/PageSaver
author = Qi Zhao
author_email = zhaoqi99@outlook.com
# "Trove classifiers" for PyPI (https://pypi.org/classifiers/).
@@ -34,7 +34,7 @@ packages = find:
[options.entry_points]
console_scripts =
- pagehub = pagehub.cli:main
+ pagesaver = pagesaver.cli:main
[options.packages.find]
exclude =