-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,641 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
VUE_APP_CLIENT_API_URL=http://127.0.0.1:8080 | ||
VUE_APP_SHOW_LOGIN=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "inciteful-xyz" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Inciteful-Web-CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
firebase_deploy: | ||
name: Building... | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Deploy to Firebase | ||
uses: w9jds/firebase-action@master | ||
with: | ||
args: deploy --only hosting | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | ||
PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,8 @@ pnpm-debug.log* | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# firebase | ||
firestore-*.log | ||
ui-*.log | ||
/firebase-backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"firestore": { | ||
"rules": "firestore.rules", | ||
"indexes": "firestore.indexes.json" | ||
}, | ||
"emulators": { | ||
"firestore": { | ||
"port": 8079 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
}, | ||
"auth": { | ||
"port": 9099 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"indexes": [], | ||
"fieldOverrides": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
rules_version = '2'; | ||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /users/{userId} { | ||
allow read, update, delete: if request.auth != null && request.auth.uid == userId; | ||
allow create: if request.auth != null; | ||
} | ||
match /paperCollections/{collectionId} { | ||
allow read: if request.auth.uid == resource.data.ownerId || resource.data.visibility == "PUBLIC"; | ||
allow update, delete: if request.auth != null && request.auth.uid == resource.data.ownerId; | ||
allow create: if request.auth != null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
import { defineStore } from 'pinia' | ||
import { collection, setDoc, addDoc, doc, query, where, onSnapshot } from 'firebase/firestore'; | ||
import { usersCol, paperCollectionsCol } from '@/plugins/firebase' | ||
import { PaperCollection, User } from '../types/user'; | ||
|
||
export const useDBStore = defineStore({ | ||
id: 'firestoreDB', | ||
state: () => { | ||
return { | ||
paperCollections: [] as PaperCollection[], | ||
user: undefined as User | undefined, | ||
db: { | ||
users: usersCol, | ||
paperCollections: paperCollectionsCol | ||
} | ||
} | ||
}, | ||
actions: { | ||
async savePaperCollection(paperCollection: PaperCollection) { | ||
await addDoc(this.db.paperCollections, paperCollection) | ||
}, | ||
async saveUser(user: User) { | ||
await setDoc(doc(this.db.users, user.id), user) | ||
}, | ||
async bind(userId: string | undefined) { | ||
console.log("binding " + userId) | ||
const q = query(paperCollectionsCol, where("ownerId", "==", userId)); | ||
|
||
onSnapshot(q, (querySnapshot) => { | ||
this.paperCollections = [] | ||
querySnapshot.forEach((doc) => { | ||
this.paperCollections.push(doc.data()); | ||
}); | ||
|
||
console.log("Current collections: ", JSON.stringify(this.paperCollections)); | ||
|
||
return this.paperCollections | ||
}); | ||
|
||
onSnapshot(doc(usersCol, userId), (doc) => { | ||
this.user = doc.data() | ||
console.log("Current data: ", doc.data()); | ||
}); | ||
} | ||
}, | ||
getters: { | ||
|
||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { PaperID } from "./inciteful"; | ||
|
||
export interface User { | ||
id: string, | ||
zoteroToken: ZoteroToken | null, | ||
} | ||
|
||
enum ItemVisibility { | ||
Hidden = "HIDDEN", | ||
Public = "PUBLIC", | ||
} | ||
|
||
export interface ZoteroToken { | ||
oauthToken: string, | ||
oauthTokenSecret: string, | ||
username: string | undefined, | ||
userId: string | undefined | ||
} | ||
|
||
export interface PaperCollection { | ||
id: string, | ||
ownerId: string, | ||
parentID: string | null, | ||
visibility: ItemVisibility, | ||
name: string, | ||
papers: CollectionPaper[] | ||
zoteroKey: string | null, | ||
} | ||
|
||
export interface CollectionPaper { | ||
paperId: PaperID | ||
zoteroKey: string | null | ||
} |
Oops, something went wrong.