Skip to content

Commit

Permalink
Merge branch 'master' into Contact-Form2
Browse files Browse the repository at this point in the history
  • Loading branch information
SaptarshiSarkar12 committed Oct 22, 2022
2 parents 6a9575e + 5c4db05 commit f2e8f58
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 41 deletions.
Binary file modified Drifty_CLI.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -47,7 +47,7 @@ git clone git@github.com:SaptarshiSarkar12/Drifty.git

![image](https://user-images.githubusercontent.com/58129377/193471489-87ee10a0-f719-47ef-9d46-e5b71c611d4b.png)

It is because Microsoft Defender could not verify it safe it is not commonly downloaded. Feel free to proceed by following steps:
It is because Microsoft Defender could not verify it is safe as it is not commonly downloaded. Feel free to proceed by following steps:
- Tap on the three dots.
- Tap on keep.

Expand All @@ -71,7 +71,7 @@ You can also provide your feedback to Microsoft Defender by reporting it to be S
- It will take you to **`Report a download`** page. You can provide your feedback there.😄

## Demo
See the below video how to use the application. For any help, you can open an [`issue`](https://github.com/SaptarshiSarkar12/Drifty/issues/new/choose/). </p>
See the video below to know how to use the application. For any help, you can open an [`issue`](https://github.com/SaptarshiSarkar12/Drifty/issues/new/choose/). </p>

https://user-images.githubusercontent.com/105960032/193530137-d66a5e07-fb81-4df6-a547-7174ccf637e6.mp4

Expand Down
29 changes: 15 additions & 14 deletions Website/index.html
Expand Up @@ -20,6 +20,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="./favicons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="./favicons/favicon-16x16.png" />
<link rel="manifest" href="./favicons/site.webmanifest" />
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
</head>

<body>
Expand Down Expand Up @@ -61,7 +62,7 @@
<h1>DRIFTY</h1>
<p>
Drifty is an open-source interactive File Downloader system built
with java. It takes the link to the file, the directory where it
with Java. It takes the link to the file, the directory where it
needs to be saved and the filename of the downloaded file as input
and downloads it in the given directory with the given filename.
</p>
Expand Down Expand Up @@ -108,9 +109,8 @@ <h2 class="text-gradient-blue">Be a part of Drifty Family!</h2>
<h4>✨Download Here✨</h4>
</div>
<div id="download_section" class="download_section">
<a href="https://github.com/SaptarshiSarkar12/Drifty/releases/latest/download/Drifty_CLI.exe"
class="btn4">Download Now <i class="fab fa-windows"></i></a>
<a href="https://github.com/SaptarshiSarkar12/Drifty/releases/latest/download/Drifty.jar" class="btn4">Download
<a onclick="download_alert_window()" class="btn4">Download Now <i class="fab fa-windows"></i></a>
<a onclick="download_alert_apple()" class="btn4">Download
Now <i class="fab fa-apple"></i> <i class="fab fa-linux"></i></a>
</div>
<span><b>All releases</b></span>
Expand Down Expand Up @@ -159,15 +159,15 @@ <h2><em>Thanks</em> for contacting us! We will get back to you soon!
<br><br>
</section>

<footer class="footer">
<div class="social">
<a href="https://www.twitter.com/SSarkar2007"><i class="fab fa-twitter"></i></a>
<a href="https://github.com/SaptarshiSarkar12"><i class="fab fa-github"></i></a>
<a href="https://saptarshisarkar.hashnode.dev/"><i class="fa-brands fa-hashnode"></i></a>
<a href="https://www.bio.link/saptarshi"><i class="fa-sharp fa-solid fa-link"></i></a>
<!--added footers -->
</div>
<p><i class="fa-solid fa-copyright"></i> Drifty
<footer class="footer">
<div class="social">
<a href="https://www.twitter.com/SSarkar2007" id="twitter"><i class="fab fa-twitter"></i></a>
<a href="https://github.com/SaptarshiSarkar12"><i class="fab fa-github"></i></a>
<a href="https://saptarshisarkar.hashnode.dev/"><i class="fa-brands fa-hashnode"></i></a>
<a href="https://www.bio.link/saptarshi"><i class="fa-sharp fa-solid fa-link"></i></a>
<!--added footers -->
</div>
<p><i class="fa-solid fa-copyright"></i> Drifty
<script>document.write(new Date().getFullYear())</script>
</p>
</footer>
Expand All @@ -176,4 +176,5 @@ <h2><em>Thanks</em> for contacting us! We will get back to you soon!
<script src="script.js"></script>
<script data-cfasync="false" type="text/javascript" src="form-submission-handler.js"></script>
</body>
</html>

</html>
58 changes: 54 additions & 4 deletions Website/script.js
@@ -1,5 +1,30 @@
"use strict";

/* Javascript alert */
function download_alert_window() {
var w = confirm("Do you want to download Drifty?");
if (w == true) {
alert("Thanks for Downloading");
window.open(
"https://github.com/SaptarshiSarkar12/Drifty/releases/latest/download/Drifty_CLI.exe"
);
} else {
alert("Sorry! You cancelled the Download!");
}
}

function download_alert_apple() {
var a = confirm("Do you want to download Drifty?");
if (a == true) {
alert("Thanks for Downloading");
window.open(
"https://github.com/SaptarshiSarkar12/Drifty/releases/latest/download/Drifty.jar"
);
} else {
alert("Sorry! You cancelled the Download!");
}
}

const date = new Date();

let darkMode = localStorage.getItem("darkMode");
Expand Down Expand Up @@ -124,9 +149,10 @@ function generateDiv(x) {
// Release SECTION ----
let releases = localStorage.getItem("releases");
let releasesRequestedAt = localStorage.getItem("releasesRequestedAt");
if (parseInt(releasesRequestedAt) > 23) localStorage.removeItem("requestedAt"); // fetch release information every day
if (parseInt(releasesRequestedAt) > 23) localStorage.removeItem("requestedAt");
if (releases == null || releasesRequestedAt == null) getReleases();
else if (currentHour != releasesRequestedAt) getReleases();
else if (currentHour - releasesRequestedAt >= 4)
getReleases(); // get release info every 4 hours
else updateReleases();

function getReleases() {
Expand Down Expand Up @@ -158,14 +184,38 @@ function renderRelease(all, release) {
console.log(release);
let assets = renderAssets(release.assets.reverse());
return `${all} <div class="release">
<div><b>${release.name}</b></div>
<div>${new Date(release.published_at)}</div>
<div style="text-align:center"><b>${release.name}</b></div>
<div style="text-align:center">${new Date(release.published_at)}</div>
<div onclick="toggleMore(this,'${
release.id
}')" style="text-align:center;cursor:pointer;font-weight:bolder;opacity: 0.4;">Learn More</div>
<div id="${release.id}" class="release-note">
${marked.parse(release.body)}
</div>
<div class="assets">
${assets}
</div>
</div>`;
}

function toggleMore(btn, id) {
let release_note = document.getElementById(id);
// calculate the real height of the element which is scrollHeight + margin(1rem top and 1 rem bottom) + border(0)
// let height = release_note.scrollHeight + parseFloat( getComputedStyle(document.documentElement).fontSize.split("px")[0] ) *2;
// or simply we could multiply the scroll height by two and the height could not be more that this
let height = release_note.scrollHeight * 2;

if (btn.innerText == "Hide") {
release_note.style.maxHeight = "0px";
release_note.style.margin = "0rem";
btn.innerText = "Learn More";
} else {
release_note.style.maxHeight = height + "px";
release_note.style.margin = "1rem";
btn.innerText = "Hide";
}
}

function renderAssets(assets) {
return assets.reduce((all, asset) => {
//check if it is for windows
Expand Down
66 changes: 56 additions & 10 deletions Website/style.css
Expand Up @@ -539,6 +539,7 @@ header {
flex-direction: column;
justify-content: center;
text-align: left;
max-width: min(100%,max(50%,500px));
}

.release{
Expand Down Expand Up @@ -680,8 +681,10 @@ header {
}

.footer .social {
text-align: center;
padding-bottom: 25px;
display: flex;
justify-content: center;
align-items: center;
padding: 1rem;
}

.footer .social a {
Expand All @@ -696,19 +699,47 @@ header {
text-align: center;
display: inline-block;
border-radius: 50%;
margin: 0 10px;
border-color: black;
margin: 0 6px;
opacity: 0.75;
transition: all 0.25s linear;
}
.footer .social .social-icons a{
color: #0f0f0f;
padding: 0.7rem;
border: 1px solid #0f0f0f;
border-radius: 50%;
width: auto;
}

.footer .social a:hover {
color: var(--maroon);
opacity: 1;
box-shadow: 2px 2px 10px var(--maroon), 2px -2px 10px var(--maroon),
-2px -2px 10px var(--maroon), -2px 2px 10px var(--maroon);
#twitter:hover {
background-color: #00acee ;
color: #fff;
transition: 0.3s ease;
border: none;
transform: scale(1.2);
}

.footer .social :nth-child(2):hover {
background-color: #0f0f0f ;
color: #fff;
transition: 0.3s ease;
border: none;
transform: scale(1.2);
}
.footer .social :nth-child(3):hover {
background-color: #2962FF ;
color: #fff;
transition: 0.3s ease;
border: none;
transform: scale(1.2);
}
.footer .social :nth-child(4):hover {
background-color: var(--maroon) ;
color: #fff;
transition: 0.3s ease;
border: none;
transform: scale(1.2);
}
.footer > p {
color: var(--black);
font-size: 15px;
Expand Down Expand Up @@ -980,4 +1011,19 @@ textarea {
width:40%;
margin-left: 30%;
}


.release-note {
overflow: hidden;
transition: max-height 200ms;
max-height: 0;
}

.release-note a, .release-note li {
color: var(--black);
}
.release h2, .release h3{
color: var(--text-color);;
}
.release ul{
margin-left:2rem;
}
Binary file modified out/artifacts/Drifty_CLI_jar/Drifty.jar
Binary file not shown.
Binary file modified out/production/Drifty/Drifty_CLI.class
Binary file not shown.
Binary file modified out/production/Drifty/FileDownloader.class
Binary file not shown.
1 change: 1 addition & 0 deletions src/Drifty_CLI.java
Expand Up @@ -240,6 +240,7 @@ private static void help(){
* This function prints the banner of the application in the console.
*/
private static void printBanner(){
System.out.println("Initializing Drifty ...");
System.out.print("\033[H\033[2J");
System.out.println(ANSI_PURPLE+"===================================================================="+ANSI_RESET);
System.out.println(ANSI_CYAN+" _____ _____ _____ ______ _______ __ __"+ANSI_RESET);
Expand Down
24 changes: 13 additions & 11 deletions src/FileDownloader.java
Expand Up @@ -41,8 +41,6 @@ public static String getDir(){
*/
@Override
public void run() {


link = link.replace('\\', '/');
if (!(link.startsWith("http://") || link.startsWith("https://"))){
link = "http://" + link;
Expand All @@ -56,24 +54,28 @@ public void run() {
//If link is from YouTube
if (Drifty_CLI.isYoutubeLink(link)) {
//download youtube video
System.out.println("Downloading ...");
Drifty_CLI.logger.log("INFO", "Downloading ...");
System.out.println("Trying to download the file ...");
Drifty_CLI.logger.log("INFO", "Trying to download the file ...");

try {
ProcessBuilder processBuilder = new ProcessBuilder("yt-dlp", "-q", "--progress", "-P", dir, link);
ProcessBuilder processBuilder = new ProcessBuilder("yt-dlp", "--quiet", "--progress", "-P", dir, link);
processBuilder.inheritIO();
Process yt_dlp = processBuilder.start();

BufferedReader br = new BufferedReader(new InputStreamReader(yt_dlp.getInputStream()));
String line = "";
while ((line = br.readLine()) != null) {
System.out.println(line);
yt_dlp.waitFor();
int exitValueOfYt_Dlp = yt_dlp.exitValue();
if (exitValueOfYt_Dlp == 0){
System.out.println("\nSuccessfully downloaded the file!");
Drifty_CLI.logger.log("INFO", "Successfully downloaded the file!");
} else if (exitValueOfYt_Dlp == 1) {
System.out.println("\nFailed to download the file!");
Drifty_CLI.logger.log("INFO", "Failed to download the file!");
}

} catch (Exception e) {
e.printStackTrace();
Drifty_CLI.logger.log("ERROR", e.getMessage());
}
System.out.println("Successfully downloaded the file.");
Drifty_CLI.logger.log("INFO", "Successfully downloaded the file");
}
else {
url = new URL(link);
Expand Down

0 comments on commit f2e8f58

Please sign in to comment.