-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from ApolloFoundation/dev
1.21.6
- Loading branch information
Showing
44 changed files
with
720 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.21.0 | ||
1.21.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# WARNING: java still bypasses the tor proxy when sending DNS queries and | ||
# this can reveal the fact that you are running Apl, however blocks and | ||
# transactions will be sent over tor only. Requires a tor proxy running | ||
# at localhost:9050. Set apl.shareMyAddress=false when using tor. | ||
|
||
if [ -x jre/bin/java ]; then | ||
JAVA=./jre/bin/java | ||
else | ||
JAVA=java | ||
fi | ||
|
||
unamestr=`uname` | ||
if [[ "$unamestr" == 'Linux' ]]; then | ||
|
||
cd secureTransport | ||
sudo ./runClient.sh | ||
cd .. | ||
fi | ||
|
||
|
||
|
||
${JAVA} -DsocksProxyHost=10.75.110.1 -DsocksProxyPort=1088 -Dapl.runtime.mode=desktop -Dapl.enablePeerUPnP=false -jar Apollo.jar | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/java/com/apollocurrency/aplwallet/apl/dbmodel/Option.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright © 2018 Apollo Foundation | ||
*/ | ||
|
||
package com.apollocurrency.aplwallet.apl.dbmodel; | ||
|
||
import com.apollocurrency.aplwallet.apl.Db; | ||
import org.slf4j.Logger; | ||
|
||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
import java.sql.PreparedStatement; | ||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
//TODO: Refactor as ORM | ||
|
||
public class Option { | ||
private static final Logger LOG = getLogger(Option.class); | ||
|
||
public static String get(String optionName) | ||
{ | ||
try (Connection con = Db.db.getConnection()) | ||
{ | ||
PreparedStatement stmt = con.prepareStatement("SELECT * FROM option WHERE name = ?"); | ||
stmt.setString(1, optionName); | ||
try (ResultSet rs = stmt.executeQuery()) { | ||
if (rs.next()) { | ||
return rs.getString("value"); | ||
} | ||
} | ||
} | ||
catch (SQLException e) | ||
{ | ||
LOG.error(e.getMessage()); | ||
} | ||
return null; | ||
} | ||
|
||
public static boolean set(String optionName, String optionValue) | ||
{ | ||
if (get(optionName) == null) | ||
{ | ||
try (Connection con = Db.db.getConnection()) | ||
{ | ||
PreparedStatement stmt = con.prepareStatement("INSERT INTO option (name, value) VALUES (?, ?)"); | ||
stmt.setString(1, optionName); | ||
stmt.setString(2, optionValue); | ||
stmt.execute(); | ||
} | ||
catch (SQLException e) | ||
{ | ||
LOG.error(e.getMessage()); | ||
} | ||
} | ||
else | ||
{ | ||
try (Connection con = Db.db.getConnection()) | ||
{ | ||
PreparedStatement stmt = con.prepareStatement("UPDATE option set value = ? WHERE name = ?"); | ||
stmt.setString(1, optionValue); | ||
stmt.setString(2, optionName); | ||
stmt.execute(); | ||
} | ||
catch (SQLException e) | ||
{ | ||
LOG.error(e.getMessage()); | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
public static boolean delete(String optionName) | ||
{ | ||
if (get(optionName) == null) | ||
{ | ||
return false; | ||
} | ||
else | ||
{ | ||
try (Connection con = Db.db.getConnection()) { | ||
PreparedStatement stmt = con.prepareStatement("DELETE FROM option WHERE name = ?"); | ||
stmt.setString(1, optionName); | ||
} | ||
catch (SQLException e) | ||
{ | ||
LOG.error(e.getMessage()); | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.