Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
+ removed unused component
+ cleanup
  • Loading branch information
m-haisham committed Feb 24, 2021
1 parent a262324 commit 45e835e
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 55 deletions.
67 changes: 57 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# QR share
# qrshare

[![PyPI version](https://badge.fury.io/py/qrshare.svg)](https://badge.fury.io/py/qrshare)
![PyPI](https://img.shields.io/pypi/v/qrshare)
![Python Version](https://img.shields.io/badge/Python-v3.6-blue)
![Repo Size](https://img.shields.io/github/repo-size/mHaisham/qrshare)
[![Contributors](https://img.shields.io/github/contributors/mHaisham/qrshare)](https://github.com/mHaisham/qrshare/graphs/contributors)
![Last Commit](https://img.shields.io/github/last-commit/mHaisham/qrshare/master)
![Issues](https://img.shields.io/github/issues/mHaisham/qrshare)
![Pull Requests](https://img.shields.io/github/issues-pr/mHaisham/qrshare)
[![License](https://img.shields.io/github/license/mHaisham/qrshare)](LICENSE)

Serve files or folders on local network with ease.

<p float="left" align="middle">
<img title="login screen" src="https://raw.githubusercontent.com/mHaisham/qrshare/master/.github/images/login.png" width="24%" />
Expand All @@ -9,8 +18,6 @@
<img title="qrcode screen" src="https://raw.githubusercontent.com/mHaisham/qrshare/master/.github/images/qr.png" width="24%" />
</p>

Serve a file on local network and give the url in qrcode form on console

For extra security provide a password `--password [password]`

## Install
Expand All @@ -19,8 +26,40 @@ For extra security provide a password `--password [password]`
pip install qrshare
```

### Termux

1. Install [Termux] from [Google Play].

2. Update packages: `apt update && apt upgrade`

3. Setup storage: `termux-setup-storage`

4. Install Python: `pkg install python`

5. Install qrshare: `pip install qrshare`

6. Use as described below in [Terminal].

[Termux]: https://termux.com/
[Google Play]: https://play.google.com/store/apps/details?id=com.termux&hl=en&gl=US
[Terminal]: https://github.com/mHaisham/qrshare#terminal

## Usage

### Terminal

Serve a specific directory or file

```bash
qrshare serve path/to/share
```

Serve the current directory

```bash
qrshare serve .
```

### Send to

> Windows only
Expand All @@ -41,11 +80,11 @@ Press `Windows` + `r` and enter `shell:sendto`
Create shortcut with command `qrshare serve` in folder

now option qrshare should appear when you right click to a file
now option qrshare should appear when you right click to a file or folder

### Commandline

> `qrshare --help`
#### `qrshare --help`

```bash
Usage: __main__.py [OPTIONS] COMMAND [ARGS]...
Expand All @@ -58,9 +97,13 @@ Commands:
serve serve given list paths as per given options
```

> `qrshare serve --help`
#### `qrshare serve --help`

```bash
Usage: __main__.py serve [OPTIONS] PATHS...

serve given list paths as per given options

Options:
-p, --password TEXT when provided every device require authentication
--port INTEGER waitress server port
Expand All @@ -69,9 +112,13 @@ Options:

- `password` is given preference over global password

> `qrshare config --help`
#### `qrshare config --help`

```bash
Usage: __main__.py config [OPTIONS]

change user configurations

Options:
-p, --password TEXT set a global password
--remove-password remove currently set global password
Expand All @@ -88,6 +135,6 @@ Options:
```python
from qrshare import App

app = App(paths)
app.serve(True)
app = App(paths, debug=True)
app.serve()
```
3 changes: 0 additions & 3 deletions qrshare/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ def zip_access_point(path):
if route is None:
return abort(404)

route.populate()

return route.zip()

if not self.app.debug:
Expand All @@ -165,7 +163,6 @@ def map(self, route):
if route.populate():
# add newly explored routes to map
for sub_route in route.sub_routes:
# make it english; remove the url specific encoding
path = sub_route.general_path(True).lstrip('/')
self.route_map[path] = sub_route

Expand Down
21 changes: 0 additions & 21 deletions qrshare/client/src/components/list/ComboGroup.svelte

This file was deleted.

1 change: 0 additions & 1 deletion qrshare/client/src/components/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export { default as ListTile } from "./ListTile.svelte";
export { default as SwitchListTile } from "./SwitchListTile.svelte";
export { default as ListGroup } from "./ListGroup.svelte";
export { default as SwitchGroup } from "./SwitchGroup.svelte";
export { default as ComboGroup } from "./ComboGroup.svelte";
export { default as ButtonGroup } from "./ButtonGroup.svelte";
6 changes: 3 additions & 3 deletions qrshare/client/src/helper/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ export function createSearchUrl({
const params = [];

// add query
if (query !== null && query !== undefined) {
if (query != null) {
params.push("query=" + query);
}

// add extensions
if (exts !== null && exts !== undefined) {
if (exts != null) {
// if the array has no values, return
if (!exts) return;

params.push("exts=" + exts.join(","));
}

// add types filtering
if (types !== null && types !== undefined) {
if (types != null) {
params.push("types=" + types.join(","));
}

Expand Down
3 changes: 1 addition & 2 deletions qrshare/client/src/pages/error/Error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import { delay, openSource } from "../../helper";
import { onMount } from "svelte";
/* global values are retrieved
these are values provided to html file in flask via jinja2 */
/* retrieve global values provided to html file from flask via jinja2 */
const code = errorCode;
const name = errorName;
const message = errorMessage;
Expand Down
17 changes: 11 additions & 6 deletions qrshare/client/src/pages/login/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
import { AppBar, BottomNavigationBar } from "../../components/navigation";
import { openSource } from "../../helper";
import { DoorClosed, Key, Github } from "../../module/icons";
import { requestJson } from "../../request";
import { request } from "../../request";
let msg = "";
let value;
function auth(e) {
async function auth(e) {
if (!value) {
msg = "This field is required";
return;
}
requestJson(`/login?key=${value}`, "POST").then((data) => {
const response = await request(`/login?key=${value}`, "POST");
/* when request redirects it wont return any response
this prevents from throwing an error when trying converting to json */
if (response) {
const data = await response.json();
msg = data ? data.msg : "The key does not match, try again.";
});
}
}
/** when input changes, clear the error */
Expand Down Expand Up @@ -53,7 +58,7 @@
on:change={change}
use:focus
/>
<div class="error">
<div class="error-message">
{msg}
</div>
<button class="button-primary">Submit</button>
Expand Down Expand Up @@ -106,7 +111,7 @@
width: 5rem;
}
.error {
.error-message {
color: var(--color-warning);
}
Expand Down
8 changes: 6 additions & 2 deletions qrshare/client/src/pages/main/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
const navs = [
{
/* its not checked for prior visit in home
since the routes options calls updateStore onMount which is basically a visit to home */
click: () => {
/* clicking on routes while being there serves as a reload */
updateStore($currentRoute.last);
Expand Down Expand Up @@ -108,3 +106,9 @@
>
<Router {routes} {options} init={false} />
</BaseApp>

<style>
:global(html) {
overflow-y: scroll;
}
</style>
18 changes: 11 additions & 7 deletions qrshare/client/src/pages/main/components/OrderSelector.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<script>
import { ComboGroup } from "../../../components/list";
import { SwitchGroup } from "../../../components/list";
import { isSorted } from "../store";
const options = ["Relevance", "None"];
let selected = options[0];
let selected = [true, false];
function toggle(e) {
const { option } = e.detail;
const { index } = e.detail;
/* clicked currently selected, skiiip */
if (option === selected) return;
if (selected[index]) return;
isSorted.set(options[0] === option);
selected = option;
/* invert selected */
selected = selected.map((v) => !v);
/* since there is only one options, it either is or isnt
and this code will only run it there is a change */
isSorted.flip();
}
</script>

<label for="order-by">Order by</label>
<ComboGroup {options} {selected} on:toggle={toggle} />
<SwitchGroup {options} {selected} on:toggle={toggle} />

0 comments on commit 45e835e

Please sign in to comment.