Preparing for release
This commit is contained in:
parent
7ede351b11
commit
c57088c6c3
4 changed files with 12 additions and 6 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
11
app/api.py
11
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 {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue