nrdxp / cfdyndns

CloudFlare Dynamic DNS Client
MIT License
12 stars 12 forks source link

Update cloudflare api to fix removed field #60

Closed Wyn-Price closed 2 months ago

Wyn-Price commented 3 months ago

A patch for cloudflare/cloudflare-rs/pull/240 Fixes #57

I've included @jcgruenhage's make-owner-fields-optional changes in my cloudflare-rs PR.

Removes some unused imports that no longer exist (ApiClient), and the change in api.rs is to coerce the error type from Client::new, as I'm assuming they're now returning their own error type. I can make this nicer if you want.

I can confirm that this works with A records, I haven't tested with AAAA records but I can't see why it wouldn't also work.

Before: ``` $ cargo run -- --records x.wynprice.com --token XXX Finished dev [unoptimized + debuginfo] target(s) in 0.13s Running `target/debug/cfdyndns --records x.wynprice.com --token XXX` INFO cfdyndns::ip > ... Error: error decoding response body: missing field `multiple_railguns_allowed` at line 1 column 586 ```
After - when there is no change needed: ``` $ cargo run -- --records x.wynprice.com --token XXX Compiling cfdyndns v0.2.0 (/home/wp/programming/cfdyndns) Finished dev [unoptimized + debuginfo] target(s) in 4.37s Running `target/debug/cfdyndns --records x.wynprice.com --token XXX` INFO cfdyndns::ip > ... INFO cfdyndns::dns > skipping A record `x.wynprice.com`; already up to date ```
After - when the DNS record needs changing: ``` $ cargo run -- --records x.wynprice.com --token XXX Compiling cfdyndns v0.2.0 (/home/wp/programming/cfdyndns) Finished dev [unoptimized + debuginfo] target(s) in 0.14s Running `target/debug/cfdyndns --records x.wynprice.com --token XXX` INFO cfdyndns::ip > ... INFO cfdyndns::dns > request: x.wynprice.com (... → ...) ```
nrdxp commented 2 months ago

looks like the build is failing in CI

Wyn-Price commented 2 months ago

Yup, I can have a look at it tonight.

Wyn-Price commented 2 months ago

I reran crate2nix, hopefully that's what the problem was. It seems to have changed the format of crate-hashes.json (even though the version of crate2nix was the same) ,but hopefully that's fine.

Wyn-Price commented 2 months ago

Sure, done

Wyn-Price commented 2 months ago

I'm happy to update nixpkgs if you create a new release, or I can just update to the latest commit

nrdxp commented 2 months ago

tagged as v0.2.1