Skip to content

Commit a79d6f8

Browse files
committed
bump odrcore again; fix http
1 parent cb5007a commit a79d6f8

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

app/conanfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[requires]
2-
odrcore/5.0.0-pre3@
2+
odrcore/5.0.0-pre4
33

44
[generators]
55
CMakeToolchain

app/src/main/cpp/CoreWrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ Java_at_tomtasche_reader_background_CoreWrapper_hostFile(JNIEnv *env, jclass cla
287287
decodePreference.engine_priority = {odr::DecoderEngine::poppler, odr::DecoderEngine::wvware, odr::DecoderEngine::odr};
288288
odr::DecodedFile file = odr::open(inputPathCpp, decodePreference);
289289

290+
odr::HtmlConfig htmlConfig;
291+
htmlConfig.embed_images = false;
292+
htmlConfig.embed_shipped_resources = false;
293+
290294
try {
291295
s_server->serve_file(file, prefixCpp, odr::HtmlConfig());
292296
} catch (const std::exception &e) {

app/src/main/java/at/tomtasche/reader/background/CoreLoader.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Context;
44
import android.net.Uri;
55
import android.os.Handler;
6+
import android.util.Log;
67
import android.webkit.MimeTypeMap;
78

89
import java.io.File;
@@ -36,7 +37,11 @@ public CoreLoader(Context context, ConfigManager configManager, boolean doOoxml,
3637
@Override
3738
public void initialize(FileLoaderListener listener, Handler mainHandler, Handler backgroundHandler, AnalyticsManager analyticsManager, CrashManager crashManager) {
3839
if (doHttp) {
39-
CoreWrapper.createServer(context.getCacheDir().getAbsolutePath() + "/core");
40+
File serverCacheDir = new File(context.getCacheDir(), "core");
41+
if (!serverCacheDir.mkdirs()) {
42+
Log.e("CoreLoader", "Failed to create cache directory for CoreWrapper server: " + serverCacheDir.getAbsolutePath());
43+
}
44+
CoreWrapper.createServer(serverCacheDir.getAbsolutePath());
4045

4146
httpThread = new Thread(() -> {
4247
try {
@@ -117,11 +122,11 @@ private void translate(Options options, Result result) throws Exception {
117122
lastCoreOptions = coreOptions;
118123

119124
if (doHttp) {
120-
String prefix = "hi";
125+
String prefix = "odr";
121126
CoreWrapper.hostFile(prefix, coreOptions);
122127

123128
result.partTitles.add("document");
124-
result.partUris.add(Uri.parse("http://localhost:29665/file/" + prefix + "/document"));
129+
result.partUris.add(Uri.parse("http://localhost:29665/file/" + prefix + "/document.html"));
125130

126131
return;
127132
}

0 commit comments

Comments
 (0)