From c57088c6c325f0bf52d7b1a69d317ac22a3623d2 Mon Sep 17 00:00:00 2001 From: Mattia Succurro Date: Tue, 5 Nov 2019 17:03:58 +0100 Subject: [PATCH] Preparing for release --- CHANGELOG.md | 3 ++- app/__init__.py | 2 +- app/api.py | 11 ++++++++--- app/models.py | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31583dc..f2d98a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.7-dev +## 0.7.0 * Biggest change: unpacking modules. The single `app.py` file has become an `app` package, with submodules `models.py`, `utils.py`, `filters.py`, `website.py` and `ajax.py`. There is also a new module `api.py`. * Now `/about/` shows Python and Flask versions. @@ -12,6 +12,7 @@ * Corrected a bug into `pwdhash`: it accepted an argument, but pulled data from the form instead of processing it. Now it uses the argument. * Schema changes: added column `telegram` to `UserProfile` table. To update schema, execute the script `migrate_0_6_to_0_7.py` * Adding public API. Each of the API endpoints take a mandatory query string argument: the access token, generated by a separate endpoint at `/get_access_token` and stored into the client. All API routes start with `/api/V1`. Added endpoints `feed`, `create`, `profile_info`, `profile_feed` and `profile_search`. +* Planning to release mobile app for Android. ## 0.6.0 diff --git a/app/__init__.py b/app/__init__.py index ff78d41..fdab8d1 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -20,7 +20,7 @@ import datetime, time, re, os, sys, string, json, html from functools import wraps from flask_login import LoginManager -__version__ = '0.7-dev' +__version__ = '0.7.0' # we want to support Python 3 only. # Python 2 has too many caveats. diff --git a/app/api.py b/app/api.py index 0c9abd9..828ba65 100644 --- a/app/api.py +++ b/app/api.py @@ -1,7 +1,8 @@ from flask import Blueprint, jsonify, request import sys, datetime, re from functools import wraps -from .models import User, Message, Relationship +from .models import User, Message, Relationship, \ + MSGPRV_PUBLIC, MSGPRV_UNLISTED, MSGPRV_FRIENDS, MSGPRV_ONLYME from .utils import check_access_token, Visibility bp = Blueprint('api', __name__, url_prefix='/api/V1') @@ -108,6 +109,8 @@ def get_relationship_info(self, other): def profile_info(self, userid): if userid == 'self': user = self + elif userid.startswith('+'): + user = User.get(User.username == userid[1:]) elif userid.isdigit(): try: user = User[userid] @@ -135,6 +138,8 @@ def profile_info(self, userid): def profile_feed(self, userid): if userid == 'self': user = self + elif userid.startswith('+'): + user = User.get(User.username == userid[1:]) elif userid.isdigit(): user = User[userid] else: @@ -163,10 +168,10 @@ def profile_search(self): results = [] for result in query: profile = result.profile - result.append({ + results.append({ "id": result.id, "username": result.username, - "full_name": result.profile.full_name, + "full_name": profile.full_name, "followers_count": len(result.followers()) }) return { diff --git a/app/models.py b/app/models.py index d03ea39..9626890 100644 --- a/app/models.py +++ b/app/models.py @@ -149,7 +149,7 @@ class Message(BaseModel): # even if unlisted return not is_public_timeline elif privacy == MSGPRV_FRIENDS: - if cur_user is None: + if cur_user.is_anonymous: return False return user.is_following(cur_user) and cur_user.is_following(user) else: