Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy #10

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const apiUrl = normalize(`https://api.unsplash.com/photos/random?client_id=${tok
// Welcome Message
if (firstRun()) {
clear();
config.set('proxy', false);
config.set('pic_dir', join(home, 'Pictures', 'splash_photos'));
log(`Hello ${chalk.bold(user.toString().capitalize())}, all photos are stored in ${chalk.yellow.underline(config.get('pic_dir'))}`);
log('');
Expand All @@ -61,8 +62,8 @@ const cli = meow(`

-u --user <username> ${chalk.gray('# Pick random image from selected user')}
-f --featured ${chalk.gray('# Pick random image from featured photos')}
-w --width <px> ${chalk.gray('# image width')}
-h --heigth <px> ${chalk.gray('# image height')}
-w --width <px> ${chalk.gray('# Image width')}
-h --heigth <px> ${chalk.gray('# Image height')}
-i --info ${chalk.gray('# Get EXIF infos and Photographer infos.')}

--collection <collection_ID> ${chalk.gray('# Filter by collection')}
Expand All @@ -77,7 +78,8 @@ const cli = meow(`
-u --update ${chalk.gray('# Update to latest version.')}
-c --clean ${chalk.gray('# Delete all downloaded photos.')}

--progress ${chalk.gray('# show progressbar during downloads')}
--offline <true|false> ${chalk.gray('# Set as true if you are under proxy')}
--progress ${chalk.gray('# Show progressbar during downloads')}
--restore ${chalk.gray('# Restore settings to default.')}
--set ${chalk.gray('# Set the saved photo [--save] as wallpaper.')}
--theme ${chalk.gray('# macOS Only! Set the dark theme if photo has low brightness')}
Expand Down Expand Up @@ -121,7 +123,7 @@ function sp(action, flags) {
} else if (flags.update) {
// UPDATE
isOnline().then(value => {
if (value) {
if (value || config.get('proxy')) {
updateCmd();
} else {
log('I need an internet connection!');
Expand All @@ -137,7 +139,7 @@ function sp(action, flags) {
} else if (flags.save) {
// SAVE ( --set )
isOnline().then(value => {
if (value) {
if (value || config.get('proxy')) {
saveCmd(flags);
} else {
log('I need an internet connection!');
Expand All @@ -147,7 +149,7 @@ function sp(action, flags) {
} else if (flags.id) {
// ID
isOnline().then(value => {
if (value) {
if (value || config.get('proxy')) {
idCmd(flags);
} else {
log('I need an internet connection!');
Expand All @@ -157,10 +159,14 @@ function sp(action, flags) {
} else if (flags.dir) {
// Dir
dirCmd(flags);
} else if (flags.offline) {
config.set('proxy', flags.offline);
console.log(`Proxy: ${config.get('proxy')}`);
} else {
// Splash Classic
isOnline().then(value => {
if (value) {
if (value || config.get('proxy')) {
console.log(config.get('proxy'));
let url = '';

if (flags.heigth && flags.width) {
Expand All @@ -180,6 +186,10 @@ function sp(action, flags) {
});
} else {
log(`${chalk.yellow('Splash:')} I need an internet connection!`);
console.log();
console.log(`Proxy Status: ${config.get('proxy')}`);
console.log();
console.log(`If you are under a ${chalk.bold('proxy')} server, check who '--offline' option is on true.`);
process.exit();
}
});
Expand Down
23 changes: 23 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Roadmap
This file is a roadmap for who wants imrove this repo.

Below you can see some **super cool** steps who this repo needs! :rabbit:

---
- [ ] Add support for proxed users (See [`proxy`](branch-proxy) branch and [#9](https://github.com/rawnly/splash-cli/issues/9))
- [ ] Review of all docs from someone who know how to write english better than me.
- [ ] Make _this module_ faster and easier
- [ ] Create a **multiplatform** desktop GUI application (See [autosplash](proj-autosplash), maybe could better without electron)
---


- [ ] I also need _someone_ to help me with the review of the **issues** and **pull requests**

---
<br>

So whatelse? **Pull requests** are always welcome!


[branch-proxy]: https://github.com/rawnly/splash-cli/tree/proxy
[proj-autosplash]: https://github.com/rawnly/autosplash
2 changes: 1 addition & 1 deletion options/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const log = console.log;
module.exports = () => {
const old = pkg.version;
const spin = new Ora({
text: 'Updating with...',
text: 'Updating...',
spinner: 'dots',
color: 'yellow'
});
Expand Down