Skip to content

Commit

Permalink
Merge branch 'notification-support' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBroughton committed Nov 24, 2023
2 parents 0d2cdaa + 17fe912 commit 88e0c71
Show file tree
Hide file tree
Showing 34 changed files with 2,048 additions and 1,525 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-pugs-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"forager": patch
---

Fix overflow issue when too many forables available in popup
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

25 changes: 21 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [{ "mode": "auto" }],
"eslint.validate": [
"javascript",
"typescript",
"vue"
],
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true,
"eslint.format.enable": true,
"editor.formatOnSave": true,
},
Expand All @@ -23,6 +25,21 @@
"marker-details",
"login-page",
"stores",
"error-handling"
]
}
"error-handling",
"notifications"
],


// Silent the stylistic rules in you IDE, but still auto fix them
// "eslint.rules.customizations": [
// { "rule": "style/*", "severity": "off" },
// { "rule": "*-indent", "severity": "off" },
// { "rule": "*-spacing", "severity": "off" },
// { "rule": "*-spaces", "severity": "off" },
// { "rule": "*-order", "severity": "off" },
// { "rule": "*-dangle", "severity": "off" },
// { "rule": "*-newline", "severity": "off" },
// { "rule": "*quotes", "severity": "off" },
// { "rule": "*semi", "severity": "off" }
// ],
}
113 changes: 2 additions & 111 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,115 +31,6 @@ All pinned locations are stored via [Pocketbase](https://github.com/pocketbase/p
injury that may occur, be it through the act of foraging, consuming
foraged foods, or any other activity.

## Screenshots
## Documentation

### Add Markers

<img src="screenshots/mobile_create_marker.png" alt="drawing" width="300"/>

<br/>

### Alternative Add Markers

<img src="screenshots/mobile_alt_create_marker.png" alt="drawing" width="300"/>

<br/>

### Settings Menu

<img src="screenshots/settings_menu.png" alt="drawing" width="300"/>

<br/>

### Images Menu

<img src="screenshots/image_menu.png" alt="drawing" width="300"/>

<br/>

## Installation

### Prebuilt Binary Installation

You can install Forager with the provided binaries available on the [releases](https://github.com/CRBroughton/Forager/releases) page.

This binary will provide both the back-end and front-end of the application.

For deployment of the application, see [Pocketbases Going to Production documentation](https://pocketbase.io/docs/going-to-production/).

### Docker

The Forager repository includes a `docker-compose.yml` file, enabling
quick deployment of Forager. Simply install Docker, clone the repository
and then run `docker compose up -d`.

## Manual Installation

Regardless of manual installation method, you will require the following to build Forager:

- npm
- pnpm
- go 1.20+ (this is version Forager is built against)
- [taskfile](https://taskfile.dev/) - Automates the build process

Forager can then be installed via the following methods:

### Single binary installation

Following Pocketbase's philosophy, Forager can be installed as a single binary,
which will include all of the application (minus the database, which is generated on first start-up).

To install Forager using this method, perform the following actions:

- Clone this repository
- `cd` into the repository and run `pnpm i`
- Run `task linux64` to build the linux64 binary; Check out the
taskfile.yml file for various architectures, or to create all, simply
run `task build`.

### Separated installation

You can install Forager using a more traditional setup, with the compiled front-end
assets served through a reverse-proxy like NGINX, and a hosted instance of [Pocketbase](https://github.com/pocketbase/pocketbase).

You can deploy the built front-end via Netlify, or any other deployment option
that supports static pages.

You can utilise Pocketbase via a domain you own; Check [Pocketbases Going to Production documentation](https://pocketbase.io/docs/going-to-production/).

### Development

Development of Forager requires:

- An active Mapbox account and API key
- A Pocketbase server
- All of the previously mentioned software requirements

Dependant on your operating system's architecture, download the latest release of
[Pocketbase](https://github.com/pocketbase/pocketbase) and extract the executable
into the db folder. When running `pnpm run pocketbase:serve` for the first time,
the database migrations will ensure the correct tables are created.

If you wish to seed the database with a test user, one is provided
if you run `pnpm run pocketbase:seed` - You will need to update this
users password and Mapbox API key.

## Progressive Web Application (PWA)

Forager is a Progressive Web Application (PWA), and therefore can be installed via any browser, however requires an active connection to your [Pocketbase](https://github.com/pocketbase/pocketbase) instance.

## FAQ

### Do you provide an official Forager instance?

I do not currently run an official instance of Forager. If there is a demand for this,
it could happen though.

### Where is the old version of Forager?

The previous version of Forager was an entirely offline application,
however this version lacked in features and was
somewhat buggy, therefor has been replaced with this version.

If you are interested in this version, checkout the master branch and checkout
the last commit from 2021.
For Forager documentation, see https://forager.crbroughton.me
6 changes: 5 additions & 1 deletion auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ declare global {
const h: typeof import('vue')['h']
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
const inject: typeof import('vue')['inject']
const injectLocal: typeof import('@vueuse/core')['injectLocal']
const isDefined: typeof import('@vueuse/core')['isDefined']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
Expand Down Expand Up @@ -82,6 +83,7 @@ declare global {
const onUpdated: typeof import('vue')['onUpdated']
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
const provide: typeof import('vue')['provide']
const provideLocal: typeof import('@vueuse/core')['provideLocal']
const reactify: typeof import('@vueuse/core')['reactify']
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
const reactive: typeof import('vue')['reactive']
Expand Down Expand Up @@ -150,6 +152,7 @@ declare global {
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
const useCached: typeof import('@vueuse/core')['useCached']
const useClipboard: typeof import('@vueuse/core')['useClipboard']
const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems']
const useCloned: typeof import('@vueuse/core')['useCloned']
const useColorMode: typeof import('@vueuse/core')['useColorMode']
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
Expand Down Expand Up @@ -304,5 +307,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
86 changes: 86 additions & 0 deletions db/migrations/1700679794_notifications_table.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package migrations

import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/models/schema"
"github.com/pocketbase/pocketbase/tools/types"
)

func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db)

ownerOnly := types.Pointer("@request.auth.id != '' && owner.id ?= @request.auth.id")
usersCollection, err := dao.FindCollectionByNameOrId("users")
if err != nil {
return err
}

collection := &models.Collection{
Name: "notifications",
Type: models.CollectionTypeBase,
ListRule: ownerOnly,
ViewRule: ownerOnly,
CreateRule: types.Pointer(""),
UpdateRule: ownerOnly,
DeleteRule: ownerOnly,
System: false,
Schema: schema.NewSchema(
&schema.SchemaField{
Name: "owner",
Type: schema.FieldTypeRelation,
Required: true,
System: false,
Options: &schema.RelationOptions{
CollectionId: usersCollection.Id,
CascadeDelete: false,
MinSelect: types.Pointer(1),
MaxSelect: types.Pointer(1),
},
},
&schema.SchemaField{
Name: "type",
Type: schema.FieldTypeText,
Required: true,
System: false,
},
&schema.SchemaField{
Name: "title",
Type: schema.FieldTypeText,
Required: true,
System: false,
},
&schema.SchemaField{
Name: "body",
Type: schema.FieldTypeText,
Required: true,
System: false,
},
),
}

err = dao.SaveCollection(collection)
if err != nil {
return err
}

return nil
}, func(db dbx.Builder) error {
dao := daos.New(db)

collection, err := dao.FindCollectionByNameOrId("notifications")
if err != nil {
return err
}

err = dao.DeleteCollection(collection)
if err != nil {
return err
}

return nil
})
}
15 changes: 15 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import antfu from '@antfu/eslint-config'

export default await antfu({
ignores: ['dist', '**/dist/**', 'public', '**/public/**', 'coverage', '**/coverage/**', 'node_modules', '**/node_modules/**'],
rules: {
'no-console': 'error',
'no-restricted-syntax': [
'error',
'TSEnumDeclaration',
'ClassDeclaration',
'Decorator',
'TSAnyKeyword',
],
},
})
37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "forager",
"version": "2.1.1",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build",
Expand All @@ -21,31 +22,31 @@
"changeset:version": "npx changeset version"
},
"dependencies": {
"@vueuse/core": "10.4.1",
"@vueuse/core": "10.6.1",
"mapbox-gl": "^2.15.0",
"pinia": "^2.1.6",
"pinia": "^2.1.7",
"pocketbase": "^0.18.0",
"tippy.js": "^6.3.7",
"vue": "3.3.4"
"vue": "3.3.8"
},
"devDependencies": {
"@antfu/eslint-config": "0.43.0",
"@antfu/eslint-config": "^2.1.0",
"@changesets/cli": "^2.26.2",
"@types/geojson": "^7946.0.10",
"@types/mapbox-gl": "^2.7.14",
"@types/node": "^20.6.2",
"@vitejs/plugin-vue": "4.3.4",
"autoprefixer": "10.4.15",
"eslint": "8.49.0",
"pocketbase-typegen": "^1.1.13",
"postcss": "8.4.30",
"sass": "1.67.0",
"tailwindcss": "3.3.3",
"@types/geojson": "^7946.0.13",
"@types/mapbox-gl": "^2.7.19",
"@types/node": "^20.9.4",
"@vitejs/plugin-vue": "4.5.0",
"autoprefixer": "10.4.16",
"eslint": "8.54.0",
"pocketbase-typegen": "^1.2.1",
"postcss": "8.4.31",
"sass": "1.69.5",
"tailwindcss": "3.3.5",
"typescript": "5.2.2",
"unplugin-auto-import": "0.16.6",
"unplugin-auto-import": "0.16.7",
"unplugin-vue-components": "0.25.2",
"vite": "4.4.9",
"vite-plugin-pwa": "^0.16.5",
"vue-tsc": "1.8.11"
"vite": "5.0.2",
"vite-plugin-pwa": "^0.17.0",
"vue-tsc": "1.8.22"
}
}
Loading

0 comments on commit 88e0c71

Please sign in to comment.