-
Notifications
You must be signed in to change notification settings - Fork 15
starpi app #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ankur-dwivedi
wants to merge
4
commits into
master
Choose a base branch
from
IK-1916
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
starpi app #45
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,11 @@ | ||
| HOST=0.0.0.0 | ||
| PORT=1337 | ||
| APP_KEYS="toBeModified1,toBeModified2" | ||
| API_TOKEN_SALT=tobemodified | ||
| ADMIN_JWT_SECRET=tobemodified | ||
| TRANSFER_TOKEN_SALT=tobemodified | ||
| JWT_SECRET=tobemodified | ||
|
|
||
| PUBLIC_KEY = <YOUR_IMAGEKIT_PUBLIC_KEY> | ||
| URL_ENDPOINT = <YOUR_IMAGEKIT_URL_ENDPOINT> | ||
| PRIVATE_KEY = <YOUR_IMAGEKIT_PRIVATE_KEY> |
This file contains hidden or 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,131 @@ | ||
| ############################ | ||
| # OS X | ||
| ############################ | ||
|
|
||
| .DS_Store | ||
| .AppleDouble | ||
| .LSOverride | ||
| Icon | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ._* | ||
|
|
||
|
|
||
| ############################ | ||
| # Linux | ||
| ############################ | ||
|
|
||
| *~ | ||
|
|
||
|
|
||
| ############################ | ||
| # Windows | ||
| ############################ | ||
|
|
||
| Thumbs.db | ||
| ehthumbs.db | ||
| Desktop.ini | ||
| $RECYCLE.BIN/ | ||
| *.cab | ||
| *.msi | ||
| *.msm | ||
| *.msp | ||
|
|
||
|
|
||
| ############################ | ||
| # Packages | ||
| ############################ | ||
|
|
||
| *.7z | ||
| *.csv | ||
| *.dat | ||
| *.dmg | ||
| *.gz | ||
| *.iso | ||
| *.jar | ||
| *.rar | ||
| *.tar | ||
| *.zip | ||
| *.com | ||
| *.class | ||
| *.dll | ||
| *.exe | ||
| *.o | ||
| *.seed | ||
| *.so | ||
| *.swo | ||
| *.swp | ||
| *.swn | ||
| *.swm | ||
| *.out | ||
| *.pid | ||
|
|
||
|
|
||
| ############################ | ||
| # Logs and databases | ||
| ############################ | ||
|
|
||
| .tmp | ||
| *.log | ||
| *.sql | ||
| *.sqlite | ||
| *.sqlite3 | ||
|
|
||
|
|
||
| ############################ | ||
| # Misc. | ||
| ############################ | ||
|
|
||
| *# | ||
| ssl | ||
| .idea | ||
| nbproject | ||
| public/uploads/* | ||
| !public/uploads/.gitkeep | ||
| .tsbuildinfo | ||
| .eslintcache | ||
|
|
||
| ############################ | ||
| # Node.js | ||
| ############################ | ||
|
|
||
| lib-cov | ||
| lcov.info | ||
| pids | ||
| logs | ||
| results | ||
| node_modules | ||
| .node_history | ||
|
|
||
| ############################ | ||
| # Package managers | ||
| ############################ | ||
|
|
||
| .yarn/* | ||
| !.yarn/cache | ||
| !.yarn/unplugged | ||
| !.yarn/patches | ||
| !.yarn/releases | ||
| !.yarn/sdks | ||
| !.yarn/versions | ||
| .pnp.* | ||
| yarn-error.log | ||
|
|
||
| ############################ | ||
| # Tests | ||
| ############################ | ||
|
|
||
| coverage | ||
|
|
||
| ############################ | ||
| # Strapi | ||
| ############################ | ||
|
|
||
| .env | ||
| license.txt | ||
| exports | ||
| .strapi | ||
| dist | ||
| build | ||
| .strapi-updater.json | ||
| .strapi-cloud.json |
This file contains hidden or 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,150 @@ | ||
|
|
||
| # How to run locally | ||
|
|
||
| This project is developed using node version 18. | ||
|
|
||
| ## Setup environment variables | ||
|
|
||
| Create a `.env`, file and add below parameters: | ||
|
|
||
| ```js | ||
| # Server | ||
| HOST=0.0.0.0 | ||
| PORT=1337 | ||
|
|
||
| # Secrets | ||
| APP_KEYS="toBeModified1,toBeModified2" | ||
| API_TOKEN_SALT=tobemodified | ||
| ADMIN_JWT_SECRET=tobemodified | ||
| TRANSFER_TOKEN_SALT=tobemodified | ||
|
|
||
| # Database | ||
| DATABASE_CLIENT=sqlite | ||
| DATABASE_HOST= | ||
| DATABASE_PORT= | ||
| DATABASE_NAME= | ||
| DATABASE_USERNAME= | ||
| DATABASE_PASSWORD= | ||
| DATABASE_SSL=false | ||
| DATABASE_FILENAME=.tmp/data.db | ||
| JWT_SECRET=tobemodified | ||
|
|
||
| PUBLIC_KEY = <YOUR_IMAGEKIT_PUBLIC_KEY> | ||
| URL_ENDPOINT = <YOUR_IMAGEKIT_URL_ENDPOINT> | ||
| PRIVATE_KEY = <YOUR_IMAGEKIT_PRIVATE_KEY> | ||
| ``` | ||
|
|
||
| You can get the value of [URL_ENDPOINT](https://imagekit.io/dashboard/url-endpoints) from your ImageKit dashboard. | ||
| `PUBLIC_KEY` and `PRIVATE_KEY` can be obtained from the [developer](https://imagekit.io/dashboard/developer/api-keys) section in your ImageKit dashboard. | ||
|
|
||
|
|
||
| ### Install packages: | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| ### Run the app | ||
|
|
||
| ``` | ||
| npm run develop | ||
| ``` | ||
|
|
||
| The app will run at `http://localhost:1337/admin`, and it will ask you to register as the first local administrator. Once done, You now have access to the admin panel. | ||
|
|
||
| ## Configuration | ||
|
|
||
| To make our provider work, we need to add a configuration in the `./config/plugins.js` file. The configuration should include the following parameters, as described below. | ||
|
|
||
| - `provider`: Specifies the name of the provider. | ||
| - `providerOptions`: Contains the options required to configure the provider. | ||
| * `urlEndpoint`: A required parameter that can be obtained from the [URL-endpoint section](https://imagekit.io/dashboard/url-endpoints) or the [developer section](https://imagekit.io/dashboard/developer/api-keys) on your ImageKit dashboard. | ||
| * `publicKey` and `privateKey`: Required parameters that can be retrieved from the [developer section](https://imagekit.io/dashboard/developer/api-keys) on your ImageKit dashboard. | ||
| * `uploadOptions` is an optional parameter that accepts upload parameters supported by the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload). The following parameters are supported by the provider: `folder`, `useUniqueFileName`, `tags`, `checks`, `isPrivateFile`, `customCoordinates`, `webhookUrl`, `extensions`, `transformation`, and `customMetadata`. | ||
|
|
||
| For more information about using a provider, refer to the [documentation about using a provider](https://docs.strapi.io/dev-docs/providers). To understand how environment variables are used in Strapi, please refer to the [documentation about environment variables](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/environment). | ||
|
|
||
| ### Provider Configuration | ||
|
|
||
| Below is an example of how to configure the provider in `./config/plugins.js`. | ||
|
|
||
| ```js | ||
| module.exports = ({ env }) => ({ | ||
| // ... | ||
| upload: { | ||
| config: { | ||
| provider: "strapi-provider-upload-imagekitio", | ||
| providerOptions: { | ||
| publicKey: env("PUBLIC_KEY"), | ||
| privateKey: env("PRIVATE_KEY"), | ||
| urlEndpoint: env("URL_ENDPOINT"), | ||
|
|
||
| // Optional | ||
| uploadOptions: { | ||
| folder: "/path", | ||
| useUniqueFileName: true, | ||
| tags: ["tag1", "tag2"], | ||
| checks: `"file.size" < "1mb"`, | ||
| isPrivateFile: false, | ||
| customCoordinates: "1,2,3,4", | ||
| webhookUrl: "https://testwebook.com", | ||
| extensions: [ | ||
| { | ||
| name: "google-auto-tagging", | ||
| maxTags: 5, | ||
| minConfidence: 95, | ||
| }, | ||
| ], | ||
| transformation: { | ||
| pre: "l-text,i-Imagekit,fs-50,l-end", | ||
| post: [ | ||
| { | ||
| type: "transformation", | ||
| value: "l-text,i-Imagekit,fs-50,l-end", | ||
| }, | ||
| ], | ||
| }, | ||
| customMetadata: { test: "value" }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| // ... | ||
| }); | ||
| ``` | ||
|
|
||
| **Note**: Ensure that the custom metadata `test` is already created in the [Media Library Settings](https://imagekit.io/dashboard/settings/media-library). | ||
|
|
||
| ### Security Middleware Configuration | ||
|
|
||
| The default settings in Strapi's Security Middleware require modifications to the `contentSecurityPolicy` settings to ensure thumbnail previews are visible in the Media Library. Replace the `strapi::security` string with the object provided below, as detailed in the [middleware configuration documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#loading-order). | ||
|
|
||
| `./config/middlewares.js` | ||
|
|
||
| ```js | ||
| module.exports = [ | ||
| // ... | ||
| { | ||
| name: 'strapi::security', | ||
| config: { | ||
| contentSecurityPolicy: { | ||
| useDefaults: true, | ||
| directives: { | ||
| 'connect-src': ["'self'", 'https:'], | ||
| 'img-src': ["'self'", 'data:', 'blob:', 'ik.imagekit.io'], | ||
| 'media-src': ["'self'", 'data:', 'blob:', 'ik.imagekit.io'], | ||
| upgradeInsecureRequests: null, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| // ... | ||
| ]; | ||
| ``` | ||
|
|
||
| # Useful links | ||
| * ImageKit Strapi provider quickstart guide - https://imagekit.io/docs/integration/strapi | ||
| * ImageKit Strapi provider and documentation - https://github.com/imagekit-developer/strapi-provider-upload-imagekitio | ||
|
|
||
| # Report a bug | ||
| If something doesn't work as expected, report a bug at [email protected]. |
This file contains hidden or 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 @@ | ||
| export default ({ env }) => ({ | ||
| auth: { | ||
| secret: env('ADMIN_JWT_SECRET'), | ||
| }, | ||
| apiToken: { | ||
| salt: env('API_TOKEN_SALT'), | ||
| }, | ||
| transfer: { | ||
| token: { | ||
| salt: env('TRANSFER_TOKEN_SALT'), | ||
| }, | ||
| }, | ||
| flags: { | ||
| nps: env.bool('FLAG_NPS', true), | ||
| promoteEE: env.bool('FLAG_PROMOTE_EE', true), | ||
| }, | ||
| }); |
This file contains hidden or 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,7 @@ | ||
| export default { | ||
| rest: { | ||
| defaultLimit: 25, | ||
| maxLimit: 100, | ||
| withCount: true, | ||
| }, | ||
| }; |
This file contains hidden or 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,60 @@ | ||
| import path from 'path'; | ||
|
|
||
| export default ({ env }) => { | ||
| const client = env('DATABASE_CLIENT', 'sqlite'); | ||
|
|
||
| const connections = { | ||
| mysql: { | ||
| connection: { | ||
| host: env('DATABASE_HOST', 'localhost'), | ||
| port: env.int('DATABASE_PORT', 3306), | ||
| database: env('DATABASE_NAME', 'strapi'), | ||
| user: env('DATABASE_USERNAME', 'strapi'), | ||
| password: env('DATABASE_PASSWORD', 'strapi'), | ||
| ssl: env.bool('DATABASE_SSL', false) && { | ||
| key: env('DATABASE_SSL_KEY', undefined), | ||
| cert: env('DATABASE_SSL_CERT', undefined), | ||
| ca: env('DATABASE_SSL_CA', undefined), | ||
| capath: env('DATABASE_SSL_CAPATH', undefined), | ||
| cipher: env('DATABASE_SSL_CIPHER', undefined), | ||
| rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true), | ||
| }, | ||
| }, | ||
| pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) }, | ||
| }, | ||
| postgres: { | ||
| connection: { | ||
| connectionString: env('DATABASE_URL'), | ||
| host: env('DATABASE_HOST', 'localhost'), | ||
| port: env.int('DATABASE_PORT', 5432), | ||
| database: env('DATABASE_NAME', 'strapi'), | ||
| user: env('DATABASE_USERNAME', 'strapi'), | ||
| password: env('DATABASE_PASSWORD', 'strapi'), | ||
| ssl: env.bool('DATABASE_SSL', false) && { | ||
| key: env('DATABASE_SSL_KEY', undefined), | ||
| cert: env('DATABASE_SSL_CERT', undefined), | ||
| ca: env('DATABASE_SSL_CA', undefined), | ||
| capath: env('DATABASE_SSL_CAPATH', undefined), | ||
| cipher: env('DATABASE_SSL_CIPHER', undefined), | ||
| rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true), | ||
| }, | ||
| schema: env('DATABASE_SCHEMA', 'public'), | ||
| }, | ||
| pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) }, | ||
| }, | ||
| sqlite: { | ||
| connection: { | ||
| filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')), | ||
| }, | ||
| useNullAsDefault: true, | ||
| }, | ||
| }; | ||
|
|
||
| return { | ||
| connection: { | ||
| client, | ||
| ...connections[client], | ||
| acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000), | ||
| }, | ||
| }; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to match https://github.com/imagekit-samples/quickstart/tree/master/android
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done