-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from himmelblau-idm/stable-0.9.x_backports2
Add a QR code to the greeter, remove python deps, and fix tasks startup
- Loading branch information
Showing
20 changed files
with
190 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,12 @@ members = [ | |
"src/broker", | ||
"src/sshd-config", | ||
"src/sso", | ||
"src/qr-greeter", | ||
] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
version = "0.9.1" | ||
version = "0.9.2" | ||
authors = [ | ||
"David Mulder <[email protected]>" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[package] | ||
name = "qr-greeter" | ||
version.workspace = true | ||
authors.workspace = true | ||
description = "GNOME Shell extension that adds a QR code to authentication prompts when a MS DAG URL is detected." | ||
rust-version.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
|
||
[lib] | ||
path = "src/lib.rs" | ||
|
||
[package.metadata.deb] | ||
name = "himmelblau-qr-greeter" | ||
depends = ["gnome-shell"] | ||
assets = [ | ||
["src/[email protected]/extension.js", "usr/share/gnome-shell/extensions/[email protected]/extension.js", "644"], | ||
["src/[email protected]/metadata.json", "usr/share/gnome-shell/extensions/[email protected]/metadata.json", "644"], | ||
["src/[email protected]/stylesheet.css", "usr/share/gnome-shell/extensions/[email protected]/stylesheet.css", "644"], | ||
["src/msdag.png", "usr/share/gnome-shell/extensions/[email protected]/msdag.png", "644"], | ||
] | ||
|
||
[package.metadata.generate-rpm] | ||
name = "himmelblau-qr-greeter" | ||
assets = [ | ||
{ source = "src/[email protected]/extension.js", dest = "/usr/share/gnome-shell/extensions/[email protected]/extension.js", mode = "644" }, | ||
{ source = "src/[email protected]/metadata.json", dest = "/usr/share/gnome-shell/extensions/[email protected]/metadata.json", mode = "644" }, | ||
{ source = "src/[email protected]/stylesheet.css", dest = "/usr/share/gnome-shell/extensions/[email protected]/stylesheet.css", mode = "644" }, | ||
{ source = "src/msdag.png", dest = "/usr/share/gnome-shell/extensions/[email protected]/msdag.png", mode = "644" }, | ||
] | ||
|
||
[package.metadata.generate-rpm.requires] | ||
gnome-shell = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
Unix Azure Entra ID implementation | ||
Copyright (C) David Mulder <[email protected]> 2024 | ||
|
||
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/>. | ||
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import St from 'gi://St'; | ||
import Clutter from 'gi://Clutter'; | ||
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; | ||
import * as AuthPromptModule from 'resource:///org/gnome/shell/gdm/authPrompt.js'; | ||
|
||
const GdmAuthPrompt = AuthPromptModule.AuthPrompt; | ||
|
||
export default class QrGreeterExtension extends Extension { | ||
enable() { | ||
console.log("Himmelblau QR Greeter: enabled..."); | ||
|
||
if (!GdmAuthPrompt) { | ||
console.error("Himmelblau QR Greeter: GdmAuthPrompt is unavailable."); | ||
return; | ||
} | ||
|
||
this._originalSetMessage = GdmAuthPrompt.prototype.setMessage; | ||
const origSetMessage = this._originalSetMessage; | ||
|
||
GdmAuthPrompt.prototype.setMessage = function(message, styleClass) { | ||
origSetMessage.call(this, message, styleClass); | ||
|
||
if (this._message) { | ||
this._message.clutter_text.line_wrap = true; | ||
this._message.set_width(350); | ||
this._message.set_x_expand(false); | ||
this._message.set_x_align(Clutter.ActorAlign.CENTER); | ||
} | ||
|
||
if (!this._qrVBox) { | ||
const parent = this._message.get_parent(); | ||
parent.remove_child(this._message); | ||
|
||
const vbox = new St.BoxLayout({ | ||
vertical: true, | ||
x_expand: false, | ||
y_expand: false, | ||
x_align: Clutter.ActorAlign.CENTER, | ||
style_class: 'qr-vbox' | ||
}); | ||
this._qrVBox = vbox; | ||
|
||
vbox.add_child(this._message); | ||
|
||
const qrContainer = new St.Widget({ | ||
style_class: 'qr-code-container', | ||
x_expand: false, | ||
y_expand: false, | ||
x_align: Clutter.ActorAlign.CENTER | ||
}); | ||
this._qrContainer = qrContainer; | ||
vbox.add_child(qrContainer); | ||
|
||
const qrLabel = new St.Label({ | ||
text: "Scan with your phone", | ||
style_class: 'qr-instruction-label' | ||
}); | ||
this._qrLabel = qrLabel; | ||
vbox.add_child(qrLabel); | ||
|
||
parent.add_child(vbox); | ||
} | ||
|
||
const targetUrl = "https://microsoft.com/devicelogin"; | ||
if (message && message.includes(targetUrl)) { | ||
const fileUri = "file:///usr/share/gnome-shell/extensions/[email protected]/msdag.png"; | ||
this._qrContainer.set_style(`background-image: url('${fileUri}');`); | ||
this._qrContainer.show(); | ||
this._qrLabel.show(); | ||
} else { | ||
if (this._qrContainer) this._qrContainer.hide(); | ||
if (this._qrLabel) this._qrLabel.hide(); | ||
} | ||
}; | ||
|
||
console.log("Himmelblau QR Greeter: GdmAuthPrompt.setMessage patched."); | ||
} | ||
|
||
disable() { | ||
console.log("Himmelblau QR Greeter: disabled..."); | ||
if (GdmAuthPrompt && this._originalSetMessage) { | ||
GdmAuthPrompt.prototype.setMessage = this._originalSetMessage; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"uuid": "[email protected]", | ||
"name": "Himmelblau QR Greeter", | ||
"description": "Adds a QR code to authentication prompts when a URL is detected.", | ||
"version": 1, | ||
"shell-version": ["45", "46"], | ||
"session-modes": ["gdm"], | ||
"donations": { "opencollective" : "himmelblau" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.qr-vbox { | ||
spacing: 10px; | ||
} | ||
|
||
.qr-code-container { | ||
width: 128px; | ||
height: 128px; | ||
max-width: 128px; | ||
max-height: 128px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
|
||
background-color: #ffffff; | ||
background-repeat: no-repeat; | ||
background-size: contain; | ||
background-position: center; | ||
|
||
border-radius: 6px; | ||
box-shadow: 0 0 8px rgba(0,0,0,0.3); | ||
overflow: hidden; | ||
} | ||
|
||
.qr-instruction-label { | ||
color: #bbb; | ||
font-size: 10pt; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters