8 Commits

Author SHA1 Message Date
Grégory Soutadé
e5697378e9 Update version 2021-11-27 10:29:22 +01:00
Grégory Soutadé
fd8ce841eb Fix a nasty bug : fulfill reply data must be copied, not just referenced 2021-11-26 20:01:49 +01:00
Grégory Soutadé
8413b844db Forgot to add libgourou.a as a dependency in utils Makefile 2021-11-26 20:01:21 +01:00
Grégory Soutadé
dd6001805f Remove invalid characters from filename before writing a file 2021-11-26 20:00:36 +01:00
Grégory Soutadé
1f6e0ecdc8 Check for application/pdf as a substring and not as a full string for Content-Type and metadata in order to determine downloaded file type 2021-11-26 19:59:57 +01:00
Grégory Soutadé
89a5408c2d Update README_package.md 2021-11-03 13:54:44 +01:00
Grégory Soutadé
56e4fda760 Utils: Forgot to pass responseHeaders parameters when we have a redirection 2021-11-03 13:54:04 +01:00
Grégory Soutadé
59c801da08 Fix STATIC_BUILD errors 2021-09-28 18:14:41 +02:00
10 changed files with 36 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
libgourou: libgourou.a libgourou.so
libgourou.a: $(OBJECTS)
$(AR) crs $@ obj/*.o $(LDFLAGS)
$(AR) crs $@ obj/*.o ./lib/updfparser/obj/*.o
libgourou.so: $(OBJECTS) $(UPDFPARSERLIB)
$(CXX) obj/*.o $(LDFLAGS) -o $@ -shared

View File

@@ -27,19 +27,19 @@ Utils
You can import configuration from your eReader or create a new one with utils/activate :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/activate -u <AdobeID USERNAME>
./activate -u <AdobeID USERNAME>
Then a _./.adept_ directory is created with all configuration file
To download an ePub/PDF :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/acsmdownloader -f <ACSM_FILE>
./acsmdownloader -f <ACSM_FILE>
To export your private key :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/acsmdownloader --export-private-key [-o adobekey_1.der]
./acsmdownloader --export-private-key [-o adobekey_1.der]
Sources

View File

@@ -34,6 +34,12 @@ namespace gourou
class FulfillmentItem
{
public:
/**
* @brief Main constructor. Not to be called by user
*
* @param doc Fulfill reply
* @param user User pointer
*/
FulfillmentItem(pugi::xml_document& doc, User* user);
/**
@@ -59,6 +65,7 @@ namespace gourou
std::string getResource();
private:
pugi::xml_document fulfillDoc;
pugi::xml_node metadatas;
pugi::xml_document rights;
std::string downloadURL;

View File

@@ -40,7 +40,7 @@
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif
#define LIBGOUROU_VERSION "0.4.1"
#define LIBGOUROU_VERSION "0.4.3"
namespace gourou
{

View File

@@ -24,8 +24,10 @@
namespace gourou
{
FulfillmentItem::FulfillmentItem(pugi::xml_document& doc, User* user)
: fulfillDoc()
{
metadatas = doc.select_node("//metadata").node();
fulfillDoc.reset(doc); /* We must keep a copy */
metadatas = fulfillDoc.select_node("//metadata").node();
if (!metadatas)
EXCEPTION(FFI_INVALID_FULFILLMENT_DATA, "No metadata tag in document");

View File

@@ -599,7 +599,11 @@ namespace gourou
std::string rightsStr = item->getRights();
if (headers.count("Content-Type") && headers["Content-Type"] == "application/pdf")
if (item->getMetadata("format").find("application/pdf") != std::string::npos)
res = PDF;
if (headers.count("Content-Type") &&
headers["Content-Type"].find("application/pdf") != std::string::npos)
res = PDF;
if (res == EPUB)

View File

@@ -2,9 +2,12 @@
TARGETS=acsmdownloader adept_activate
CXXFLAGS=-Wall `pkg-config --cflags Qt5Core Qt5Network` -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/
STATIC_DEP=
LDFLAGS=`pkg-config --libs Qt5Core Qt5Network` -L$(ROOT) -lcrypto -lzip -lz
ifneq ($(STATIC_UTILS),)
LDFLAGS += $(ROOT)/libgourou.a
STATIC_DEP = $(ROOT)/libgourou.a
else
LDFLAGS += -lgourou
endif
@@ -17,10 +20,10 @@ endif
all: $(TARGETS)
acsmdownloader: drmprocessorclientimpl.cpp acsmdownloader.cpp
acsmdownloader: drmprocessorclientimpl.cpp acsmdownloader.cpp $(STATIC_DEP)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
adept_activate: drmprocessorclientimpl.cpp adept_activate.cpp
adept_activate: drmprocessorclientimpl.cpp adept_activate.cpp $(STATIC_DEP)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
clean:

View File

@@ -105,6 +105,11 @@ public:
filename = item->getMetadata("title");
if (filename == "")
filename = "output";
else
{
// Remove invalid characters
std::replace(filename.begin(), filename.end(), '/', '_');
}
}
else
filename = outputFile;

View File

@@ -116,7 +116,7 @@ std::string DRMProcessorClientImpl::sendHTTPRequest(const std::string& URL, cons
if (location.size() != 0)
{
GOUROU_LOG(gourou::DEBUG, "New location");
return sendHTTPRequest(location.constData(), POSTData, contentType);
return sendHTTPRequest(location.constData(), POSTData, contentType, responseHeaders);
}
if (reply->error() != QNetworkReply::NoError)