diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-21 23:39:03 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-03-09 17:04:02 +0100 |
| commit | 2fd641547b5fb795fc17e98e47f489fa82e8ff42 (patch) | |
| tree | ebfd84898df8e1eabaaa2888c89e0c71137cb301 /src/lib | |
| parent | cf65c2709664936940935996499ac87dc47515f0 (diff) | |
Display the filename / URL that a screen certificate was obtained from (#1894).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dkdm_recipient.h | 2 | ||||
| -rw-r--r-- | src/lib/internet.cc | 8 | ||||
| -rw-r--r-- | src/lib/internet.h | 18 | ||||
| -rw-r--r-- | src/lib/kdm_cli.cc | 2 | ||||
| -rw-r--r-- | src/lib/kdm_recipient.cc | 5 | ||||
| -rw-r--r-- | src/lib/kdm_recipient.h | 7 | ||||
| -rw-r--r-- | src/lib/screen.h | 10 |
7 files changed, 41 insertions, 11 deletions
diff --git a/src/lib/dkdm_recipient.h b/src/lib/dkdm_recipient.h index d08f82daa..50f2f3e15 100644 --- a/src/lib/dkdm_recipient.h +++ b/src/lib/dkdm_recipient.h @@ -37,7 +37,7 @@ public: int utc_offset_hour_, int utc_offset_minute_ ) - : KDMRecipient (name_, notes_, recipient_) + : KDMRecipient (name_, notes_, recipient_, boost::none) , emails (emails_) , utc_offset_hour (utc_offset_hour_) , utc_offset_minute (utc_offset_minute_) diff --git a/src/lib/internet.cc b/src/lib/internet.cc index 4fb6c7cb3..121d3524c 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -126,14 +126,14 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp) optional<string> -get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load) +get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path, string)> load) { ScopedTemporary temp; auto e = get_from_url (url, pasv, skip_pasv_ip, temp); if (e) { return e; } - return load (temp.file()); + return load (temp.file(), url); } @@ -142,7 +142,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string * @param load Function passed a (temporary) filesystem path of the unpacked file. */ optional<string> -get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load) +get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path, string)> load) { /* Download the ZIP file to temp_zip */ ScopedTemporary temp_zip; @@ -199,5 +199,5 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio zip_close (zip); temp_cert.close (); - return load (temp_cert.file()); + return load (temp_cert.file(), url); } diff --git a/src/lib/internet.h b/src/lib/internet.h index f3cd2c6b4..041bb1bb1 100644 --- a/src/lib/internet.h +++ b/src/lib/internet.h @@ -27,6 +27,20 @@ class ScopedTemporary; boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp); -boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load); -boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, std::function<boost::optional<std::string> (boost::filesystem::path)> load); + +boost::optional<std::string> get_from_url ( + std::string url, + bool pasv, + bool skip_pasv_ip, + std::function<boost::optional<std::string> (boost::filesystem::path, std::string)> load + ); + +boost::optional<std::string> get_from_zip_url ( + std::string url, + std::string file, + bool pasv, + bool skip_pasv_ip, + std::function<boost::optional<std::string> (boost::filesystem::path, std::string)> load + ); + std::list<std::string> ls_url (std::string url); diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index e6ba600f4..0ec648e04 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -540,7 +540,7 @@ try { /* Make a new screen and add it to the current cinema */ dcp::CertificateChain chain (dcp::file_to_string(optarg)); - auto screen = make_shared<Screen>(screen_description, "", chain.leaf(), vector<TrustedDevice>()); + auto screen = std::make_shared<Screen>(screen_description, "", chain.leaf(), boost::none, vector<TrustedDevice>()); if (cinema) { cinema->add_screen (screen); } diff --git a/src/lib/kdm_recipient.cc b/src/lib/kdm_recipient.cc index cde41e22d..671e9797c 100644 --- a/src/lib/kdm_recipient.cc +++ b/src/lib/kdm_recipient.cc @@ -31,6 +31,8 @@ KDMRecipient::KDMRecipient (cxml::ConstNodePtr node) } else if (node->optional_string_child("Recipient")) { recipient = dcp::Certificate (node->string_child("Recipient")); } + + recipient_file = node->optional_string_child("RecipientFile"); } @@ -41,6 +43,9 @@ KDMRecipient::as_xml (xmlpp::Element* parent) const if (recipient) { parent->add_child("Recipient")->add_child_text(recipient->certificate(true)); } + if (recipient_file) { + parent->add_child("RecipientFile")->add_child_text(*recipient_file); + } parent->add_child("Notes")->add_child_text(notes); } diff --git a/src/lib/kdm_recipient.h b/src/lib/kdm_recipient.h index 85352f0ee..90e9fd16d 100644 --- a/src/lib/kdm_recipient.h +++ b/src/lib/kdm_recipient.h @@ -36,10 +36,11 @@ DCPOMATIC_ENABLE_WARNINGS class KDMRecipient { public: - KDMRecipient (std::string const& name_, std::string const& notes_, boost::optional<dcp::Certificate> recipient_) + KDMRecipient (std::string const& name_, std::string const& notes_, boost::optional<dcp::Certificate> recipient_, boost::optional<std::string> recipient_file_) : name (name_) , notes (notes_) , recipient (recipient_) + , recipient_file (recipient_file_) {} explicit KDMRecipient (cxml::ConstNodePtr); @@ -51,6 +52,10 @@ public: std::string name; std::string notes; boost::optional<dcp::Certificate> recipient; + /** The pathname or URL that the recipient certificate was obtained from; purely + * to inform the user. + */ + boost::optional<std::string> recipient_file; }; diff --git a/src/lib/screen.h b/src/lib/screen.h index 15a0785d5..6103d207d 100644 --- a/src/lib/screen.h +++ b/src/lib/screen.h @@ -49,8 +49,14 @@ namespace dcpomatic { class Screen : public KDMRecipient { public: - Screen (std::string const & name_, std::string const & notes_, boost::optional<dcp::Certificate> recipient_, std::vector<TrustedDevice> trusted_devices_) - : KDMRecipient (name_, notes_, recipient_) + Screen ( + std::string const & name_, + std::string const & notes_, + boost::optional<dcp::Certificate> recipient_, + boost::optional<std::string> recipient_file_, + std::vector<TrustedDevice> trusted_devices_ + ) + : KDMRecipient (name_, notes_, recipient_, recipient_file_) , trusted_devices (trusted_devices_) {} |
