mirror of https://github.com/LeOS-GSI/LeOS-Genesis
parent
d238985734
commit
cf716b5f08
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,153 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!--Includes-->
|
||||||
|
<link rel="icon" href="../resources/images/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style/cs-help-dark.css" />
|
||||||
|
<link rel="stylesheet" href="../resources/style/cs-bootstrap.css">
|
||||||
|
|
||||||
|
<!--Javascripts-->
|
||||||
|
<script src="../resources/javascript/jquery.js"></script>
|
||||||
|
<script src="../resources/javascript/bootstrap.bundle.min.js"></script>
|
||||||
|
<script type="../resources/javascript/bootstrap.js"></script>
|
||||||
|
<script type="../resources/javascript/bootstrap.min.js"></script>
|
||||||
|
<script type="text/javascript" src="javascript/js-help.js"></script>
|
||||||
|
<script src="../resources/javascript/jquery.min.js"></script>
|
||||||
|
<script src="../resources/javascript/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<!--Meta Data-->
|
||||||
|
<title>Genesis Search Engine | Dark Web Based Search Engine</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="description" content="Darkweb or Deepweb Search Engine working on multiple layered network including i2p,onion and riddle. Optimized Searches with mobile support and seperate Mobile Apps">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<p class="hi_info hi_no_select">The following<strong> help manual</strong> is loaded from local cache. Connect to proxy for viewing latest help repository</p>
|
||||||
|
<div id="accordion">
|
||||||
|
<div class="card hi_card">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseZero">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 1 </span>Internet Connection Problem</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseZero" class="collapse show" data-parent="#accordion">
|
||||||
|
<div class="card-body hi_bullets">
|
||||||
|
<li>Checking the network cables and router</li>
|
||||||
|
<li>Reconnect to Wi-Fi</li>
|
||||||
|
<li>Restart phone or application</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseOne">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 2 </span> View Connection Status </strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseOne" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
To see connection status with Tor network GOTO
|
||||||
|
<br><br>Menu Icon (Top-Right) <span class="hi_arrow--color">➔</span> Settings <span class="hi_arrow--color">➔</span> Onion Proxy Status
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseTwo">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 3 </span> View Tor Logs </strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseTwo" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
You can view Tor logs to debug an issue. To do this GOTO
|
||||||
|
<br><br> Menu Icon (Top-Right) <span class="hi_arrow--color">➔</span> Orbot Logs
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseThree">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 4 </span> Help manual not loading</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseThree" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
This happens when we are unable to fetch help manual due to internet connection issue. It can also happen when ISP blocks some of our servers.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseFour">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 5 </span> Tor routing blocked by ISP</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseFour" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
Some times ISP blocks Tor network routing. This issue can be solved by enabling Tor Bridges. To do this GOTO
|
||||||
|
<br><br> Connection Screen <span class="hi_arrow--color">➔</span> Gear Icon <span class="hi_arrow--color">➔</span> Enable Bridges
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseFive">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 6 </span> Genesis not working in China</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseFive" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
Tor routing can be blocked in China even when you are using default bridges. This issue can be solved by connecting with Meek bridges. To do this GOTO
|
||||||
|
<br><br> Connection Screen <span class="hi_arrow--color">➔</span> Gear Icon <span class="hi_arrow--color">➔</span> Enable Bridges <span class="hi_arrow--color">➔</span> Customize bridges <span class="hi_arrow--color">➔</span> Meek-azure (China)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseSix">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 7 </span> Provide a custom bridges</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseSix" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
You can also provide custom bridges in Genesis. To do this GOTO
|
||||||
|
<br><br> Connection Screen <span class="hi_arrow--color">➔</span> Gear Icon <span class="hi_arrow--color">➔</span> Enable Bridges <span class="hi_arrow--color">➔</span> Customize bridges <span class="hi_arrow--color">➔</span> Paste custom bridge <span class="hi_arrow--color">➔</span> paste your bridge string
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card hi_card hi_card--margin-top">
|
||||||
|
<div class="card-header" data-toggle="collapse" href="#collapseSeven">
|
||||||
|
<a class="card-link">
|
||||||
|
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 8 </span> Use Genesis as a VPN </strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapseSeven" class="collapse" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
Genesis also provides a vpn from which you can secure data of other applications. To do this GOTO
|
||||||
|
<br><br> Connection Screen <span class="hi_arrow--color">➔</span> Gear Icon <span class="hi_arrow--color">➔</span> Enable VPN Service
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
body{
|
||||||
|
background-color : #1c1b21 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_logo_text{
|
||||||
|
max-width: 450px;
|
||||||
|
width: 65%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_info{
|
||||||
|
margin-top: 30px;
|
||||||
|
padding-left:15px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
padding-top: 10px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
height: auto;
|
||||||
|
color:#d9d9d9;
|
||||||
|
border-left: 5px solid #ff9933;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_bullets{
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_card{
|
||||||
|
cursor: pointer;
|
||||||
|
background: #121212 !important;
|
||||||
|
color:#cccccc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_card_link{
|
||||||
|
color: #6699cc;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_issue--color{
|
||||||
|
color: #336699;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_arrow--color{
|
||||||
|
color: #4080bf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_card--margin-top{
|
||||||
|
margin-top: 2%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_no_select {
|
||||||
|
-webkit-touch-callout: none; /* iOS Safari */
|
||||||
|
-webkit-user-select: none; /* Safari */
|
||||||
|
-khtml-user-select: none; /* Konqueror HTML */
|
||||||
|
-moz-user-select: none; /* Firefox */
|
||||||
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||||
|
user-select: none; /* Non-prefixed version, currently
|
||||||
|
supported by Chrome and Opera */
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
var Commands = {
|
var Commands = {
|
||||||
onLoadReferenceWebsites : "onLoadReferenceWebsites",
|
onLoadReferenceWebsites : "onLoadReferenceWebsites",
|
||||||
|
onClickReferenceWebsite : "onClickReferenceWebsite"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Links*/
|
/*Links*/
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
/*Homepage Classes*/
|
||||||
|
|
||||||
|
class homepage {
|
||||||
|
|
||||||
|
mLastLinkID = "";
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
onLoadReferenceWebsites(){
|
||||||
|
document.getElementById('mReferenceWebsites').className = 'hide';
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoadReferenceWebsiteContent(mJson){
|
||||||
|
var mResponseJson = mJson;
|
||||||
|
var mOBJ = JSON.parse(mResponseJson);
|
||||||
|
var mReferenceHTML = strings.emptyString;
|
||||||
|
|
||||||
|
var mIDCounter = 0;
|
||||||
|
Object.keys(mOBJ).forEach(function(key) {
|
||||||
|
var mObject = mOBJ[key];
|
||||||
|
mReferenceHTML += '<div id="'+ mIDCounter +'" class="hi_reference" onclick="onTriggerScriptHandler(\'onClickReferenceWebsite\',[\''+ mIDCounter +'\',\''+ mObject[ReferenceWebsitesDataID.mUrl] +'\'])"><div class="hi_reference_website content-heading"> <div class="hi_image_container"><img class="hi_reference_image" alt="❏" src="'+mObject[ReferenceWebsitesDataID.mIcon]+'"/></div><h6 class="hi_reference_header">'+mObject[ReferenceWebsitesDataID.mHeader]+'</h5><p class="hi_reference_body">'+mObject[ReferenceWebsitesDataID.mBody]+'</p></div></div>'
|
||||||
|
mIDCounter+=1;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var mReferenceID = document.getElementById(UIID.mReferenceWebsites);
|
||||||
|
mReferenceID.innerHTML = mReferenceHTML;
|
||||||
|
|
||||||
|
document.getElementById('mReferenceWebsites').className = 'show';
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoadStaticWebpage(pData){
|
||||||
|
if(this.mLastLinkID.localeCompare("") != 0){
|
||||||
|
document.getElementById(this.mLastLinkID).style.backgroundColor = "#1c1b21";
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById(pData[0]).style.backgroundColor = "#0c0b0e";
|
||||||
|
window.open(pData[1],"_self");
|
||||||
|
this.mLastLinkID = pData[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Ajax Request*/
|
||||||
|
|
||||||
|
onParseReferenceWebsites() {
|
||||||
|
var $_GET=[];
|
||||||
|
decodeURIComponent(window.location.href).replace(/[?&]+([^=&]+)=([^&]*)/gi,function(a,name,value){$_GET[name]=value;});
|
||||||
|
|
||||||
|
setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
|
||||||
|
setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, $_GET[GET.pData]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let mHomepageLoader = new homepage();
|
||||||
|
|
||||||
|
/*Helper Classes Manager*/
|
||||||
|
function onTriggerScriptHandler(pCommand,pData) {
|
||||||
|
if(pCommand == Commands.onLoadReferenceWebsites){
|
||||||
|
mHomepageLoader.onParseReferenceWebsites()
|
||||||
|
}
|
||||||
|
else if(pCommand == Commands.onClickReferenceWebsite){
|
||||||
|
mHomepageLoader.onLoadStaticWebpage(pData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Default Loaders*/
|
||||||
|
$(window).on('load', function() {
|
||||||
|
/* For Local Testing */
|
||||||
|
|
||||||
|
// var mResponseJson = '[{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://wikileaks.org/static/img/wl-logo.png", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"}]';
|
||||||
|
// setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
|
||||||
|
// setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, mResponseJson);
|
||||||
|
|
||||||
|
onTriggerScriptHandler(Commands.onLoadReferenceWebsites, null)
|
||||||
|
});
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
class homepage {
|
class homepage {
|
||||||
|
|
||||||
|
mLastLinkID = "";
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +16,14 @@ class homepage {
|
||||||
|
|
||||||
onLoadReferenceWebsiteContent(mJson){
|
onLoadReferenceWebsiteContent(mJson){
|
||||||
var mResponseJson = mJson;
|
var mResponseJson = mJson;
|
||||||
var obj = JSON.parse(mResponseJson);
|
var mOBJ = JSON.parse(mResponseJson);
|
||||||
var mReferenceHTML = strings.emptyString;
|
var mReferenceHTML = strings.emptyString;
|
||||||
|
|
||||||
Object.keys(obj).forEach(function(key) {
|
var mIDCounter = 0;
|
||||||
var mObject = obj[key];
|
Object.keys(mOBJ).forEach(function(key) {
|
||||||
mReferenceHTML += '<div class="hi_reference" onclick="location.href=\' ' + mObject[ReferenceWebsitesDataID.mUrl] + ' \';"><div class="hi_reference_website content-heading"> <div class="hi_image_container"><img class="hi_reference_image" alt="❏" src="'+mObject[ReferenceWebsitesDataID.mIcon]+'"/></div><h6 class="hi_reference_header">'+mObject[ReferenceWebsitesDataID.mHeader]+'</h5><p class="hi_reference_body">'+mObject[ReferenceWebsitesDataID.mBody]+'</p></div></div>'
|
var mObject = mOBJ[key];
|
||||||
|
mReferenceHTML += '<div id="'+ mIDCounter +'" class="hi_reference" onclick="onTriggerScriptHandler(\'onClickReferenceWebsite\',[\''+ mIDCounter +'\',\''+ mObject[ReferenceWebsitesDataID.mUrl] +'\'])"><div class="hi_reference_website content-heading"> <div class="hi_image_container"><img class="hi_reference_image" alt="❏" src="'+mObject[ReferenceWebsitesDataID.mIcon]+'"/></div><h6 class="hi_reference_header">'+mObject[ReferenceWebsitesDataID.mHeader]+'</h5><p class="hi_reference_body">'+mObject[ReferenceWebsitesDataID.mBody]+'</p></div></div>'
|
||||||
|
mIDCounter+=1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +33,16 @@ class homepage {
|
||||||
document.getElementById('mReferenceWebsites').className = 'show';
|
document.getElementById('mReferenceWebsites').className = 'show';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoadStaticWebpage(pData){
|
||||||
|
if(this.mLastLinkID.localeCompare("") != 0){
|
||||||
|
document.getElementById(this.mLastLinkID).style.backgroundColor = "#ffffff";
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById(pData[0]).style.backgroundColor = "#f2f2f2";
|
||||||
|
window.open(pData[1],"_self");
|
||||||
|
this.mLastLinkID = pData[0];
|
||||||
|
}
|
||||||
|
|
||||||
/*Ajax Request*/
|
/*Ajax Request*/
|
||||||
|
|
||||||
onParseReferenceWebsites() {
|
onParseReferenceWebsites() {
|
||||||
|
@ -44,18 +58,22 @@ class homepage {
|
||||||
let mHomepageLoader = new homepage();
|
let mHomepageLoader = new homepage();
|
||||||
|
|
||||||
/*Helper Classes Manager*/
|
/*Helper Classes Manager*/
|
||||||
function onTriggerScriptHandler(pCommand) {
|
function onTriggerScriptHandler(pCommand,pData) {
|
||||||
if(pCommand == Commands.onLoadReferenceWebsites){
|
if(pCommand == Commands.onLoadReferenceWebsites){
|
||||||
mHomepageLoader.onParseReferenceWebsites()
|
mHomepageLoader.onParseReferenceWebsites()
|
||||||
}
|
}
|
||||||
|
else if(pCommand == Commands.onClickReferenceWebsite){
|
||||||
|
mHomepageLoader.onLoadStaticWebpage(pData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Default Loaders*/
|
/*Default Loaders*/
|
||||||
$(window).on('load', function() {
|
$(window).on('load', function() {
|
||||||
/* For Local Testing */
|
/* For Local Testing */
|
||||||
//var mResponseJson = '[{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://wikileaks.org/static/img/wl-logo.png", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"}]';
|
|
||||||
//setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
|
|
||||||
//setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, mResponseJson);
|
|
||||||
|
|
||||||
onTriggerScriptHandler(Commands.onLoadReferenceWebsites)
|
// var mResponseJson = '[{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://wikileaks.org/static/img/wl-logo.png", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"}]';
|
||||||
|
// setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
|
||||||
|
// setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, mResponseJson);
|
||||||
|
|
||||||
|
onTriggerScriptHandler(Commands.onLoadReferenceWebsites, null)
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
.lh_light_background{
|
||||||
|
background-color: #1c1b21 !important;
|
||||||
|
color:#cccccc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.lh_light_header__catagory_image {
|
||||||
|
display : none
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.lh_light_header__catagory_bold_mobile {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #cccccc !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lh_light_header{
|
||||||
|
color:#000000;
|
||||||
|
text-align: right;
|
||||||
|
padding-top: 0px;
|
||||||
|
border-bottom-color:#000000 !important;
|
||||||
|
padding-top: 11px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
border-style: solid;border-right-width: 0;
|
||||||
|
border-left-width: 0;border-top-width: 0;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.lh_light_header {
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#lh_light_header_identifier {
|
||||||
|
background-color:#ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
#lh_light_header_identifier {
|
||||||
|
background-color:#ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lh_light_header__bold{
|
||||||
|
font-weight: bold;
|
||||||
|
color: #1967d2 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lh_light_header__catagory-spacing-right{
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lh_light_header__catagory{
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
color: black;
|
||||||
|
padding: 13px 9px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*light-header events*/
|
||||||
|
.lh_light_header__catagory:hover{
|
||||||
|
color: darkslategray;
|
||||||
|
text-decoration: none !important;
|
||||||
|
border-bottom: 4px solid lightslategray;
|
||||||
|
background: whitesmoke;
|
||||||
|
}
|
||||||
|
.lh_light_header__catagory:focus{
|
||||||
|
color: darkslategray;
|
||||||
|
text-decoration: none !important;
|
||||||
|
border-bottom: 4px solid lightslategray;
|
||||||
|
background: whitesmoke;
|
||||||
|
}
|
|
@ -1,14 +1,4 @@
|
||||||
/*global styles*/
|
/*global styles*/
|
||||||
.line-style {
|
|
||||||
border: 0;
|
|
||||||
height: 1px;
|
|
||||||
background-image: -webkit-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
|
||||||
background-image: -moz-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
|
||||||
background-image: -ms-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
|
||||||
background-image: -o-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
|
||||||
width:40% !important;
|
|
||||||
max-width:500px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* visited link */
|
/* visited link */
|
||||||
a:visited {
|
a:visited {
|
||||||
|
|
|
@ -0,0 +1,329 @@
|
||||||
|
/*Search*/
|
||||||
|
.line-style {
|
||||||
|
border: 0;
|
||||||
|
height: 1px;
|
||||||
|
background-image: -webkit-linear-gradient(left, #212121, #000000, #212121);
|
||||||
|
background-image: -moz-linear-gradient(left, #212121, #000000, #212121);
|
||||||
|
background-image: -ms-linear-gradient(left, #212121, #000000, #212121);
|
||||||
|
background-image: -o-linear-gradient(left, #212121, #000000, #212121);
|
||||||
|
width:40% !important;
|
||||||
|
max-width:500px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_background{
|
||||||
|
background-color : #1c1b21 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear_selection{
|
||||||
|
moz-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-user-select:none;
|
||||||
|
user-select:none;
|
||||||
|
-o-user-select:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#hi_search_container {
|
||||||
|
margin-top:15vh;
|
||||||
|
margin-bottom: -25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
#hi_search_container {
|
||||||
|
margin-top:9vh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_logo_text{
|
||||||
|
max-width: 450px;
|
||||||
|
width: 65%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
margin-top: -20px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hp_logo_text {
|
||||||
|
max-width: 380px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_logo_image{
|
||||||
|
max-width: 150px;
|
||||||
|
width: 30%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 00px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hi_logo_image {
|
||||||
|
max-width: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__logo{
|
||||||
|
text-align: center;
|
||||||
|
color: lightblue;
|
||||||
|
margin-bottom: -17px;
|
||||||
|
font-style: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
line-height: 26px;
|
||||||
|
font-family: helvetica, monospace;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__search-box{
|
||||||
|
border-radius: 6px !important;
|
||||||
|
align-self: center;
|
||||||
|
height:42px !important;
|
||||||
|
outline: none;
|
||||||
|
color:#cccccc !important;
|
||||||
|
border-color: #3c3946 !important;
|
||||||
|
width:91% !important;
|
||||||
|
max-width: 575px;
|
||||||
|
display:block;
|
||||||
|
font:16px arial,sans-serif;
|
||||||
|
color: black;
|
||||||
|
padding-left:22px;
|
||||||
|
margin: 0 auto 5px;
|
||||||
|
background: #474554 !important;
|
||||||
|
|
||||||
|
box-shadow: 0 1px 1px 0 #535062;
|
||||||
|
-webkit-transition: .0s;
|
||||||
|
-moz-transition: .0s;
|
||||||
|
-o-transition: .0s;
|
||||||
|
transition: .0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_reference{
|
||||||
|
align-self: center;
|
||||||
|
height:auto;
|
||||||
|
padding: 10px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
border-radius: 6px;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
border: 1px solid #28262c;
|
||||||
|
box-shadow: 0 3px 3px 0 #0f0e11;
|
||||||
|
width:91% !important;
|
||||||
|
max-width: 575px;
|
||||||
|
display:block;
|
||||||
|
font:16px arial,sans-serif;
|
||||||
|
color: black;
|
||||||
|
margin: 0 auto 0px;
|
||||||
|
margin-top: -15px;
|
||||||
|
margin-bottom: 35px;
|
||||||
|
|
||||||
|
-webkit-transition: .0s;
|
||||||
|
-moz-transition: .0s;
|
||||||
|
-o-transition: .0s;
|
||||||
|
transition: .0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hi_search__search-box {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__search-box:hover {
|
||||||
|
box-shadow: 0 4px 4px -1.5px #1c1b21;
|
||||||
|
-webkit-transition: .07s linear 0s;
|
||||||
|
-moz-transition: .07s linear 0s;
|
||||||
|
-o-transition: .07s linear 0s;
|
||||||
|
transition: .07s linear 0s
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__search-box:focus{
|
||||||
|
box-shadow: 0 4px 4px -1.5px #1c1b21 !important;
|
||||||
|
-webkit-transition: .07s linear 0s !important;;
|
||||||
|
-moz-transition: .07s linear 0s !important;;
|
||||||
|
-o-transition: .07s linear 0s !important;;
|
||||||
|
transition: .07s linear 0s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*footer-bar style*/
|
||||||
|
.hi_search__logo{
|
||||||
|
margin:0 auto;
|
||||||
|
display:block;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 400px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__language-text{
|
||||||
|
font-size: 14px;
|
||||||
|
text-align:center;
|
||||||
|
margin-top: 25px;
|
||||||
|
padding-top: 3px
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hi_search__language-text {
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__language-name{
|
||||||
|
color:#7173f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__search-button{
|
||||||
|
margin-top: 12px;
|
||||||
|
background-color:#f2f2f2;
|
||||||
|
height: 35px;
|
||||||
|
width:110%;
|
||||||
|
text-align:center;
|
||||||
|
max-width: 130px;
|
||||||
|
border-width: 0;
|
||||||
|
color:#6c6c6c;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hi_search__search-button {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__button-container{
|
||||||
|
display:block;
|
||||||
|
text-align: center;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_search__search-button--left-spacing{
|
||||||
|
margin-left: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Homepage Search Buttons */
|
||||||
|
.hi_search__search-button:hover{
|
||||||
|
color : #000000;
|
||||||
|
background: linear-gradient(#f7f7f7,#f1f1f1);
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
border-color:#C4C4C4;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#hi_search_button {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
#hi_search_button {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#hi_lucky_button {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
#hi_lucky_button {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_reference_website{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_container_size
|
||||||
|
{
|
||||||
|
min-height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 943px) {
|
||||||
|
.hi_container_size {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.hi_loader {
|
||||||
|
border: 4px solid #f3f3f3;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-top: 4px solid #3498db;
|
||||||
|
width: 30px;
|
||||||
|
float: left;
|
||||||
|
height: 30px;
|
||||||
|
-webkit-animation: spin 2s linear infinite; /* Safari */
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_loader_item{
|
||||||
|
height:10px;
|
||||||
|
border-width:0;
|
||||||
|
color:gray;
|
||||||
|
background-color:#0d0d0d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_reference_body{
|
||||||
|
margin-left: 0px;
|
||||||
|
line-height: 18px;
|
||||||
|
margin-top: 15px;
|
||||||
|
color: #e6e6e6;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_reference_header{
|
||||||
|
margin-left: 50px;
|
||||||
|
padding-left: 10px;
|
||||||
|
border-left: 4px solid #161617 !important;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #8cb3d9;
|
||||||
|
height: 40px;
|
||||||
|
padding-top:9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_image_container{
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 100px;
|
||||||
|
float: left;
|
||||||
|
background-color: #1a2f42;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hi_reference_image{
|
||||||
|
max-width: 22px; /* Or whatever */
|
||||||
|
max-height: 22px; /* Or whatever */
|
||||||
|
margin: auto; /* Magic! */
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
float:left;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #bfbfbf;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
line-style
|
||||||
|
/* Safari */
|
||||||
|
@-webkit-keyframes spin {
|
||||||
|
0% { -webkit-transform: rotate(0deg); }
|
||||||
|
100% { -webkit-transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.show {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 500ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 350ms;
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
/*Search*/
|
/*Search*/
|
||||||
|
.line-style {
|
||||||
|
border: 0;
|
||||||
|
height: 1px;
|
||||||
|
background-image: -webkit-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -moz-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -ms-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -o-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
width:40% !important;
|
||||||
|
max-width:500px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.clear_selection{
|
.clear_selection{
|
||||||
moz-user-select: none;
|
moz-user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
|
|
@ -80,8 +80,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
onVerifyLongSelectedURL();
|
onVerifyLongSelectedURL();
|
||||||
|
|
||||||
ArrayList<bookmarkRowModel> p_model_list = mPassedList;
|
ArrayList<bookmarkRowModel> p_model_list = mPassedList;
|
||||||
int m_date_state = -1;
|
|
||||||
int m_last_day = -1;
|
|
||||||
for(int counter = 0; counter< p_model_list.size(); counter++){
|
for(int counter = 0; counter< p_model_list.size(); counter++){
|
||||||
|
|
||||||
if(pFilterEnabled){
|
if(pFilterEnabled){
|
||||||
|
@ -90,40 +88,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(p_model_list.get(counter).getDate());
|
|
||||||
|
|
||||||
int m_date_1 = cal.get(Calendar.DAY_OF_YEAR);
|
|
||||||
cal.setTime(Calendar.getInstance().getTime());
|
|
||||||
int m_date_2 = cal.get(Calendar.DAY_OF_YEAR);
|
|
||||||
|
|
||||||
float diff = m_date_2-m_date_1;
|
|
||||||
|
|
||||||
if(diff==0){
|
|
||||||
if(m_date_state!=1 && p_model_list.get(counter).getID()!=-2){
|
|
||||||
this.mModelList.add(new bookmarkRowModel("Today ",null,-1));
|
|
||||||
mRealID.add(m_real_counter);
|
|
||||||
mRealIndex.add(m_real_counter);
|
|
||||||
m_date_state = 1;
|
|
||||||
}
|
|
||||||
}else if (diff>=1){
|
|
||||||
|
|
||||||
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
|
|
||||||
m_last_day = (int)(Math.ceil(diff/7)*7);
|
|
||||||
this.mModelList.add(new bookmarkRowModel("Last " + m_last_day + " Days",null,-1));
|
|
||||||
mRealID.add(m_real_counter);
|
|
||||||
mRealIndex.add(m_real_counter);
|
|
||||||
m_date_state = 2;
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if(m_date_state!=3){
|
|
||||||
this.mModelList.add(new bookmarkRowModel("Older ",null,-1));
|
|
||||||
mRealID.add(m_real_counter);
|
|
||||||
mRealIndex.add(m_real_counter);
|
|
||||||
m_date_state = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mRealID.add(p_model_list.get(counter).getID());
|
mRealID.add(p_model_list.get(counter).getID());
|
||||||
mRealIndex.add(m_real_counter);
|
mRealIndex.add(m_real_counter);
|
||||||
this.mModelList.add(p_model_list.get(counter));
|
this.mModelList.add(p_model_list.get(counter));
|
||||||
|
@ -179,7 +143,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mLongSelectedDate.clear();
|
mLongSelectedDate.clear();
|
||||||
mLongSelectedIndex.clear();
|
mLongSelectedIndex.clear();
|
||||||
mLongSelectedID.clear();
|
mLongSelectedID.clear();
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSelectedURL(){
|
private String getSelectedURL(){
|
||||||
|
@ -227,7 +191,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
if(!pIsForced){
|
if(!pIsForced){
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
mLongSelectedDate.add(pDate);
|
mLongSelectedDate.add(pDate);
|
||||||
mLongSelectedIndex.add(pUrl);
|
mLongSelectedIndex.add(pUrl);
|
||||||
|
@ -254,7 +218,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mLongSelectedIndex.remove(pUrl);
|
mLongSelectedIndex.remove(pUrl);
|
||||||
mLongSelectedID.remove((Integer) pId);
|
mLongSelectedID.remove((Integer) pId);
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
onVerifyLongSelectedURL();
|
onVerifyLongSelectedURL();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -375,7 +339,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
||||||
boolean mDateVerify = false;
|
boolean mDateVerify = false;
|
||||||
if(mPassedList.size()>0){
|
if(mPassedList.size()>0){
|
||||||
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getDescription()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getDescription()==null || mCurrentList.size()==pIndex+1)){
|
if(mCurrentList.size()>0 && (mCurrentList.size()>pIndex+1 || mCurrentList.size()==pIndex+1)){
|
||||||
mDateVerify = true;
|
mDateVerify = true;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
@ -386,11 +350,9 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
int size = mCurrentList.size();
|
int size = mCurrentList.size();
|
||||||
|
|
||||||
if(mDateVerify){
|
if(mDateVerify){
|
||||||
notifyItemRemoved(pIndex-1);
|
notifyItemRemoved(pIndex);
|
||||||
mCurrentList.remove(pIndex-1);
|
mCurrentList.remove(pIndex);
|
||||||
notifyItemRemoved(pIndex-1);
|
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
||||||
mCurrentList.remove(pIndex-1);
|
|
||||||
notifyItemRangeChanged(pIndex-1, mCurrentList.size());
|
|
||||||
}else {
|
}else {
|
||||||
mCurrentList.remove(pIndex);
|
mCurrentList.remove(pIndex);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class bookmarkController extends AppCompatActivity
|
||||||
private bookmarkAdapter mbookmarkAdapter;
|
private bookmarkAdapter mbookmarkAdapter;
|
||||||
private LinearLayout mHeaderContainer;
|
private LinearLayout mHeaderContainer;
|
||||||
private TextView mTitle;
|
private TextView mTitle;
|
||||||
|
|
||||||
/*Private Views*/
|
/*Private Views*/
|
||||||
|
|
||||||
private ImageView mEmptyListNotification;
|
private ImageView mEmptyListNotification;
|
||||||
|
|
|
@ -283,14 +283,14 @@ class bookmarkViewController
|
||||||
float width = height / 3;
|
float width = height / 3;
|
||||||
|
|
||||||
if(pDX > 0){
|
if(pDX > 0){
|
||||||
mPainter.setColor(ContextCompat.getColor(mContext, R.color.c_list_item_current));
|
mPainter.setColor(ContextCompat.getColor(mContext, R.color.holo_gray_light_row));
|
||||||
RectF background = new RectF((float) itemView.getLeft(), (float) itemView.getTop(), pDX,(float) itemView.getBottom());
|
RectF background = new RectF((float) itemView.getLeft(), (float) itemView.getTop(), pDX,(float) itemView.getBottom());
|
||||||
pCanvas.drawRect(background, mPainter);
|
pCanvas.drawRect(background, mPainter);
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
||||||
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
||||||
} else {
|
} else {
|
||||||
mPainter.setColor(ContextCompat.getColor(mContext, R.color.c_list_item_current));
|
mPainter.setColor(ContextCompat.getColor(mContext, R.color.holo_gray_light_row));
|
||||||
RectF background = new RectF((float) itemView.getRight() + pDX, (float) itemView.getTop(),(float) itemView.getRight(), (float) itemView.getBottom());
|
RectF background = new RectF((float) itemView.getRight() + pDX, (float) itemView.getTop(),(float) itemView.getRight(), (float) itemView.getBottom());
|
||||||
pCanvas.drawRect(background, mPainter);
|
pCanvas.drawRect(background, mPainter);
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
|
|
|
@ -4,14 +4,28 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
|
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.landingManager.landingController;
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
public class externalNavigationController extends Activity {
|
public class externalNavigationController extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
if(status.sSettingIsAppStarted){
|
||||||
|
finish();
|
||||||
|
Uri data = externalNavigationController.this.getIntent().getData();
|
||||||
|
activityContextManager.getInstance().getHomeController().onLoadURL(data.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
setContentView(R.layout.home_view);
|
setContentView(R.layout.home_view);
|
||||||
Intent intent = new Intent(this.getIntent());
|
Intent intent = new Intent(this.getIntent());
|
||||||
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
|
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
|
||||||
|
|
|
@ -218,7 +218,12 @@ public class helpController extends AppCompatActivity {
|
||||||
if(!status.sSettingIsAppStarted){
|
if(!status.sSettingIsAppStarted){
|
||||||
activityContextManager.getInstance().getHomeController().onStartApplication(null);
|
activityContextManager.getInstance().getHomeController().onStartApplication(null);
|
||||||
}
|
}
|
||||||
activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE);
|
|
||||||
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(this)){
|
||||||
|
activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE);
|
||||||
|
}else {
|
||||||
|
activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
activityContextManager.getInstance().onClearStack();
|
activityContextManager.getInstance().onClearStack();
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
if(mDateVerify){
|
if(mDateVerify){
|
||||||
notifyItemRemoved(m_counter_inner-1);
|
notifyItemRemoved(m_counter_inner-1);
|
||||||
mCurrentList.remove(m_counter_inner-1);
|
mCurrentList.remove(m_counter_inner-1);
|
||||||
//notifyItemRemoved(m_counter_inner-1);
|
|
||||||
//mCurrentList.remove(m_counter_inner-1);
|
|
||||||
notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size());
|
notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size());
|
||||||
}else {
|
}else {
|
||||||
notifyItemRemoved(m_counter_inner);
|
notifyItemRemoved(m_counter_inner);
|
||||||
|
@ -183,7 +181,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mLongSelectedDate.clear();
|
mLongSelectedDate.clear();
|
||||||
mLongSelectedIndex.clear();
|
mLongSelectedIndex.clear();
|
||||||
mLongSelectedID.clear();
|
mLongSelectedID.clear();
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSelectedURL(){
|
private String getSelectedURL(){
|
||||||
|
@ -231,7 +229,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
}
|
}
|
||||||
if(!pIsForced){
|
if(!pIsForced){
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
// notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
mLongSelectedDate.add(pDate);
|
mLongSelectedDate.add(pDate);
|
||||||
mLongSelectedIndex.add(pUrl);
|
mLongSelectedIndex.add(pUrl);
|
||||||
|
@ -258,7 +256,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mLongSelectedIndex.remove(pUrl);
|
mLongSelectedIndex.remove(pUrl);
|
||||||
mLongSelectedID.remove((Integer) pId);
|
mLongSelectedID.remove((Integer) pId);
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
onVerifyLongSelectedURL();
|
onVerifyLongSelectedURL();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -384,7 +382,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
mCurrentList.clear();
|
mCurrentList.clear();
|
||||||
notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int size = mCurrentList.size();
|
int size = mCurrentList.size();
|
||||||
|
@ -402,6 +400,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
||||||
notifyItemChanged(mCurrentList.size()-1);
|
notifyItemChanged(mCurrentList.size()-1);
|
||||||
}
|
}
|
||||||
|
initializeModelWithDate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*View Holder Extensions*/
|
/*View Holder Extensions*/
|
||||||
|
|
|
@ -280,14 +280,14 @@ class historyViewController
|
||||||
float width = height / 3;
|
float width = height / 3;
|
||||||
|
|
||||||
if(pDX > 0){
|
if(pDX > 0){
|
||||||
mPainter.setColor(ContextCompat.getColor(mContext, R.color.c_list_item_current));
|
mPainter.setColor(ContextCompat.getColor(mContext, R.color.holo_gray_light_row));
|
||||||
RectF background = new RectF((float) itemView.getLeft(), (float) itemView.getTop(), pDX,(float) itemView.getBottom());
|
RectF background = new RectF((float) itemView.getLeft(), (float) itemView.getTop(), pDX,(float) itemView.getBottom());
|
||||||
pCanvas.drawRect(background, mPainter);
|
pCanvas.drawRect(background, mPainter);
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
||||||
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
||||||
} else {
|
} else {
|
||||||
mPainter.setColor(ContextCompat.getColor(mContext, R.color.c_list_item_current));
|
mPainter.setColor(ContextCompat.getColor(mContext, R.color.holo_gray_light_row));
|
||||||
RectF background = new RectF((float) itemView.getRight() + pDX, (float) itemView.getTop(),(float) itemView.getRight(), (float) itemView.getBottom());
|
RectF background = new RectF((float) itemView.getRight() + pDX, (float) itemView.getTop(),(float) itemView.getRight(), (float) itemView.getBottom());
|
||||||
pCanvas.drawRect(background, mPainter);
|
pCanvas.drawRect(background, mPainter);
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
|
|
|
@ -72,7 +72,11 @@ public class geckoClients
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValidateInitializeFromStartup(){
|
public void onValidateInitializeFromStartup(){
|
||||||
mSession.onValidateInitializeFromStartup();
|
boolean mStatus = mSession.onValidateInitializeFromStartup();
|
||||||
|
if(mStatus){
|
||||||
|
loadURL(mSession.getCurrentURL());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onGetInitializeFromStartup(){
|
public boolean onGetInitializeFromStartup(){
|
||||||
|
@ -184,18 +188,27 @@ public class geckoClients
|
||||||
public void loadURL(String url) {
|
public void loadURL(String url) {
|
||||||
if(mSession.onGetInitializeFromStartup()){
|
if(mSession.onGetInitializeFromStartup()){
|
||||||
mSession.initURL(url);
|
mSession.initURL(url);
|
||||||
if(url.startsWith("https://boogle.store?pG") || url.endsWith("boogle.store") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED)){
|
if(url.startsWith("https://boogle.store/?pG") || url.startsWith("https://boogle.store?pG") || url.endsWith("boogle.store") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED)){
|
||||||
try{
|
try{
|
||||||
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
|
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
|
||||||
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(context)){
|
||||||
mSession.loadUri(mURL);
|
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
|
||||||
|
mSession.loadUri(mURL);
|
||||||
|
}else {
|
||||||
|
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
|
||||||
|
mSession.loadUri(mURL);
|
||||||
|
}
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB)){
|
}else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB)){
|
||||||
try{
|
try{
|
||||||
mSession.initURL(constants.CONST_GENESIS_HELP_URL);
|
mSession.initURL(constants.CONST_GENESIS_HELP_URL);
|
||||||
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE);
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(context)){
|
||||||
|
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE);
|
||||||
|
}else {
|
||||||
|
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
|
||||||
|
}
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -276,10 +289,6 @@ public class geckoClients
|
||||||
loadURL(mSession.getCurrentURL());
|
loadURL(mSession.getCurrentURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReloadStatic(){
|
|
||||||
mSession.loadUri(mSession.getCurrentURL());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void manual_download(String url, AppCompatActivity context){
|
public void manual_download(String url, AppCompatActivity context){
|
||||||
Uri downloadURL = Uri.parse(url);
|
Uri downloadURL = Uri.parse(url);
|
||||||
File f = new File(url);
|
File f = new File(url);
|
||||||
|
|
|
@ -61,6 +61,7 @@ import java.util.Objects;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL;
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK;
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
||||||
|
@ -120,12 +121,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
return mIsLoaded;
|
return mIsLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValidateInitializeFromStartup(){
|
public boolean onValidateInitializeFromStartup(){
|
||||||
if(!mIsLoaded){
|
if(!mIsLoaded){
|
||||||
mIsLoaded = true;
|
mIsLoaded = true;
|
||||||
initURL(mCurrentURL);
|
initURL(mCurrentURL);
|
||||||
loadUri(mCurrentURL);
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFileUploadRequest(int resultCode, Intent data){
|
void onFileUploadRequest(int resultCode, Intent data){
|
||||||
|
@ -276,7 +278,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRedrawPixel(){
|
public void onRedrawPixel(){
|
||||||
event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme), dataEnums.eTabCommands.M_UPDATE_PIXEL);
|
event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*History Delegate*/
|
/*History Delegate*/
|
||||||
|
@ -306,11 +308,15 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
if(!mCurrentTitle.equals("loading")){
|
if(!mCurrentTitle.equals("loading")){
|
||||||
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history);
|
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history);
|
||||||
}
|
}
|
||||||
if(newUrl.startsWith(CONST_GENESIS_URL_CACHED)){
|
if(newUrl.startsWith(CONST_GENESIS_URL_CACHED) || newUrl.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
|
||||||
mCurrentURL = constants.CONST_GENESIS_DOMAIN_URL;
|
mCurrentURL = constants.CONST_GENESIS_DOMAIN_URL;
|
||||||
}
|
}
|
||||||
else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
|
else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
|
||||||
mCurrentURL = constants.CONST_GENESIS_HELP_URL;
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
|
||||||
|
mCurrentURL = constants.CONST_GENESIS_HELP_URL;
|
||||||
|
}else {
|
||||||
|
mCurrentURL = constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
mCurrentURL = newUrl;
|
mCurrentURL = newUrl;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +339,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
|
|
||||||
public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) {
|
public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) {
|
||||||
mPreviousErrorPage = false;
|
mPreviousErrorPage = false;
|
||||||
if(!var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && var1.uri.startsWith("https://boogle.store") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){
|
if(!var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("https://boogle.store") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){
|
||||||
String mVerificationURL = setGenesisVerificationToken(var1.uri);
|
String mVerificationURL = setGenesisVerificationToken(var1.uri);
|
||||||
initURL(mVerificationURL);
|
initURL(mVerificationURL);
|
||||||
loadUri(mVerificationURL);
|
loadUri(mVerificationURL);
|
||||||
|
@ -362,10 +368,16 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
return GeckoResult.fromValue(AllowOrDeny.DENY);
|
return GeckoResult.fromValue(AllowOrDeny.DENY);
|
||||||
}
|
}
|
||||||
else if(!var1.uri.equals("about:blank")){
|
else if(!var1.uri.equals("about:blank")){
|
||||||
if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED)){
|
if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
|
||||||
mCurrentURL = constants.CONST_GENESIS_DOMAIN_URL;
|
mCurrentURL = constants.CONST_GENESIS_DOMAIN_URL;
|
||||||
}else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
|
}else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
|
||||||
mCurrentURL = constants.CONST_GENESIS_HELP_URL;
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
|
||||||
|
mCurrentURL = constants.CONST_GENESIS_HELP_URL;
|
||||||
|
}else {
|
||||||
|
mCurrentURL = constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
mCurrentURL = var1.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy);
|
event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy);
|
||||||
|
@ -377,7 +389,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
if(mCurrentURL.contains("boogle.store")){
|
if(mCurrentURL.contains("boogle.store")){
|
||||||
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update_forced);
|
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update_forced);
|
||||||
}
|
}
|
||||||
mCurrentURL = var1.uri;
|
|
||||||
|
|
||||||
return GeckoResult.fromValue(AllowOrDeny.ALLOW);
|
return GeckoResult.fromValue(AllowOrDeny.ALLOW);
|
||||||
}else {
|
}else {
|
||||||
|
@ -423,7 +434,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
|
||||||
public void onFirstContentfulPaint(@NonNull GeckoSession var1) {
|
public void onFirstContentfulPaint(@NonNull GeckoSession var1) {
|
||||||
isFirstPaintExecuted = true;
|
isFirstPaintExecuted = true;
|
||||||
|
|
||||||
if(mPreviousErrorPage || mCurrentURL.contains("boogle.store") || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED)){
|
if(mPreviousErrorPage || mCurrentURL.contains("boogle.store") || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
|
||||||
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE);
|
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE);
|
||||||
}else {
|
}else {
|
||||||
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE);
|
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE);
|
||||||
|
|
|
@ -45,13 +45,10 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
|
||||||
this.mHintList.addAll(pHintList.subList(0,maxCounter));
|
this.mHintList.addAll(pHintList.subList(0,maxCounter));
|
||||||
this.mContext = pContext;
|
this.mContext = pContext;
|
||||||
this.mEvent = pEvent;
|
this.mEvent = pEvent;
|
||||||
this.mSearch = pSearch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch){
|
public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch){
|
||||||
//mHintList.clear();
|
|
||||||
mHintList = pHintList;
|
mHintList = pHintList;
|
||||||
mSearch = pSearch;
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,12 +100,14 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
|
||||||
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
|
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
|
||||||
mHindTypeIconTemp = new ImageView(mContext);
|
mHindTypeIconTemp = new ImageView(mContext);
|
||||||
|
|
||||||
if(mWebIcon[getLayoutPosition()]!=null){
|
if(getLayoutPosition() < mWebIcon.length){
|
||||||
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
|
if(mWebIcon[getLayoutPosition()]!=null){
|
||||||
mHintWebIcon.setImageDrawable(mWebIcon[getLayoutPosition()].getDrawable());
|
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
|
||||||
mHindTypeIconTemp.setImageDrawable(mWebIcon[getLayoutPosition()].getDrawable());
|
mHintWebIcon.setImageDrawable(mWebIcon[getLayoutPosition()].getDrawable());
|
||||||
|
mHindTypeIconTemp.setImageDrawable(mWebIcon[getLayoutPosition()].getDrawable());
|
||||||
|
}
|
||||||
|
mWebIcon[getLayoutPosition()] = mHintWebIcon;
|
||||||
}
|
}
|
||||||
mWebIcon[getLayoutPosition()] = mHintWebIcon;
|
|
||||||
|
|
||||||
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
|
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
|
||||||
mHeaderSingle.setText(model.getHeader());
|
mHeaderSingle.setText(model.getHeader());
|
||||||
|
@ -126,7 +125,12 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
|
||||||
}
|
}
|
||||||
|
|
||||||
mHeader.setText(model.getHeader());
|
mHeader.setText(model.getHeader());
|
||||||
mMoveURL.setTag(model.getDescription());
|
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
|
||||||
|
mMoveURL.setTag(model.getHeader());
|
||||||
|
}else {
|
||||||
|
mMoveURL.setTag(model.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
mURL.setText(model.getDescription());
|
mURL.setText(model.getDescription());
|
||||||
Drawable mDrawable = null;
|
Drawable mDrawable = null;
|
||||||
Resources res = itemView.getContext().getResources();
|
Resources res = itemView.getContext().getResources();
|
||||||
|
@ -167,6 +171,9 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
|
mHintWebIcon.setColorFilter(null);
|
||||||
|
mHintWebIcon.clearColorFilter();
|
||||||
|
mHintWebIcon.setImageTintList(null);
|
||||||
mHintWebIcon.setClipToOutline(true);
|
mHintWebIcon.setClipToOutline(true);
|
||||||
mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
|
mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,9 @@ import android.content.ComponentCallbacks2;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -16,6 +18,7 @@ import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.speech.RecognizerIntent;
|
import android.speech.RecognizerIntent;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -88,11 +91,13 @@ import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
|
||||||
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
|
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
|
||||||
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK;
|
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK;
|
||||||
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE;
|
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE;
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*;
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
||||||
|
import static java.lang.Character.isLetter;
|
||||||
|
|
||||||
public class homeController extends AppCompatActivity implements ComponentCallbacks2
|
public class homeController extends AppCompatActivity implements ComponentCallbacks2
|
||||||
{
|
{
|
||||||
|
@ -165,7 +170,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
onChangeTheme();
|
onChangeTheme();
|
||||||
status.initStatus();
|
status.initStatus();
|
||||||
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
|
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
|
||||||
onInitTheme();
|
|
||||||
trueTime.getInstance().initTime();
|
trueTime.getInstance().initTime();
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -182,6 +186,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
initLocalLanguage();
|
initLocalLanguage();
|
||||||
onInitResume(false);
|
onInitResume(false);
|
||||||
initSuggestions();
|
initSuggestions();
|
||||||
|
initAdmob();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initAdmob(){
|
||||||
|
pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onInitBooleans(){
|
public void onInitBooleans(){
|
||||||
|
@ -221,7 +230,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
if(mTempModel!=null){
|
if(mTempModel!=null){
|
||||||
tabRowModel model = (tabRowModel)mTempModel;
|
tabRowModel model = (tabRowModel)mTempModel;
|
||||||
if(!status.mThemeApplying){
|
if(!status.mThemeApplying){
|
||||||
mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false);
|
mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false);
|
||||||
}
|
}
|
||||||
onLoadTab(model.getSession(),false);
|
onLoadTab(model.getSession(),false);
|
||||||
onLoadURL(model.getSession().getCurrentURL());
|
onLoadURL(model.getSession().getCurrentURL());
|
||||||
|
@ -231,7 +240,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
initTabCount();
|
initTabCount();
|
||||||
if(!status.mThemeApplying){
|
if(!status.mThemeApplying){
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false);
|
||||||
}
|
}
|
||||||
status.mThemeApplying = false;
|
status.mThemeApplying = false;
|
||||||
}
|
}
|
||||||
|
@ -247,27 +256,39 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onInitTheme(){
|
public Context setupTheme(Context context) {
|
||||||
|
|
||||||
|
Resources res = context.getResources();
|
||||||
|
int mode = res.getConfiguration().uiMode;
|
||||||
|
|
||||||
if(status.sTheme == enums.Theme.THEME_DARK){
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
mode = Configuration.UI_MODE_NIGHT_YES;
|
||||||
}
|
}
|
||||||
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
|
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
|
||||||
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
mode = Configuration.UI_MODE_NIGHT_NO;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(!status.sDefaultNightMode){
|
if(!status.sDefaultNightMode){
|
||||||
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
mode = Configuration.UI_MODE_NIGHT_NO;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
mode = Configuration.UI_MODE_NIGHT_YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Configuration config = new Configuration(res.getConfiguration());
|
||||||
|
config.uiMode = mode;
|
||||||
|
context = context.createConfigurationContext(config);
|
||||||
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
@ -435,9 +456,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
|
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(base);
|
||||||
|
status.sTheme = mPrefs.getInt(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT);
|
||||||
|
|
||||||
Prefs.setContext(base);
|
Prefs.setContext(base);
|
||||||
orbotLocalConstants.mHomeContext = new WeakReference<>(base);
|
orbotLocalConstants.mHomeContext = new WeakReference<>(base);
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base, Prefs.getDefaultLocale()));
|
Context context = setupTheme(base);
|
||||||
|
super.attachBaseContext(LocaleHelper.onAttach(context, Prefs.getDefaultLocale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
|
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
|
||||||
|
@ -446,9 +471,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.onGetFavIcon(pImageView, pURL);
|
mGeckoClient.onGetFavIcon(pImageView, pURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGetThumbnail(ImageView pImageView){
|
public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){
|
||||||
mRenderedBitmap = mGeckoView.capturePixels();
|
mRenderedBitmap = mGeckoView.capturePixels();
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, pLoadTabView));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -483,7 +508,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed){
|
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed){
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false));
|
||||||
|
|
||||||
if(!isSessionClosed){
|
if(!isSessionClosed){
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
|
||||||
|
@ -494,7 +519,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoView.setSession(mTempSession);
|
mGeckoView.setSession(mTempSession);
|
||||||
|
|
||||||
mHomeViewController.onClearSelections(false);
|
mHomeViewController.onClearSelections(false);
|
||||||
mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true);
|
mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true, false);
|
||||||
if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){
|
if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){
|
||||||
mHomeViewController.onProgressBarUpdate(mTempSession.getProgress(), false);
|
mHomeViewController.onProgressBarUpdate(mTempSession.getProgress(), false);
|
||||||
}else {
|
}else {
|
||||||
|
@ -504,7 +529,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.onValidateInitializeFromStartup();
|
mGeckoClient.onValidateInitializeFromStartup();
|
||||||
mGeckoClient.onSessionReinit();
|
mGeckoClient.onSessionReinit();
|
||||||
mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false);
|
mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false);
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false);
|
||||||
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),true);
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),true);
|
||||||
mAppBar.setExpanded(true,true);
|
mAppBar.setExpanded(true,true);
|
||||||
mRenderedBitmap = mGeckoView.capturePixels();
|
mRenderedBitmap = mGeckoView.capturePixels();
|
||||||
|
@ -618,7 +643,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE)
|
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE)
|
||||||
{
|
{
|
||||||
onSearchBarInvoked(v);
|
onSearchBarInvoked(v);
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true, false);
|
||||||
mHomeViewController.onClearSelections(true);
|
mHomeViewController.onClearSelections(true);
|
||||||
mGeckoClient.setLoading(true);
|
mGeckoClient.setLoading(true);
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
|
@ -648,7 +673,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
if(hasFocus)
|
if(hasFocus)
|
||||||
{
|
{
|
||||||
pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
|
pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false);
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(() ->
|
handler.postDelayed(() ->
|
||||||
|
@ -668,6 +693,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
if(status.sSearchSuggestionStatus && isSuggestionChanged){
|
if(status.sSearchSuggestionStatus && isSuggestionChanged){
|
||||||
|
String mURL = mSearchbar.getText().toString();
|
||||||
|
|
||||||
|
if(!mURL.equals(strings.GENERIC_EMPTY_STR) && isLetter(mSearchbar.getText().toString().charAt(0)) && mSearchbar.getText().toString().contains(".")){
|
||||||
|
mHomeViewController.onUpdateSearchIcon(2);
|
||||||
|
}else{
|
||||||
|
mHomeViewController.onUpdateSearchIcon(0);
|
||||||
|
}
|
||||||
if(!mSearchBarLoading && mSearchEngineBar.getVisibility() != View.VISIBLE){
|
if(!mSearchBarLoading && mSearchEngineBar.getVisibility() != View.VISIBLE){
|
||||||
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mSearchbar.getText().toString()));
|
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mSearchbar.getText().toString()));
|
||||||
initSuggestionView(mSuggestions, s.toString());
|
initSuggestionView(mSuggestions, s.toString());
|
||||||
|
@ -720,7 +752,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
mHomeViewController.initSearchBarFocus(false);
|
mHomeViewController.initSearchBarFocus(false);
|
||||||
if(!mGeckoClient.isLoading()){
|
if(!mGeckoClient.isLoading()){
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false);
|
||||||
}
|
}
|
||||||
helperMethod.hideKeyboard(homeController.this);
|
helperMethod.hideKeyboard(homeController.this);
|
||||||
}
|
}
|
||||||
|
@ -770,7 +802,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
if(validated_url!=null){
|
if(validated_url!=null){
|
||||||
url = validated_url;
|
url = validated_url;
|
||||||
}
|
}
|
||||||
mHomeViewController.onUpdateSearchBar(url,false,true);
|
mHomeViewController.onUpdateSearchBar(url,false,true, false);
|
||||||
onLoadURL(url);
|
onLoadURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,12 +817,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoadURL(pURL);
|
onLoadURL(pURL);
|
||||||
mHomeViewController.onUpdateSearchBar(pURL,false,true);
|
mHomeViewController.onUpdateSearchBar(pURL,false,true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuggestionMove(View view){
|
public void onSuggestionMove(View view){
|
||||||
String val = view.getTag().toString();
|
String val = view.getTag().toString();
|
||||||
mHomeViewController.onUpdateSearchBar(val,false,false);
|
mHomeViewController.onUpdateSearchBar(val,false,false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyTheme(){
|
public void applyTheme(){
|
||||||
|
@ -832,10 +864,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
initializeGeckoView(true, true);
|
initializeGeckoView(true, true);
|
||||||
if(status.sOpenURLInNewTab){
|
if(status.sOpenURLInNewTab){
|
||||||
onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus));
|
onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus));
|
||||||
mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true);
|
mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true, false);
|
||||||
}else {
|
}else {
|
||||||
onLoadURL("about:blank");
|
onLoadURL("about:blank");
|
||||||
mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true);
|
mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true, false);
|
||||||
mHomeViewController.onNewTab();
|
mHomeViewController.onNewTab();
|
||||||
}
|
}
|
||||||
mHomeViewController.progressBarReset();
|
mHomeViewController.progressBarReset();
|
||||||
|
@ -844,17 +876,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postNewLinkTabAnimation(String url){
|
public void postNewLinkTabAnimation(String url){
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false));
|
||||||
initializeGeckoView(true, true);
|
initializeGeckoView(true, true);
|
||||||
mHomeViewController.progressBarReset();
|
mHomeViewController.progressBarReset();
|
||||||
mHomeViewController.onUpdateSearchBar(url,false,true);
|
mHomeViewController.onUpdateSearchBar(url,false,true, false);
|
||||||
mGeckoClient.loadURL(url);
|
mGeckoClient.loadURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
|
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
|
||||||
try {
|
try {
|
||||||
onGetThumbnail(null);
|
onGetThumbnail(null, false);
|
||||||
}catch (Exception ignored){}
|
}catch (Exception ignored){}
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
|
@ -868,24 +900,26 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenLinkNewTab(String url){
|
public void onOpenLinkNewTab(String url){
|
||||||
onGetThumbnail(null);
|
onGetThumbnail(null, false);
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(() -> mHomeViewController.onNewTabAnimation(Collections.singletonList(url),M_INITIALIZE_TAB_LINK), 100);
|
handler.postDelayed(() -> mHomeViewController.onNewTabAnimation(Collections.singletonList(url),M_INITIALIZE_TAB_LINK), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenTabViewBoundary(View view){
|
public void onOpenTabViewBoundary(View view){
|
||||||
onGetThumbnail(null);
|
onGetThumbnail(null, true);
|
||||||
mGeckoClient.onRedrawPixel();
|
mGeckoClient.onRedrawPixel();
|
||||||
mNewTab.setPressed(true);
|
mNewTab.setPressed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenTabReady(){
|
public void onOpenTabReady(){
|
||||||
runOnUiThread(() -> {
|
if(!status.mThemeApplying){
|
||||||
activityContextManager.getInstance().getTabController().onInit();
|
runOnUiThread(() -> {
|
||||||
mHomeViewController.onShowTabContainer();
|
activityContextManager.getInstance().getTabController().onInit();
|
||||||
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
mHomeViewController.onShowTabContainer();
|
||||||
});
|
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLockSecure(View view){
|
public void onLockSecure(View view){
|
||||||
|
@ -910,14 +944,20 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisableTabViewController(){
|
public void onDisableTabViewController(){
|
||||||
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
|
||||||
mHomeViewController.onHideTabContainer();
|
mHomeViewController.onHideTabContainer();
|
||||||
|
activityContextManager.getInstance().getTabController().onExitAndClearBackup();
|
||||||
|
activityContextManager.getInstance().getTabController().onPostExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
if(mTabFragment.getVisibility()==View.VISIBLE){
|
if(mTabFragment.getVisibility()==View.VISIBLE){
|
||||||
onResume();
|
onResume();
|
||||||
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
|
||||||
mHomeViewController.onHideTabContainer();
|
mHomeViewController.onHideTabContainer();
|
||||||
|
activityContextManager.getInstance().getTabController().onPostExit();
|
||||||
|
activityContextManager.getInstance().getTabController().onBackPressed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,10 +1027,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
|
mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED)){
|
if(mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK)){
|
||||||
mHomeViewController.updateBannerAdvertStatus(false);
|
mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
|
||||||
}else {
|
}else {
|
||||||
mHomeViewController.updateBannerAdvertStatus(true);
|
mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mSplashScreen.getAlpha()>0){
|
if(mSplashScreen.getAlpha()>0){
|
||||||
|
@ -1006,6 +1046,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.closeMenu();
|
mHomeViewController.closeMenu();
|
||||||
helperMethod.hideKeyboard(this);
|
helperMethod.hideKeyboard(this);
|
||||||
}
|
}
|
||||||
|
if(mTabFragment.getVisibility()==View.VISIBLE){
|
||||||
|
onResume();
|
||||||
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
|
||||||
|
mHomeViewController.onHideTabContainer();
|
||||||
|
activityContextManager.getInstance().getTabController().onPostExit();
|
||||||
|
activityContextManager.getInstance().getTabController().onBackPressed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mGeckoClient.onExitFullScreen();
|
mGeckoClient.onExitFullScreen();
|
||||||
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
|
||||||
|
@ -1164,7 +1212,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCloseCurrentTab(geckoSession session){
|
public boolean onCloseCurrentTab(geckoSession session){
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Collections.singletonList(session));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Arrays.asList(session, session));
|
||||||
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
|
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
|
||||||
|
|
||||||
session.stop();
|
session.stop();
|
||||||
|
@ -1172,13 +1220,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
initTabCount();
|
initTabCount();
|
||||||
|
|
||||||
if(model!=null){
|
if(model!=null){
|
||||||
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE){
|
if(mTabFragment.getVisibility()!=View.VISIBLE){
|
||||||
onLoadTab(model.getSession(),true);
|
onLoadTab(model.getSession(),true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE){
|
if(mTabFragment.getVisibility()!=View.VISIBLE){
|
||||||
return false;
|
return false;
|
||||||
}else {
|
}else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1199,7 +1247,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClearSearchBar(View view){
|
public void onClearSearchBar(View view){
|
||||||
mHomeViewController.onUpdateSearchBar(strings.GENERIC_EMPTY_STR, false, true);
|
mHomeViewController.onUpdateSearchBar(strings.GENERIC_EMPTY_STR, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFindNext(View view){
|
public void onFindNext(View view){
|
||||||
|
@ -1400,12 +1448,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
|
status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
|
||||||
}else {
|
}else {
|
||||||
if(status.mThemeApplying){
|
if(status.mThemeApplying){
|
||||||
mHomeViewController.onUpdateSearchBar(data.get(0).toString(),false, false);
|
mHomeViewController.onUpdateSearchBar(data.get(0).toString(),false, false, false);
|
||||||
mHomeViewController.splashScreenDisableInstant();
|
mHomeViewController.splashScreenDisableInstant();
|
||||||
onLoadTabOnResume();
|
onLoadTabOnResume();
|
||||||
}
|
}
|
||||||
onLoadURL(data.get(0).toString());
|
onLoadURL(data.get(0).toString());
|
||||||
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true);
|
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.ON_LOAD_TAB_ON_RESUME)){
|
else if(e_type.equals(enums.etype.ON_LOAD_TAB_ON_RESUME)){
|
||||||
|
@ -1471,7 +1519,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
mHomeViewController.initSearchBarFocus(false);
|
mHomeViewController.initSearchBarFocus(false);
|
||||||
if(!mGeckoClient.isLoading()){
|
if(!mGeckoClient.isLoading()){
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false);
|
||||||
}
|
}
|
||||||
helperMethod.hideKeyboard(homeController.this);
|
helperMethod.hideKeyboard(homeController.this);
|
||||||
}
|
}
|
||||||
|
@ -1503,7 +1551,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mAppBar.setExpanded(true,true);
|
mAppBar.setExpanded(true,true);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){
|
else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){
|
||||||
mHomeViewController.updateBannerAdvertStatus((boolean)data.get(3));
|
Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED);
|
||||||
|
if(mAdvertResponse != null){
|
||||||
|
mHomeViewController.updateBannerAdvertStatus((boolean)data.get(3), (boolean)mAdvertResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.progress_update)){
|
else if(e_type.equals(enums.etype.progress_update)){
|
||||||
mHomeViewController.onProgressBarUpdate((int)data.get(0), false);
|
mHomeViewController.onProgressBarUpdate((int)data.get(0), false);
|
||||||
|
@ -1512,7 +1563,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.onProgressBarUpdate((int)data.get(0), true);
|
mHomeViewController.onProgressBarUpdate((int)data.get(0), true);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.ON_UPDATE_SEARCH_BAR)){
|
else if(e_type.equals(enums.etype.ON_UPDATE_SEARCH_BAR)){
|
||||||
mHomeViewController.onUpdateSearchBar((String)data.get(0), false, false);
|
mHomeViewController.onUpdateSearchBar((String)data.get(0), false, false, false);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){
|
else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){
|
||||||
mHomeViewController.onFirstPaint();
|
mHomeViewController.onFirstPaint();
|
||||||
|
@ -1524,13 +1575,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
//mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true);
|
//mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.back_list_empty)){
|
else if(e_type.equals(enums.etype.back_list_empty)){
|
||||||
if((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)>1){
|
helperMethod.onMinimizeApp(homeController.this);
|
||||||
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
|
||||||
postNewTabAnimation(true,false);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
helperMethod.onMinimizeApp(homeController.this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){
|
else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){
|
||||||
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false);
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false);
|
||||||
|
@ -1545,10 +1590,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true));
|
||||||
mHomeViewController.onPageFinished();
|
mHomeViewController.onPageFinished();
|
||||||
mGeckoClient.onRedrawPixel();
|
mGeckoClient.onRedrawPixel();
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
|
||||||
Runnable runnable = () -> pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS);
|
|
||||||
handler.postDelayed(runnable, 2000);
|
|
||||||
}
|
}
|
||||||
else if(e_type.equals(M_RATE_APPLICATION)){
|
else if(e_type.equals(M_RATE_APPLICATION)){
|
||||||
if(!status.sSettingIsAppRated){
|
if(!status.sSettingIsAppRated){
|
||||||
|
@ -1562,10 +1603,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
initLocalLanguage();
|
initLocalLanguage();
|
||||||
mHomeViewController.onPageFinished();
|
mHomeViewController.onPageFinished();
|
||||||
mGeckoClient.onRedrawPixel();
|
mGeckoClient.onRedrawPixel();
|
||||||
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true);
|
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.search_update)){
|
else if(e_type.equals(enums.etype.search_update)){
|
||||||
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false, true);
|
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false, true, false);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.download_file_popup)){
|
else if(e_type.equals(enums.etype.download_file_popup)){
|
||||||
List<Object> mData = new ArrayList<>();
|
List<Object> mData = new ArrayList<>();
|
||||||
|
|
|
@ -55,6 +55,9 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
|
||||||
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
|
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
|
||||||
|
|
||||||
class homeViewController
|
class homeViewController
|
||||||
|
@ -160,7 +163,7 @@ class homeViewController
|
||||||
mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
|
mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
updateBannerAdvertStatus(false);
|
updateBannerAdvertStatus(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTopBarPadding(){
|
public void initTopBarPadding(){
|
||||||
|
@ -192,20 +195,27 @@ class homeViewController
|
||||||
public void onShowTabContainer(){
|
public void onShowTabContainer(){
|
||||||
if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){
|
if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){
|
||||||
mTabFragment.setVisibility(View.VISIBLE);
|
mTabFragment.setVisibility(View.VISIBLE);
|
||||||
mTabFragment.animate().setDuration(250).alpha(1);
|
mTabFragment.setTranslationY(-1 * helperMethod.pxFromDp(15));
|
||||||
|
mTabFragment.animate()
|
||||||
|
.setDuration(250)
|
||||||
|
.translationY(0)
|
||||||
|
.alpha(1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onHideTabContainer(){
|
public void onHideTabContainer(){
|
||||||
if(mTabFragment.getAlpha()==1){
|
if(mTabFragment.getAlpha()==1){
|
||||||
mTabFragment.animate().setDuration(250).alpha(0).withEndAction(() -> mTabFragment.setVisibility(View.GONE));
|
mTabFragment.animate()
|
||||||
|
.setDuration(250)
|
||||||
|
.alpha(0f).withEndAction(() -> mTabFragment.setVisibility(View.GONE));
|
||||||
}
|
}
|
||||||
|
mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.M_INIT_TAB_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSearchLogo(){
|
public int getSearchLogo(){
|
||||||
switch (status.sSettingSearchStatus) {
|
switch (status.sSettingSearchStatus) {
|
||||||
case constants.CONST_BACKEND_GENESIS_URL:
|
case constants.CONST_BACKEND_GENESIS_URL:
|
||||||
return R.drawable.genesis;
|
return R.drawable.ic_genesis_vector;
|
||||||
case constants.CONST_BACKEND_GOOGLE_URL:
|
case constants.CONST_BACKEND_GOOGLE_URL:
|
||||||
return R.drawable.google;
|
return R.drawable.google;
|
||||||
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
|
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
|
||||||
|
@ -217,17 +227,34 @@ class homeViewController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("UseCompatLoadingForDrawables")
|
||||||
|
public void onUpdateSearchIcon(int mStatus){
|
||||||
|
try {
|
||||||
|
if(mStatus==0){
|
||||||
|
mSearchLock.setColorFilter(null);
|
||||||
|
mSearchLock.clearColorFilter();
|
||||||
|
mSearchLock.setImageTintList(null);
|
||||||
|
mSearchLock.setImageDrawable(mContext.getResources().getDrawable(getSearchLogo()));
|
||||||
|
}
|
||||||
|
else if(mStatus==1){
|
||||||
|
mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint));
|
||||||
|
mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock));
|
||||||
|
}
|
||||||
|
else if(mStatus==2){
|
||||||
|
mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_icon_tint));
|
||||||
|
mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_browser));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("UseCompatLoadingForDrawables")
|
@SuppressLint("UseCompatLoadingForDrawables")
|
||||||
public void initSearchBarFocus(boolean pStatus){
|
public void initSearchBarFocus(boolean pStatus){
|
||||||
if(!pStatus){
|
if(!pStatus){
|
||||||
this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> {
|
this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> {
|
||||||
try {
|
|
||||||
mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint));
|
|
||||||
mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
onUpdateSearchIcon(1);
|
||||||
mVoiceInput.setVisibility(View.GONE);
|
mVoiceInput.setVisibility(View.GONE);
|
||||||
mNewTab.setVisibility(View.VISIBLE);
|
mNewTab.setVisibility(View.VISIBLE);
|
||||||
mMenu.setVisibility(View.VISIBLE);
|
mMenu.setVisibility(View.VISIBLE);
|
||||||
|
@ -246,28 +273,10 @@ class homeViewController
|
||||||
|
|
||||||
});
|
});
|
||||||
}else {
|
}else {
|
||||||
try {
|
|
||||||
mSearchLock.setImageDrawable(mContext.getResources().getDrawable(getSearchLogo()));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
mSearchLock.setColorFilter(null);
|
onUpdateSearchIcon(0);
|
||||||
mSearchLock.clearColorFilter();
|
|
||||||
mSearchLock.setImageTintList(null);
|
|
||||||
mSearchbar.setMovementMethod(mSearchBarMovementMethod);
|
mSearchbar.setMovementMethod(mSearchBarMovementMethod);
|
||||||
mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(0));
|
mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(0));
|
||||||
Drawable drawable;
|
|
||||||
Resources res = mContext.getResources();
|
|
||||||
try {
|
|
||||||
if(status.sSettingEnableVoiceInput){
|
|
||||||
drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_voice));
|
|
||||||
}else {
|
|
||||||
drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_search_small));
|
|
||||||
}
|
|
||||||
mVoiceInput.setImageDrawable(drawable);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(() ->
|
handler.postDelayed(() ->
|
||||||
|
@ -295,6 +304,25 @@ class homeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTab(int count){
|
void initTab(int count){
|
||||||
|
mNewTab.animate().cancel();
|
||||||
|
mNewTab.animate().withLayer()
|
||||||
|
.rotationX(60)
|
||||||
|
.alpha(0.4f)
|
||||||
|
.setDuration(80)
|
||||||
|
.withEndAction(
|
||||||
|
new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
// second quarter turn
|
||||||
|
mNewTab.setRotationX(-60);
|
||||||
|
mNewTab.animate().withLayer()
|
||||||
|
.rotationX(0)
|
||||||
|
.alpha(1)
|
||||||
|
.setDuration(100)
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).start();
|
||||||
|
|
||||||
mNewTab.setText((count+strings.GENERIC_EMPTY_STR));
|
mNewTab.setText((count+strings.GENERIC_EMPTY_STR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,8 +663,8 @@ class homeViewController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBannerAdvertStatus(boolean status){
|
void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){
|
||||||
if(status){
|
if(status && pIsAdvertLoaded){
|
||||||
if(mBannerAds.getAlpha()==0){
|
if(mBannerAds.getAlpha()==0){
|
||||||
mBannerAds.animate().cancel();
|
mBannerAds.animate().cancel();
|
||||||
mBannerAds.setAlpha(0);
|
mBannerAds.setAlpha(0);
|
||||||
|
@ -655,8 +683,11 @@ class homeViewController
|
||||||
|
|
||||||
private Handler searchBarUpdateHandler = new Handler();
|
private Handler searchBarUpdateHandler = new Handler();
|
||||||
private String handlerLocalUrl = "";
|
private String handlerLocalUrl = "";
|
||||||
void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText){
|
void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText, boolean pBypassFocus){
|
||||||
if(!mSearchbar.hasFocus() || pClearText){
|
if(url.equals(CONST_GENESIS_URL_CACHED) || url.equals(CONST_GENESIS_URL_CACHED_DARK)){
|
||||||
|
url = CONST_GENESIS_DOMAIN_URL;
|
||||||
|
}
|
||||||
|
if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
handlerLocalUrl = url;
|
handlerLocalUrl = url;
|
||||||
|
|
||||||
|
@ -685,7 +716,7 @@ class homeViewController
|
||||||
|
|
||||||
public void onUpdateStatusBarTheme(String pTheme, boolean mForced)
|
public void onUpdateStatusBarTheme(String pTheme, boolean mForced)
|
||||||
{
|
{
|
||||||
if(mSplashScreen.getAlpha()<=0){
|
if(mSplashScreen.getAlpha()<=0 && status.sTheme != enums.Theme.THEME_DARK){
|
||||||
int mColor = -1;
|
int mColor = -1;
|
||||||
try{
|
try{
|
||||||
mColor = Color.parseColor(pTheme);
|
mColor = Color.parseColor(pTheme);
|
||||||
|
@ -693,7 +724,7 @@ class homeViewController
|
||||||
mColor = -1;
|
mColor = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pTheme!=null && status.sToolbarTheme && mColor!=-1){
|
if(pTheme!=null && status.sToolbarTheme && mColor!=-1 && helperMethod.getColorDensity(mColor)<0.80){
|
||||||
mTopBar.setBackgroundColor(mColor);
|
mTopBar.setBackgroundColor(mColor);
|
||||||
mSearchbar.setTextColor(helperMethod.invertedGrayColor(mColor));
|
mSearchbar.setTextColor(helperMethod.invertedGrayColor(mColor));
|
||||||
mSearchbar.setHintTextColor(helperMethod.invertedGrayColor(mColor));
|
mSearchbar.setHintTextColor(helperMethod.invertedGrayColor(mColor));
|
||||||
|
@ -929,10 +960,10 @@ class homeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
private int defaultFlag = 0;
|
private int defaultFlag = 0;
|
||||||
void onFullScreenUpdate(boolean status){
|
void onFullScreenUpdate(boolean pStatus){
|
||||||
int value = !status ? 1 : 0;
|
int value = !pStatus ? 1 : 0;
|
||||||
|
|
||||||
if(status) {
|
if(pStatus) {
|
||||||
isFullScreen = true;
|
isFullScreen = true;
|
||||||
}else {
|
}else {
|
||||||
this.mBlockerFullSceen.setVisibility(View.VISIBLE);
|
this.mBlockerFullSceen.setVisibility(View.VISIBLE);
|
||||||
|
@ -940,13 +971,13 @@ class homeViewController
|
||||||
isFullScreen = false;
|
isFullScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status){
|
if(pStatus){
|
||||||
onProgressBarUpdate(100, false);
|
onProgressBarUpdate(100, false);
|
||||||
this.mBlockerFullSceen.setVisibility(View.VISIBLE);
|
this.mBlockerFullSceen.setVisibility(View.VISIBLE);
|
||||||
this.mBlockerFullSceen.setAlpha(0f);
|
this.mBlockerFullSceen.setAlpha(0f);
|
||||||
this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> {
|
this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> {
|
||||||
mTopBar.setClickable(!status);
|
mTopBar.setClickable(!pStatus);
|
||||||
disableEnableControls(!status, mTopBar);
|
disableEnableControls(!pStatus, mTopBar);
|
||||||
mTopBar.setAlpha(value);
|
mTopBar.setAlpha(value);
|
||||||
mBannerAds.setVisibility(View.GONE);
|
mBannerAds.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
@ -976,8 +1007,8 @@ class homeViewController
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mTopBar.setClickable(!status);
|
mTopBar.setClickable(!pStatus);
|
||||||
disableEnableControls(!status, mTopBar);
|
disableEnableControls(!pStatus, mTopBar);
|
||||||
mTopBar.setAlpha(value);
|
mTopBar.setAlpha(value);
|
||||||
mBannerAds.setVisibility(View.GONE);
|
mBannerAds.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
@ -994,7 +1025,11 @@ class homeViewController
|
||||||
initTopBarPadding();
|
initTopBarPadding();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(0);
|
||||||
|
}else {
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,8 @@ public class settingGeneralController extends AppCompatActivity {
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
||||||
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
|
||||||
mIsThemeChanging = false;
|
mIsThemeChanging = false;
|
||||||
|
}else {
|
||||||
|
mIsThemeChanging = false;
|
||||||
}
|
}
|
||||||
}else if(view.getId() == R.id.pOption2) {
|
}else if(view.getId() == R.id.pOption2) {
|
||||||
if(status.sTheme != enums.Theme.THEME_LIGHT) {
|
if(status.sTheme != enums.Theme.THEME_LIGHT) {
|
||||||
|
@ -219,6 +221,8 @@ public class settingGeneralController extends AppCompatActivity {
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
||||||
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
|
||||||
mIsThemeChanging = false;
|
mIsThemeChanging = false;
|
||||||
|
}else {
|
||||||
|
mIsThemeChanging = false;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
|
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
|
||||||
|
@ -228,6 +232,8 @@ public class settingGeneralController extends AppCompatActivity {
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
|
||||||
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
|
||||||
mIsThemeChanging = false;
|
mIsThemeChanging = false;
|
||||||
|
}else {
|
||||||
|
mIsThemeChanging = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,6 +309,9 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
||||||
notifyItemChanged(mModelList.size()-1);
|
notifyItemChanged(mModelList.size()-1);
|
||||||
}
|
}
|
||||||
}else if(v.getId() == R.id.pRemoveRow){
|
}else if(v.getId() == R.id.pRemoveRow){
|
||||||
|
v.setEnabled(false);
|
||||||
|
v.setFocusableInTouchMode(false);
|
||||||
|
v.setClickable(false);
|
||||||
for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){
|
for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){
|
||||||
if(mSelectedList.get(mCounter).equals(mModelList.get(this.getLayoutPosition()).getmId())){
|
if(mSelectedList.get(mCounter).equals(mModelList.get(this.getLayoutPosition()).getmId())){
|
||||||
mSelectedList.remove(mCounter);
|
mSelectedList.remove(mCounter);
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -14,6 +12,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
@ -21,7 +20,6 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
|
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
|
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
|
||||||
|
@ -29,8 +27,7 @@ import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -144,9 +141,31 @@ public class tabController extends Fragment
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||||
|
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||||
|
if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size()){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
|
||||||
|
final int swipeFlags = 0;
|
||||||
|
return makeMovementFlags(swipeFlags, dragFlags);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size()){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
|
||||||
|
final int swipeFlags = 0;
|
||||||
|
return makeMovementFlags(swipeFlags, dragFlags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
int position = viewHolder.getAdapterPosition();
|
int position = viewHolder.getAdapterPosition();
|
||||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE,null);
|
|
||||||
boolean mStatus = onInitRemoveView(position, true);
|
boolean mStatus = onInitRemoveView(position, true);
|
||||||
if(mStatus){
|
if(mStatus){
|
||||||
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.NOTIFY_SWIPE, Collections.singletonList(position));
|
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.NOTIFY_SWIPE, Collections.singletonList(position));
|
||||||
|
@ -167,6 +186,10 @@ public class tabController extends Fragment
|
||||||
}
|
}
|
||||||
/*View Handlers*/
|
/*View Handlers*/
|
||||||
|
|
||||||
|
public void onExitAndClearBackup(){
|
||||||
|
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE,null);
|
||||||
|
}
|
||||||
|
|
||||||
public void onRemoveTab(int pIndex){
|
public void onRemoveTab(int pIndex){
|
||||||
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
|
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
|
||||||
if(mListModel.getList().size()<1){
|
if(mListModel.getList().size()<1){
|
||||||
|
@ -192,22 +215,26 @@ public class tabController extends Fragment
|
||||||
public void initTabCount()
|
public void initTabCount()
|
||||||
{
|
{
|
||||||
mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size()));
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size()));
|
||||||
mHomeController.initTabCount();
|
|
||||||
|
ViewGroup.LayoutParams params = mRecycleView.getLayoutParams();
|
||||||
|
params.height = helperMethod.pxFromDp(mTabAdapter.getItemCount() * 90);
|
||||||
|
mRecycleView.setLayoutParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClose(){
|
public void onClose(){
|
||||||
onClearTabBackup();
|
onClearTabBackup();
|
||||||
// finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNewTabInvoked(){
|
public void onNewTabInvoked(){
|
||||||
mHomeController.onNewTabBackground(true,false);
|
mHomeController.onBackPressed();
|
||||||
|
int mBackupList = ((ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null)).size();
|
||||||
|
if(mListModel.getList().size()-mBackupList>=1){
|
||||||
|
mHomeController.onNewTabBackground(true,false);
|
||||||
|
}
|
||||||
onClose();
|
onClose();
|
||||||
// overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRestoreTab(View view){
|
public void onRestoreTab(View view){
|
||||||
Log.i("FUCKSSS","FUCKSSS1 : " + (mPopupUndo.findViewById(R.id.pBlockerUndo).getVisibility()==View.VISIBLE));
|
|
||||||
mPopupUndo.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE);
|
mPopupUndo.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE);
|
||||||
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG, null);
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG, null);
|
||||||
|
|
||||||
|
@ -220,7 +247,7 @@ public class tabController extends Fragment
|
||||||
|
|
||||||
ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_LOAD_BACKUP,null);
|
ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_LOAD_BACKUP,null);
|
||||||
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup));
|
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup));
|
||||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE,null);
|
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
|
||||||
initTabCount();
|
initTabCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +258,7 @@ public class tabController extends Fragment
|
||||||
public void onClearTabBackup(){
|
public void onClearTabBackup(){
|
||||||
ArrayList<tabRowModel> mBackupIndex = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null);
|
ArrayList<tabRowModel> mBackupIndex = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null);
|
||||||
for(int mCounter=0;mCounter<mBackupIndex.size();mCounter++){
|
for(int mCounter=0;mCounter<mBackupIndex.size();mCounter++){
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Collections.singletonList(mBackupIndex.get(mCounter).getSession()));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Arrays.asList(mBackupIndex.get(mCounter).getSession(), mBackupIndex.get(mCounter).getmId()));
|
||||||
mBackupIndex.get(mCounter).getSession().closeSession();
|
mBackupIndex.get(mCounter).getSession().closeSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,6 +275,10 @@ public class tabController extends Fragment
|
||||||
|
|
||||||
/*UI Triggers*/
|
/*UI Triggers*/
|
||||||
|
|
||||||
|
public void onPostExit() {
|
||||||
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_EXIT, null);
|
||||||
|
}
|
||||||
|
|
||||||
public void openTabMenu(View view) {
|
public void openTabMenu(View view) {
|
||||||
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_SHOW_MENU, Collections.singletonList(view));
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_SHOW_MENU, Collections.singletonList(view));
|
||||||
}
|
}
|
||||||
|
@ -324,10 +355,9 @@ public class tabController extends Fragment
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if(mTabAdapter!=null){
|
if(mTabAdapter!=null){
|
||||||
boolean mStatus = (boolean) mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_SELECTION_MENU_SHOWING, null);
|
boolean mStatus = (boolean) mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_SELECTION_MENU_SHOWING, null);
|
||||||
if(mStatus){
|
onClearTabBackup();
|
||||||
onClearTabBackup();
|
onClearSelection(null);
|
||||||
onClearSelection(null);
|
if(!mStatus){
|
||||||
}else {
|
|
||||||
mHomeController.onDisableTabViewController();
|
mHomeController.onDisableTabViewController();
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
@ -362,7 +392,6 @@ public class tabController extends Fragment
|
||||||
mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1));
|
mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1));
|
||||||
}
|
}
|
||||||
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW)){
|
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW)){
|
||||||
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE,null);
|
|
||||||
onInitRemoveView((Integer) data.get(0), true);
|
onInitRemoveView((Integer) data.get(0), true);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP)){
|
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP)){
|
||||||
|
|
|
@ -4,7 +4,7 @@ public class tabEnums
|
||||||
{
|
{
|
||||||
/*Settings Manager*/
|
/*Settings Manager*/
|
||||||
public enum eTabViewCommands {
|
public enum eTabViewCommands {
|
||||||
M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT, ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_SHOW_SELECTION_MENU, ON_SHOW_UNDO_DIALOG, ON_HIDE_UNDO_DIALOG, ON_GENERATE_SWIPABLE_BACKGROUND
|
M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT, ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_SHOW_SELECTION_MENU, ON_SHOW_UNDO_DIALOG, ON_HIDE_UNDO_DIALOG, ON_GENERATE_SWIPABLE_BACKGROUND, ON_EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eTabAdapterCommands {
|
public enum eTabAdapterCommands {
|
||||||
|
@ -16,7 +16,7 @@ public class tabEnums
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eModelCallback {
|
public enum eModelCallback {
|
||||||
M_SET_LIST, M_GET_LIST, M_REMOVE_TAB, M_GET_BACKUP, M_CLEAR_BACKUP_WITHOUT_CLOSE, M_LOAD_BACKUP
|
M_SET_LIST, M_GET_LIST, M_REMOVE_TAB, M_GET_BACKUP, M_CLEAR_BACKUP_WITHOUT_CLOSE, M_CLEAR_BACKUP_RETAIN_DATABASE, M_LOAD_BACKUP
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.tabManager;
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import android.view.View;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
class tabModel
|
class tabModel
|
||||||
|
@ -35,6 +35,13 @@ class tabModel
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClearBackupWithoutClose(){
|
private void onClearBackupWithoutClose(){
|
||||||
|
for(int mCounter=0;mCounter<mBackupIndex.size();mCounter++){
|
||||||
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Arrays.asList(mBackupIndex.get(mCounter).getSession(), mBackupIndex.get(mCounter).getmId()));
|
||||||
|
}
|
||||||
|
mBackupIndex.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClearBackupRetainDatabase(){
|
||||||
mBackupIndex.clear();
|
mBackupIndex.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +69,9 @@ class tabModel
|
||||||
if(pCommands.equals(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE)){
|
if(pCommands.equals(tabEnums.eModelCallback.M_CLEAR_BACKUP_WITHOUT_CLOSE)){
|
||||||
onClearBackupWithoutClose();
|
onClearBackupWithoutClose();
|
||||||
}
|
}
|
||||||
|
if(pCommands.equals(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE)){
|
||||||
|
onClearBackupRetainDatabase();
|
||||||
|
}
|
||||||
if(pCommands.equals(tabEnums.eModelCallback.M_LOAD_BACKUP)){
|
if(pCommands.equals(tabEnums.eModelCallback.M_LOAD_BACKUP)){
|
||||||
return onLoadBackup();
|
return onLoadBackup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,26 @@ import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ActionMenuView;
|
import android.widget.ActionMenuView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
@ -58,6 +66,7 @@ class tabViewController
|
||||||
this.mBlocker = pBlocker;
|
this.mBlocker = pBlocker;
|
||||||
this.mRecycleView = pRecycleView;
|
this.mRecycleView = pRecycleView;
|
||||||
|
|
||||||
|
initUI();
|
||||||
initPostUI();
|
initPostUI();
|
||||||
onHoldInteraction();
|
onHoldInteraction();
|
||||||
}
|
}
|
||||||
|
@ -72,9 +81,34 @@ class tabViewController
|
||||||
mTabs.setText(String.valueOf(pCount));
|
mTabs.setText(String.valueOf(pCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initUI(){
|
||||||
|
mMenuButton.setAlpha(0f);
|
||||||
|
mMenuButton.animate().setStartDelay(200).setDuration(350).alpha(1);
|
||||||
|
mMenuButton.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initExitUI(){
|
||||||
|
//mMenuButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void initPostUI(){
|
private void initPostUI(){
|
||||||
mRecycleView.setAlpha(1);
|
mRecycleView.setAlpha(1);
|
||||||
mContext.getView().setBackgroundColor(Color.WHITE);
|
mContext.getView().setBackgroundColor(Color.WHITE);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
Window window = mContext.getActivity().getWindow();
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(mContext.getActivity(), R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenTabMenu(View view) {
|
public void onOpenTabMenu(View view) {
|
||||||
|
@ -159,12 +193,20 @@ class tabViewController
|
||||||
float width = height / 3;
|
float width = height / 3;
|
||||||
|
|
||||||
if(pDX > 0){
|
if(pDX > 0){
|
||||||
pCanvas.drawARGB(0, 241, 243, 244);
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
pCanvas.drawARGB(255, 59, 57, 70);
|
||||||
|
}else {
|
||||||
|
pCanvas.drawARGB(255, 230, 230, 230);
|
||||||
|
}
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
|
||||||
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
||||||
} else {
|
} else {
|
||||||
pCanvas.drawARGB(0, 241, 243, 244);
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
pCanvas.drawARGB(255, 59, 57, 70);
|
||||||
|
}else {
|
||||||
|
pCanvas.drawARGB(255, 230, 230, 230);
|
||||||
|
}
|
||||||
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
|
||||||
RectF icon_dest = new RectF((float) itemView.getRight() - 2*width ,(float) itemView.getTop() + width,(float) itemView.getRight() - width,(float)itemView.getBottom() - width);
|
RectF icon_dest = new RectF((float) itemView.getRight() - 2*width ,(float) itemView.getTop() + width,(float) itemView.getRight() - width,(float)itemView.getBottom() - width);
|
||||||
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
|
||||||
|
@ -193,6 +235,8 @@ class tabViewController
|
||||||
onHideUndoDialog();
|
onHideUndoDialog();
|
||||||
}else if(pCommands.equals(tabEnums.eTabViewCommands.ON_GENERATE_SWIPABLE_BACKGROUND)){
|
}else if(pCommands.equals(tabEnums.eTabViewCommands.ON_GENERATE_SWIPABLE_BACKGROUND)){
|
||||||
onDrawSwipableBackground((Canvas)pData.get(0), (RecyclerView.ViewHolder)pData.get(1), (float)pData.get(2), (int)pData.get(3));
|
onDrawSwipableBackground((Canvas)pData.get(0), (RecyclerView.ViewHolder)pData.get(1), (float)pData.get(2), (int)pData.get(3));
|
||||||
|
}else if(pCommands.equals(tabEnums.eTabViewCommands.ON_EXIT)){
|
||||||
|
initExitUI();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,16 @@ public class constants
|
||||||
/*URL CONSTANTS*/
|
/*URL CONSTANTS*/
|
||||||
|
|
||||||
public static final String CONST_GENESIS_URL_CACHED = "resource://android/assets/homepage/homepage.html";
|
public static final String CONST_GENESIS_URL_CACHED = "resource://android/assets/homepage/homepage.html";
|
||||||
|
public static final String CONST_GENESIS_URL_CACHED_DARK = "resource://android/assets/homepage/homepage-dark.html";
|
||||||
public static final String CONST_GENESIS_ERROR_CACHED = "resource://android/assets/error/error.html";
|
public static final String CONST_GENESIS_ERROR_CACHED = "resource://android/assets/error/error.html";
|
||||||
|
public static final String CONST_GENESIS_ERROR_CACHED_DARK = "resource://android/assets/error/error-dark.html";
|
||||||
public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://boogle.store/";
|
public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://boogle.store/";
|
||||||
public static final String CONST_GENESIS_REFERENCE_WEBSITES = "https://drive.google.com/uc?export=download&id=1lOmukKOPYHApBFyTDkaRPoAwm59E_YEE";
|
public static final String CONST_GENESIS_REFERENCE_WEBSITES = "https://drive.google.com/uc?export=download&id=1lOmukKOPYHApBFyTDkaRPoAwm59E_YEE";
|
||||||
public static final String CONST_GENESIS_DOMAIN_URL = "https://boogle.store";
|
public static final String CONST_GENESIS_DOMAIN_URL = "https://boogle.store";
|
||||||
public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken";
|
public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken";
|
||||||
public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pGlobalTimeVerificationToken";
|
public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pGlobalTimeVerificationToken";
|
||||||
public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/help/help.html";
|
public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/help/help.html";
|
||||||
|
public static final String CONST_GENESIS_HELP_URL_CACHE_DARK = "resource://android/assets/help/help-dark.html";
|
||||||
public static final String CONST_GENESIS_HELP_URL = "https://boogle.store/help";
|
public static final String CONST_GENESIS_HELP_URL = "https://boogle.store/help";
|
||||||
public static final String CONST_GENESIS_HELP_URL_SUB = "boogle.store/help";
|
public static final String CONST_GENESIS_HELP_URL_SUB = "boogle.store/help";
|
||||||
public static final String CONST_BACKEND_GENESIS_URL = "https://boogle.store/search?q=$s&p_num=1&s_type=all";
|
public static final String CONST_BACKEND_GENESIS_URL = "https://boogle.store/search?q=$s&p_num=1&s_type=all";
|
||||||
|
|
|
@ -100,8 +100,8 @@ public class status
|
||||||
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
|
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
|
||||||
status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
|
status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
|
||||||
status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
|
status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
|
||||||
status.sToolbarTheme = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
|
|
||||||
status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
|
status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
|
||||||
|
status.sToolbarTheme = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
|
||||||
status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT));
|
status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT));
|
||||||
status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
|
status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
|
||||||
status.sLogListView = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
|
status.sLogListView = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
|
||||||
|
|
|
@ -58,7 +58,7 @@ class tabDataModel
|
||||||
mTabs.add(0,mTabModel);
|
mTabs.add(0,mTabModel);
|
||||||
|
|
||||||
if(mTabs.size()>20){
|
if(mTabs.size()>20){
|
||||||
closeTab(mTabs.get(mTabs.size()-1).getSession());
|
closeTab(mTabs.get(mTabs.size()-1).getSession(), mTabs.get(mTabs.size()-1).getmId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pIsDataSavable){
|
if(pIsDataSavable){
|
||||||
|
@ -89,14 +89,27 @@ class tabDataModel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeTab(geckoSession mSession) {
|
void closeTab(geckoSession mSession,Object pID) {
|
||||||
for(int counter = 0; counter< mTabs.size(); counter++){
|
if(pID == null){
|
||||||
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
|
String mID = strings.GENERIC_EMPTY_STR;
|
||||||
{
|
for(int counter = 0; counter< mTabs.size(); counter++){
|
||||||
databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + mTabs.get(counter).getmId() + "'",null);
|
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
|
||||||
mTabs.remove(counter);
|
{
|
||||||
break;
|
mTabs.remove(counter);
|
||||||
|
mID = mTabs.get(counter).getmId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + mID + "'",null);
|
||||||
|
}else {
|
||||||
|
for(int counter = 0; counter< mTabs.size(); counter++){
|
||||||
|
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
|
||||||
|
{
|
||||||
|
mTabs.remove(counter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + pID + "'",null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +202,7 @@ class tabDataModel
|
||||||
};
|
};
|
||||||
|
|
||||||
// int isLoading = 0;
|
// int isLoading = 0;
|
||||||
public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, NestedGeckoView pGeckoView){
|
public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, NestedGeckoView pGeckoView, boolean pOpenTabView){
|
||||||
|
|
||||||
new Thread(){
|
new Thread(){
|
||||||
public void run(){
|
public void run(){
|
||||||
|
@ -217,7 +230,9 @@ class tabDataModel
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
activityContextManager.getInstance().getHomeController().onOpenTabReady();
|
if(pOpenTabView){
|
||||||
|
activityContextManager.getInstance().getHomeController().onOpenTabReady();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
@ -255,7 +270,7 @@ class tabDataModel
|
||||||
moveTabToTop((geckoSession)pData.get(0));
|
moveTabToTop((geckoSession)pData.get(0));
|
||||||
}
|
}
|
||||||
else if(pCommands == dataEnums.eTabCommands.CLOSE_TAB){
|
else if(pCommands == dataEnums.eTabCommands.CLOSE_TAB){
|
||||||
closeTab((geckoSession)pData.get(0));
|
closeTab((geckoSession)pData.get(0), pData.get(1));
|
||||||
}
|
}
|
||||||
else if(pCommands == dataEnums.eTabCommands.M_CLEAR_TAB){
|
else if(pCommands == dataEnums.eTabCommands.M_CLEAR_TAB){
|
||||||
clearTab();
|
clearTab();
|
||||||
|
@ -273,7 +288,7 @@ class tabDataModel
|
||||||
return getSuggestions((String) pData.get(0));
|
return getSuggestions((String) pData.get(0));
|
||||||
}
|
}
|
||||||
else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){
|
else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){
|
||||||
updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (NestedGeckoView) pData.get(3));
|
updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (NestedGeckoView) pData.get(3), (Boolean) pData.get(4));
|
||||||
}
|
}
|
||||||
else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){
|
else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){
|
||||||
return getHomePage();
|
return getHomePage();
|
||||||
|
|
|
@ -2,7 +2,12 @@ package com.darkweb.genesissearchengine.helperManager;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
import org.mozilla.geckoview.WebRequestError;
|
import org.mozilla.geckoview.WebRequestError;
|
||||||
|
@ -12,6 +17,9 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK;
|
||||||
|
|
||||||
public class errorHandler
|
public class errorHandler
|
||||||
{
|
{
|
||||||
private AppCompatActivity mContext;
|
private AppCompatActivity mContext;
|
||||||
|
@ -23,7 +31,12 @@ public class errorHandler
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
stream = mContext.getResources().getAssets().open("error/error.html");
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
|
||||||
|
stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
|
||||||
|
}else {
|
||||||
|
stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
|
||||||
|
}
|
||||||
|
|
||||||
reader = new BufferedReader(new InputStreamReader(stream));
|
reader = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
|
@ -173,7 +186,11 @@ public class errorHandler
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
stream = mContext.getResources().getAssets().open("error/error.html");
|
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
|
||||||
|
stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
|
||||||
|
}else {
|
||||||
|
stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
|
||||||
|
}
|
||||||
reader = new BufferedReader(new InputStreamReader(stream));
|
reader = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
|
|
|
@ -66,6 +66,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
@ -313,6 +315,10 @@ public class helperMethod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double getColorDensity(int pColor) {
|
||||||
|
return ColorUtils.calculateLuminance(pColor);
|
||||||
|
}
|
||||||
|
|
||||||
public static void shareApp(AppCompatActivity context, String p_share, String p_title) {
|
public static void shareApp(AppCompatActivity context, String p_share, String p_title) {
|
||||||
ShareCompat.IntentBuilder.from(context)
|
ShareCompat.IntentBuilder.from(context)
|
||||||
.setType("text/plain")
|
.setType("text/plain")
|
||||||
|
@ -347,7 +353,7 @@ public class helperMethod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getHost(String link){
|
static public String getHost(String link){
|
||||||
URL url;
|
URL url;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -408,6 +414,13 @@ public class helperMethod
|
||||||
|
|
||||||
return "Not Defined";
|
return "Not Defined";
|
||||||
}
|
}
|
||||||
|
public static Boolean isValidURL(String url)
|
||||||
|
{
|
||||||
|
Pattern p = Pattern.compile("((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)");
|
||||||
|
Matcher m;
|
||||||
|
m=p.matcher(url);
|
||||||
|
return m.matches();
|
||||||
|
}
|
||||||
|
|
||||||
public static String capitalizeString(String string) {
|
public static String capitalizeString(String string) {
|
||||||
char[] chars = string.toLowerCase().toCharArray();
|
char[] chars = string.toLowerCase().toCharArray();
|
||||||
|
@ -492,6 +505,15 @@ public class helperMethod
|
||||||
pContext.startActivity(intent);
|
pContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isDayMode(AppCompatActivity pContext)
|
||||||
|
{
|
||||||
|
if(pContext.getResources().getString(R.string.mode).equals("Day")){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String getDomainName(String url)
|
public static String getDomainName(String url)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -81,10 +81,11 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
|
||||||
.setChannelId(mID + "")
|
.setChannelId(mID + "")
|
||||||
.setAutoCancel(false)
|
.setAutoCancel(false)
|
||||||
.setDefaults(0)
|
.setDefaults(0)
|
||||||
|
.setColor(Color.parseColor("#84989f"))
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(Notification.PRIORITY_DEFAULT)
|
.setPriority(Notification.PRIORITY_DEFAULT)
|
||||||
.addAction(R.drawable.ic_download, "Cancel",pendingIntent)
|
.addAction(R.drawable.ic_download, "Cancel",pendingIntent)
|
||||||
.setSmallIcon(R.drawable.ic_download);
|
.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||||
|
|
||||||
build.setOngoing(Prefs.persistNotifications());
|
build.setOngoing(Prefs.persistNotifications());
|
||||||
|
|
||||||
|
@ -140,13 +141,21 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build.setContentText("saving file");
|
||||||
|
build.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||||
|
mNotifyManager.notify(mID, build.build());
|
||||||
|
|
||||||
output.flush();
|
output.flush();
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
mStream.close();
|
mStream.close();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.i("ERROR", Objects.requireNonNull(ex.getMessage()));
|
build.setContentText("error occured while downloading file");
|
||||||
|
build.setAutoCancel(true);
|
||||||
|
build.setOngoing(false);
|
||||||
|
build.setPriority(Notification.PRIORITY_LOW);
|
||||||
|
build.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||||
|
mNotifyManager.notify(mID, build.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -172,11 +181,12 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
|
||||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
build.setContentIntent(pendingIntent);
|
build.setContentIntent(pendingIntent);
|
||||||
build.addAction(R.drawable.ic_download, "Open",pendingIntent);
|
build.addAction(android.R.drawable.stat_sys_download, "Open",pendingIntent);
|
||||||
build.setContentText("Download complete");
|
build.setContentText("Download complete");
|
||||||
build.setSmallIcon(R.drawable.ic_download_complete);
|
build.setSmallIcon(R.xml.ic_check);
|
||||||
build.setProgress(0, 0, false);
|
build.setProgress(0, 0, false);
|
||||||
build.setAutoCancel(true);
|
build.setAutoCancel(true);
|
||||||
|
build.setColor(Color.parseColor("#212d45"));
|
||||||
build.setOngoing(false);
|
build.setOngoing(false);
|
||||||
build.setPriority(Notification.PRIORITY_LOW);
|
build.setPriority(Notification.PRIORITY_LOW);
|
||||||
mNotifyManager.notify(mID, build.build());
|
mNotifyManager.notify(mID, build.build());
|
||||||
|
|
|
@ -35,17 +35,8 @@ class adManager
|
||||||
private void initializeBannerAds(){
|
private void initializeBannerAds(){
|
||||||
if(!sPaidStatus){
|
if(!sPaidStatus){
|
||||||
AdRequest request = new AdRequest.Builder().build();
|
AdRequest request = new AdRequest.Builder().build();
|
||||||
new Timer().schedule(new TimerTask()
|
mBannerAds.loadAd(request);
|
||||||
{
|
admobListeners();
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
mAppContext.runOnUiThread(() -> {
|
|
||||||
mBannerAds.loadAd(request);
|
|
||||||
admobListeners();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 1500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:top="113dp">
|
||||||
|
<shape
|
||||||
|
android:shape="rectangle" android:padding="10dp" >
|
||||||
|
<solid android:color="@color/c_edittext_background"/>
|
||||||
|
<corners android:radius="3dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_pressed="false"
|
||||||
|
android:top="113dp">
|
||||||
|
<shape
|
||||||
|
android:shape="rectangle" android:padding="10dp">
|
||||||
|
<solid android:color="@color/c_edittext_background"/>
|
||||||
|
<corners android:radius="3dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<corners android:radius="4dp" />
|
<corners android:radius="2.5dp" />
|
||||||
...
|
...
|
||||||
</shape>
|
</shape>
|
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
|
@ -62,7 +62,7 @@
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@xml/gx_generic_input"
|
android:background="@xml/gx_generic_input_create_bookmark"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
android:hint="@string/ALERT_TITLE_ADD"
|
android:hint="@string/ALERT_TITLE_ADD"
|
||||||
|
|
|
@ -38,25 +38,25 @@
|
||||||
android:id="@+id/pDescription"
|
android:id="@+id/pDescription"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="10dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingStart="15dp"
|
android:paddingStart="15dp"
|
||||||
android:lines="2"
|
|
||||||
android:paddingEnd="15dp"
|
android:paddingEnd="15dp"
|
||||||
android:textDirection="locale"
|
android:text="@string/GENERAL_DEFAULT_TEXT"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:layout_marginEnd="30dp"
|
|
||||||
android:textColor="@color/c_alert_text"
|
android:textColor="@color/c_alert_text"
|
||||||
android:textSize="13sp"
|
android:textDirection="locale"
|
||||||
|
android:textSize="12sp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
||||||
tools:ignore="SmallSp" />
|
tools:ignore="SmallSp" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/pDivider"
|
android:id="@+id/pDivider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="20dp"
|
||||||
android:background="@color/c_view_divier_background"
|
android:background="@color/c_view_divier_background"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -16,35 +16,61 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView2"
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginStart="14dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_download"
|
||||||
|
app:tint="@color/c_icon_tint" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/pHeader"
|
android:id="@+id/pHeader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginStart="25dp"
|
||||||
android:paddingEnd="15dp"
|
android:layout_marginTop="8dp"
|
||||||
android:paddingStart="15dp"
|
|
||||||
android:text="@string/ALERT_DOWNLOAD_SINGLE"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:paddingStart="15dp"
|
||||||
|
android:paddingEnd="15dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/ALERT_DOWNLOAD_SINGLE"
|
||||||
android:textAlignment="textStart"
|
android:textAlignment="textStart"
|
||||||
android:textColor="@color/c_text_setting_heading_v2"
|
android:textColor="@color/c_text_setting_heading_v2"
|
||||||
android:textSize="17sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="19dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@color/holo_gray_light"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/pDescription"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/pHeader" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/pDescription"
|
android:id="@+id/pDescription"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="3dp"
|
android:layout_marginEnd="3dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:paddingStart="15dp"
|
android:paddingStart="15dp"
|
||||||
android:paddingEnd="10dp"
|
android:paddingEnd="15dp"
|
||||||
|
android:text="@string/GENERAL_DEFAULT_TEXT"
|
||||||
android:textAlignment="textStart"
|
android:textAlignment="textStart"
|
||||||
android:textColor="@color/c_alert_text"
|
android:textColor="@color/c_alert_text"
|
||||||
android:textSize="14sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
||||||
|
@ -54,7 +80,7 @@
|
||||||
android:id="@+id/pDivider"
|
android:id="@+id/pDivider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginTop="35dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@color/c_view_divier_background"
|
android:background="@color/c_view_divier_background"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@ -63,7 +89,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/pNavigationContainer"
|
android:id="@+id/pNavigationContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="40dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@ -79,7 +105,7 @@
|
||||||
android:text="@string/ALERT_DISMISS"
|
android:text="@string/ALERT_DISMISS"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/c_button_text_v2"
|
android:textColor="@color/c_button_text_v2"
|
||||||
android:textSize="15sp"
|
android:textSize="13sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -101,7 +127,7 @@
|
||||||
android:text="@string/ALERT_DOWNLOAD_SINGLE_BUTTON"
|
android:text="@string/ALERT_DOWNLOAD_SINGLE_BUTTON"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/c_button_text_v3"
|
android:textColor="@color/c_button_text_v3"
|
||||||
android:textSize="15sp"
|
android:textSize="13sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -36,20 +36,17 @@
|
||||||
android:id="@+id/pDescription"
|
android:id="@+id/pDescription"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="10dp"
|
||||||
android:justificationMode="inter_word"
|
|
||||||
android:paddingStart="15dp"
|
|
||||||
android:textColor="@color/c_alert_text"
|
|
||||||
android:ellipsize="start"
|
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:lines="2"
|
android:ellipsize="start"
|
||||||
|
android:paddingStart="15dp"
|
||||||
android:paddingEnd="15dp"
|
android:paddingEnd="15dp"
|
||||||
android:textDirection="locale"
|
android:text="@string/GENERAL_DEFAULT_TEXT"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textSize="13sp"
|
android:textColor="@color/c_alert_text"
|
||||||
|
android:textDirection="locale"
|
||||||
|
android:textSize="12sp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_marginEnd="20dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
||||||
tools:ignore="SmallSp" />
|
tools:ignore="SmallSp" />
|
||||||
|
|
||||||
|
@ -57,7 +54,7 @@
|
||||||
android:id="@+id/pDivider"
|
android:id="@+id/pDivider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="20dp"
|
||||||
android:background="@color/c_view_divier_background"
|
android:background="@color/c_view_divier_background"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
android:text="@string/ALERT_REPORT_URL_INFO"
|
android:text="@string/ALERT_REPORT_URL_INFO"
|
||||||
android:textAlignment="textStart"
|
android:textAlignment="textStart"
|
||||||
android:textColor="@color/c_alert_text"
|
android:textColor="@color/c_alert_text"
|
||||||
android:textSize="14sp"
|
android:textSize="13sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
||||||
|
|
|
@ -35,18 +35,16 @@
|
||||||
android:id="@+id/pDescription"
|
android:id="@+id/pDescription"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="10dp"
|
||||||
android:justificationMode="inter_word"
|
android:text="@string/GENERAL_DEFAULT_TEXT"
|
||||||
android:paddingStart="15dp"
|
android:paddingStart="15dp"
|
||||||
android:textColor="@color/c_alert_text"
|
android:textColor="@color/c_alert_text"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:lines="2"
|
|
||||||
android:paddingEnd="15dp"
|
android:paddingEnd="15dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:textDirection="locale"
|
android:textDirection="locale"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:singleLine="true"
|
android:textSize="12sp"
|
||||||
android:textSize="13sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
app:layout_constraintTop_toBottomOf="@+id/pHeader"
|
||||||
|
@ -56,7 +54,7 @@
|
||||||
android:id="@+id/pDivider"
|
android:id="@+id/pDivider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="20dp"
|
||||||
android:background="@color/c_view_divier_background"
|
android:background="@color/c_view_divier_background"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
tools:ignore="RtlSymmetry">
|
tools:ignore="RtlSymmetry">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="7"
|
android:layout_weight="7"
|
||||||
android:layout_height="55dp"
|
android:layout_height="55dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
android:background="@xml/hox_round_outline"
|
android:background="@xml/hox_round_outline"
|
||||||
android:contentDescription="@string/GENERAL_TODO"
|
android:contentDescription="@string/GENERAL_TODO"
|
||||||
android:src="@xml/ic_baseline_browser"
|
android:src="@xml/ic_baseline_browser"
|
||||||
|
app:tint="@color/c_text_v6"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/pHindTypeIcon"
|
app:layout_constraintStart_toEndOf="@+id/pHindTypeIcon"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
|
|
@ -709,6 +709,7 @@
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
|
android:visibility="gone"
|
||||||
android:backgroundTint="@color/white"
|
android:backgroundTint="@color/white"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/GENERAL_TODO"
|
android:contentDescription="@string/GENERAL_TODO"
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="15dp"
|
||||||
android:background="@color/button_light" />
|
android:background="@color/c_home_side" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu7"
|
android:id="@+id/menu7"
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="15dp"
|
||||||
android:background="@color/button_light" />
|
android:background="@color/c_home_side" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu12"
|
android:id="@+id/menu12"
|
||||||
|
@ -464,7 +464,7 @@
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="15dp"
|
||||||
android:background="@color/button_light" />
|
android:background="@color/c_home_side" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu6"
|
android:id="@+id/menu6"
|
||||||
|
|
|
@ -155,22 +155,23 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/pTrackingRadioOption1"
|
android:id="@+id/pTrackingRadioOption1"
|
||||||
|
android:layoutDirection="rtl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:buttonTint="@color/c_radio_tint"
|
android:buttonTint="@color/c_radio_tint"
|
||||||
android:textColor="@color/c_text_v1"
|
android:textColor="@color/c_text_v1"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
android:paddingStart="10dp"
|
android:paddingStart="10dp"
|
||||||
android:paddingEnd="10dp"
|
android:paddingEnd="10dp"
|
||||||
android:textDirection="locale"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1"
|
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1"
|
||||||
|
tools:ignore="RtlHardcoded"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="42dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="42dp"
|
android:layout_marginEnd="42dp"
|
||||||
android:layout_marginTop="-2dp"
|
android:layout_marginTop="-2dp"
|
||||||
android:paddingEnd="55dp"
|
android:paddingEnd="55dp"
|
||||||
|
@ -212,7 +213,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="42dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="42dp"
|
android:layout_marginEnd="42dp"
|
||||||
android:layout_marginTop="-2dp"
|
android:layout_marginTop="-2dp"
|
||||||
android:paddingEnd="55dp"
|
android:paddingEnd="55dp"
|
||||||
|
@ -240,12 +241,13 @@
|
||||||
android:id="@+id/pTrackingRadioOption3"
|
android:id="@+id/pTrackingRadioOption3"
|
||||||
android:layoutDirection="rtl"
|
android:layoutDirection="rtl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:buttonTint="@color/c_radio_tint"
|
android:buttonTint="@color/c_radio_tint"
|
||||||
android:textColor="@color/c_text_v1"
|
android:textColor="@color/c_text_v1"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
android:paddingStart="10dp"
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3"
|
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3"
|
||||||
tools:ignore="RtlHardcoded"
|
tools:ignore="RtlHardcoded"
|
||||||
|
@ -253,7 +255,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="42dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="42dp"
|
android:layout_marginEnd="42dp"
|
||||||
android:layout_marginTop="-2dp"
|
android:layout_marginTop="-2dp"
|
||||||
android:paddingEnd="55dp"
|
android:paddingEnd="55dp"
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="43dp"
|
android:layout_width="43dp"
|
||||||
android:layout_height="43dp"
|
android:layout_height="43dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
android:padding="20dp"
|
android:padding="20dp"
|
||||||
android:translationZ="1dp"
|
android:translationZ="1dp"
|
||||||
android:layout_marginStart="-48dp"
|
android:layout_marginStart="-48dp"
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginTop="-3.5dp"
|
android:layout_marginTop="-3.5dp"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:background="@xml/gx_generic_tab_button"
|
android:background="@xml/gx_generic_tab_button"
|
||||||
|
@ -154,7 +155,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/clear_alpha"
|
android:background="@color/c_background"
|
||||||
android:elevation="8dp"
|
android:elevation="8dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<color name="c_seekbar_thumb">#33cccc</color>
|
<color name="c_seekbar_thumb">#33cccc</color>
|
||||||
<color name="c_ripple">#808080</color>
|
<color name="c_ripple">#808080</color>
|
||||||
<color name="c_ripple_v1">#0c0b0e</color>
|
<color name="c_ripple_v1">#0c0b0e</color>
|
||||||
<color name="c_ripple_v2">#ededed</color>
|
<color name="c_ripple_v2">#18171c</color>
|
||||||
<color name="c_ripple_v3">#24222a</color>
|
<color name="c_ripple_v3">#24222a</color>
|
||||||
<color name="c_button_text">#1c1b21</color>
|
<color name="c_button_text">#1c1b21</color>
|
||||||
<color name="c_button_background">#3c3946</color>
|
<color name="c_button_background">#3c3946</color>
|
||||||
|
@ -64,6 +64,7 @@
|
||||||
<color name="c_lock_tint">#f2f2f2</color>
|
<color name="c_lock_tint">#f2f2f2</color>
|
||||||
<color name="c_lock_text">#00b300</color>
|
<color name="c_lock_text">#00b300</color>
|
||||||
<color name="c_text_v6">#a6a6a6</color>
|
<color name="c_text_v6">#a6a6a6</color>
|
||||||
|
<color name="c_home_side">#28282a</color>
|
||||||
|
|
||||||
<color name="c_alert_text">#ffffff</color>
|
<color name="c_alert_text">#ffffff</color>
|
||||||
<color name="c_alert_text_inverted">#242B64</color>
|
<color name="c_alert_text_inverted">#242B64</color>
|
||||||
|
@ -109,6 +110,7 @@
|
||||||
<color name="button_gray">#d9d9d9</color>
|
<color name="button_gray">#d9d9d9</color>
|
||||||
<color name="button_light">#e3e3e3</color>
|
<color name="button_light">#e3e3e3</color>
|
||||||
<color name="holo_gray_light">#f2f2f2</color>
|
<color name="holo_gray_light">#f2f2f2</color>
|
||||||
|
<color name="holo_gray_light_row">#3b3946</color>
|
||||||
<color name="holo_light">#e6e6e6</color>
|
<color name="holo_light">#e6e6e6</color>
|
||||||
<color name="white_darker">#f8f8f8</color>
|
<color name="white_darker">#f8f8f8</color>
|
||||||
<color name="white_dark">#f2f2f2</color>
|
<color name="white_dark">#f2f2f2</color>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Application Strings -->
|
||||||
|
<string name="mode">Night</string>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -69,6 +69,7 @@
|
||||||
<color name="c_list_item_current">#f1f3f4</color>
|
<color name="c_list_item_current">#f1f3f4</color>
|
||||||
<color name="c_lock_tint">#00b300</color>
|
<color name="c_lock_tint">#00b300</color>
|
||||||
<color name="c_lock_text">#00b300</color>
|
<color name="c_lock_text">#00b300</color>
|
||||||
|
<color name="c_home_side">#e3e3e3</color>
|
||||||
|
|
||||||
<color name="c_menu_drop_shadow_05">#05e6e6e6</color>
|
<color name="c_menu_drop_shadow_05">#05e6e6e6</color>
|
||||||
<color name="c_menu_drop_shadow_10">#10e6e6e6</color>
|
<color name="c_menu_drop_shadow_10">#10e6e6e6</color>
|
||||||
|
@ -111,6 +112,7 @@
|
||||||
<color name="button_gray">#d9d9d9</color>
|
<color name="button_gray">#d9d9d9</color>
|
||||||
<color name="button_light">#e3e3e3</color>
|
<color name="button_light">#e3e3e3</color>
|
||||||
<color name="holo_gray_light">#f2f2f2</color>
|
<color name="holo_gray_light">#f2f2f2</color>
|
||||||
|
<color name="holo_gray_light_row">#f2f2f2</color>
|
||||||
<color name="holo_light">#e6e6e6</color>
|
<color name="holo_light">#e6e6e6</color>
|
||||||
<color name="white_darker">#f8f8f8</color>
|
<color name="white_darker">#f8f8f8</color>
|
||||||
<color name="white_dark">#f2f2f2</color>
|
<color name="white_dark">#f2f2f2</color>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Application Strings -->
|
<!-- Application Strings -->
|
||||||
|
<string name="mode">Day</string>
|
||||||
<string name="app_name" translatable="false">Genesis</string>
|
<string name="app_name" translatable="false">Genesis</string>
|
||||||
|
<string name="GENERAL_DEFAULT_TEXT" translatable="true">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</string>
|
||||||
<string name="GENERAL_SEARCH_HINT" translatable="true">Search or type a web address</string>
|
<string name="GENERAL_SEARCH_HINT" translatable="true">Search or type a web address</string>
|
||||||
<string name="GENERAL_FIND_HINT" translatable="true">Find in page</string>
|
<string name="GENERAL_FIND_HINT" translatable="true">Find in page</string>
|
||||||
<string name="GENERAL_SEARCH_ENGINE" translatable="true">Search Engine</string>
|
<string name="GENERAL_SEARCH_ENGINE" translatable="true">Search Engine</string>
|
||||||
|
@ -201,7 +203,7 @@
|
||||||
<string name="ALERT_SECURE_INFO" translatable="true">Connection is secure</string>
|
<string name="ALERT_SECURE_INFO" translatable="true">Connection is secure</string>
|
||||||
<string name="ALERT_SECURE_INFO_DETAIL" translatable="true">Your information(for example, password or credit card numbers) is private when it is sent to this site</string>
|
<string name="ALERT_SECURE_INFO_DETAIL" translatable="true">Your information(for example, password or credit card numbers) is private when it is sent to this site</string>
|
||||||
<string name="ALERT_SECURE_INFO_SETTINGS" translatable="true">Privacy Settings</string>
|
<string name="ALERT_SECURE_INFO_SETTINGS" translatable="true">Privacy Settings</string>
|
||||||
<string name="ALERT_DOWNLOAD_SINGLE" translatable="true">Download File</string>
|
<string name="ALERT_DOWNLOAD_SINGLE" translatable="true">Download</string>
|
||||||
<string name="ALERT_DOWNLOAD_SINGLE_BUTTON" translatable="true">Download</string>
|
<string name="ALERT_DOWNLOAD_SINGLE_BUTTON" translatable="true">Download</string>
|
||||||
<string name="ALERT_REPORT" translatable="true">Report</string>
|
<string name="ALERT_REPORT" translatable="true">Report</string>
|
||||||
<string name="ALERT_REPORT_URL" translatable="true">Report Website</string>
|
<string name="ALERT_REPORT_URL" translatable="true">Report Website</string>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/build
|
|
|
@ -1,68 +0,0 @@
|
||||||
apply plugin: 'com.android.library'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 30
|
|
||||||
buildToolsVersion '30.0.3'
|
|
||||||
ndkVersion '21.3.6528147'
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
jniLibs.srcDirs = ['./src/main/libs']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 16
|
|
||||||
targetSdkVersion 30
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aaptOptions {
|
|
||||||
cruncherEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
checkReleaseBuilds false
|
|
||||||
abortOnError true
|
|
||||||
|
|
||||||
htmlReport true
|
|
||||||
xmlReport false
|
|
||||||
textReport false
|
|
||||||
|
|
||||||
lintConfig file("../lint.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
|
|
||||||
implementation 'org.torproject:tor-android-binary:0.4.4.6'
|
|
||||||
|
|
||||||
/**
|
|
||||||
implementation 'info.pluggabletransports.aptds:apt-dispatch-library:1.0.9'
|
|
||||||
implementation 'info.pluggabletransports.aptds:apt-meek-obfs4-legacy:1.0.9'
|
|
||||||
**/
|
|
||||||
implementation 'info.pluggabletransports.aptds:jsocksAndroid:1.0.4'
|
|
||||||
|
|
||||||
implementation 'com.jaredrummler:android-shell:1.0.0'
|
|
||||||
//implementation fileTree(dir: 'libs', include: ['.so','.aar'])
|
|
||||||
|
|
||||||
implementation 'androidx.core:core:1.3.2'
|
|
||||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
|
||||||
testImplementation 'junit:junit:4.13.1'
|
|
||||||
|
|
||||||
implementation 'com.offbynull.portmapper:portmapper:2.0.5'
|
|
||||||
|
|
||||||
implementation 'info.guardianproject:jtorctl:0.4'
|
|
||||||
|
|
||||||
implementation 'com.github.tladesignz:IPtProxy:0.5.2'
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="org.torproject.android.service">
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
|
|
@ -1,38 +0,0 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */
|
|
||||||
/* See LICENSE for licensing information */
|
|
||||||
|
|
||||||
package org.torproject.android.service;
|
|
||||||
|
|
||||||
public interface OrbotConstants {
|
|
||||||
|
|
||||||
String TAG = "Orbot";
|
|
||||||
|
|
||||||
String PREF_OR = "pref_or";
|
|
||||||
String PREF_OR_PORT = "pref_or_port";
|
|
||||||
String PREF_OR_NICKNAME = "pref_or_nickname";
|
|
||||||
String PREF_REACHABLE_ADDRESSES = "pref_reachable_addresses";
|
|
||||||
String PREF_REACHABLE_ADDRESSES_PORTS = "pref_reachable_addresses_ports";
|
|
||||||
|
|
||||||
String PREF_DISABLE_NETWORK = "pref_disable_network";
|
|
||||||
|
|
||||||
String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences";
|
|
||||||
|
|
||||||
String PREF_SOCKS = "pref_socks";
|
|
||||||
|
|
||||||
String PREF_HTTP = "pref_http";
|
|
||||||
|
|
||||||
String PREF_ISOLATE_DEST = "pref_isolate_dest";
|
|
||||||
|
|
||||||
String PREF_CONNECTION_PADDING = "pref_connection_padding";
|
|
||||||
String PREF_REDUCED_CONNECTION_PADDING = "pref_reduced_connection_padding";
|
|
||||||
String PREF_CIRCUIT_PADDING = "pref_circuit_padding";
|
|
||||||
String PREF_REDUCED_CIRCUIT_PADDING = "pref_reduced_circuit_padding";
|
|
||||||
|
|
||||||
String PREF_PREFER_IPV6 = "pref_prefer_ipv6";
|
|
||||||
String PREF_DISABLE_IPV4 = "pref_disable_ipv4";
|
|
||||||
|
|
||||||
|
|
||||||
String APP_TOR_KEY = "_app_tor";
|
|
||||||
String APP_DATA_KEY = "_app_data";
|
|
||||||
String APP_WIFI_KEY = "_app_wifi";
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,42 +0,0 @@
|
||||||
package org.torproject.android.service;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
|
||||||
|
|
||||||
|
|
||||||
public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
/* sanitize the Intent before forwarding it to OrbotService */
|
|
||||||
Prefs.setContext(context);
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (TextUtils.equals(action, ACTION_START)) {
|
|
||||||
String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME);
|
|
||||||
if (Prefs.allowBackgroundStarts()) {
|
|
||||||
Intent startTorIntent = new Intent(context, OrbotService.class);
|
|
||||||
startTorIntent.setAction(action);
|
|
||||||
if (packageName != null) {
|
|
||||||
startTorIntent.putExtra(OrbotService.EXTRA_PACKAGE_NAME, packageName);
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Prefs.persistNotifications()) {
|
|
||||||
context.startForegroundService(startTorIntent);
|
|
||||||
} else {
|
|
||||||
context.startService(startTorIntent);
|
|
||||||
}
|
|
||||||
} else if (!TextUtils.isEmpty(packageName)) {
|
|
||||||
// let the requesting app know that the user has disabled
|
|
||||||
// starting via Intent
|
|
||||||
Intent startsDisabledIntent = new Intent(ACTION_STATUS);
|
|
||||||
startsDisabledIntent.putExtra(EXTRA_STATUS, STATUS_STARTS_DISABLED);
|
|
||||||
startsDisabledIntent.setPackage(packageName);
|
|
||||||
context.sendBroadcast(startsDisabledIntent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,252 +0,0 @@
|
||||||
package org.torproject.android.service;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import androidx.core.app.NotificationCompat;
|
|
||||||
|
|
||||||
import net.freehaven.tor.control.EventHandler;
|
|
||||||
|
|
||||||
import org.torproject.android.service.util.ExternalIPFetcher;
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by n8fr8 on 9/25/16.
|
|
||||||
*/
|
|
||||||
public class TorEventHandler implements EventHandler, TorServiceConstants {
|
|
||||||
|
|
||||||
private final static int BW_THRESDHOLD = 10000;
|
|
||||||
private OrbotService mService;
|
|
||||||
private long lastRead = -1;
|
|
||||||
private long lastWritten = -1;
|
|
||||||
private long mTotalTrafficWritten = 0;
|
|
||||||
private long mTotalTrafficRead = 0;
|
|
||||||
private NumberFormat mNumberFormat;
|
|
||||||
private HashMap<String, Node> hmBuiltNodes = new HashMap<>();
|
|
||||||
|
|
||||||
public TorEventHandler(OrbotService service) {
|
|
||||||
mService = service;
|
|
||||||
mNumberFormat = NumberFormat.getInstance(Locale.getDefault()); //localized numbers!
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Node> getNodes() {
|
|
||||||
return hmBuiltNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void message(String severity, String msg) {
|
|
||||||
|
|
||||||
if (severity.equalsIgnoreCase("debug"))
|
|
||||||
mService.debug(severity + ": " + msg);
|
|
||||||
else
|
|
||||||
mService.logNotice(severity + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void newDescriptors(List<String> orList) {
|
|
||||||
|
|
||||||
for (String desc : orList)
|
|
||||||
mService.debug("descriptors: " + desc);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void orConnStatus(String status, String orName) {
|
|
||||||
|
|
||||||
String sb = "orConnStatus (" +
|
|
||||||
parseNodeName(orName) +
|
|
||||||
"): " +
|
|
||||||
status;
|
|
||||||
mService.debug(sb);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void streamStatus(String status, String streamID, String target) {
|
|
||||||
|
|
||||||
String sb = "StreamStatus (" +
|
|
||||||
(streamID) +
|
|
||||||
"): " +
|
|
||||||
status;
|
|
||||||
mService.debug(sb);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unrecognized(String type, String msg) {
|
|
||||||
|
|
||||||
String sb = "Message (" +
|
|
||||||
type +
|
|
||||||
"): " +
|
|
||||||
msg;
|
|
||||||
mService.logNotice(sb);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bandwidthUsed(long read, long written) {
|
|
||||||
|
|
||||||
if (lastWritten > BW_THRESDHOLD || lastRead > BW_THRESDHOLD) {
|
|
||||||
|
|
||||||
int iconId = R.drawable.ic_stat_tor_logo;
|
|
||||||
|
|
||||||
if (read > 0 || written > 0){
|
|
||||||
if(orbotLocalConstants.mIsTorInitialized){
|
|
||||||
iconId = R.drawable.ic_stat_tor_logo;
|
|
||||||
}else {
|
|
||||||
iconId = R.drawable.ic_stat_starting_tor_logo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String sb = formatCount(read) +
|
|
||||||
" \u2193" +
|
|
||||||
" / " +
|
|
||||||
formatCount(written) +
|
|
||||||
" \u2191";
|
|
||||||
mService.showToolbarNotification(sb, mService.getNotifyId(), iconId);
|
|
||||||
|
|
||||||
mTotalTrafficWritten += written;
|
|
||||||
mTotalTrafficRead += read;
|
|
||||||
|
|
||||||
mService.sendCallbackBandwidth(lastWritten, lastRead, mTotalTrafficWritten, mTotalTrafficRead);
|
|
||||||
|
|
||||||
lastWritten = 0;
|
|
||||||
lastRead = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastWritten += written;
|
|
||||||
lastRead += read;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private String formatCount(long count) {
|
|
||||||
// Converts the supplied argument into a string.
|
|
||||||
|
|
||||||
// Under 2Mb, returns "xxx.xKb"
|
|
||||||
// Over 2Mb, returns "xxx.xxMb"
|
|
||||||
if (mNumberFormat != null)
|
|
||||||
if (count < 1e6)
|
|
||||||
return mNumberFormat.format(Math.round((float) ((int) (count * 10 / 1024)) / 10)) + "kbps";
|
|
||||||
else
|
|
||||||
return mNumberFormat.format(Math.round((float) ((int) (count * 100 / 1024 / 1024)) / 100)) + "mbps";
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
|
|
||||||
//return count+" kB";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void circuitStatus(String status, String circID, String path) {
|
|
||||||
|
|
||||||
/* once the first circuit is complete, then announce that Orbot is on*/
|
|
||||||
if (mService.getCurrentStatus() == STATUS_STARTING && TextUtils.equals(status, "BUILT")) {
|
|
||||||
mService.sendCallbackStatus(STATUS_ON);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Prefs.useDebugLogging()) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Circuit (");
|
|
||||||
sb.append((circID));
|
|
||||||
sb.append(") ");
|
|
||||||
sb.append(status);
|
|
||||||
sb.append(": ");
|
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(path, ",");
|
|
||||||
Node node;
|
|
||||||
|
|
||||||
boolean isFirstNode = true;
|
|
||||||
int nodeCount = st.countTokens();
|
|
||||||
|
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
String nodePath = st.nextToken();
|
|
||||||
String nodeId = null, nodeName = null;
|
|
||||||
|
|
||||||
String[] nodeParts;
|
|
||||||
|
|
||||||
if (nodePath.contains("="))
|
|
||||||
nodeParts = nodePath.split("=");
|
|
||||||
else
|
|
||||||
nodeParts = nodePath.split("~");
|
|
||||||
|
|
||||||
if (nodeParts.length == 1) {
|
|
||||||
nodeId = nodeParts[0].substring(1);
|
|
||||||
nodeName = nodeId;
|
|
||||||
} else if (nodeParts.length == 2) {
|
|
||||||
nodeId = nodeParts[0].substring(1);
|
|
||||||
nodeName = nodeParts[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nodeId == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
node = hmBuiltNodes.get(nodeId);
|
|
||||||
|
|
||||||
if (node == null) {
|
|
||||||
node = new Node();
|
|
||||||
node.id = nodeId;
|
|
||||||
node.name = nodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
node.status = status;
|
|
||||||
|
|
||||||
sb.append(node.name);
|
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(node.ipAddress))
|
|
||||||
sb.append("(").append(node.ipAddress).append(")");
|
|
||||||
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
sb.append(" > ");
|
|
||||||
|
|
||||||
if (status.equals("EXTENDED")) {
|
|
||||||
|
|
||||||
if (isFirstNode) {
|
|
||||||
hmBuiltNodes.put(node.id, node);
|
|
||||||
|
|
||||||
if (node.ipAddress == null && (!node.isFetchingInfo) && Prefs.useDebugLogging()) {
|
|
||||||
node.isFetchingInfo = true;
|
|
||||||
mService.exec(new ExternalIPFetcher(mService, node, OrbotService.mPortHTTP));
|
|
||||||
}
|
|
||||||
|
|
||||||
isFirstNode = false;
|
|
||||||
}
|
|
||||||
} else if (status.equals("BUILT")) {
|
|
||||||
// mService.logNotice(sb.toString());
|
|
||||||
|
|
||||||
if (Prefs.useDebugLogging() && nodeCount > 3)
|
|
||||||
mService.debug(sb.toString());
|
|
||||||
} else if (status.equals("CLOSED")) {
|
|
||||||
// mService.logNotice(sb.toString());
|
|
||||||
hmBuiltNodes.remove(node.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parseNodeName(String node) {
|
|
||||||
if (node.indexOf('=') != -1) {
|
|
||||||
return (node.substring(node.indexOf("=") + 1));
|
|
||||||
} else if (node.indexOf('~') != -1) {
|
|
||||||
return (node.substring(node.indexOf("~") + 1));
|
|
||||||
} else
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Node {
|
|
||||||
public String status;
|
|
||||||
public String id;
|
|
||||||
public String name;
|
|
||||||
public String ipAddress;
|
|
||||||
public String country;
|
|
||||||
public String organization;
|
|
||||||
|
|
||||||
public boolean isFetchingInfo = false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,118 +0,0 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
|
||||||
/* See LICENSE for licensing information */
|
|
||||||
|
|
||||||
package org.torproject.android.service;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
public interface TorServiceConstants {
|
|
||||||
|
|
||||||
String DIRECTORY_TOR_DATA = "tordata";
|
|
||||||
|
|
||||||
String TOR_CONTROL_PORT_FILE = "control.txt";
|
|
||||||
String TOR_PID_FILE = "torpid";
|
|
||||||
|
|
||||||
//torrc (tor config file)
|
|
||||||
String TORRC_ASSET_KEY = "torrc";
|
|
||||||
|
|
||||||
String TOR_CONTROL_COOKIE = "control_auth_cookie";
|
|
||||||
|
|
||||||
//geoip data file asset key
|
|
||||||
String GEOIP_ASSET_KEY = "geoip";
|
|
||||||
String GEOIP6_ASSET_KEY = "geoip6";
|
|
||||||
|
|
||||||
String IP_LOCALHOST = "127.0.0.1";
|
|
||||||
int TOR_TRANSPROXY_PORT_DEFAULT = 9040;
|
|
||||||
|
|
||||||
int TOR_DNS_PORT_DEFAULT = 5400;
|
|
||||||
|
|
||||||
String HTTP_PROXY_PORT_DEFAULT = "8118"; // like Privoxy!
|
|
||||||
String SOCKS_PROXY_PORT_DEFAULT = "9050";
|
|
||||||
|
|
||||||
//control port
|
|
||||||
String LOG_NOTICE_HEADER = "NOTICE";
|
|
||||||
String LOG_NOTICE_BOOTSTRAPPED = "Bootstrapped";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A request to Orbot to transparently start Tor services
|
|
||||||
*/
|
|
||||||
String ACTION_START = "org.torproject.android.intent.action.START";
|
|
||||||
String ACTION_STOP = "org.torproject.android.intent.action.STOP";
|
|
||||||
|
|
||||||
String ACTION_START_VPN = "org.torproject.android.intent.action.START_VPN";
|
|
||||||
String ACTION_STOP_VPN = "org.torproject.android.intent.action.STOP_VPN";
|
|
||||||
|
|
||||||
String ACTION_START_ON_BOOT = "org.torproject.android.intent.action.START_BOOT";
|
|
||||||
|
|
||||||
int REQUEST_VPN = 7777;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status
|
|
||||||
*/
|
|
||||||
String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
|
|
||||||
/**
|
|
||||||
* {@code String} that contains a status constant: {@link #STATUS_ON},
|
|
||||||
* {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or
|
|
||||||
* {@link #STATUS_STOPPING}
|
|
||||||
*/
|
|
||||||
String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
|
|
||||||
/**
|
|
||||||
* A {@link String} {@code packageName} for Orbot to direct its status reply
|
|
||||||
* to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot
|
|
||||||
*/
|
|
||||||
String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME";
|
|
||||||
/**
|
|
||||||
* The SOCKS proxy settings in URL form.
|
|
||||||
*/
|
|
||||||
String EXTRA_SOCKS_PROXY = "org.torproject.android.intent.extra.SOCKS_PROXY";
|
|
||||||
String EXTRA_SOCKS_PROXY_HOST = "org.torproject.android.intent.extra.SOCKS_PROXY_HOST";
|
|
||||||
String EXTRA_SOCKS_PROXY_PORT = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT";
|
|
||||||
/**
|
|
||||||
* The HTTP proxy settings in URL form.
|
|
||||||
*/
|
|
||||||
String EXTRA_HTTP_PROXY = "org.torproject.android.intent.extra.HTTP_PROXY";
|
|
||||||
String EXTRA_HTTP_PROXY_HOST = "org.torproject.android.intent.extra.HTTP_PROXY_HOST";
|
|
||||||
String EXTRA_HTTP_PROXY_PORT = "org.torproject.android.intent.extra.HTTP_PROXY_PORT";
|
|
||||||
|
|
||||||
String EXTRA_DNS_PORT = "org.torproject.android.intent.extra.DNS_PORT";
|
|
||||||
String EXTRA_TRANS_PORT = "org.torproject.android.intent.extra.TRANS_PORT";
|
|
||||||
|
|
||||||
String LOCAL_ACTION_LOG = "log";
|
|
||||||
String LOCAL_ACTION_BANDWIDTH = "bandwidth";
|
|
||||||
String LOCAL_EXTRA_LOG = "log";
|
|
||||||
String LOCAL_ACTION_PORTS = "ports";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All tor-related services and daemons are stopped
|
|
||||||
*/
|
|
||||||
String STATUS_OFF = "OFF";
|
|
||||||
/**
|
|
||||||
* All tor-related services and daemons have completed starting
|
|
||||||
*/
|
|
||||||
String STATUS_ON = "ON";
|
|
||||||
String STATUS_STARTING = "STARTING";
|
|
||||||
String STATUS_STOPPING = "STOPPING";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The user has disabled the ability for background starts triggered by
|
|
||||||
* apps. Fallback to the old {@link Intent} action that brings up Orbot:
|
|
||||||
* {@link org.torproject.android.OrbotMainActivity#INTENT_ACTION_REQUEST_START_TOR}
|
|
||||||
*/
|
|
||||||
String STATUS_STARTS_DISABLED = "STARTS_DISABLED";
|
|
||||||
|
|
||||||
// actions for internal command Intents
|
|
||||||
String CMD_SIGNAL_HUP = "signal_hup";
|
|
||||||
String CMD_NEWNYM = "newnym";
|
|
||||||
String CMD_SET_EXIT = "setexit";
|
|
||||||
String CMD_ACTIVE = "ACTIVE";
|
|
||||||
|
|
||||||
String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED";
|
|
||||||
|
|
||||||
//obfsproxy
|
|
||||||
String OBFSCLIENT_ASSET_KEY = "obfs4proxy";
|
|
||||||
|
|
||||||
String HIDDEN_SERVICES_DIR = "hidden_services";
|
|
||||||
String ONION_SERVICES_DIR = "v3_onion_services";
|
|
||||||
String V3_CLIENT_AUTH_DIR = "v3_client_auth";
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,128 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
|
|
||||||
public class CustomNativeLoader {
|
|
||||||
|
|
||||||
private final static String TAG = "CNL";
|
|
||||||
|
|
||||||
@SuppressLint("SetWorldReadable")
|
|
||||||
private static boolean loadFromZip(Context context, String libname, File destLocalFile, String arch) {
|
|
||||||
|
|
||||||
|
|
||||||
ZipFile zipFile = null;
|
|
||||||
InputStream stream = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
zipFile = new ZipFile(context.getApplicationInfo().sourceDir);
|
|
||||||
ZipEntry entry = zipFile.getEntry("lib/" + arch + "/" + libname + ".so");
|
|
||||||
if (entry == null) {
|
|
||||||
entry = zipFile.getEntry("jni/" + arch + "/" + libname + ".so");
|
|
||||||
if (entry == null)
|
|
||||||
throw new Exception("Unable to find file in apk:" + "lib/" + arch + "/" + libname);
|
|
||||||
}
|
|
||||||
|
|
||||||
//how we wrap this in another stream because the native .so is zipped itself
|
|
||||||
stream = zipFile.getInputStream(entry);
|
|
||||||
|
|
||||||
OutputStream out = new FileOutputStream(destLocalFile);
|
|
||||||
byte[] buf = new byte[4096];
|
|
||||||
int len;
|
|
||||||
while ((len = stream.read(buf)) > 0) {
|
|
||||||
Thread.yield();
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
destLocalFile.setReadable(true, false);
|
|
||||||
destLocalFile.setExecutable(true, false);
|
|
||||||
destLocalFile.setWritable(true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (stream != null) {
|
|
||||||
try {
|
|
||||||
stream.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (zipFile != null) {
|
|
||||||
try {
|
|
||||||
zipFile.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File loadNativeBinary(Context context, String libname, File destLocalFile) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
|
|
||||||
File fileNativeBin = new File(getNativeLibraryDir(context), libname + ".so");
|
|
||||||
if (!fileNativeBin.exists())
|
|
||||||
fileNativeBin = new File(getNativeLibraryDir(context), "lib" + libname + ".so");
|
|
||||||
|
|
||||||
if (fileNativeBin.exists()) {
|
|
||||||
if (fileNativeBin.canExecute())
|
|
||||||
return fileNativeBin;
|
|
||||||
else {
|
|
||||||
setExecutable(fileNativeBin);
|
|
||||||
|
|
||||||
if (fileNativeBin.canExecute())
|
|
||||||
return fileNativeBin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String folder = Build.CPU_ABI;
|
|
||||||
|
|
||||||
|
|
||||||
String javaArch = System.getProperty("os.arch");
|
|
||||||
if (javaArch != null && javaArch.contains("686")) {
|
|
||||||
folder = "x86";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadFromZip(context, libname, destLocalFile, folder)) {
|
|
||||||
return destLocalFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.e(TAG, e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setExecutable(File fileBin) {
|
|
||||||
fileBin.setReadable(true);
|
|
||||||
fileBin.setExecutable(true);
|
|
||||||
fileBin.setWritable(false);
|
|
||||||
fileBin.setWritable(true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return Full path to the directory where native JNI libraries are stored.
|
|
||||||
private static String getNativeLibraryDir(Context context) {
|
|
||||||
ApplicationInfo appInfo = context.getApplicationInfo();
|
|
||||||
return appInfo.nativeLibraryDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.annotation.WorkerThread;
|
|
||||||
|
|
||||||
import com.jaredrummler.android.shell.CommandResult;
|
|
||||||
import com.jaredrummler.android.shell.Shell;
|
|
||||||
import com.jaredrummler.android.shell.ShellExitCode;
|
|
||||||
import com.jaredrummler.android.shell.StreamGobbler;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CustomShell extends Shell {
|
|
||||||
|
|
||||||
|
|
||||||
@WorkerThread
|
|
||||||
public static CommandResult run(@NonNull String shell, boolean waitFor, @Nullable Map<String, String> env, @NonNull String command) {
|
|
||||||
List<String> stdout = Collections.synchronizedList(new ArrayList<>());
|
|
||||||
List<String> stderr = Collections.synchronizedList(new ArrayList<>());
|
|
||||||
int exitCode = -1;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
// setup our process, retrieve stdin stream, and stdout/stderr gobblers
|
|
||||||
//Process process = runWithEnv(command, env);
|
|
||||||
ProcessBuilder builder = new ProcessBuilder();
|
|
||||||
|
|
||||||
if (env != null && (!env.isEmpty()))
|
|
||||||
builder.environment().putAll(env);
|
|
||||||
|
|
||||||
builder.command("/system/bin/" + shell, "-c", command);
|
|
||||||
Process process = builder.start();
|
|
||||||
|
|
||||||
StreamGobbler stdoutGobbler = null;
|
|
||||||
StreamGobbler stderrGobbler = null;
|
|
||||||
|
|
||||||
if (waitFor) {
|
|
||||||
stdoutGobbler = new StreamGobbler(process.getInputStream(), stdout);
|
|
||||||
stderrGobbler = new StreamGobbler(process.getErrorStream(), stderr);
|
|
||||||
|
|
||||||
// start gobbling and write our commands to the shell
|
|
||||||
stdoutGobbler.start();
|
|
||||||
stderrGobbler.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for our process to finish, while we gobble away in the background
|
|
||||||
if (waitFor)
|
|
||||||
exitCode = process.waitFor();
|
|
||||||
else
|
|
||||||
exitCode = 0;
|
|
||||||
|
|
||||||
// make sure our threads are done gobbling, our streams are closed, and the process is destroyed - while the
|
|
||||||
// latter two shouldn't be needed in theory, and may even produce warnings, in "normal" Java they are required
|
|
||||||
// for guaranteed cleanup of resources, so lets be safe and do this on Android as well
|
|
||||||
/**
|
|
||||||
try {
|
|
||||||
stdin.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// might be closed already
|
|
||||||
}**/
|
|
||||||
|
|
||||||
if (waitFor) {
|
|
||||||
stdoutGobbler.join();
|
|
||||||
stderrGobbler.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
exitCode = ShellExitCode.WATCHDOG_EXIT;
|
|
||||||
} catch (IOException e) {
|
|
||||||
exitCode = ShellExitCode.SHELL_WRONG_UID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CommandResult(stdout, stderr, exitCode);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,184 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.torproject.android.binary.TorServiceConstants;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
public class CustomTorResourceInstaller implements TorServiceConstants {
|
|
||||||
|
|
||||||
|
|
||||||
private File installFolder;
|
|
||||||
private Context context;
|
|
||||||
|
|
||||||
private File fileTorrc;
|
|
||||||
private File fileTor;
|
|
||||||
|
|
||||||
public CustomTorResourceInstaller(Context context, File installFolder) {
|
|
||||||
this.installFolder = installFolder;
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return Full path to the directory where native JNI libraries are stored.
|
|
||||||
private static String getNativeLibraryDir(Context context) {
|
|
||||||
ApplicationInfo appInfo = context.getApplicationInfo();
|
|
||||||
return appInfo.nativeLibraryDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write the inputstream contents to the file
|
|
||||||
*/
|
|
||||||
private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException {
|
|
||||||
byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
|
|
||||||
|
|
||||||
int bytecount;
|
|
||||||
|
|
||||||
OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append);
|
|
||||||
ZipInputStream zis = null;
|
|
||||||
|
|
||||||
if (zip) {
|
|
||||||
zis = new ZipInputStream(stm);
|
|
||||||
ZipEntry ze = zis.getNextEntry();
|
|
||||||
stm = zis;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((bytecount = stm.read(buffer)) > 0) {
|
|
||||||
|
|
||||||
stmOut.write(buffer, 0, bytecount);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
stmOut.close();
|
|
||||||
stm.close();
|
|
||||||
|
|
||||||
if (zis != null)
|
|
||||||
zis.close();
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extract the Tor binary from the APK file using ZIP
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static File[] listf(String directoryName) {
|
|
||||||
|
|
||||||
// .............list file
|
|
||||||
File directory = new File(directoryName);
|
|
||||||
|
|
||||||
// get all the files from a directory
|
|
||||||
File[] fList = directory.listFiles();
|
|
||||||
|
|
||||||
if (fList != null)
|
|
||||||
for (File file : fList) {
|
|
||||||
if (file.isFile()) {
|
|
||||||
Log.d(TAG, file.getAbsolutePath());
|
|
||||||
} else if (file.isDirectory()) {
|
|
||||||
listf(file.getAbsolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fList;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
* Extract the Tor resources from the APK file using ZIP
|
|
||||||
*
|
|
||||||
* @File path to the Tor executable
|
|
||||||
*/
|
|
||||||
public File installResources() throws IOException, TimeoutException {
|
|
||||||
|
|
||||||
fileTor = new File(installFolder, TOR_ASSET_KEY);
|
|
||||||
|
|
||||||
if (!installFolder.exists())
|
|
||||||
installFolder.mkdirs();
|
|
||||||
|
|
||||||
installGeoIP();
|
|
||||||
fileTorrc = assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
|
|
||||||
|
|
||||||
File fileNativeDir = new File(getNativeLibraryDir(context));
|
|
||||||
fileTor = new File(fileNativeDir, TOR_ASSET_KEY + ".so");
|
|
||||||
|
|
||||||
if (fileTor.exists()) {
|
|
||||||
if (fileTor.canExecute())
|
|
||||||
return fileTor;
|
|
||||||
else {
|
|
||||||
setExecutable(fileTor);
|
|
||||||
|
|
||||||
if (fileTor.canExecute())
|
|
||||||
return fileTor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File fileTorBin = new File(installFolder, TOR_BINARY_KEY);
|
|
||||||
|
|
||||||
//it exists but we can't execute it, so copy it to a new path
|
|
||||||
if (fileTor.exists()) {
|
|
||||||
InputStream is = new FileInputStream(fileTor);
|
|
||||||
streamToFile(is, fileTorBin, false, true);
|
|
||||||
setExecutable(fileTorBin);
|
|
||||||
|
|
||||||
if (fileTorBin.exists() && fileTorBin.canExecute())
|
|
||||||
return fileTorBin;
|
|
||||||
}
|
|
||||||
|
|
||||||
//let's try another approach
|
|
||||||
fileTor = CustomNativeLoader.loadNativeBinary(context, TOR_ASSET_KEY, fileTorBin);
|
|
||||||
|
|
||||||
if (fileTor != null && fileTor.exists())
|
|
||||||
setExecutable(fileTor);
|
|
||||||
|
|
||||||
if (fileTor != null && fileTor.exists() && fileTor.canExecute())
|
|
||||||
return fileTor;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean installGeoIP() throws IOException {
|
|
||||||
|
|
||||||
assetToFile(COMMON_ASSET_KEY + GEOIP_ASSET_KEY, GEOIP_ASSET_KEY, false, false);
|
|
||||||
|
|
||||||
assetToFile(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY, GEOIP6_ASSET_KEY, false, false);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reads file from assetPath/assetKey writes it to the install folder
|
|
||||||
*/
|
|
||||||
private File assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException {
|
|
||||||
InputStream is = context.getAssets().open(assetPath);
|
|
||||||
File outFile = new File(installFolder, assetKey);
|
|
||||||
streamToFile(is, outFile, false, isZipped);
|
|
||||||
if (isExecutable) {
|
|
||||||
setExecutable(outFile);
|
|
||||||
}
|
|
||||||
return outFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setExecutable(File fileBin) {
|
|
||||||
fileBin.setReadable(true);
|
|
||||||
fileBin.setExecutable(true);
|
|
||||||
fileBin.setWritable(false);
|
|
||||||
fileBin.setWritable(true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To combat background service being stopped/swiped
|
|
||||||
*/
|
|
||||||
public class DummyActivity extends Activity {
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle icicle) {
|
|
||||||
super.onCreate(icicle);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.torproject.android.service.OrbotService;
|
|
||||||
import org.torproject.android.service.TorEventHandler;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Proxy;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
|
|
||||||
public class ExternalIPFetcher implements Runnable {
|
|
||||||
|
|
||||||
private final static String ONIONOO_BASE_URL = "https://onionoo.torproject.org/details?fields=country_name,as_name,or_addresses&lookup=";
|
|
||||||
private OrbotService mService;
|
|
||||||
private TorEventHandler.Node mNode;
|
|
||||||
private int mLocalHttpProxyPort = 8118;
|
|
||||||
|
|
||||||
public ExternalIPFetcher(OrbotService service, TorEventHandler.Node node, int localProxyPort) {
|
|
||||||
mService = service;
|
|
||||||
mNode = node;
|
|
||||||
mLocalHttpProxyPort = localProxyPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
|
|
||||||
URLConnection conn;
|
|
||||||
|
|
||||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", mLocalHttpProxyPort));
|
|
||||||
conn = new URL(ONIONOO_BASE_URL + mNode.id).openConnection(proxy);
|
|
||||||
|
|
||||||
conn.setRequestProperty("Connection", "Close");
|
|
||||||
conn.setConnectTimeout(60000);
|
|
||||||
conn.setReadTimeout(60000);
|
|
||||||
|
|
||||||
InputStream is = conn.getInputStream();
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
|
||||||
|
|
||||||
// getting JSON string from URL
|
|
||||||
|
|
||||||
StringBuffer json = new StringBuffer();
|
|
||||||
String line;
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null)
|
|
||||||
json.append(line);
|
|
||||||
|
|
||||||
JSONObject jsonNodeInfo = new org.json.JSONObject(json.toString());
|
|
||||||
|
|
||||||
JSONArray jsonRelays = jsonNodeInfo.getJSONArray("relays");
|
|
||||||
|
|
||||||
if (jsonRelays.length() > 0) {
|
|
||||||
mNode.ipAddress = jsonRelays.getJSONObject(0).getJSONArray("or_addresses").getString(0).split(":")[0];
|
|
||||||
mNode.country = jsonRelays.getJSONObject(0).getString("country_name");
|
|
||||||
mNode.organization = jsonRelays.getJSONObject(0).getString("as_name");
|
|
||||||
|
|
||||||
StringBuffer sbInfo = new StringBuffer();
|
|
||||||
sbInfo.append(mNode.name).append("(");
|
|
||||||
sbInfo.append(mNode.ipAddress).append(")");
|
|
||||||
|
|
||||||
if (mNode.country != null)
|
|
||||||
sbInfo.append(' ').append(mNode.country);
|
|
||||||
|
|
||||||
if (mNode.organization != null)
|
|
||||||
sbInfo.append(" (").append(mNode.organization).append(')');
|
|
||||||
|
|
||||||
mService.debug(sbInfo.toString());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.close();
|
|
||||||
is.close();
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
// mService.debug ("Error getting node details from onionoo: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,98 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
|
|
||||||
public class NativeLoader {
|
|
||||||
|
|
||||||
private final static String TAG = "TorNativeLoader";
|
|
||||||
|
|
||||||
@SuppressLint("SetWorldReadable")
|
|
||||||
private static boolean loadFromZip(Context context, String libName, File destLocalFile, String folder) {
|
|
||||||
|
|
||||||
|
|
||||||
ZipFile zipFile = null;
|
|
||||||
InputStream stream = null;
|
|
||||||
try {
|
|
||||||
zipFile = new ZipFile(context.getApplicationInfo().sourceDir);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
|
||||||
while (entries.hasMoreElements())
|
|
||||||
{
|
|
||||||
ZipEntry entry = entries.nextElement();
|
|
||||||
Log.d("Zip","entry: " + entry.getName());
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
|
|
||||||
ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + libName + ".so");
|
|
||||||
if (entry == null) {
|
|
||||||
entry = zipFile.getEntry("lib/" + folder + "/" + libName);
|
|
||||||
if (entry == null)
|
|
||||||
throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + libName);
|
|
||||||
}
|
|
||||||
stream = zipFile.getInputStream(entry);
|
|
||||||
|
|
||||||
OutputStream out = new FileOutputStream(destLocalFile);
|
|
||||||
byte[] buf = new byte[4096];
|
|
||||||
int len;
|
|
||||||
while ((len = stream.read(buf)) > 0) {
|
|
||||||
Thread.yield();
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
destLocalFile.setReadable(true, false);
|
|
||||||
destLocalFile.setExecutable(true, false);
|
|
||||||
destLocalFile.setWritable(true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (stream != null) {
|
|
||||||
try {
|
|
||||||
stream.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (zipFile != null) {
|
|
||||||
try {
|
|
||||||
zipFile.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized boolean initNativeLibs(Context context, String binaryName, File destLocalFile) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
String folder = Build.CPU_ABI;
|
|
||||||
|
|
||||||
String javaArch = System.getProperty("os.arch");
|
|
||||||
if (javaArch != null && javaArch.contains("686")) {
|
|
||||||
folder = "x86";
|
|
||||||
}
|
|
||||||
|
|
||||||
return loadFromZip(context, binaryName, destLocalFile, folder);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.offbynull.portmapper.PortMapperFactory;
|
|
||||||
import com.offbynull.portmapper.gateway.Bus;
|
|
||||||
import com.offbynull.portmapper.gateway.Gateway;
|
|
||||||
import com.offbynull.portmapper.gateways.network.NetworkGateway;
|
|
||||||
import com.offbynull.portmapper.gateways.network.internalmessages.KillNetworkRequest;
|
|
||||||
import com.offbynull.portmapper.gateways.process.ProcessGateway;
|
|
||||||
import com.offbynull.portmapper.gateways.process.internalmessages.KillProcessRequest;
|
|
||||||
import com.offbynull.portmapper.mapper.MappedPort;
|
|
||||||
import com.offbynull.portmapper.mapper.PortMapper;
|
|
||||||
import com.offbynull.portmapper.mapper.PortType;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PortForwarder {
|
|
||||||
|
|
||||||
private boolean shutdown = false;
|
|
||||||
private Thread mThread = null;
|
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
shutdown = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void forward(final int internalPort, final int externalPort, final long lifetime) throws InterruptedException {
|
|
||||||
|
|
||||||
mThread = new Thread() {
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
forwardSync(internalPort, externalPort, lifetime);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void forwardSync(int internalPort, int externalPort, long lifetime) throws InterruptedException {
|
|
||||||
// Start gateways
|
|
||||||
Gateway network = NetworkGateway.create();
|
|
||||||
Gateway process = ProcessGateway.create();
|
|
||||||
Bus networkBus = network.getBus();
|
|
||||||
Bus processBus = process.getBus();
|
|
||||||
|
|
||||||
// Discover port forwarding devices and take the first one found
|
|
||||||
List<PortMapper> mappers = PortMapperFactory.discover(networkBus, processBus);
|
|
||||||
PortMapper mapper = mappers.get(0);
|
|
||||||
|
|
||||||
// Map internal port 12345 to some external port (55555 preferred)
|
|
||||||
//
|
|
||||||
// IMPORTANT NOTE: Many devices prevent you from mapping ports that are <= 1024
|
|
||||||
// (both internal and external ports). Be mindful of this when choosing which
|
|
||||||
// ports you want to map.
|
|
||||||
MappedPort mappedPort = mapper.mapPort(PortType.TCP, internalPort, externalPort, lifetime);
|
|
||||||
Log.d(getClass().getName(), "Port mapping added: " + mappedPort);
|
|
||||||
|
|
||||||
// Refresh mapping half-way through the lifetime of the mapping (for example,
|
|
||||||
// if the mapping is available for 40 seconds, refresh it every 20 seconds)
|
|
||||||
while (!shutdown) {
|
|
||||||
mappedPort = mapper.refreshPort(mappedPort, mappedPort.getLifetime() / 2L);
|
|
||||||
Log.d(getClass().getName(), "Port mapping refreshed: " + mappedPort);
|
|
||||||
Thread.sleep(mappedPort.getLifetime() * 1000L);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unmap port 12345
|
|
||||||
mapper.unmapPort(mappedPort);
|
|
||||||
|
|
||||||
// Stop gateways
|
|
||||||
networkBus.send(new KillNetworkRequest());
|
|
||||||
processBus.send(new KillProcessRequest()); // can kill this after discovery
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
|
|
||||||
import org.torproject.android.service.OrbotConstants;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class Prefs {
|
|
||||||
|
|
||||||
private final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
|
|
||||||
private final static String PREF_BRIDGES_LIST = "pref_bridges_list";
|
|
||||||
private final static String PREF_DEFAULT_LOCALE = "pref_default_locale";
|
|
||||||
private final static String PREF_ENABLE_LOGGING = "pref_enable_logging";
|
|
||||||
private final static String PREF_EXPANDED_NOTIFICATIONS = "pref_expanded_notifications";
|
|
||||||
private final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications";
|
|
||||||
private final static String PREF_START_ON_BOOT = "pref_start_boot";
|
|
||||||
private final static String PREF_ALLOW_BACKGROUND_STARTS = "pref_allow_background_starts";
|
|
||||||
private final static String PREF_OPEN_PROXY_ON_ALL_INTERFACES = "pref_open_proxy_on_all_interfaces";
|
|
||||||
private final static String PREF_USE_VPN = "pref_vpn";
|
|
||||||
private final static String PREF_EXIT_NODES = "pref_exit_nodes";
|
|
||||||
private final static String PREF_BE_A_SNOWFLAKE = "pref_be_a_snowflake";
|
|
||||||
|
|
||||||
private static SharedPreferences prefs;
|
|
||||||
|
|
||||||
public static void setContext(Context context) {
|
|
||||||
if (prefs == null)
|
|
||||||
prefs = getSharedPrefs(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void putBoolean(String key, boolean value) {
|
|
||||||
prefs.edit().putBoolean(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void putString(String key, String value) {
|
|
||||||
prefs.edit().putString(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean bridgesEnabled() {
|
|
||||||
//if phone is in Farsi, enable bridges by default
|
|
||||||
boolean bridgesEnabledDefault = Locale.getDefault().getLanguage().equals("fa");
|
|
||||||
return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void putBridgesEnabled(boolean value) {
|
|
||||||
putBoolean(PREF_BRIDGES_ENABLED, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getBridgesList() {
|
|
||||||
String defaultBridgeType = "obfs4";
|
|
||||||
if (Locale.getDefault().getLanguage().equals("fa"))
|
|
||||||
defaultBridgeType = "meek"; //if Farsi, use meek as the default bridge type
|
|
||||||
return prefs.getString(PREF_BRIDGES_LIST, defaultBridgeType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBridgesList(String value) {
|
|
||||||
putString(PREF_BRIDGES_LIST, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDefaultLocale() {
|
|
||||||
return prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean beSnowflakeProxy () {
|
|
||||||
return prefs.getBoolean(PREF_BE_A_SNOWFLAKE,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBeSnowflakeProxy (boolean beSnowflakeProxy) {
|
|
||||||
putBoolean(PREF_BE_A_SNOWFLAKE,beSnowflakeProxy);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDefaultLocale(String value) {
|
|
||||||
putString(PREF_DEFAULT_LOCALE, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean expandedNotifications() {
|
|
||||||
return prefs.getBoolean(PREF_EXPANDED_NOTIFICATIONS, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean useDebugLogging() {
|
|
||||||
return prefs.getBoolean(PREF_ENABLE_LOGGING, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean persistNotifications() {
|
|
||||||
return prefs.getBoolean(PREF_PERSIST_NOTIFICATIONS, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean allowBackgroundStarts() {
|
|
||||||
return prefs.getBoolean(PREF_ALLOW_BACKGROUND_STARTS, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean openProxyOnAllInterfaces() {
|
|
||||||
return prefs.getBoolean(PREF_OPEN_PROXY_ON_ALL_INTERFACES, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean useVpn() {
|
|
||||||
return prefs.getBoolean(PREF_USE_VPN, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void putUseVpn(boolean value) {
|
|
||||||
putBoolean(PREF_USE_VPN, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean startOnBoot() {
|
|
||||||
return prefs.getBoolean(PREF_START_ON_BOOT, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void putStartOnBoot(boolean value) {
|
|
||||||
putBoolean(PREF_START_ON_BOOT, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getExitNodes() {
|
|
||||||
return prefs.getString(PREF_EXIT_NODES, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setExitNodes(String exits) {
|
|
||||||
putString(PREF_EXIT_NODES, exits);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SharedPreferences getSharedPrefs(Context context) {
|
|
||||||
return context.getSharedPreferences(OrbotConstants.PREF_TOR_SHARED_PREFS, Context.MODE_MULTI_PROCESS);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,307 +0,0 @@
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013, Sebastiano Gottardo
|
|
||||||
* All rights reserved.
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the MegaDevs nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL SEBASTIANO GOTTARDO BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main class for the TCPSourceApp library.
|
|
||||||
*
|
|
||||||
* @author Sebastiano Gottardo
|
|
||||||
*/
|
|
||||||
public class TCPSourceApp {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In a Linux-based OS, each active TCP socket is mapped in the following
|
|
||||||
* two files. A socket may be mapped in the '/proc/net/tcp' file in case
|
|
||||||
* of a simple IPv4 address, or in the '/proc/net/tcp6' if an IPv6 address
|
|
||||||
* is available.
|
|
||||||
*/
|
|
||||||
private static final String TCP_4_FILE_PATH = "/proc/net/tcp";
|
|
||||||
private static final String TCP_6_FILE_PATH = "/proc/net/tcp6";
|
|
||||||
/*
|
|
||||||
* Two regular expressions that are able to extract valuable informations
|
|
||||||
* from the two /proc/net/tcp* files. More specifically, there are three
|
|
||||||
* fields that are extracted:
|
|
||||||
* - address
|
|
||||||
* - port
|
|
||||||
* - PID
|
|
||||||
*/
|
|
||||||
private static final String TCP_6_PATTERN = "\\d+:\\s([0-9A-F]{32}):([0-9A-F]{4})\\s[0-9A-F]{32}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9]{8}:[0-9]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9]{8}\\s+([0-9]+)";
|
|
||||||
private static final String TCP_4_PATTERN = "\\d+:\\s([0-9A-F]{8}):([0-9A-F]{4})\\s[0-9A-F]{8}:[0-9A-F]{4}\\s[0-9A-F]{2}\\s[0-9A-F]{8}:[0-9A-F]{8}\\s[0-9]{2}:[0-9]{8}\\s[0-9A-F]{8}\\s+([0-9]+)";
|
|
||||||
//sargo:/ $ cat /proc/net/tcp6
|
|
||||||
// sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
|
|
||||||
// 0: 00000000000000000000000000000000:C36A 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 35059 1 0000000000000000 99 0 0 10 0
|
|
||||||
// 1: 00000000000000000000000000000000:A64B 00000000000000000000000000000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 910009 1 0000000000000000 99 0 0 10 0
|
|
||||||
/*
|
|
||||||
* Optimises the socket lookup by checking if the connected network
|
|
||||||
* interface has a 'valid' IPv6 address (a global address, not a link-local
|
|
||||||
* one).
|
|
||||||
*/
|
|
||||||
private static boolean checkConnectedIfaces = true;
|
|
||||||
// sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
|
|
||||||
// 0: 00000000:C368 00000000:0000 8A 00000000:00000000 00:00000000 00000000 1001 0 34999 1 0000000000000000 99 0 0 10 0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The main method of the TCPSourceApp library. This method receives an
|
|
||||||
* Android Context instance, which is used to access the PackageManager.
|
|
||||||
* It parses the /proc/net/tcp* files, looking for a socket entry that
|
|
||||||
* matches the given port. If it finds an entry, this method extracts the
|
|
||||||
* PID value and it uses the PackageManager.getPackagesFromPid() method to
|
|
||||||
* find the originating application.
|
|
||||||
*
|
|
||||||
* @param context a valid Android Context instance
|
|
||||||
* @param daddr the (logical) address of the destination
|
|
||||||
* @param dport the (logical) port of the destination
|
|
||||||
* @return an AppDescriptor object, representing the found application; null
|
|
||||||
* if no application could be found
|
|
||||||
*/
|
|
||||||
public static AppDescriptor getApplicationInfo(Context context, String saddr, int sport, String daddr, int dport) {
|
|
||||||
|
|
||||||
File tcp;
|
|
||||||
BufferedReader reader;
|
|
||||||
String line;
|
|
||||||
StringBuilder builder;
|
|
||||||
String content;
|
|
||||||
|
|
||||||
try {
|
|
||||||
boolean hasIPv6 = true;
|
|
||||||
|
|
||||||
// if true, checks for a connected network interface with a valid
|
|
||||||
// IPv4 / IPv6 address
|
|
||||||
if (checkConnectedIfaces) {
|
|
||||||
String ipv4Address = getIPAddress(true);
|
|
||||||
String ipv6Address = getIPAddress(false);
|
|
||||||
|
|
||||||
hasIPv6 = (ipv6Address.length() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
tcp = new File(TCP_6_FILE_PATH);
|
|
||||||
reader = new BufferedReader(new FileReader(tcp));
|
|
||||||
builder = new StringBuilder();
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
builder.append(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
content = builder.toString();
|
|
||||||
|
|
||||||
Matcher m6 = Pattern.compile(TCP_6_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content);
|
|
||||||
|
|
||||||
if (hasIPv6)
|
|
||||||
while (m6.find()) {
|
|
||||||
String addressEntry = m6.group(1);
|
|
||||||
String portEntry = m6.group(2);
|
|
||||||
int pidEntry = Integer.valueOf(m6.group(3));
|
|
||||||
|
|
||||||
if (Integer.parseInt(portEntry, 16) == dport) {
|
|
||||||
PackageManager manager = context.getPackageManager();
|
|
||||||
String[] packagesForUid = manager.getPackagesForUid(pidEntry);
|
|
||||||
|
|
||||||
if (packagesForUid != null) {
|
|
||||||
String packageName = packagesForUid[0];
|
|
||||||
PackageInfo pInfo = manager.getPackageInfo(packageName, 0);
|
|
||||||
String version = pInfo.versionName;
|
|
||||||
|
|
||||||
return new AppDescriptor(pidEntry, packageName, version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SocketException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// From here, no connection with the given port could be found in the tcp6 file
|
|
||||||
// So let's try the tcp (IPv4) one
|
|
||||||
|
|
||||||
try {
|
|
||||||
tcp = new File(TCP_4_FILE_PATH);
|
|
||||||
reader = new BufferedReader(new FileReader(tcp));
|
|
||||||
builder = new StringBuilder();
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
builder.append(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
content = builder.toString();
|
|
||||||
|
|
||||||
Matcher m4 = Pattern.compile(TCP_4_PATTERN, Pattern.CASE_INSENSITIVE | Pattern.UNIX_LINES | Pattern.DOTALL).matcher(content);
|
|
||||||
|
|
||||||
while (m4.find()) {
|
|
||||||
String addressEntry = m4.group(1);
|
|
||||||
String portEntry = m4.group(2);
|
|
||||||
int pidEntry = Integer.valueOf(m4.group(3));
|
|
||||||
|
|
||||||
if (Integer.parseInt(portEntry, 16) == dport) {
|
|
||||||
PackageManager manager = context.getPackageManager();
|
|
||||||
String[] packagesForUid = manager.getPackagesForUid(pidEntry);
|
|
||||||
|
|
||||||
if (packagesForUid != null) {
|
|
||||||
String packageName = packagesForUid[0];
|
|
||||||
PackageInfo pInfo = manager.getPackageInfo(packageName, 0);
|
|
||||||
String version = pInfo.versionName;
|
|
||||||
|
|
||||||
return new AppDescriptor(pidEntry, packageName, version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SocketException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("DefaultLocale")
|
|
||||||
public static String getIPAddress(boolean useIPv4) throws SocketException {
|
|
||||||
|
|
||||||
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
|
||||||
|
|
||||||
for (NetworkInterface intf : interfaces) {
|
|
||||||
List<InetAddress> addrs = Collections.list(intf.getInetAddresses());
|
|
||||||
|
|
||||||
for (InetAddress addr : addrs) {
|
|
||||||
if (!addr.isLoopbackAddress()) {
|
|
||||||
String sAddr = addr.getHostAddress().toUpperCase();
|
|
||||||
|
|
||||||
boolean isIPv4 = addr instanceof Inet4Address;
|
|
||||||
|
|
||||||
if (useIPv4) {
|
|
||||||
if (isIPv4)
|
|
||||||
return sAddr;
|
|
||||||
} else {
|
|
||||||
if (!isIPv4) {
|
|
||||||
if (sAddr.startsWith("fe80") || sAddr.startsWith("FE80")) // skipping link-local addresses
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int delim = sAddr.indexOf('%'); // drop ip6 port suffix
|
|
||||||
return delim < 0 ? sAddr : sAddr.substring(0, delim);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the connected interfaces optimisation.
|
|
||||||
*/
|
|
||||||
public static void setCheckConnectedIfaces(boolean value) {
|
|
||||||
checkConnectedIfaces = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This class represents an Android application. Each application is
|
|
||||||
* uniquely identified by its package name (e.g. com.megadevs.tcpsourceapp)
|
|
||||||
* and its version (e.g. 1.0).
|
|
||||||
*/
|
|
||||||
public static class AppDescriptor {
|
|
||||||
|
|
||||||
private String packageName;
|
|
||||||
private String version;
|
|
||||||
private int uid;
|
|
||||||
|
|
||||||
public AppDescriptor(int uid, String pName, String ver) {
|
|
||||||
this.uid = uid;
|
|
||||||
packageName = pName;
|
|
||||||
version = ver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUid() {
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackageName() {
|
|
||||||
return packageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Override of the 'equals' method, in order to have a proper
|
|
||||||
* comparison between two AppDescriptor objects.
|
|
||||||
*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
|
|
||||||
if (o instanceof AppDescriptor) {
|
|
||||||
boolean c1 = ((AppDescriptor) o).packageName.compareTo(this.packageName) == 0;
|
|
||||||
boolean c2 = ((AppDescriptor) o).version.compareTo(this.version) == 0;
|
|
||||||
|
|
||||||
return c1 && c2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
|
||||||
/* See LICENSE for licensing information */
|
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
|
||||||
|
|
||||||
import java.net.ConnectException;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Socket;
|
|
||||||
|
|
||||||
public class TorServiceUtils implements TorServiceConstants {
|
|
||||||
|
|
||||||
public static boolean isPortOpen(final String ip, final int port, final int timeout) {
|
|
||||||
try {
|
|
||||||
Socket socket = new Socket();
|
|
||||||
socket.connect(new InetSocketAddress(ip, port), timeout);
|
|
||||||
socket.close();
|
|
||||||
return true;
|
|
||||||
} catch (ConnectException ce) {
|
|
||||||
//ce.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} catch (Exception ex) {
|
|
||||||
//ex.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,183 +0,0 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
|
||||||
/* See LICENSE for licensing information */
|
|
||||||
|
|
||||||
|
|
||||||
package org.torproject.android.service.util;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
public class Utils {
|
|
||||||
|
|
||||||
|
|
||||||
public static String readString(InputStream stream) {
|
|
||||||
String line;
|
|
||||||
|
|
||||||
StringBuffer out = new StringBuffer();
|
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
out.append(line);
|
|
||||||
out.append('\n');
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return out.toString();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load the log file text
|
|
||||||
*/
|
|
||||||
public static String loadTextFile(String path) {
|
|
||||||
String line;
|
|
||||||
|
|
||||||
StringBuffer out = new StringBuffer();
|
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedReader reader = new BufferedReader((new FileReader(new File(path))));
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
out.append(line);
|
|
||||||
out.append('\n');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return out.toString();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load the log file text
|
|
||||||
*/
|
|
||||||
public static boolean saveTextFile(String path, String contents) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
FileWriter writer = new FileWriter(path, false);
|
|
||||||
writer.write(contents);
|
|
||||||
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Log.d(TAG, "error writing file: " + path, e);
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Zips a file at a location and places the resulting zip file at the toLocation
|
|
||||||
* Example: zipFileAtPath("downloads/myfolder", "downloads/myFolder.zip");
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean zipFileAtPath(String sourcePath, String toLocation) {
|
|
||||||
final int BUFFER = 2048;
|
|
||||||
|
|
||||||
File sourceFile = new File(sourcePath);
|
|
||||||
try {
|
|
||||||
BufferedInputStream origin;
|
|
||||||
FileOutputStream dest = new FileOutputStream(toLocation);
|
|
||||||
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(
|
|
||||||
dest));
|
|
||||||
if (sourceFile.isDirectory()) {
|
|
||||||
zipSubFolder(out, sourceFile, sourceFile.getParent().length());
|
|
||||||
} else {
|
|
||||||
byte[] data = new byte[BUFFER];
|
|
||||||
FileInputStream fi = new FileInputStream(sourcePath);
|
|
||||||
origin = new BufferedInputStream(fi, BUFFER);
|
|
||||||
ZipEntry entry = new ZipEntry(getLastPathComponent(sourcePath));
|
|
||||||
entry.setTime(sourceFile.lastModified()); // to keep modification time after unzipping
|
|
||||||
out.putNextEntry(entry);
|
|
||||||
int count;
|
|
||||||
while ((count = origin.read(data, 0, BUFFER)) != -1) {
|
|
||||||
out.write(data, 0, count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Zips a subfolder
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static void zipSubFolder(ZipOutputStream out, File folder,
|
|
||||||
int basePathLength) throws IOException {
|
|
||||||
|
|
||||||
final int BUFFER = 2048;
|
|
||||||
|
|
||||||
File[] fileList = folder.listFiles();
|
|
||||||
BufferedInputStream origin;
|
|
||||||
for (File file : fileList) {
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
zipSubFolder(out, file, basePathLength);
|
|
||||||
} else {
|
|
||||||
byte[] data = new byte[BUFFER];
|
|
||||||
String unmodifiedFilePath = file.getPath();
|
|
||||||
String relativePath = unmodifiedFilePath
|
|
||||||
.substring(basePathLength);
|
|
||||||
FileInputStream fi = new FileInputStream(unmodifiedFilePath);
|
|
||||||
origin = new BufferedInputStream(fi, BUFFER);
|
|
||||||
ZipEntry entry = new ZipEntry(relativePath);
|
|
||||||
entry.setTime(file.lastModified()); // to keep modification time after unzipping
|
|
||||||
out.putNextEntry(entry);
|
|
||||||
int count;
|
|
||||||
while ((count = origin.read(data, 0, BUFFER)) != -1) {
|
|
||||||
out.write(data, 0, count);
|
|
||||||
}
|
|
||||||
origin.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gets the last path component
|
|
||||||
*
|
|
||||||
* Example: getLastPathComponent("downloads/example/fileToZip");
|
|
||||||
* Result: "fileToZip"
|
|
||||||
*/
|
|
||||||
public static String getLastPathComponent(String filePath) {
|
|
||||||
String[] segments = filePath.split("/");
|
|
||||||
if (segments.length == 0)
|
|
||||||
return "";
|
|
||||||
return segments[segments.length - 1];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,408 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.torproject.android.service.vpn;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
|
||||||
import android.net.VpnService;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.os.ParcelFileDescriptor;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.runjva.sourceforge.jsocks.protocol.ProxyServer;
|
|
||||||
import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone;
|
|
||||||
|
|
||||||
import org.torproject.android.service.OrbotConstants;
|
|
||||||
import org.torproject.android.service.OrbotService;
|
|
||||||
import org.torproject.android.service.R;
|
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
|
||||||
import org.torproject.android.service.util.CustomNativeLoader;
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
|
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_START;
|
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_START_VPN;
|
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_STOP_VPN;
|
|
||||||
|
|
||||||
public class OrbotVpnManager implements Handler.Callback {
|
|
||||||
private static final String TAG = "OrbotVpnService";
|
|
||||||
private final static int VPN_MTU = 1500;
|
|
||||||
private final static boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
|
||||||
private final static String PDNSD_BIN = "pdnsd";
|
|
||||||
public static int sSocksProxyServerPort = -1;
|
|
||||||
public static String sSocksProxyLocalhost = null;
|
|
||||||
boolean isStarted = false;
|
|
||||||
File filePdnsPid;
|
|
||||||
private Thread mThreadVPN;
|
|
||||||
private final static String mSessionName = "OrbotVPN";
|
|
||||||
private ParcelFileDescriptor mInterface;
|
|
||||||
private int mTorSocks = -1;
|
|
||||||
private int mTorDns = -1;
|
|
||||||
private int pdnsdPort = 8091;
|
|
||||||
private ProxyServer mSocksProxyServer;
|
|
||||||
private final File filePdnsd;
|
|
||||||
private boolean isRestart = false;
|
|
||||||
private final VpnService mService;
|
|
||||||
|
|
||||||
public OrbotVpnManager(VpnService service) {
|
|
||||||
mService = service;
|
|
||||||
filePdnsd = CustomNativeLoader.loadNativeBinary(service.getApplicationContext(), PDNSD_BIN, new File(service.getFilesDir(), PDNSD_BIN));
|
|
||||||
Tun2Socks.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File makePdnsdConf(Context context, File fileDir, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException {
|
|
||||||
String conf = String.format(context.getString(R.string.pdnsd_conf), torDnsHost, torDnsPort, fileDir.getCanonicalPath(), pdnsdHost, pdnsdPort);
|
|
||||||
|
|
||||||
Log.d(TAG, "pdsnd conf:" + conf);
|
|
||||||
|
|
||||||
File fPid = new File(fileDir, pdnsdPort + "pdnsd.conf");
|
|
||||||
|
|
||||||
if (fPid.exists()) {
|
|
||||||
fPid.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream(fPid, false);
|
|
||||||
PrintStream ps = new PrintStream(fos);
|
|
||||||
ps.print(conf);
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
File cache = new File(fileDir, "pdnsd.cache");
|
|
||||||
|
|
||||||
if (!cache.exists()) {
|
|
||||||
try {
|
|
||||||
cache.createNewFile();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fPid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int handleIntent(VpnService.Builder builder, Intent intent) {
|
|
||||||
if (intent != null) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
|
|
||||||
if (action != null) {
|
|
||||||
if (action.equals(ACTION_START_VPN) || action.equals(ACTION_START)) {
|
|
||||||
Log.d(TAG, "starting VPN");
|
|
||||||
|
|
||||||
isStarted = true;
|
|
||||||
|
|
||||||
// Stop the previous session by interrupting the thread.
|
|
||||||
if (mThreadVPN != null && mThreadVPN.isAlive())
|
|
||||||
stopVPN();
|
|
||||||
|
|
||||||
if (mTorSocks != -1) {
|
|
||||||
if (!mIsLollipop) {
|
|
||||||
startSocksBypass();
|
|
||||||
}
|
|
||||||
|
|
||||||
setupTun2Socks(builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (action.equals(ACTION_STOP_VPN)) {
|
|
||||||
isStarted = false;
|
|
||||||
|
|
||||||
Log.d(TAG, "stopping VPN");
|
|
||||||
|
|
||||||
stopVPN();
|
|
||||||
} else if (action.equals(TorServiceConstants.LOCAL_ACTION_PORTS)) {
|
|
||||||
Log.d(TAG, "setting VPN ports");
|
|
||||||
|
|
||||||
int torSocks = intent.getIntExtra(OrbotService.EXTRA_SOCKS_PROXY_PORT, -1);
|
|
||||||
int torDns = intent.getIntExtra(OrbotService.EXTRA_DNS_PORT, -1);
|
|
||||||
|
|
||||||
//if running, we need to restart
|
|
||||||
if ((torSocks != mTorSocks || torDns != mTorDns)) {
|
|
||||||
|
|
||||||
mTorSocks = torSocks;
|
|
||||||
mTorDns = torDns;
|
|
||||||
|
|
||||||
if (!mIsLollipop) {
|
|
||||||
stopSocksBypass();
|
|
||||||
startSocksBypass();
|
|
||||||
}
|
|
||||||
|
|
||||||
setupTun2Socks(builder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return Service.START_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startSocksBypass() {
|
|
||||||
new Thread() {
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
//generate the proxy port that the
|
|
||||||
if (sSocksProxyServerPort == -1) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
sSocksProxyLocalhost = "127.0.0.1";// InetAddress.getLocalHost().getHostAddress();
|
|
||||||
sSocksProxyServerPort = (int) ((Math.random() * 1000) + 10000);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Unable to access localhost", e);
|
|
||||||
throw new RuntimeException("Unable to access localhost: " + e);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mSocksProxyServer != null) {
|
|
||||||
stopSocksBypass();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
mSocksProxyServer = new ProxyServer(new ServerAuthenticatorNone(null, null));
|
|
||||||
ProxyServer.setVpnService(mService);
|
|
||||||
mSocksProxyServer.start(sSocksProxyServerPort, 5, InetAddress.getLocalHost());
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "error getting host", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void stopSocksBypass() {
|
|
||||||
if (mSocksProxyServer != null) {
|
|
||||||
mSocksProxyServer.stop();
|
|
||||||
mSocksProxyServer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopVPN() {
|
|
||||||
if (mIsLollipop)
|
|
||||||
stopSocksBypass();
|
|
||||||
|
|
||||||
Tun2Socks.Stop();
|
|
||||||
|
|
||||||
if (mInterface != null) {
|
|
||||||
try {
|
|
||||||
Log.d(TAG, "closing interface, destroying VPN interface");
|
|
||||||
|
|
||||||
mInterface.close();
|
|
||||||
mInterface = null;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.d(TAG, "error stopping tun2socks", e);
|
|
||||||
} catch (Error e) {
|
|
||||||
Log.d(TAG, "error stopping tun2socks", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stopDns();
|
|
||||||
mThreadVPN = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleMessage(Message message) {
|
|
||||||
if (message != null) {
|
|
||||||
Toast.makeText(mService, message.what, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void setupTun2Socks(final VpnService.Builder builder) {
|
|
||||||
if (mInterface != null) //stop tun2socks now to give it time to clean up
|
|
||||||
{
|
|
||||||
isRestart = true;
|
|
||||||
Tun2Socks.Stop();
|
|
||||||
|
|
||||||
stopDns();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mThreadVPN = new Thread() {
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (isRestart) {
|
|
||||||
Log.d(TAG, "is a restart... let's wait for a few seconds");
|
|
||||||
Thread.sleep(3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String vpnName = "OrbotVPN";
|
|
||||||
final String localhost = "127.0.0.1";
|
|
||||||
|
|
||||||
final String virtualGateway = "192.168.200.1";
|
|
||||||
final String virtualIP = "192.168.200.2";
|
|
||||||
final String virtualNetMask = "255.255.255.0";
|
|
||||||
final String dummyDNS = "1.1.1.1"; //this is intercepted by the tun2socks library, but we must put in a valid DNS to start
|
|
||||||
final String defaultRoute = "0.0.0.0";
|
|
||||||
|
|
||||||
final String localSocks = localhost + ':' + mTorSocks;
|
|
||||||
|
|
||||||
builder.setMtu(VPN_MTU);
|
|
||||||
builder.addAddress(virtualGateway, 32);
|
|
||||||
|
|
||||||
builder.setSession(vpnName);
|
|
||||||
|
|
||||||
//route all traffic through VPN (we might offer country specific exclude lists in the future)
|
|
||||||
builder.addRoute(defaultRoute, 0);
|
|
||||||
|
|
||||||
builder.addDnsServer(dummyDNS);
|
|
||||||
builder.addRoute(dummyDNS, 32);
|
|
||||||
|
|
||||||
//handle ipv6
|
|
||||||
//builder.addAddress("fdfe:dcba:9876::1", 126);
|
|
||||||
//builder.addRoute("::", 0);
|
|
||||||
|
|
||||||
if (mIsLollipop)
|
|
||||||
doLollipopAppRouting(builder);
|
|
||||||
|
|
||||||
// https://developer.android.com/reference/android/net/VpnService.Builder#setMetered(boolean)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
builder.setMetered(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new interface using the builder and save the parameters.
|
|
||||||
ParcelFileDescriptor newInterface = builder.setSession(mSessionName)
|
|
||||||
.setConfigureIntent(null) // previously this was set to a null member variable
|
|
||||||
.establish();
|
|
||||||
|
|
||||||
if (mInterface != null) {
|
|
||||||
Log.d(TAG, "Stopping existing VPN interface");
|
|
||||||
mInterface.close();
|
|
||||||
mInterface = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
mInterface = newInterface;
|
|
||||||
|
|
||||||
isRestart = false;
|
|
||||||
|
|
||||||
//start PDNSD daemon pointing to actual DNS
|
|
||||||
if (filePdnsd != null) {
|
|
||||||
|
|
||||||
pdnsdPort++;
|
|
||||||
startDNS(filePdnsd.getCanonicalPath(), localhost, mTorDns, virtualGateway, pdnsdPort);
|
|
||||||
final boolean localDnsTransparentProxy = true;
|
|
||||||
|
|
||||||
Tun2Socks.Start(mService, mInterface, VPN_MTU, virtualIP, virtualNetMask, localSocks, virtualGateway + ":" + pdnsdPort, localDnsTransparentProxy);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.d(TAG, "tun2Socks has stopped", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
mThreadVPN.start();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private void doLollipopAppRouting(VpnService.Builder builder) throws NameNotFoundException {
|
|
||||||
SharedPreferences prefs = Prefs.getSharedPrefs(mService.getApplicationContext());
|
|
||||||
ArrayList<TorifiedApp> apps = TorifiedApp.getApps(mService, prefs);
|
|
||||||
|
|
||||||
|
|
||||||
boolean perAppEnabled = false;
|
|
||||||
|
|
||||||
for (TorifiedApp app : apps) {
|
|
||||||
if (app.isTorified() && (!app.getPackageName().equals(mService.getPackageName()))) {
|
|
||||||
if (prefs.getBoolean(app.getPackageName() + OrbotConstants.APP_TOR_KEY, true)) {
|
|
||||||
|
|
||||||
builder.addAllowedApplication(app.getPackageName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
perAppEnabled = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!perAppEnabled)
|
|
||||||
builder.addDisallowedApplication(mService.getPackageName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startDNS(String pdnsPath, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException, TimeoutException {
|
|
||||||
|
|
||||||
File fileConf = makePdnsdConf(mService, mService.getFilesDir(), torDnsHost, torDnsPort, pdnsdHost, pdnsdPort);
|
|
||||||
|
|
||||||
String[] cmdString = {pdnsPath, "-c", fileConf.toString(), "-g", "-v2"};
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmdString);
|
|
||||||
pb.redirectErrorStream(true);
|
|
||||||
Process proc = pb.start();
|
|
||||||
try {
|
|
||||||
proc.waitFor();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.i(TAG, "PDNSD: " + proc.exitValue());
|
|
||||||
|
|
||||||
if (proc.exitValue() != 0) {
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = br.readLine()) != null) {
|
|
||||||
Log.d(TAG, "pdnsd: " + line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopDns() {
|
|
||||||
if (filePdnsPid != null && filePdnsPid.exists()) {
|
|
||||||
ArrayList<String> lines = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(filePdnsPid));
|
|
||||||
|
|
||||||
String line = null;
|
|
||||||
while ((line = reader.readLine())!= null)
|
|
||||||
lines.add(line);
|
|
||||||
|
|
||||||
String dnsPid = lines.get(0);
|
|
||||||
VpnUtils.killProcess(dnsPid, "");
|
|
||||||
filePdnsPid.delete();
|
|
||||||
filePdnsPid = null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("OrbotVPN", "error killing dns process", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStarted() {
|
|
||||||
return isStarted;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,260 +0,0 @@
|
||||||
package org.torproject.android.service.vpn;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import static org.torproject.android.service.vpn.VpnPrefs.PREFS_KEY_TORIFIED;
|
|
||||||
|
|
||||||
public class TorifiedApp implements Comparable {
|
|
||||||
|
|
||||||
private boolean enabled;
|
|
||||||
private int uid;
|
|
||||||
private String username;
|
|
||||||
private String procname;
|
|
||||||
private String name;
|
|
||||||
private Drawable icon;
|
|
||||||
private String packageName;
|
|
||||||
|
|
||||||
private boolean torified = false;
|
|
||||||
private boolean usesInternet = false;
|
|
||||||
private int[] enabledPorts;
|
|
||||||
|
|
||||||
public static ArrayList<TorifiedApp> getApps(Context context, SharedPreferences prefs) {
|
|
||||||
|
|
||||||
String tordAppString = prefs.getString(PREFS_KEY_TORIFIED, "");
|
|
||||||
String[] tordApps;
|
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(tordAppString, "|");
|
|
||||||
tordApps = new String[st.countTokens()];
|
|
||||||
int tordIdx = 0;
|
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
tordApps[tordIdx++] = st.nextToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
Arrays.sort(tordApps);
|
|
||||||
|
|
||||||
//else load the apps up
|
|
||||||
PackageManager pMgr = context.getPackageManager();
|
|
||||||
|
|
||||||
List<ApplicationInfo> lAppInfo = pMgr.getInstalledApplications(0);
|
|
||||||
|
|
||||||
Iterator<ApplicationInfo> itAppInfo = lAppInfo.iterator();
|
|
||||||
|
|
||||||
ArrayList<TorifiedApp> apps = new ArrayList<>();
|
|
||||||
|
|
||||||
ApplicationInfo aInfo;
|
|
||||||
|
|
||||||
int appIdx = 0;
|
|
||||||
TorifiedApp app;
|
|
||||||
|
|
||||||
while (itAppInfo.hasNext()) {
|
|
||||||
aInfo = itAppInfo.next();
|
|
||||||
|
|
||||||
app = new TorifiedApp();
|
|
||||||
|
|
||||||
try {
|
|
||||||
PackageInfo pInfo = pMgr.getPackageInfo(aInfo.packageName, PackageManager.GET_PERMISSIONS);
|
|
||||||
|
|
||||||
if (pInfo != null && pInfo.requestedPermissions != null) {
|
|
||||||
for (String permInfo : pInfo.requestedPermissions) {
|
|
||||||
if (permInfo.equals(Manifest.permission.INTERNET)) {
|
|
||||||
app.setUsesInternet(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((aInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
|
||||||
//System app
|
|
||||||
app.setUsesInternet(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!app.usesInternet())
|
|
||||||
continue;
|
|
||||||
else {
|
|
||||||
apps.add(app);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
app.setEnabled(aInfo.enabled);
|
|
||||||
app.setUid(aInfo.uid);
|
|
||||||
app.setUsername(pMgr.getNameForUid(app.getUid()));
|
|
||||||
app.setProcname(aInfo.processName);
|
|
||||||
app.setPackageName(aInfo.packageName);
|
|
||||||
|
|
||||||
try {
|
|
||||||
app.setName(pMgr.getApplicationLabel(aInfo).toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
app.setName(aInfo.packageName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//app.setIcon(pMgr.getApplicationIcon(aInfo));
|
|
||||||
|
|
||||||
// check if this application is allowed
|
|
||||||
if (Arrays.binarySearch(tordApps, app.getUsername()) >= 0) {
|
|
||||||
app.setTorified(true);
|
|
||||||
} else {
|
|
||||||
app.setTorified(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
appIdx++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(apps);
|
|
||||||
|
|
||||||
return apps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean usesInternet() {
|
|
||||||
return usesInternet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsesInternet(boolean usesInternet) {
|
|
||||||
this.usesInternet = usesInternet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the torified
|
|
||||||
*/
|
|
||||||
public boolean isTorified() {
|
|
||||||
return torified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param torified the torified to set
|
|
||||||
*/
|
|
||||||
public void setTorified(boolean torified) {
|
|
||||||
this.torified = torified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the enabledPorts
|
|
||||||
*/
|
|
||||||
public int[] getEnabledPorts() {
|
|
||||||
return enabledPorts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param enabledPorts the enabledPorts to set
|
|
||||||
*/
|
|
||||||
public void setEnabledPorts(int[] enabledPorts) {
|
|
||||||
this.enabledPorts = enabledPorts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the enabled
|
|
||||||
*/
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param enabled the enabled to set
|
|
||||||
*/
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the uid
|
|
||||||
*/
|
|
||||||
public int getUid() {
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param uid the uid to set
|
|
||||||
*/
|
|
||||||
public void setUid(int uid) {
|
|
||||||
this.uid = uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the username
|
|
||||||
*/
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param username the username to set
|
|
||||||
*/
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the procname
|
|
||||||
*/
|
|
||||||
public String getProcname() {
|
|
||||||
return procname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param procname the procname to set
|
|
||||||
*/
|
|
||||||
public void setProcname(String procname) {
|
|
||||||
this.procname = procname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name the name to set
|
|
||||||
*/
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Drawable getIcon() {
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIcon(Drawable icon) {
|
|
||||||
this.icon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Object another) {
|
|
||||||
return this.toString().compareToIgnoreCase(another.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackageName() {
|
|
||||||
return packageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPackageName(String packageName) {
|
|
||||||
this.packageName = packageName;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,173 +0,0 @@
|
||||||
package org.torproject.android.service.vpn;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2013, Psiphon Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.ParcelFileDescriptor;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.torproject.android.service.util.TCPSourceApp;
|
|
||||||
|
|
||||||
import java.net.DatagramSocket;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import static android.content.Context.CONNECTIVITY_SERVICE;
|
|
||||||
|
|
||||||
public class Tun2Socks {
|
|
||||||
|
|
||||||
private static final String TAG = Tun2Socks.class.getSimpleName();
|
|
||||||
private static final boolean LOGD = true;
|
|
||||||
|
|
||||||
private static ParcelFileDescriptor mVpnInterfaceFileDescriptor;
|
|
||||||
private static int mVpnInterfaceMTU;
|
|
||||||
private static String mVpnIpAddress;
|
|
||||||
private static String mVpnNetMask;
|
|
||||||
private static String mSocksServerAddress;
|
|
||||||
private static String mUdpgwServerAddress;
|
|
||||||
private static boolean mUdpgwTransparentDNS;
|
|
||||||
private static HashMap<Integer, String> mAppUidBlacklist = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
System.loadLibrary("tun2socks");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
}
|
|
||||||
// Note: this class isn't a singleton, but you can't run more
|
|
||||||
// than one instance due to the use of global state (the lwip
|
|
||||||
// module, etc.) in the native code.
|
|
||||||
|
|
||||||
public static void Start(
|
|
||||||
Context context,
|
|
||||||
ParcelFileDescriptor vpnInterfaceFileDescriptor,
|
|
||||||
int vpnInterfaceMTU,
|
|
||||||
String vpnIpAddress,
|
|
||||||
String vpnNetMask,
|
|
||||||
String socksServerAddress,
|
|
||||||
String udpgwServerAddress,
|
|
||||||
boolean udpgwTransparentDNS) {
|
|
||||||
|
|
||||||
mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor;
|
|
||||||
mVpnInterfaceMTU = vpnInterfaceMTU;
|
|
||||||
mVpnIpAddress = vpnIpAddress;
|
|
||||||
mVpnNetMask = vpnNetMask;
|
|
||||||
mSocksServerAddress = socksServerAddress;
|
|
||||||
mUdpgwServerAddress = udpgwServerAddress;
|
|
||||||
mUdpgwTransparentDNS = udpgwTransparentDNS;
|
|
||||||
|
|
||||||
if (mVpnInterfaceFileDescriptor != null)
|
|
||||||
runTun2Socks(
|
|
||||||
mVpnInterfaceFileDescriptor.detachFd(),
|
|
||||||
mVpnInterfaceMTU,
|
|
||||||
mVpnIpAddress,
|
|
||||||
mVpnNetMask,
|
|
||||||
mSocksServerAddress,
|
|
||||||
mUdpgwServerAddress,
|
|
||||||
mUdpgwTransparentDNS ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Stop() {
|
|
||||||
|
|
||||||
terminateTun2Socks();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logTun2Socks(
|
|
||||||
String level,
|
|
||||||
String channel,
|
|
||||||
String msg) {
|
|
||||||
String logMsg = level + "(" + channel + "): " + msg;
|
|
||||||
if (0 == level.compareTo("ERROR")) {
|
|
||||||
Log.e(TAG, logMsg);
|
|
||||||
} else {
|
|
||||||
if (LOGD) Log.d(TAG, logMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private native static int runTun2Socks(
|
|
||||||
int vpnInterfaceFileDescriptor,
|
|
||||||
int vpnInterfaceMTU,
|
|
||||||
String vpnIpAddress,
|
|
||||||
String vpnNetMask,
|
|
||||||
String socksServerAddress,
|
|
||||||
String udpgwServerAddress,
|
|
||||||
int udpgwTransparentDNS);
|
|
||||||
|
|
||||||
private native static void terminateTun2Socks();
|
|
||||||
|
|
||||||
public static boolean checkIsAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
return isAllowedQ(context, protocol, sourceAddr, sourcePort, destAddr, destPort);
|
|
||||||
} else
|
|
||||||
return isAllowed(context, protocol, sourceAddr, sourcePort, destAddr, destPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isAllowed(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) {
|
|
||||||
|
|
||||||
TCPSourceApp.AppDescriptor aInfo = TCPSourceApp.getApplicationInfo(context, sourceAddr, sourcePort, destAddr, destPort);
|
|
||||||
|
|
||||||
if (aInfo != null) {
|
|
||||||
int uid = aInfo.getUid();
|
|
||||||
return mAppUidBlacklist.containsKey(uid);
|
|
||||||
} else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.Q)
|
|
||||||
public static boolean isAllowedQ(Context context, int protocol, String sourceAddr, int sourcePort, String destAddr, int destPort) {
|
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE);
|
|
||||||
if (cm == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
InetSocketAddress local = new InetSocketAddress(sourceAddr, sourcePort);
|
|
||||||
InetSocketAddress remote = new InetSocketAddress(destAddr, destPort);
|
|
||||||
|
|
||||||
int uid = cm.getConnectionOwnerUid(protocol, local, remote);
|
|
||||||
return mAppUidBlacklist.containsKey(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBlacklist(HashMap<Integer, String> appUidBlacklist) {
|
|
||||||
mAppUidBlacklist = appUidBlacklist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clearBlacklist() {
|
|
||||||
mAppUidBlacklist.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addToBlacklist(int uid, String pkgId) {
|
|
||||||
mAppUidBlacklist.put(uid, pkgId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeFromBlacklist(int uid) {
|
|
||||||
mAppUidBlacklist.remove(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IProtectSocket {
|
|
||||||
boolean doVpnProtect(Socket socket);
|
|
||||||
|
|
||||||
boolean doVpnProtect(DatagramSocket socket);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package org.torproject.android.service.vpn;
|
|
||||||
|
|
||||||
public interface VpnPrefs {
|
|
||||||
|
|
||||||
String PREFS_DNS_PORT = "PREFS_DNS_PORT";
|
|
||||||
|
|
||||||
String PREFS_KEY_TORIFIED = "PrefTord";
|
|
||||||
}
|
|
|
@ -1,136 +0,0 @@
|
||||||
package org.torproject.android.service.vpn;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static java.lang.Runtime.getRuntime;
|
|
||||||
|
|
||||||
public class VpnUtils {
|
|
||||||
|
|
||||||
public static int findProcessId(String command) throws IOException {
|
|
||||||
|
|
||||||
String[] cmds = {"ps -ef", "ps -A", "toolbox ps"};
|
|
||||||
|
|
||||||
for (int i = 0; i < cmds.length; i++) {
|
|
||||||
Process procPs = getRuntime().exec(cmds[i]);
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
if (!line.contains("PID") && line.contains(command)) {
|
|
||||||
String[] lineParts = line.split("\\s+");
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(lineParts[1]); //for most devices it is the second
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return Integer.parseInt(lineParts[0]); //but for samsungs it is the first
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
procPs.destroy();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void killProcess(File fileProcBin) throws Exception {
|
|
||||||
killProcess(fileProcBin, "-9"); // this is -KILL
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int killProcess(File fileProcBin, String signal) throws Exception {
|
|
||||||
|
|
||||||
int procId = -1;
|
|
||||||
int killAttempts = 0;
|
|
||||||
|
|
||||||
while ((procId = findProcessId(fileProcBin.getName())) != -1) {
|
|
||||||
killAttempts++;
|
|
||||||
String pidString = String.valueOf(procId);
|
|
||||||
boolean itBeDead = killProcess(pidString, signal);
|
|
||||||
|
|
||||||
if (!itBeDead) {
|
|
||||||
|
|
||||||
String[] cmds = {"", "busybox ", "toolbox "};
|
|
||||||
|
|
||||||
for (int i = 0; i < cmds.length; i++) {
|
|
||||||
|
|
||||||
Process proc;
|
|
||||||
|
|
||||||
try {
|
|
||||||
proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getName
|
|
||||||
());
|
|
||||||
int exitValue = proc.waitFor();
|
|
||||||
if (exitValue == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
proc = getRuntime().exec(cmds[i] + "killall " + signal + " " + fileProcBin.getCanonicalPath());
|
|
||||||
int exitValue = proc.waitFor();
|
|
||||||
if (exitValue == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (killAttempts > 4)
|
|
||||||
throw new Exception("Cannot kill: " + fileProcBin.getAbsolutePath());
|
|
||||||
}
|
|
||||||
|
|
||||||
return procId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean killProcess(String pidString, String signal) throws Exception {
|
|
||||||
|
|
||||||
String[] cmds = {"", "toolbox ", "busybox "};
|
|
||||||
|
|
||||||
for (int i = 0; i < cmds.length; i++) {
|
|
||||||
try {
|
|
||||||
Process proc = getRuntime().exec(cmds[i] + "kill " + signal + " " + pidString);
|
|
||||||
int exitVal = proc.waitFor();
|
|
||||||
List<String> lineErrors = IOUtils.readLines(proc.getErrorStream());
|
|
||||||
List<String> lineInputs = IOUtils.readLines(proc.getInputStream());
|
|
||||||
|
|
||||||
if (exitVal != 0) {
|
|
||||||
Log.d("Orbot.killProcess", "exit=" + exitVal);
|
|
||||||
for (String line : lineErrors)
|
|
||||||
Log.d("Orbot.killProcess", line);
|
|
||||||
|
|
||||||
for (String line : lineInputs)
|
|
||||||
Log.d("Orbot.killProcess", line);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//it worked, let's exit
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
Log.e("Orbot.killprcess", "error killing process: " + pidString, ioe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
package org.torproject.android.service.wrapper;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Build;
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is used to change your application locale and persist this change for the next time
|
|
||||||
* that your app is going to be used.
|
|
||||||
* <p/>
|
|
||||||
* You can also change the locale of your application on the fly by using the setLocale method.
|
|
||||||
* <p/>
|
|
||||||
* Created by gunhansancar on 07/10/15.
|
|
||||||
* https://gunhansancar.com/change-language-programmatically-in-android/
|
|
||||||
*/
|
|
||||||
public class LocaleHelper {
|
|
||||||
|
|
||||||
private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language";
|
|
||||||
|
|
||||||
public static Context onAttach(Context context) {
|
|
||||||
String lang = getPersistedData(context, Locale.getDefault().getLanguage());
|
|
||||||
return setLocale(context, lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context onAttach(Context context, String defaultLanguage) {
|
|
||||||
String lang = getPersistedData(context, defaultLanguage);
|
|
||||||
return setLocale(context, lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getLanguage(Context context) {
|
|
||||||
return getPersistedData(context, Locale.getDefault().getLanguage());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context setLocale(Context context, String language) {
|
|
||||||
persist(context, language);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
return updateResources(context, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
return updateResourcesLegacy(context, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getPersistedData(Context context, String defaultLanguage) {
|
|
||||||
return Prefs.getDefaultLocale();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void persist(Context context, String language) {
|
|
||||||
Prefs.setDefaultLocale(language);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
|
||||||
private static Context updateResources(Context context, String language) {
|
|
||||||
Locale locale = new Locale(language);
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
Configuration configuration = context.getResources().getConfiguration();
|
|
||||||
configuration.setLocale(locale);
|
|
||||||
configuration.setLayoutDirection(locale);
|
|
||||||
|
|
||||||
return context.createConfigurationContext(configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private static Context updateResourcesLegacy(Context context, String language) {
|
|
||||||
Locale locale = new Locale(language);
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
|
|
||||||
Resources resources = context.getResources();
|
|
||||||
|
|
||||||
Configuration configuration = resources.getConfiguration();
|
|
||||||
configuration.locale = locale;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
configuration.setLayoutDirection(locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package org.torproject.android.service.wrapper;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
public class localHelperMethod
|
|
||||||
{
|
|
||||||
/*Helper Methods General*/
|
|
||||||
public static String getCurrentTime(){
|
|
||||||
Calendar now = Calendar.getInstance();
|
|
||||||
int year = now.get(Calendar.YEAR);
|
|
||||||
int month = now.get(Calendar.MONTH) + 1; // Note: zero based!
|
|
||||||
int day = now.get(Calendar.DAY_OF_MONTH);
|
|
||||||
int hour = now.get(Calendar.HOUR_OF_DAY);
|
|
||||||
int minute = now.get(Calendar.MINUTE);
|
|
||||||
int second = now.get(Calendar.SECOND);
|
|
||||||
int millis = now.get(Calendar.MILLISECOND);
|
|
||||||
|
|
||||||
System.out.printf("%d-%02d-%02d %02d:%02d:%02d.%03d", year, month, day, hour, minute, second, millis);
|
|
||||||
return month + "/" + year + " | " + hour + ":" + minute + ":" + second;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package org.torproject.android.service.wrapper;
|
|
||||||
|
|
||||||
public class logRowModel {
|
|
||||||
/*Private Variables*/
|
|
||||||
|
|
||||||
private String mLog;
|
|
||||||
private String mDate;
|
|
||||||
|
|
||||||
/*Initializations*/
|
|
||||||
|
|
||||||
public logRowModel(String pLog, String pDate) {
|
|
||||||
this.mLog = pLog;
|
|
||||||
this.mDate = pDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Variable Setters*/
|
|
||||||
|
|
||||||
public void setLog(String pLog){
|
|
||||||
this.mLog = pLog;
|
|
||||||
}
|
|
||||||
public void setDate(String pDate) {
|
|
||||||
mDate = pDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Variable Getters*/
|
|
||||||
|
|
||||||
public String getLog() {
|
|
||||||
return mLog;
|
|
||||||
}
|
|
||||||
public String getDate() {
|
|
||||||
return mDate;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package org.torproject.android.service.wrapper;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class orbotLocalConstants
|
|
||||||
{
|
|
||||||
public static ArrayList<logRowModel> mTorLogsHistory = new ArrayList<>();
|
|
||||||
public static String mTorLogsStatus = "Loading...";
|
|
||||||
public static boolean mIsTorInitialized = false;
|
|
||||||
public static String mCurrentStatus = "";
|
|
||||||
public static int mNotificationStatus = 0;
|
|
||||||
public static WeakReference<Context> mHomeContext;
|
|
||||||
public static Intent mHomeIntent = null;
|
|
||||||
public static String mBridges = "";
|
|
||||||
public static boolean mIsManualBridge = false;
|
|
||||||
public static boolean mNetworkState = true;
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
# Copyright (C) 2009 The Android Open Source Project
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
ROOT_PATH := $(LOCAL_PATH)
|
|
||||||
EXTERN_PATH := $(LOCAL_PATH)/../../../../external
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
## pdnsd library
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
|
|
||||||
|
|
||||||
LOCAL_MODULE := pdnsd
|
|
||||||
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)/%=%)
|
|
||||||
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd -DHAVE_STPCPY
|
|
||||||
|
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
## libancillary
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
ANCILLARY_SOURCE := fd_recv.c fd_send.c
|
|
||||||
|
|
||||||
LOCAL_MODULE := libancillary
|
|
||||||
LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libancillary
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
|
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
## tun2socks
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
LOCAL_CFLAGS := -std=gnu99
|
|
||||||
LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
|
|
||||||
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
|
|
||||||
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
|
|
||||||
LOCAL_CFLAGS += -DNDEBUG -DANDROID
|
|
||||||
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
|
|
||||||
LOCAL_CFLAGS += -DPSIPHON
|
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := libancillary
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES:= \
|
|
||||||
$(LOCAL_PATH)/libancillary \
|
|
||||||
$(EXTERN_PATH)/badvpn/ \
|
|
||||||
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv4 \
|
|
||||||
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv6 \
|
|
||||||
$(EXTERN_PATH)/badvpn/lwip/src/include \
|
|
||||||
$(EXTERN_PATH)/badvpn/lwip/custom \
|
|
||||||
|
|
||||||
TUN2SOCKS_SOURCES := \
|
|
||||||
base/BLog_syslog.c \
|
|
||||||
system/BReactor_badvpn.c \
|
|
||||||
system/BSignal.c \
|
|
||||||
system/BConnection_unix.c \
|
|
||||||
system/BTime.c \
|
|
||||||
system/BUnixSignal.c \
|
|
||||||
system/BNetwork.c \
|
|
||||||
flow/StreamRecvInterface.c \
|
|
||||||
flow/PacketRecvInterface.c \
|
|
||||||
flow/PacketPassInterface.c \
|
|
||||||
flow/StreamPassInterface.c \
|
|
||||||
flow/SinglePacketBuffer.c \
|
|
||||||
flow/BufferWriter.c \
|
|
||||||
flow/PacketBuffer.c \
|
|
||||||
flow/PacketStreamSender.c \
|
|
||||||
flow/PacketPassConnector.c \
|
|
||||||
flow/PacketProtoFlow.c \
|
|
||||||
flow/PacketPassFairQueue.c \
|
|
||||||
flow/PacketProtoEncoder.c \
|
|
||||||
flow/PacketProtoDecoder.c \
|
|
||||||
socksclient/BSocksClient.c \
|
|
||||||
tuntap/BTap.c \
|
|
||||||
lwip/src/core/timers.c \
|
|
||||||
lwip/src/core/udp.c \
|
|
||||||
lwip/src/core/memp.c \
|
|
||||||
lwip/src/core/init.c \
|
|
||||||
lwip/src/core/pbuf.c \
|
|
||||||
lwip/src/core/tcp.c \
|
|
||||||
lwip/src/core/tcp_out.c \
|
|
||||||
lwip/src/core/netif.c \
|
|
||||||
lwip/src/core/def.c \
|
|
||||||
lwip/src/core/mem.c \
|
|
||||||
lwip/src/core/tcp_in.c \
|
|
||||||
lwip/src/core/stats.c \
|
|
||||||
lwip/src/core/inet_chksum.c \
|
|
||||||
lwip/src/core/ipv4/icmp.c \
|
|
||||||
lwip/src/core/ipv4/igmp.c \
|
|
||||||
lwip/src/core/ipv4/ip4_addr.c \
|
|
||||||
lwip/src/core/ipv4/ip_frag.c \
|
|
||||||
lwip/src/core/ipv4/ip4.c \
|
|
||||||
lwip/src/core/ipv4/autoip.c \
|
|
||||||
lwip/src/core/ipv6/ethip6.c \
|
|
||||||
lwip/src/core/ipv6/inet6.c \
|
|
||||||
lwip/src/core/ipv6/ip6_addr.c \
|
|
||||||
lwip/src/core/ipv6/mld6.c \
|
|
||||||
lwip/src/core/ipv6/dhcp6.c \
|
|
||||||
lwip/src/core/ipv6/icmp6.c \
|
|
||||||
lwip/src/core/ipv6/ip6.c \
|
|
||||||
lwip/src/core/ipv6/ip6_frag.c \
|
|
||||||
lwip/src/core/ipv6/nd6.c \
|
|
||||||
lwip/custom/sys.c \
|
|
||||||
tun2socks/tun2socks.c \
|
|
||||||
base/DebugObject.c \
|
|
||||||
base/BLog.c \
|
|
||||||
base/BPending.c \
|
|
||||||
system/BDatagram_unix.c \
|
|
||||||
flowextra/PacketPassInactivityMonitor.c \
|
|
||||||
tun2socks/SocksUdpGwClient.c \
|
|
||||||
udpgw_client/UdpGwClient.c
|
|
||||||
|
|
||||||
LOCAL_MODULE := tun2socks
|
|
||||||
|
|
||||||
LOCAL_LDLIBS := -ldl -llog
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(addprefix ../../../../external/badvpn/, $(TUN2SOCKS_SOURCES))
|
|
||||||
|
|
||||||
##include $(BUILD_EXECUTABLE)
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
|
|
||||||
# Import cpufeatures
|
|
||||||
$(call import-module,android/cpufeatures)
|
|
|
@ -1,3 +0,0 @@
|
||||||
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
|
|
||||||
APP_PLATFORM := android-16
|
|
||||||
APP_STL := c++_static
|
|
|
@ -1,139 +0,0 @@
|
||||||
This library provide an easy interface to the black magic that can be done
|
|
||||||
on Unix domain sockets, like passing file descriptors from one process to
|
|
||||||
another.
|
|
||||||
|
|
||||||
Programs that uses this library should include the ancillary.h header file.
|
|
||||||
Nothing else is required.
|
|
||||||
|
|
||||||
All functions of this library require the following header:
|
|
||||||
|
|
||||||
#include <ancillary.h>
|
|
||||||
|
|
||||||
At this time, the only ancillary data defined by the Single Unix
|
|
||||||
Specification (v3) is file descriptors.
|
|
||||||
|
|
||||||
Passing file descriptors
|
|
||||||
|
|
||||||
int ancil_send_fd(socket, file_descriptor)
|
|
||||||
int socket: the Unix socket
|
|
||||||
int file_descriptor: the file descriptor
|
|
||||||
Return value: 0 for success, -1 for failure.
|
|
||||||
|
|
||||||
Sends one file descriptor on a socket.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
sendmsg(2) system call.
|
|
||||||
|
|
||||||
|
|
||||||
int ancil_recv_fd(socket, file_descriptor)
|
|
||||||
int socket: the Unix socket
|
|
||||||
int *file_descriptor: pointer to the returned file descriptor
|
|
||||||
Return value: 0 for success, -1 for failure
|
|
||||||
|
|
||||||
Receives one file descriptor from a socket.
|
|
||||||
In case of success, the file descriptor is stored in the integer pointed
|
|
||||||
to by file_descriptor.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
recvmsg(2) system call.
|
|
||||||
The behavior is undefined if the recv_fd does not match a send_fd* on the
|
|
||||||
other side.
|
|
||||||
|
|
||||||
|
|
||||||
int ancil_send_fds(socket, file_descriptors, num_file_descriptors)
|
|
||||||
int socket: the Unix socket
|
|
||||||
const int *file_descriptors: array of file descriptors
|
|
||||||
unsigned num_file_descriptors: number of file descriptors
|
|
||||||
Return value: 0 for success, -1 for failure
|
|
||||||
|
|
||||||
Sends several file descriptors on a socket.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
sendmsg(2) system call.
|
|
||||||
The maximum number of file descriptors that can be sent using this
|
|
||||||
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
|
|
||||||
overflow, probably a stack corruption.
|
|
||||||
|
|
||||||
|
|
||||||
int ancil_recv_fds(socket, file_descriptors, num_file_descriptors)
|
|
||||||
int socket: the Unix socket
|
|
||||||
int *file_descriptors: return array of file descriptors
|
|
||||||
unsigned num_file_descriptors: number of file descriptors
|
|
||||||
Return value: number of received fd for success, -1 for failure
|
|
||||||
|
|
||||||
Receives several file descriptors from a socket, no more than
|
|
||||||
num_file_descriptors.
|
|
||||||
In case of success, the received file descriptors are stored in the array
|
|
||||||
pointed to by file_descriptors.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
recvmsg(2) system call.
|
|
||||||
The maximum number of file descriptors that can be received using this
|
|
||||||
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
|
|
||||||
overflow, probably a stack corruption.
|
|
||||||
The behavior is undefined if the recv_fds does not match a send_fd* on
|
|
||||||
the other side, or if the number of received file descriptors is more than
|
|
||||||
num_file_descriptors.
|
|
||||||
|
|
||||||
|
|
||||||
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
|
|
||||||
int socket: the Unix socket
|
|
||||||
const int *fds: array of file descriptors
|
|
||||||
unsigned num: number of file descriptors
|
|
||||||
void *buffer: buffer to hold the system data structures
|
|
||||||
Return value: 0 for success, -1 for failure
|
|
||||||
|
|
||||||
Sends several file descriptors on a socket.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
sendmsg(2) system call.
|
|
||||||
The buffer argument must point to a memory area large enough to hold the
|
|
||||||
system data structures, see ANCIL_FD_BUFFER.
|
|
||||||
|
|
||||||
|
|
||||||
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
|
|
||||||
int socket: the Unix socket
|
|
||||||
int *fds: return array of file descriptors
|
|
||||||
unsigned num: number of file descriptors
|
|
||||||
void *buffer: buffer to hold the system data structures
|
|
||||||
Return value: number of received fd for success, -1 for failure
|
|
||||||
|
|
||||||
Receives several file descriptors from a socket, no more than
|
|
||||||
num_file_descriptors.
|
|
||||||
In case of success, the received file descriptors are stored in the array
|
|
||||||
pointed to by file_descriptors.
|
|
||||||
In case of failure, errno is set; the possible values are the ones of the
|
|
||||||
recvmsg(2) system call.
|
|
||||||
The behavior is undefined if the recv_fds does not match a send_fd* on
|
|
||||||
the other side, or if the number of received file descriptors is more than
|
|
||||||
num_file_descriptors.
|
|
||||||
The buffer argument must point to a memory area large enough to hold the
|
|
||||||
system data structures, see ANCIL_FD_BUFFER.
|
|
||||||
|
|
||||||
|
|
||||||
ANCIL_MAX_N_FDS
|
|
||||||
|
|
||||||
Maximum number of file descriptors that can be sent with the sent_fds and
|
|
||||||
recv_fds functions. If you have to send more at once, use the
|
|
||||||
*_with_buffer versions. The value is enough to send "quite a few" file
|
|
||||||
descriptors.
|
|
||||||
|
|
||||||
|
|
||||||
ANCIL_FD_BUFFER(n)
|
|
||||||
int n: number of file descriptors
|
|
||||||
|
|
||||||
Expands to a structure data type large enough to hold the system data
|
|
||||||
structures for n file descriptors. So the address of a variable declared
|
|
||||||
of type ANCIL_FD_BUFFER(n) is suitable as the buffer argument for
|
|
||||||
*_with_buffer on n file descriptors.
|
|
||||||
To use this macro, you need <sys/types.h> and <sys/socket.h>. Bevare: with
|
|
||||||
Solaris, the _XPG4_2 macro must be defined before sys/socket is included.
|
|
||||||
|
|
||||||
|
|
||||||
Tuning the compilation
|
|
||||||
|
|
||||||
This library is designed to be included in projects, not installed in
|
|
||||||
/usr/lib. If your project does not use some of the functions, the
|
|
||||||
TUNE_OPTS variable in the Makefile allows not to build them. It is a list
|
|
||||||
of proprocessor options:
|
|
||||||
|
|
||||||
-DNDEBUG: turn assertions off (see assert(3))
|
|
||||||
-DSPARE_SEND_FDS: do not build ancil_send_fds
|
|
||||||
-DSPARE_SEND_FD: do not build ancil_send_fd
|
|
||||||
-DSPARE_RECV_FDS: do not build ancil_recv_fds
|
|
||||||
-DSPARE_RECV_FD: do not build ancil_recv_fd
|
|
|
@ -1,21 +0,0 @@
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
3. The name of the author may not be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
@ -1,73 +0,0 @@
|
||||||
###########################################################################
|
|
||||||
# libancillary - black magic on Unix domain sockets
|
|
||||||
# (C) Nicolas George
|
|
||||||
# Makefile - guess what
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. The name of the author may not be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
CFLAGS=-Wall -g -O2
|
|
||||||
LDFLAGS=
|
|
||||||
LIBS=
|
|
||||||
AR=ar
|
|
||||||
RANLIB=ranlib
|
|
||||||
RM=rm
|
|
||||||
CP=cp
|
|
||||||
MKDIR=mkdir
|
|
||||||
TAR=tar
|
|
||||||
GZIP=gzip -9
|
|
||||||
|
|
||||||
NAME=libancillary
|
|
||||||
DISTRIBUTION=API COPYING Makefile ancillary.h fd_send.c fd_recv.c test.c
|
|
||||||
VERSION=0.9.1
|
|
||||||
|
|
||||||
OBJECTS=fd_send.o fd_recv.o
|
|
||||||
|
|
||||||
TUNE_OPTS=-DNDEBUG
|
|
||||||
#TUNE_OPTS=-DNDEBUG \
|
|
||||||
-DSPARE_SEND_FDS -DSPARE_SEND_FD -DSPARE_RECV_FDS -DSPARE_RECV_FD
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) -c $(CFLAGS) $(TUNE_OPTS) $<
|
|
||||||
|
|
||||||
all: libancillary.a
|
|
||||||
|
|
||||||
libancillary.a: $(OBJECTS)
|
|
||||||
$(AR) cr $@ $(OBJECTS)
|
|
||||||
$(RANLIB) $@
|
|
||||||
|
|
||||||
fd_send.o: ancillary.h
|
|
||||||
fd_recv.o: ancillary.h
|
|
||||||
|
|
||||||
test: test.c libancillary.a
|
|
||||||
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) -L. test.c -lancillary $(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-$(RM) -f *.o *.a test
|
|
||||||
|
|
||||||
dist:
|
|
||||||
$(MKDIR) $(NAME)-$(VERSION)
|
|
||||||
$(CP) $(DISTRIBUTION) $(NAME)-$(VERSION)
|
|
||||||
$(TAR) -cf - $(NAME)-$(VERSION) | $(GZIP) > $(NAME)-$(VERSION).tar.gz
|
|
||||||
$(RM) -rf $(NAME)-$(VERSION)
|
|
|
@ -1,131 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* libancillary - black magic on Unix domain sockets
|
|
||||||
* (C) Nicolas George
|
|
||||||
* ancillary.c - public header
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ANCILLARY_H__
|
|
||||||
#define ANCILLARY_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Start of the readable part.
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#define ANCIL_MAX_N_FDS 960
|
|
||||||
/*
|
|
||||||
* Maximum number of fds that can be sent or received using the "esay"
|
|
||||||
* functions; this is so that all can fit in one page.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_send_fds_with_buffer(int, const int *, unsigned, void *);
|
|
||||||
/*
|
|
||||||
* ancil_send_fds_with_buffer(sock, n_fds, fds, buffer)
|
|
||||||
*
|
|
||||||
* Sends the file descriptors in the array pointed by fds, of length n_fds
|
|
||||||
* on the socket sock.
|
|
||||||
* buffer is a writeable memory area large enough to hold the required data
|
|
||||||
* structures.
|
|
||||||
* Returns: -1 and errno in case of error, 0 in case of success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_recv_fds_with_buffer(int, int *, unsigned, void *);
|
|
||||||
/*
|
|
||||||
* ancil_recv_fds_with_buffer(sock, n_fds, fds, buffer)
|
|
||||||
*
|
|
||||||
* Receives *n_fds file descriptors into the array pointed by fds
|
|
||||||
* from the socket sock.
|
|
||||||
* buffer is a writeable memory area large enough to hold the required data
|
|
||||||
* structures.
|
|
||||||
* Returns: -1 and errno in case of error, the actual number of received fd
|
|
||||||
* in case of success
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ANCIL_FD_BUFFER(n) \
|
|
||||||
struct { \
|
|
||||||
struct cmsghdr h; \
|
|
||||||
int fd[n]; \
|
|
||||||
}
|
|
||||||
/* ANCIL_FD_BUFFER(n)
|
|
||||||
*
|
|
||||||
* A structure type suitable to be used as buffer for n file descriptors.
|
|
||||||
* Requires <sys/socket.h>.
|
|
||||||
* Example:
|
|
||||||
* ANCIL_FD_BUFFER(42) buffer;
|
|
||||||
* ancil_recv_fds_with_buffer(sock, 42, my_fds, &buffer);
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_send_fds(int, const int *, unsigned);
|
|
||||||
/*
|
|
||||||
* ancil_send_fds(sock, n_fds, fds)
|
|
||||||
*
|
|
||||||
* Sends the file descriptors in the array pointed by fds, of length n_fds
|
|
||||||
* on the socket sock.
|
|
||||||
* n_fds must not be greater than ANCIL_MAX_N_FDS.
|
|
||||||
* Returns: -1 and errno in case of error, 0 in case of success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_recv_fds(int, int *, unsigned);
|
|
||||||
/*
|
|
||||||
* ancil_recv_fds(sock, n_fds, fds)
|
|
||||||
*
|
|
||||||
* Receives *n_fds file descriptors into the array pointed by fds
|
|
||||||
* from the socket sock.
|
|
||||||
* *n_fds must not be greater than ANCIL_MAX_N_FDS.
|
|
||||||
* Returns: -1 and errno in case of error, the actual number of received fd
|
|
||||||
* in case of success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_send_fd(int, int);
|
|
||||||
/* ancil_recv_fd(sock, fd);
|
|
||||||
*
|
|
||||||
* Sends the file descriptor fd on the socket sock.
|
|
||||||
* Returns : -1 and errno in case of error, 0 in case of success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int
|
|
||||||
ancil_recv_fd(int, int *);
|
|
||||||
/* ancil_send_fd(sock, &fd);
|
|
||||||
*
|
|
||||||
* Receives the file descriptor fd from the socket sock.
|
|
||||||
* Returns : -1 and errno in case of error, 0 in case of success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ANCILLARY_H__ */
|
|
|
@ -1,98 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* libancillary - black magic on Unix domain sockets
|
|
||||||
* (C) Nicolas George
|
|
||||||
* fd_send.c - receiving file descriptors
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _XPG4_2 /* Solaris sucks */
|
|
||||||
# define _XPG4_2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
# include <sys/param.h> /* FreeBSD sucks */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ancillary.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
ancil_recv_fds_with_buffer(int sock, int *fds, unsigned n_fds, void *buffer)
|
|
||||||
{
|
|
||||||
struct msghdr msghdr;
|
|
||||||
char nothing;
|
|
||||||
struct iovec nothing_ptr;
|
|
||||||
struct cmsghdr *cmsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
nothing_ptr.iov_base = ¬hing;
|
|
||||||
nothing_ptr.iov_len = 1;
|
|
||||||
msghdr.msg_name = NULL;
|
|
||||||
msghdr.msg_namelen = 0;
|
|
||||||
msghdr.msg_iov = ¬hing_ptr;
|
|
||||||
msghdr.msg_iovlen = 1;
|
|
||||||
msghdr.msg_flags = 0;
|
|
||||||
msghdr.msg_control = buffer;
|
|
||||||
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
|
|
||||||
cmsg = CMSG_FIRSTHDR(&msghdr);
|
|
||||||
cmsg->cmsg_len = msghdr.msg_controllen;
|
|
||||||
cmsg->cmsg_level = SOL_SOCKET;
|
|
||||||
cmsg->cmsg_type = SCM_RIGHTS;
|
|
||||||
for(i = 0; i < n_fds; i++)
|
|
||||||
((int *)CMSG_DATA(cmsg))[i] = -1;
|
|
||||||
|
|
||||||
if(recvmsg(sock, &msghdr, 0) < 0)
|
|
||||||
return(-1);
|
|
||||||
for(i = 0; i < n_fds; i++)
|
|
||||||
fds[i] = ((int *)CMSG_DATA(cmsg))[i];
|
|
||||||
n_fds = (msghdr.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
|
|
||||||
return(n_fds);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef SPARE_RECV_FDS
|
|
||||||
int
|
|
||||||
ancil_recv_fds(int sock, int *fd, unsigned n_fds)
|
|
||||||
{
|
|
||||||
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
|
|
||||||
|
|
||||||
assert(n_fds <= ANCIL_MAX_N_FDS);
|
|
||||||
return(ancil_recv_fds_with_buffer(sock, fd, n_fds, &buffer));
|
|
||||||
}
|
|
||||||
#endif /* SPARE_RECV_FDS */
|
|
||||||
|
|
||||||
#ifndef SPARE_RECV_FD
|
|
||||||
int
|
|
||||||
ancil_recv_fd(int sock, int *fd)
|
|
||||||
{
|
|
||||||
ANCIL_FD_BUFFER(1) buffer;
|
|
||||||
|
|
||||||
return(ancil_recv_fds_with_buffer(sock, fd, 1, &buffer) == 1 ? 0 : -1);
|
|
||||||
}
|
|
||||||
#endif /* SPARE_RECV_FD */
|
|
|
@ -1,92 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* libancillary - black magic on Unix domain sockets
|
|
||||||
* (C) Nicolas George
|
|
||||||
* fd_send.c - sending file descriptors
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _XPG4_2 /* Solaris sucks */
|
|
||||||
# define _XPG4_2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
# include <sys/param.h> /* FreeBSD sucks */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ancillary.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
ancil_send_fds_with_buffer(int sock, const int *fds, unsigned n_fds, void *buffer)
|
|
||||||
{
|
|
||||||
struct msghdr msghdr;
|
|
||||||
char nothing = '!';
|
|
||||||
struct iovec nothing_ptr;
|
|
||||||
struct cmsghdr *cmsg;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
nothing_ptr.iov_base = ¬hing;
|
|
||||||
nothing_ptr.iov_len = 1;
|
|
||||||
msghdr.msg_name = NULL;
|
|
||||||
msghdr.msg_namelen = 0;
|
|
||||||
msghdr.msg_iov = ¬hing_ptr;
|
|
||||||
msghdr.msg_iovlen = 1;
|
|
||||||
msghdr.msg_flags = 0;
|
|
||||||
msghdr.msg_control = buffer;
|
|
||||||
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
|
|
||||||
cmsg = CMSG_FIRSTHDR(&msghdr);
|
|
||||||
cmsg->cmsg_len = msghdr.msg_controllen;
|
|
||||||
cmsg->cmsg_level = SOL_SOCKET;
|
|
||||||
cmsg->cmsg_type = SCM_RIGHTS;
|
|
||||||
for(i = 0; i < n_fds; i++)
|
|
||||||
((int *)CMSG_DATA(cmsg))[i] = fds[i];
|
|
||||||
return(sendmsg(sock, &msghdr, 0) >= 0 ? 0 : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef SPARE_SEND_FDS
|
|
||||||
int
|
|
||||||
ancil_send_fds(int sock, const int *fds, unsigned n_fds)
|
|
||||||
{
|
|
||||||
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
|
|
||||||
|
|
||||||
assert(n_fds <= ANCIL_MAX_N_FDS);
|
|
||||||
return(ancil_send_fds_with_buffer(sock, fds, n_fds, &buffer));
|
|
||||||
}
|
|
||||||
#endif /* SPARE_SEND_FDS */
|
|
||||||
|
|
||||||
#ifndef SPARE_SEND_FD
|
|
||||||
int
|
|
||||||
ancil_send_fd(int sock, int fd)
|
|
||||||
{
|
|
||||||
ANCIL_FD_BUFFER(1) buffer;
|
|
||||||
|
|
||||||
return(ancil_send_fds_with_buffer(sock, &fd, 1, &buffer));
|
|
||||||
}
|
|
||||||
#endif /* SPARE_SEND_FD */
|
|
|
@ -1,112 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* libancillary - black magic on Unix domain sockets
|
|
||||||
* (C) Nicolas George
|
|
||||||
* test.c - testing and example program
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include "ancillary.h"
|
|
||||||
|
|
||||||
void child_process(int sock)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int fds[3], nfds;
|
|
||||||
char b[] = "This is on the received fd!\n";
|
|
||||||
|
|
||||||
if(ancil_recv_fd(sock, &fd)) {
|
|
||||||
perror("ancil_recv_fd");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("Received fd: %d\n", fd);
|
|
||||||
}
|
|
||||||
write(fd, b, sizeof(b));
|
|
||||||
close(fd);
|
|
||||||
sleep(2);
|
|
||||||
|
|
||||||
nfds = ancil_recv_fds(sock, fds, 3);
|
|
||||||
if(nfds < 0) {
|
|
||||||
perror("ancil_recv_fds");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("Received %d/3 fds : %d %d %d.\n", nfds,
|
|
||||||
fds[0], fds[1], fds[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void parent_process(int sock)
|
|
||||||
{
|
|
||||||
int fds[2] = { 1, 2 };
|
|
||||||
|
|
||||||
if(ancil_send_fd(sock, 1)) {
|
|
||||||
perror("ancil_send_fd");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("Sent fd.\n");
|
|
||||||
}
|
|
||||||
sleep(1);
|
|
||||||
|
|
||||||
if(ancil_send_fds(sock, fds, 2)) {
|
|
||||||
perror("ancil_send_fds");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("Sent two fds.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int sock[2];
|
|
||||||
|
|
||||||
if(socketpair(PF_UNIX, SOCK_STREAM, 0, sock)) {
|
|
||||||
perror("socketpair");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
printf("Established socket pair: (%d, %d)\n", sock[0], sock[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(fork()) {
|
|
||||||
case 0:
|
|
||||||
close(sock[0]);
|
|
||||||
child_process(sock[1]);
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
perror("fork");
|
|
||||||
exit(1);
|
|
||||||
default:
|
|
||||||
close(sock[1]);
|
|
||||||
parent_process(sock[0]);
|
|
||||||
wait(NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
Most of pdnsd was written by Thomas Moestl (tmoestl@gmx.net).
|
|
||||||
In the "par" versions large parts of the code have been revised
|
|
||||||
and several features have been added by Paul Rombouts.
|
|
||||||
|
|
||||||
Small parts of this program are based on code that was taken from nmap (IP
|
|
||||||
checksumming), the isdn4k-utils (ippp interface uptest), glibc 2.1.2 (some
|
|
||||||
definitions for kernel 2.2.x missing in 2.0 glibcs) and FreeBSD
|
|
||||||
(SIZEOF_ADDR_IFREQ in netdev.c).
|
|
||||||
nmap was written by Fyodor. The insd4k-utils were written by Fritz Elfert and
|
|
||||||
others. The GNU C library (glibc) is copyright by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
The following people have contributed code:
|
|
||||||
Andrew M. Bishop contributed support for server labels
|
|
||||||
Carsten Block contributed 'configure'-able rc scripts
|
|
||||||
Stephan Boettcher contributed the SCHEME= option.
|
|
||||||
P.J. Bostley contributed patches to get pdnsd working on
|
|
||||||
alpha
|
|
||||||
Frank Elsner contributed rc script fixes
|
|
||||||
Christian Engstler contributed patches for SuSE compatability
|
|
||||||
Bjoern Fischer contributed code to make pdnsd leave the case of names
|
|
||||||
in the cache unchanged
|
|
||||||
Torben Janssen contributed RedHat rc scripts
|
|
||||||
Olaf Kirch contributed a security fix for the run_as()
|
|
||||||
function
|
|
||||||
Bernd Leibing contributed fixes to the spec file.
|
|
||||||
Sourav K. Mandal contributed the autoconf/automake code, gdbm
|
|
||||||
caching facility and many suggestions
|
|
||||||
Markus Mohr contributed Debian rc scripts
|
|
||||||
Alexandre Nunes contributed autoconf fixes
|
|
||||||
Wolfgang Ocker contributed the server_ip option
|
|
||||||
Soenke J. Peters contributed patches and suggestions for RedHat
|
|
||||||
compatability
|
|
||||||
Roman Shterenzon contributed many helpful hints and patches for
|
|
||||||
FreeBSD compatability.
|
|
||||||
Andreas Steinmetz contributed the code for the query_port_start and
|
|
||||||
query_port_end options (which I changed slightly,
|
|
||||||
so blame any breakage on me ;)
|
|
||||||
Marko Stolle contributed the contrib/pdnsd_update.pl script that
|
|
||||||
makes pdnsd usable in a DHCP setup.
|
|
||||||
Lyonel Vincent extended the serve_aliases option to support an
|
|
||||||
arbitrary number of aliases
|
|
||||||
Paul Wagland contributed a patches for bind9-compatability
|
|
||||||
and for some memory leaks on error paths.
|
|
||||||
Sverker Wiberg contributed IPv6 build fixes
|
|
||||||
Michael Wiedmann contributed the pdnsd-ctl.8 man page.
|
|
||||||
Ron Yorston contributed the dev-uptest for Linux ppp dial-
|
|
||||||
on-demand devices
|
|
||||||
Nikita V. Youshchenko contributed extensions to the "if" uptest
|
|
||||||
Mahesh T. Pai contributed the pdnsd.8 man page.
|
|
||||||
Nikola Kotur contributed the Slackware start-up script.
|
|
||||||
Kiyo Kelvin Lee contributed a patch for Cygwin support.
|
|
||||||
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
|
|
||||||
Jan-Marek Glogowski contributed a patch implementing the "use_nss" option.
|
|
||||||
|
|
||||||
Please look into the THANKS file for people who helped me in various ways on
|
|
||||||
this project.
|
|
||||||
If this list is incomplete, pease drop me a mail!
|
|
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
|
@ -1,26 +0,0 @@
|
||||||
A small part of the pdnsd source is licensed under the following BSD-style
|
|
||||||
license:
|
|
||||||
|
|
||||||
Copyright (C) 2001 Thomas Moestl
|
|
||||||
|
|
||||||
This file is part of the pdnsd package.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
||||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
||||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,161 +0,0 @@
|
||||||
2000-02-15
|
|
||||||
Version 0.2. First working alpha with the extended feature set.
|
|
||||||
|
|
||||||
2000-02-16
|
|
||||||
Version 0.3 with many bugfixes, better standard conformity and
|
|
||||||
some new features.
|
|
||||||
|
|
||||||
2000-02-17
|
|
||||||
Did a lint on the code, implemented soft timeouts, again bugfixes,
|
|
||||||
drastically reduced cache memory requirements, implemented local
|
|
||||||
records.
|
|
||||||
Version 0.4 released.
|
|
||||||
|
|
||||||
2000-02-19
|
|
||||||
Recursive query finally implemented. Version 0.5 out.
|
|
||||||
|
|
||||||
2000-02-20
|
|
||||||
Various bugfixes. The server now always tries to get an AA answer
|
|
||||||
if possible; this implies recursion. This is to deal better with
|
|
||||||
caching servers that may return incomplete results on * queries.
|
|
||||||
This may be a little sub-optimal since it may not take the full
|
|
||||||
effect of caching, but it is the only real possibility of getting
|
|
||||||
complete records.
|
|
||||||
Redid the deps in the makefile for now.
|
|
||||||
Version is now 0.6.
|
|
||||||
|
|
||||||
2000-02-21
|
|
||||||
Another set of bugfixes. Version is 0.6.1.
|
|
||||||
|
|
||||||
2000-02-22
|
|
||||||
Another set of bugfixes. It should stabilize by now. Answer compression
|
|
||||||
is there finally. Version is therefore up again, 0.7 by now.
|
|
||||||
|
|
||||||
2000-02-23
|
|
||||||
Minor bugfixes, isdn interface uptest added. The new record types as of
|
|
||||||
rfc1700 are implemented, but as a compile-time option, since normally
|
|
||||||
there is no need to waste space for them.
|
|
||||||
Version is 0.7.1.
|
|
||||||
|
|
||||||
2000-02-24
|
|
||||||
Version 0.7.2 with all rrs up to KX (36). #define DNS_NEW_RRS in
|
|
||||||
config.h and (re)compile if you want to use them. Delete the cache
|
|
||||||
file before using a version with this option changed!
|
|
||||||
NSAP-PTR does NOT WORK (any incoming answer containing it may cause
|
|
||||||
a format error) because it is ill-designed (see TODO). Never mind, it
|
|
||||||
is officially deprecated anyway.
|
|
||||||
The secure DNS extension record types defined in RFC 2065 (KEY, SIG,
|
|
||||||
NXT) are cached only and therefore useless.
|
|
||||||
|
|
||||||
2000-02-26
|
|
||||||
Version 0.8 with parallel query (and probably new bugs) introduced.
|
|
||||||
|
|
||||||
2000-02-27
|
|
||||||
Version 0.8.1 with minor bugfixes on the new features.
|
|
||||||
|
|
||||||
2000-02-27
|
|
||||||
Version 0.8.5 with authority support and the usual bugifxes. Some issues
|
|
||||||
with standard conformity were also fixed (wow, two versions a day).
|
|
||||||
|
|
||||||
2000-02-28
|
|
||||||
Implemented caching of non-authoritative records. This allows better
|
|
||||||
usage of other caching name servers. This may return non-authoritative
|
|
||||||
records to any non-wildcard query. If a wildcard query arrives, we
|
|
||||||
always look for authoritative records, so we do if the non-authoritative
|
|
||||||
answer does not contain at least one answering record to the query.
|
|
||||||
This fixes the sub-optimal behaviour since 0.6.
|
|
||||||
Version is therefore up to 0.8.7 (0.8.6 was also released today
|
|
||||||
containing bugfixes)
|
|
||||||
|
|
||||||
2000-02-29
|
|
||||||
Better thread support, avoiding deadlocks in signal handling. The cost
|
|
||||||
is unfortunately one more thread.
|
|
||||||
New option server_port in config file.
|
|
||||||
Version is 0.8.8.
|
|
||||||
|
|
||||||
2000-03-01
|
|
||||||
Nailed a renitent memory leak bug to the wall (shame, what a trivial
|
|
||||||
mistake). Also improved handling of error conditions slightly.
|
|
||||||
Version is 0.8.9.
|
|
||||||
|
|
||||||
2000-03-01
|
|
||||||
Cache code cleanup. The development of the non-parallel query code
|
|
||||||
is discontinued, although it still works. If you want serial query,
|
|
||||||
just set PAR_QUERIES to 1.
|
|
||||||
Additional information finally implemented.
|
|
||||||
We are up to 0.9.
|
|
||||||
|
|
||||||
2000-03-02
|
|
||||||
Fixed a DoS possibility.
|
|
||||||
More rfc compatability fixups and a smarter resolver logic.
|
|
||||||
Version 0.9.1
|
|
||||||
|
|
||||||
2000-03-02
|
|
||||||
Added the source section to the config file handling. This allows to
|
|
||||||
source your /etc/hosts file. Version 0.9.2.
|
|
||||||
|
|
||||||
2000-03-02
|
|
||||||
Avoiding double additional records now. Version 0.9.3.
|
|
||||||
|
|
||||||
2000-03-09
|
|
||||||
Fixed some REALLY STUPID bugs. Uuummph, thought it was finished.
|
|
||||||
However, the number of bugs remaining is always n+1...
|
|
||||||
Anyway, we are up to 0.9.4. Hope that there are no mean bugs left.
|
|
||||||
|
|
||||||
2000-03-14
|
|
||||||
Added another uptest, exec. See README for details. Also grained the
|
|
||||||
cache size finer (it's now specified in kB). Version 0.9.5
|
|
||||||
|
|
||||||
2000-04-07
|
|
||||||
Fixed some really stupid bugs, what else? Version is 0.9.6
|
|
||||||
To be more exact: fixed misc bugs, cleaned up hash.c and cache.c
|
|
||||||
|
|
||||||
2000-04-20
|
|
||||||
Again fixed some bugs, version is now 0.9.7.
|
|
||||||
|
|
||||||
2000-04-29
|
|
||||||
Fixed a build problem caused by some missing #defines in glibc2.0 and a
|
|
||||||
minor bug.
|
|
||||||
Version is up to 0.9.8
|
|
||||||
|
|
||||||
2000-04-30
|
|
||||||
Fixed some unclean C code and did a general C lint. Thanks to Byrial
|
|
||||||
Jensen for pointing out some issues. Now using stricter compiler flags.
|
|
||||||
Also replaced the daemon() call in main.c for improved portability.
|
|
||||||
Pre-Released 0.9.9p1
|
|
||||||
|
|
||||||
2000-05-03
|
|
||||||
Released 0.9.9p2 with the changes of 0.9.9p1, Documentation updates,
|
|
||||||
bugfixes, and the Red Hat rc scripts contributed by Torben Janssen.
|
|
||||||
Also, the meaning of the command line option -v has changed.
|
|
||||||
There is a new config file option "lean_query" that is on by
|
|
||||||
default. It is an optimization, so please look in the docs when
|
|
||||||
updating whether you want it switched on or not.
|
|
||||||
Removed the long-dead serial query code from the distribution tree.
|
|
||||||
Some resolvers seem to be broken somehow in a respect that it cares
|
|
||||||
about order in which the records appear. In particular, it wants
|
|
||||||
cname to appear before other records. Ok, so it be...
|
|
||||||
|
|
||||||
|
|
||||||
2000-05-04
|
|
||||||
Save all names in lower case in the rrs.
|
|
||||||
Tidying up the source tree.
|
|
||||||
The long-awaited cache structure changes have been started. Please
|
|
||||||
delete you cache files before using this new release.
|
|
||||||
|
|
||||||
2000-05-05
|
|
||||||
Fixed several bugs in the old and in the new source tree.
|
|
||||||
Use time_t instead of long for internal time storage for compatibility.
|
|
||||||
|
|
||||||
|
|
||||||
2000-05-06
|
|
||||||
Version 0.9.10.
|
|
||||||
This fixes a bug in uptest=if. Red Hat and configuration fixes
|
|
||||||
suggested by Soeren J. Peters were included.
|
|
||||||
|
|
||||||
2000-05-08
|
|
||||||
Version 0.9.11
|
|
||||||
This fixes a locally exploitable security problem (pdnsd.cache was
|
|
||||||
world-writeable). This is actually a one-line fix; for a description of
|
|
||||||
possible dangers, please refer to the html documentation.
|
|
||||||
Thanks to Alan Swanson for reporting.
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue