Compare commits

..

No commits in common. "1f48689a32cec85a9d84108758504813f1bee569" and "04c5410c4119747818acea2d97607a2c45021def" have entirely different histories.

6 changed files with 11 additions and 26 deletions

@ -1 +1 @@
Subproject commit 056779f7d26746cf54e73156e0a3909ecf058298
Subproject commit fec09edb888013c5cb9c062d5cdb2220bc1a217d

View File

@ -2,7 +2,7 @@ FROM python:3.8-slim-buster
RUN apt-get update && apt-get upgrade
RUN pip3 install flask Flask-SQLAlchemy flask_migrate flask_login flask_wtf python-dotenv
RUN apt-get install gcc libpcre3 libpcre3-dev libmariadbclient-dev -y
RUN pip3 install uwsgi email-validator RandomWords ics
RUN pip3 install uwsgi email-validator RandomWords icalevents
RUN pip3 install google google-oauth google-auth-oauthlib google-api-python-client mysqlclient
COPY docker-entrypoint.sh /usr/local/bin/
EXPOSE 8084

View File

@ -50,7 +50,6 @@ class DeviceForm(FlaskForm):
class CalendarForm(FlaskForm):
iCalURL = StringField('New ical URL', validators=[DataRequired()])
calName = StringField('Calendar Name', validators=[DataRequired()])
submit = SubmitField('Add URL')
def validate_iCalURL (self, iCalURL):

View File

@ -122,22 +122,18 @@ def deleteAccount(user):
def fetchCalendarEvents(user, calendars, startDate, endDate):
service = None
if user.google_token is not None:
client_token = GC.build_credentials(user.google_token.token,
user.google_token.refresh_token)
credentials = google.oauth2.credentials.Credentials(**client_token)
client_token = GC.build_credentials(user.google_token.token,
user.google_token.refresh_token)
credentials = google.oauth2.credentials.Credentials(**client_token)
service = build(GC.API_SERVICE_NAME, GC.API_VERSION, credentials=credentials)
service = build(GC.API_SERVICE_NAME, GC.API_VERSION, credentials=credentials)
all_events = []
for calendar in calendars:
if (calendar.toggle == "True" and
calendar.calendar_type == "Google" and
service != None):
if calendar.toggle == "True" and calendar.calType == "Google":
event_result = service.events().list(calendarId=calendar.calendar_id,
timeMin=startDate.isoformat(),
timeMax=endDate.isoformat(),
timeMin=startDate,
timeMax=endDate,
maxResults=10,
singleEvents=True,
orderBy='startTime').execute()
@ -160,10 +156,7 @@ def fetchCalendarEvents(user, calendars, startDate, endDate):
all_events.append(newEvent)
if service != None:
colors = service.colors().get().execute()
else:
colors = None
colors = service.colors().get().execute()
return all_events, colors

View File

@ -17,7 +17,6 @@ from flask_login import (
from random_words import RandomWords
import requests
import backend.icalHandler as ical
import server.googleHandler as google
from server import login_manager, app, db
@ -107,9 +106,6 @@ def calendar():
# try to add the submitted ical as a calendar
print(form.iCalURL.data, flush=True)
ical.icalToCalendarDb(form.iCalURL.data, form.calName.data, current_user)
# otherwise it is a javascript POST
else:
calId = request.json.get('calendar_id')
@ -259,7 +255,6 @@ def downloader(device):
# TODO only pass along google calendars form user
startDate, endDate = backend.getTimeStamps()
events, colors = google.fetchCalendarEvents(request_user, request_user.calendars, startDate, endDate)
events.extend(ical.fetchCalendarEvents(request_user.calendars, startDate, endDate))
calendarjson = backend.generateJsonFromCalendarEntries(events, colors)
return jsonify(calendarjson)

View File

@ -36,8 +36,6 @@
<form action="" method="post">
<div class="container grey" style="margin-top: 3rem;">
<div>{{ form.hidden_tag() }}</div>
<div style="margin: 1rem">{{ form.calName.label }}</div>
<div style="margin: 1rem">{{ form.calName(size=24) }}</div>
<div style="margin: 1rem">{{ form.iCalURL.label }}</div>
<div style="margin: 1rem">{{ form.iCalURL(size=24) }}</div>
<div style="with: 8rem; margin: 1rem">{{ form.submit() }}</div>