[tor-commits] [orbot/master] add support for updating Polipo config
n8fr8 at torproject.org
n8fr8 at torproject.org
Sat Jun 14 10:01:22 UTC 2014
commit af51290aa9074efadc73892ba1beff5510bc49c4
Author: Nathan Freitas <nathan at freitas.net>
Date: Fri Jun 13 13:51:28 2014 -0400
add support for updating Polipo config
---
.../android/service/TorResourceInstaller.java | 22 ++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java
index fa00b1e..9478384 100644
--- a/src/org/torproject/android/service/TorResourceInstaller.java
+++ b/src/org/torproject/android/service/TorResourceInstaller.java
@@ -149,6 +149,28 @@ public class TorResourceInstaller implements TorServiceConstants {
return true;
}
+ public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException
+ {
+
+ InputStream is;
+
+ Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
+
+ is = context.getResources().openRawResource(R.raw.torpolipo);
+ shell.add(new SimpleCommand(COMMAND_RM_FORCE + filePolipo.getAbsolutePath())).waitForFinish();
+ streamToFile(is,filePolipo, false, false);
+
+ if (extraLines != null && extraLines.length() > 0)
+ {
+ StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n');
+ streamToFile(sbis,filePolipo,true,false);
+ }
+
+ shell.close();
+
+ return true;
+ }
+
public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException
{
More information about the tor-commits
mailing list