Fix packaging
This commit is contained in:
parent
ca35c09c4d
commit
9b3e17997d
|
@ -6,4 +6,4 @@ blocklists/*
|
||||||
!blocklists/.gitkeep
|
!blocklists/.gitkeep
|
||||||
tmp.py
|
tmp.py
|
||||||
.venv
|
.venv
|
||||||
testtmp
|
dist/
|
|
@ -230,4 +230,4 @@ dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"]
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.10"
|
python-versions = "^3.10"
|
||||||
content-hash = "843328e3217d5ebc1fbb55737ca6edc4d47894e2b1c48e5ab5f3fe0b6a27045c"
|
content-hash = "8737765a4f30f43f2314296861d56c04682f5632f54ecd7b2046b4d9591ed101"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "cloudflare-gateway-adblocking"
|
name = "cloudflare-gateway-adblocking"
|
||||||
version = "0.1.0"
|
version = "0.1.9"
|
||||||
description = "Serverless adblocking via Cloudflare Zero Trust Gateway"
|
description = "Serverless adblocking via Cloudflare Zero Trust Gateway"
|
||||||
authors = ["slastechno <77907286+slashtechno@users.noreply.github.com>"]
|
authors = ["slastechno <77907286+slashtechno@users.noreply.github.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{include = "cloudflare_gateway_adblocking"}]
|
packages = [{include = "src"}]
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
cloudflare-gateway-adblocking = "cloudflare_gateway_adblocking.__main__:cli"
|
cloudflare-gateway-adblocking = "src.__main__:main"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
# Import the utils package
|
# Import the utils package
|
||||||
import utils
|
from . import utils
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
@ -11,7 +11,7 @@ from pathlib import Path
|
||||||
TOKEN = None
|
TOKEN = None
|
||||||
ACCOUNT_ID = None
|
ACCOUNT_ID = None
|
||||||
|
|
||||||
def cli():
|
def main():
|
||||||
# Setup logging
|
# Setup logging
|
||||||
logger.remove()
|
logger.remove()
|
||||||
# ^10 is a formatting directive to center with a padding of 10
|
# ^10 is a formatting directive to center with a padding of 10
|
||||||
|
@ -98,7 +98,10 @@ def cli():
|
||||||
if TOKEN is None or ACCOUNT_ID is None:
|
if TOKEN is None or ACCOUNT_ID is None:
|
||||||
logger.error("No environment variables found. Please create a .env file or .envrc file") # noqa E501
|
logger.error("No environment variables found. Please create a .env file or .envrc file") # noqa E501
|
||||||
exit(1)
|
exit(1)
|
||||||
args.func(args)
|
try :
|
||||||
|
args.func(args)
|
||||||
|
except AttributeError:
|
||||||
|
argparser.print_help()
|
||||||
|
|
||||||
def upload_to_cloudflare(args):
|
def upload_to_cloudflare(args):
|
||||||
logger.info("Uploading to Cloudflare")
|
logger.info("Uploading to Cloudflare")
|
||||||
|
@ -112,10 +115,10 @@ def upload_to_cloudflare(args):
|
||||||
def delete_from_cloudflare(args):
|
def delete_from_cloudflare(args):
|
||||||
logger.info("Deleting from Cloudflare")
|
logger.info("Deleting from Cloudflare")
|
||||||
rules = utils.utils.get_gateway_rules(ACCOUNT_ID, TOKEN)
|
rules = utils.utils.get_gateway_rules(ACCOUNT_ID, TOKEN)
|
||||||
utils.delete_adblock_zerotrust.delete_adblock_policy(rules, ACCOUNT_ID, TOKEN)
|
utils.delete.delete_adblock_policy(rules, ACCOUNT_ID, TOKEN)
|
||||||
lists = utils.utils.get_lists(ACCOUNT_ID, TOKEN)
|
lists = utils.utils.get_lists(ACCOUNT_ID, TOKEN)
|
||||||
lists = utils.utils.filter_adblock_lists(lists)
|
lists = utils.utils.filter_adblock_lists(lists)
|
||||||
utils.delete_adblock_zerotrust.delete_adblock_list(lists, ACCOUNT_ID, TOKEN)
|
utils.delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli()
|
main()
|
|
@ -1,3 +1,3 @@
|
||||||
from .utils import *
|
from .utils import *
|
||||||
from .upload import *
|
from .upload import *
|
||||||
from .delete_adblock_zerotrust import *
|
from .delete import *
|
|
@ -1,7 +1,7 @@
|
||||||
# This is a scriprt to undo the changes made by adblock-zerotrust.py
|
# This is a scriprt to undo the changes made by adblock-zerotrust.py
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
def delete_adblock_list(lists: dict, account_id: str, token: str):
|
def delete_adblock_list(lists: dict, account_id: str, token: str):
|
|
@ -1,5 +1,5 @@
|
||||||
import requests
|
import requests
|
||||||
import utils
|
from . import utils
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue