214 lines
2.9 KiB
Markdown
214 lines
2.9 KiB
Markdown
# yourls-ui
|
|
|
|
Small Qt tray utility for shortening URLs using the **YOURLS API**.
|
|
|
|
The application sits in the system tray and allows quickly shortening the URL currently stored in the clipboard.
|
|
|
|
It was designed as a lightweight helper for everyday use with a self-hosted YOURLS instance.
|
|
|
|
---
|
|
|
|
# Features (v0.1)
|
|
|
|
- System tray application
|
|
- Simple configuration window
|
|
- Uses YOURLS API with **signature authentication**
|
|
- Reads URL from clipboard
|
|
- Generates a short URL
|
|
- Copies the short URL back to clipboard
|
|
- Shows popup with clickable link
|
|
- Error reporting with API response
|
|
|
|
---
|
|
|
|
# How it works
|
|
|
|
1. Application starts
|
|
2. If configuration exists → it goes directly to the **system tray**
|
|
3. If configuration is missing → **settings window opens**
|
|
|
|
From the tray menu you can run:
|
|
|
|
```
|
|
Cut URL
|
|
```
|
|
|
|
The application will:
|
|
|
|
1. Read the current clipboard
|
|
2. Check if the content is a valid URL
|
|
3. Call the YOURLS API
|
|
4. Receive a shortened link
|
|
5. Copy the shortened link back to clipboard
|
|
6. Show a popup window with the result
|
|
|
|
---
|
|
|
|
# Configuration
|
|
|
|
The settings window contains:
|
|
|
|
```
|
|
API URL
|
|
API signature
|
|
```
|
|
|
|
Example:
|
|
|
|
```
|
|
API URL:
|
|
https://example.com/yourls-api.php
|
|
|
|
Signature:
|
|
e484ea32c0
|
|
```
|
|
|
|
⚠️ Important:
|
|
|
|
The signature field must contain **only the signature value**, not:
|
|
|
|
```
|
|
signature=e484ea32c0
|
|
```
|
|
|
|
Correct:
|
|
|
|
```
|
|
e484ea32c0
|
|
```
|
|
|
|
---
|
|
|
|
# Tray menu
|
|
|
|
Right click the tray icon to access the menu:
|
|
|
|
```
|
|
Cut URL
|
|
Help
|
|
About
|
|
Exit
|
|
```
|
|
|
|
Double clicking the tray icon opens the settings window.
|
|
|
|
---
|
|
|
|
# Building
|
|
|
|
Requirements:
|
|
|
|
```
|
|
Qt 5
|
|
Qt Widgets
|
|
Qt Network
|
|
qmake
|
|
```
|
|
|
|
Build:
|
|
|
|
```bash
|
|
qmake
|
|
make
|
|
```
|
|
|
|
Or open `yourls-ui.pro` in **Qt Creator** and build normally.
|
|
|
|
---
|
|
|
|
# Project structure
|
|
|
|
```
|
|
main.cpp
|
|
Application entry point
|
|
|
|
mainwindow.h / mainwindow.cpp
|
|
Main application window
|
|
Tray integration
|
|
UI logic
|
|
|
|
mainwindow.ui
|
|
Qt Designer UI for settings window
|
|
|
|
yourlsclient.h / yourlsclient.cpp
|
|
YOURLS API client
|
|
Handles HTTP requests and responses
|
|
```
|
|
|
|
The YOURLS API communication is encapsulated in `YourlsClient`.
|
|
|
|
---
|
|
|
|
# API call
|
|
|
|
The application performs a request similar to:
|
|
|
|
```
|
|
GET /yourls-api.php
|
|
?action=shorturl
|
|
&format=json
|
|
&signature=<signature>
|
|
&url=<url>
|
|
```
|
|
|
|
Example:
|
|
|
|
```
|
|
https://example.com/yourls-api.php?action=shorturl&format=json&signature=ABC123&url=https://example.com
|
|
```
|
|
|
|
---
|
|
|
|
# Future ideas
|
|
|
|
Possible improvements for future versions:
|
|
|
|
### Hotkey support
|
|
Global hotkey to trigger URL shortening.
|
|
|
|
### Clipboard watcher
|
|
Automatically detect URLs copied to clipboard.
|
|
|
|
### Tray notifications
|
|
Use system notifications instead of popup dialog.
|
|
|
|
### Recent history
|
|
Store last shortened URLs.
|
|
|
|
### Custom alias
|
|
Allow specifying custom short URL alias.
|
|
|
|
### Open YOURLS admin
|
|
Add tray menu entry for opening YOURLS admin panel.
|
|
|
|
### Packaging
|
|
Provide:
|
|
|
|
```
|
|
AppImage
|
|
.deb package
|
|
```
|
|
|
|
---
|
|
|
|
# Version
|
|
|
|
```
|
|
v0.1
|
|
```
|
|
|
|
Initial working release.
|
|
|
|
---
|
|
|
|
# Author
|
|
|
|
```
|
|
deeaitch
|
|
```
|
|
|
|
---
|
|
|
|
# License
|
|
|
|
GPL |