Skip to content

Commit

Permalink
fix keyring management params for icloud in docker (#719) (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Nov 30, 2023
1 parent c64e70c commit d38f831
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fix: `icloud --username` parameter reported as not an option [#719](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/719)

## 1.16.2 (2023-09-30)

- fix: send logs to stdout [#697](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/697)
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ COPY src src

RUN pip3 install -e .[dev]

RUN pyinstaller -y --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata src/starters/exec.py
RUN pyinstaller -y --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd_ex.py

FROM alpine:3.18 as runtime

WORKDIR /app

ENV TZ="America/Los_Angeles"

COPY --from=build /app/dist/exec .
COPY --from=build /app/dist/icloudpd_ex .

ENTRYPOINT ["/app/exec"]
ENTRYPOINT ["/app/icloudpd_ex"]

# RUN set -xe \
# && ln -s /app/icloudpd /usr/local/bin/icloudpd \
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Homepage="https://github.com/icloud-photos-downloader/icloud_photos_downloader"
[project.scripts]
icloudpd = "icloudpd.base:main"
icloud = "pyicloud_ipd.cmdline:main"
icloudpd_ex = "starters.icloudpd_ex:main"

[tool.pytest.ini_options]
log_format = "%(levelname)-8s %(message)s"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_bin_linux
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -euo pipefail

pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-linux-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-linux-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/exec.py --name icloudpd-ex-$1-linux-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd_ex.py --name icloudpd-ex-$1-linux-$2
2 changes: 1 addition & 1 deletion scripts/build_bin_macos
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -euo pipefail

pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-macos-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-macos-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/exec.py --name icloudpd-ex-$1-macos-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd_ex.py --name icloudpd-ex-$1-macos-$2
2 changes: 1 addition & 1 deletion scripts/build_bin_windows
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -euo pipefail

pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd.py src/starters/icloud.py --name icloudpd-$1-windows-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloud.py --name icloud-$1-windows-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/exec.py --name icloudpd-ex-$1-windows-$2
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile src/starters/icloudpd_ex.py --name icloudpd-ex-$1-windows-$2
59 changes: 51 additions & 8 deletions src/starters/exec.py → src/starters/icloudpd_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,101 @@
import click

# goal0 -- allow experimental flow from cli
# goal1 -- compose auth flow for icloud auth apis that supports 2fa, fido, and works from China
# goal1 -- compose auth flow for icloud auth apis that supports 2fa, fido,
# and works from China

# print("Experimenting with authentication")

# def make_requestor():
# """ make_requestor :: IO (Request -> Response) """

# def make_request_builder():
# """ make_request_builder :: State (a -> Request) """

# def make_response_parser():
# """ make_response_parser :: State (Response -> a) """


@click.group()
def commands():
pass


@commands.command()
def icloud():
@click.option(
"--username",
default="",
help="Apple ID to Use"
)
@click.option(
"--password",
default="",
help=(
"Apple ID Password to Use; if unspecified, password will be "
"fetched from the system keyring."
)
)
@click.option(
"-n", "--non-interactive",
default=True,
help="Disable interactive prompts."
)
@click.option(
"--delete-from-keyring",
default=False,
help="Delete stored password in system keyring for this username.",
)
@click.option(
"--domain",
default="com",
help="Root Domain for requests to iCloud. com or cn",
)
def icloud(username, password, non_interactive, delete_from_keyring, domain):
"""Legacy iCloud utils (keyring)"""
# raise Exception("blah")
icloud_main(sys.argv[2:])


@commands.command()
@click.argument('appleid') #, help="AppleID of the account to use")
@click.argument('target') #, help="Target path template")
@click.argument('appleid') # , help="AppleID of the account to use")
@click.argument('target') # , help="Target path template")
def copy(appleid, target):
"""Copy assets from iCloud to local storage"""


@commands.command()
def move():
"""Move assets from iCloud to local storage"""


@commands.group()
def auth():
"""Manages persistant credentials"""


@auth.command()
@click.argument('appleid') #, help="AppleID of the account to use")
@click.argument('appleid') # , help="AppleID of the account to use")
def add(appleid):
"""Add credentials to keyring"""


@auth.command()
@click.argument('appleid') #, help="AppleID of the account to use")
@click.argument('appleid') # , help="AppleID of the account to use")
def delete(appleid):
"""Delete credentials from keyring"""


@commands.group()
def watch():
"""Watch for iCloud changes"""

if __name__ == "__main__":

def main():
commands.add_command(icloudpd_main, name="icloudpd")
watch.add_command(copy)
watch.add_command(move)
commands()


if __name__ == "__main__":
main()

0 comments on commit d38f831

Please sign in to comment.