Skip to content

Commit a15f29c

Browse files
authored
0.1.0 (#10)
* convert to using web application oauth client id type due to Google dropping support for OOB oAuth flow. * due to above uses a redirect_uri of this plugin's github page found at https://jneilliii.github.io/OctoPrint-GoogleDriveFiles/ to display the retrieved authentication code. * added client_secrets.json validation for web type and redirect_uri
1 parent 058294c commit a15f29c

31 files changed

+190
-17
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ sudo apt install libssl-dev
4141
![screenshot](screenshots/settings_step10.png)
4242
12. Click on `Create credentials` and select `OAuth client ID`. <br>
4343
![screenshot](screenshots/settings_step11.png)
44-
13. Select `Desktop App` for application type and then enter a name (can be anything and does not really matter) and then click `Create`. <br>
44+
13. Select `Web application` for application type and then enter a name (can be anything and does not really matter). Fill in the Authorized redirect URIs as `https://jneilliii.github.io/OctoPrint-GoogleDriveFiles/` and then click `Create`. <br>
4545
![screenshot](screenshots/settings_step12.png)
4646
14. Click `OK` to the confirmation page and then use the download button ![screenshot](screenshots/settings_download.png) to save your client_secrets#####.json file. <br>
4747
![screenshot](screenshots/settings_step13.png)
@@ -61,15 +61,17 @@ Once the Prerequisite steps above have been completed and you have downloaded yo
6161
![screenshot](screenshots/configuration_step1.png)
6262
2. Fill in the name of the folder you'd like to sync with in your Google Drive (will be added if it doesn't exist), use the `Browse` button to select your downloaded client_secrets#####.json file and press the `Upload` button. <br>
6363
![screenshot](screenshots/configuration_step2.png)
64-
3. An authentication URL will be generated and presented to you. Click that new URL to open a new window and authorize your custom Google app. <br>
64+
3. An authentication URL will be generated, click the `Get Auth Code` button to open a new window and authorize your custom Google app. <br>
6565
![screenshot](screenshots/configuration_step3.png)
66-
4. Log in to your Google account you want to give Drive access to. You will get a warning that the App isn't verified. This is normal as you have not submitted your custom app for verification by Google. You can choose to do that if you want but is not necessary for the operation of the plugin. Click the `Advanced` link at the bottom of the page and the click `Go to <app name>`. <br>
66+
4. Log in to your Google account you want to give Drive access to. You will get a warning that the App isn't verified. This is normal as you have not submitted your custom app for verification by Google. You can choose to do that if you want but is not necessary for the operation of the plugin. Click the `Continue` button. <br>
6767
![screenshot](screenshots/configuration_step4.png)
68-
5. Click the `Allow` button to retrieve your authentication code to enter in the plugin's settings in the next step. <br>
68+
5. Click the `Continue` button to retrieve your authentication code.<br>
6969
![screenshot](screenshots/configuration_step5.png)
70-
6. Copy the code from step 5 and paste it into the **Auth Code** field and click `Authorize`. <br>
70+
6. Click the copy button to copy the authentication code to the clipboard.<br>
71+
![screenshot](screenshots/configuration_step5a.png)
72+
7. Paste the code copied in the previous step into the **Auth Code** field and click `Authorize`. <br>
7173
![screenshot](screenshots/configuration_step6.png)
72-
7. If everything went well then you will be presented with a successful message. <br>
74+
8. If everything went well then you will be presented with a successful message. <br>
7375
![screenshot](screenshots/configuration_step7.png)
7476

7577
## Get Help

docs/Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6+
7+
# gem "rails"
8+
9+
gem 'github-pages', ">=206", group: :jekyll_plugins

docs/_includes/footer.html

Whitespace-only changes.

docs/_includes/navbar.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
2+
<div class="container">
3+
<a class="navbar-brand" href="#">Google Drive Files oAuth</a>
4+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
<div class="collapse navbar-collapse" id="navbarContent">
8+
<ul class="navbar-nav mr-auto mb-2 mb-lg-0">
9+
<li class="nav-item mx-2">
10+
<a class="nav-link" href="https://plugins.octoprint.org/by_author/#jneilliii">
11+
<i class="fas fa-puzzle-piece"></i> Plugins</a>
12+
</li>
13+
<li class="nav-item mx-2">
14+
<a class="nav-link" href="https://github.com/jneilliii">
15+
<i class="fas fa-user"></i> My Github Profile</a>
16+
</li>
17+
<li class="nav-item mx-2">
18+
<a class="nav-link" href="https://github.com/sponsors/jneilliii">
19+
<i class="fas fa-heart"></i> Support My Projects</a>
20+
</li>
21+
</ul>
22+
<ul class="navbar-nav mr-0 mb-2 mb-lg-0">
23+
<li class="nav-item">
24+
<a class="nav-link" href="https://github.com/jneilliii/OctoPrint-GoogleDriveFiles"><i class="fas fa-code-branch"></i> Source</a>
25+
</li>
26+
</ul>
27+
</div>
28+
</div>
29+
</nav>

docs/_layouts/base.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
7+
<!-- Bootstrap CSS -->
8+
<link href="static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
9+
10+
<!-- Fontawesome -->
11+
<link href="static/lib/fontawesome/css/fontawesome.min.css" rel="stylesheet">
12+
<link href="static/lib/fontawesome/css/solid.min.css" rel="stylesheet">
13+
14+
<!-- jQuery -->
15+
<script type="application/javascript" src="static/lib/jquery/js/jquery-3.6.0.min.js"></script>
16+
17+
<!-- helpers -->
18+
<script type="application/javascript" src="static/js/helpers.js"></script>
19+
20+
<title>{{ page.title }}</title>
21+
</head>
22+
<body>
23+
{% include navbar.html %}
24+
25+
<div class="container-fluid">
26+
{{ content }}
27+
</div>
28+
</body>
29+
</html>

docs/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Google Drive Files oAuth
3+
layout: base
4+
---
5+
<section class="py-5 text-center container">
6+
<div class="row py-lg-5">
7+
<div class="col-lg-6 col-md-8 mx-auto">
8+
<h1 class="fw-light">Google Drive Files</h1>
9+
<label for="oAuthResults" class="form-label">Your Authentication Code</label>
10+
<div class="input-group mb-3">
11+
<input type="text" class="form-control" id="oAuthResults" aria-describedby="basic-addon3" placeholder="Authentication Code" readonly>
12+
<button class="btn btn-outline-secondary" type="button" id="button-copy-to-clipboard"><i class="fa-solid fa-clipboard"></i></button>
13+
</div>
14+
<div class="alert alert-success invisible" role="alert" id="oAuthCopied">
15+
Authentication code copied to clipboard.
16+
</div>
17+
</div>
18+
</div>
19+
</section>
20+
<script type="application/javascript">
21+
$(document).ready(function(){
22+
const params = new Proxy(new URLSearchParams(window.location.search), {
23+
get: (searchParams, prop) => searchParams.get(prop),
24+
});
25+
let oAuthCode = params.code;
26+
$('#oAuthResults').val(oAuthCode).on('click', function() {$(this).select();});
27+
$('#button-copy-to-clipboard').on('click', function(){
28+
copyToClipboard($('#oAuthResults').val());
29+
$('#oAuthCopied').removeClass('invisible');
30+
window.setTimeout(function(){$('#oAuthCopied').addClass('invisible');},5000);
31+
});
32+
});
33+
</script>

docs/static/js/helpers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var copyToClipboard = function (text) {
2+
var temp = $("<textarea>");
3+
$("body").append(temp);
4+
temp.val(text).select();
5+
document.execCommand("copy");
6+
temp.remove();
7+
};

docs/static/lib/bootstrap/css/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/lib/bootstrap/js/bootstrap.bundle.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/lib/bootstrap/js/bootstrap.bundle.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)