Compare commits

...

8 Commits

11 changed files with 31 additions and 20 deletions

View File

@ -5,6 +5,10 @@ Cuizin is a tool wrapping around [Web Outside Of Browsers](http://weboob.org/)
to help you sort and organize recipes you find online. You can also manually
add new recipes.
![Homepage](screenshots/home.png)
More screenshots are available in the [`screenshots` folder](screenshots/).
## Installation
@ -33,7 +37,7 @@ WSGI to serve the application directly (`application` variable is exported in
You can customize the behavior of the app by passing environment variables:
* `CUIZIN_HOST` to set the host on which the webserver should listen to
(defaults to `localhost` only). Use `HOST=0.0.0.0` to make it
(defaults to `localhost` only). Use `CUIZIN_HOST=0.0.0.0` to make it
world-accessible.
* `CUIZIN_PORT` to set the port on which the webserver should listen. Defaults
to `8080`.

View File

@ -1,6 +1,14 @@
import * as constants from '@/constants';
function fetchAPI(endpoint, params = {}) {
return fetch(
`${constants.API_URL}${endpoint}`,
Object.assign({}, { credentials: 'same-origin' }, params),
);
}
function loadJSON(response) {
return response.json();
}
@ -16,9 +24,9 @@ function _postProcessRecipes(response) {
parsed.recipes = parsed.recipes.map(item => Object.assign(
item,
{
instructions: item.instructions.split(/[\r\n]\n/).map(
instructions: item.instructions ? item.instructions.split(/[\r\n]\n/).map(
line => line.trim(),
),
) : [],
},
));
}
@ -29,27 +37,25 @@ function _postProcessRecipes(response) {
export function loadRecipes() {
return fetch(`${constants.API_URL}api/v1/recipes`)
return fetchAPI('api/v1/recipes')
.then(_postProcessRecipes);
}
export function loadRecipe(id) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`)
return fetchAPI(`api/v1/recipe/${id}`)
.then(_postProcessRecipes);
}
export function refetchRecipe(id) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}/refetch`, {
method: 'GET',
})
return fetchAPI(`api/v1/recipe/${id}/refetch`)
.then(_postProcessRecipes);
}
export function postRecipeByUrl(recipe) {
return fetch(`${constants.API_URL}api/v1/recipes/by_url`, {
return fetchAPI('api/v1/recipes/by_url', {
method: 'POST',
body: JSON.stringify(recipe),
})
@ -58,7 +64,7 @@ export function postRecipeByUrl(recipe) {
export function postRecipeManually(recipe) {
return fetch(`${constants.API_URL}api/v1/recipes/manually`, {
return fetchAPI('api/v1/recipes/manually', {
method: 'POST',
body: JSON.stringify(recipe),
})
@ -67,7 +73,7 @@ export function postRecipeManually(recipe) {
export function editRecipe(id, recipe) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, {
return fetchAPI(`api/v1/recipe/${id}`, {
method: 'POST',
body: JSON.stringify(recipe),
})
@ -76,7 +82,7 @@ export function editRecipe(id, recipe) {
export function deleteRecipe(id) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, {
return fetchAPI(`api/v1/recipe/${id}`, {
method: 'DELETE',
});
}

View File

@ -1,6 +1,6 @@
<template>
<v-flex xs12>
<ErrorDialog :v-model="error" :description="$t('error.title')" />
<ErrorDialog v-model="error" :description="$t('error.title')" />
<h2 v-if="recipe">{{ $t('new.edit_recipe') }}</h2>
<h2 v-else>{{ $t('new.add_manually') }}</h2>

View File

@ -17,7 +17,7 @@
export default {
props: {
description: String,
value: [Error, Boolean],
value: Error,
},
computed: {
error: {

View File

@ -2,9 +2,9 @@
<v-container fluid grid-list-md>
<Loader v-if="isLoading"></Loader>
<v-layout row wrap v-else>
<ErrorDialog :v-model="error" :description="$t('error.unable_load_recipes')" />
<ErrorDialog v-model="error" :description="$t('error.unable_load_recipes')" />
<v-flex xs12 v-if="!recipes.length" class="text-xs-center">
<v-flex xs12 v-if="!error && !recipes.length" class="text-xs-center">
<p>{{ $t('home.onboarding') }}</p>
</v-flex>
<v-flex

View File

@ -2,9 +2,9 @@
<v-container grid-list-md class="panel">
<Loader v-if="isLoading"></Loader>
<v-layout row v-else>
<ErrorDialog :v-model="errorDelete" :description="$t('error.unable_delete_recipe')" />
<ErrorDialog :v-model="errorFetch" :description="$t('error.unable_fetch_recipe')" />
<ErrorDialog :v-model="errorRefetch" :description="$t('error.unable_refetch_recipe')" />
<ErrorDialog v-model="errorDelete" :description="$t('error.unable_delete_recipe')" />
<ErrorDialog v-model="errorFetch" :description="$t('error.unable_fetch_recipe')" />
<ErrorDialog v-model="errorRefetch" :description="$t('error.unable_refetch_recipe')" />
<v-dialog v-model="refetchConfirm" max-width="500px">
<v-card>

View File

@ -12,7 +12,8 @@ from weboob.core.ouiboube import WebNip
from cuizin import db
# List of backends with recipe abilities in Weboob
BACKENDS = ['750g', 'allrecipes', 'cuisineaz', 'marmiton', 'supertoinette']
BACKENDS = ['750g', 'allrecipes', 'cuisineaz', 'journaldesfemmes', 'marmiton',
'supertoinette']
def fetch_recipe(url, recipe=None):

BIN
screenshots/add_recipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
screenshots/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

BIN
screenshots/recipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 KiB