Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Athou committed Apr 25, 2023
2 parents 55741c6 + 4f625d8 commit bd33369
Show file tree
Hide file tree
Showing 415 changed files with 49,520 additions and 13,724 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore everything
*

# allow only what we need
!commafeed-server/target/commafeed.jar
!commafeed-server/config.yml.example
60 changes: 44 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
name: Java CI

on: [push]
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ["8", "11", "17"]

steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: "temurin"
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ "8", "11", "17" ]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: "temurin"
cache: "maven"

- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify

- uses: actions/upload-artifact@v3
if: ${{ matrix.java == '8' }}
with:
name: commafeed.jar
path: commafeed-server/target/commafeed.jar

# Docker
- name: Login to Container Registry
if: ${{ github.ref_type == 'tag' && matrix.java == '8' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.ref_type == 'tag' && matrix.java == '8' }}
tags: |
athou/commafeed:latest
athou/commafeed:${{ github.ref_name }}
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v 3.0.0
- complete overhaul of the UI
- backend and frontend are now in separate maven modules
- no changes to the api or the database

v 2.6.0
- add support for media content as a backup for missing content (useful for youtube feeds)
- correctly follow http error code 308 redirects
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openjdk:17-alpine

RUN mkdir -p /commafeed/data
VOLUME /commafeed/data

ENV CF_SESSION_PATH=/commafeed/data/sessions

COPY commafeed-server/target/commafeed.jar .
COPY commafeed-server/config.yml.example config.yml

EXPOSE 8082
CMD ["java", "-Djava.net.preferIPv4Stack=true", "-jar", "commafeed.jar", "server", "config.yml"]
78 changes: 38 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CommaFeed [![Build Status](https://travis-ci.org/Athou/commafeed.svg?branch=master)](https://travis-ci.org/Athou/commafeed)
# CommaFeed

Sources for [CommaFeed.com](http://www.commafeed.com/).

Expand All @@ -7,17 +7,20 @@ CommaFeed is now considered feature-complete and is in maintenance mode.

## Related open-source projects

Android apps: [News+ extension](https://github.com/Athou/commafeed-newsplus)
Browser extensions:

Browser extensions: [Chrome](https://github.com/Athou/commafeed-chrome) - [Firefox](https://github.com/Athou/commafeed-firefox) - [Opera](https://github.com/Athou/commafeed-opera) - [Safari](https://github.com/Athou/commafeed-safari)
- [Chrome](https://github.com/Athou/commafeed-chrome)
- [Firefox](https://github.com/Athou/commafeed-firefox)
- [Opera](https://github.com/Athou/commafeed-opera)
- [Safari](https://github.com/Athou/commafeed-safari)

## Deployment on your own server

### The very short version (download precompiled package)

mkdir commafeed && cd commafeed
wget https://github.com/Athou/commafeed/releases/download/2.6.0/commafeed.jar
wget https://raw.githubusercontent.com/Athou/commafeed/2.6.0/config.yml.example -O config.yml
wget https://github.com/Athou/commafeed/releases/download/3.0.0/commafeed.jar
wget https://raw.githubusercontent.com/Athou/commafeed/3.0.0/commafeed-server/config.yml.example -O config.yml
vi config.yml
java -Djava.net.preferIPv4Stack=true -jar commafeed.jar server config.yml

Expand All @@ -26,9 +29,9 @@ Browser extensions: [Chrome](https://github.com/Athou/commafeed-chrome) - [Firef
git clone https://github.com/Athou/commafeed.git
cd commafeed
./mvnw clean package
cp config.yml.example config.yml
cp commafeed-server/config.yml.example config.yml
vi config.yml
java -Djava.net.preferIPv4Stack=true -jar target/commafeed.jar server config.yml
java -Djava.net.preferIPv4Stack=true -jar commafeed-server/target/commafeed.jar server config.yml

### The long version (same as the short version, but more detailed)

Expand All @@ -39,6 +42,9 @@ You also need the Java 1.8+ JDK in order to build the application.

To install the required packages to build CommaFeed on Ubuntu, issue the following commands

# if this commands works and returns a version >= 1.8.0 you're good to go and you can skip JDK installation
javac -version

# if openjdk-8-jdk is not available on your ubuntu version (14.04 LTS), add the following repo first
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
Expand All @@ -58,56 +64,48 @@ Now build the application

./mvnw clean package

Copy `config.yml.example` to `config.yml` then edit the file to your liking.
Copy `commafeed-server/config.yml.example` to `./config.yml` then edit the file to your liking.
Issue the following command to run the app, the server will listen by default on `http://localhost:8082`. The default user is `admin` and the default password is `admin`.

java -Djava.net.preferIPv4Stack=true -jar target/commafeed.jar server config.yml
java -Djava.net.preferIPv4Stack=true -jar commafeed-server/target/commafeed.jar server config.yml

You can use a proxy http server such as nginx or apache.

## Translate CommaFeed into your language

Files for internationalization are located [here](https://github.com/Athou/commafeed/tree/master/src/main/app/i18n).
Files for internationalization are located [here](https://github.com/Athou/commafeed/tree/master/commafeed-client/src/locales).

To add a new language, create a new file in that directory.
The name of the file should be the two-letters [ISO-639-1 language code](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
The language has to be referenced in the `src/main/app/js/i18n.js` file to be picked up.
To add a new language:

## Themes
- edit `commafeed-client/src/i18n.ts`
- add the new locale to the `locales` array.
- import the dayjs locale
- edit `commafeed-client/.linguirc` and add the new locale to the `locales` array.
- run `npm run i18n` and add translations to the newly created `commafeed-client/src/locales/[locale]/messages.po` file

To create a theme, create a new file `src/main/app/sass/themes/_<theme>.scss`. Your styles should be wrapped in a `#theme-<theme>` element and use the [SCSS format](http://sass-lang.com/) which is a superset of CSS.
The name of the locale should be the two-letters [ISO-639-1 language code](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

Don't forget to reference your theme in `src/main/app/sass/app.scss` and in `src/main/app/js/controllers.js` (look for `$scope.themes`).
## Local development

See [\_test.scss](https://github.com/Athou/commafeed/blob/master/src/main/app/sass/themes/_test.scss) for an example.
- `git clone https://github.com/Athou/CommaFeed`

## Local development
### Backend

- Open `commafeed-server` in your preferred Java IDE.
- CommaFeed uses Lombok, you need the Lombok plugin for your IDE.
- If using Eclipse, Go to Window → Preferences → Maven → Annotation Processing and check "Automatically configure JDT APT"
- Start `CommaFeedApplication.java` in debug mode with `server config.dev.yml` as arguments

### Frontend

Steps to configuring a development environment for CommaFeed may include, but may not be limited to:

1. `git clone https://github.com/Athou/CommaFeed` into some folder to get the project files.
2. Install Eclipse Luna (or latest) from http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/lunasr1 or your repo if available.
3. In Eclipse, Window → Preferences → Maven → Annotation Processing. Check "Automatically configure JDT APT"
- You may have to install the m2e-apt connector to have "Annotation Processing" as an option. Do so from Window → Preferences → Maven → Discovery → Open Catalog → type "m2e-apt" in the search box
- If you have installed Eclipse EE instead of Luna, you may have trouble installing m2e-apt
4. Install Lombok into Eclipse from http://projectlombok.org/download.html
- You may have to run `java -jar lombok.jar` as an administrator if your eclipse installation is not in your home folder
5. In Eclipse, File → Import → Maven → Existing Maven Projects. Navigate to where you cloned the CommaFeed files into, and select that as the root directory. Click Finish.
- You may notice some errors along the lines of "Plugin execution not covered by lifecycle configuration". These are inconsequential.
6. Find the file "CommaFeedApplication.java" under the navigation pane.
7. Right click it to bring up the context menu → Debug as... → Debug Configurations
8. Type `server config.dev.yml` under "Program arguments" in the "Arguments" tab for the Java Application setting "CommaFeedApplication"
9. Apply and hit "Debug"
10. The debugger is now working. To connect to it, open a terminal (or command prompt) and navigate to the directory where you cloned the CommaFeed files.
11. Issue the command `gulp dev` on Unix based systems or `gulp.cmd dev` in Windows.
12. The development server is now running at http://localhost:8082 and is proxying REST requests to dropwizard on port 8083.
13. Connect to the server from your browser; you should have functional breakpoints and watches on assets.
14. When you're done developing, create a fork at the top of https://github.com/Athou/CommaFeed page and commit your changes to it.
15. If you'd like to contribute to CommaFeed, create a pull request from your repository to https://github.com/Athou/CommaFeed when your changes are ready. There's a button to do so at the top of https://github.com/Athou/CommaFeed.
- Open `commafeed-client` in your preferred JavaScript IDE.
- run `npm install`
- run `npm run dev`
- the frontend server is now running at http://localhost:8082 and is proxying REST requests to the backend running on port 8083

## Copyright and license

Copyright 2013-2016 CommaFeed.
Copyright 2013-2022 CommaFeed.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
Expand Down
37 changes: 0 additions & 37 deletions bower.json

This file was deleted.

6 changes: 6 additions & 0 deletions commafeed-client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist
node_modules

vite.config.ts

src/locales/**/*.ts
85 changes: 85 additions & 0 deletions commafeed-client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"react-app",
"airbnb",
"airbnb-typescript",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier", "hooks"],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
// make eslint check prettier rules
"prettier/prettier": "error",

// enforce consistent curly braces usage
"curly": ["error", "multi-line", "consistent"],

// set "props" to false because it cases false positives with immer
"no-param-reassign": ["error", { "props": false }],

"prefer-destructuring": [
"error",
{
"array": false,
"object": true
},
{
"enforceForRenamedProperties": false
}
],

// causes issues in thunks when we want to dispatch an action that is defined in the reducer
"@typescript-eslint/no-use-before-define": "off",

// make sure the key prop is filled when required
"react/jsx-key": ["error", { "checkFragmentShorthand": true }],

// configure additional hooks
"react-hooks/exhaustive-deps": [
"warn",
{
"additionalHooks": "(^useAsync$|useDidUpdate)"
}
],

// trigger even if props is used only in createStyles()
"react/no-unused-prop-types": "off",

// no longer required with modern react versions
"react/react-in-jsx-scope": "off",

// not required with typescript
"react/prop-types": "off",
"react/require-default-props": "off",

// matter of taste
"react/destructuring-assignment": "off",
"react/jsx-props-no-spreading": "off",
"react/no-unescaped-entities": "off",
"import/prefer-default-export": "off",

// enforce hook call order
"hooks/sort": [
2,
{
"groups": [
"useLocation",
"useParams",
"useState",
"useAppSelector",
"useAppDispatch",
"useAsync",
"useForm",
"useAsyncCallback",
"useCallback",
"useEffect"
]
}
]
}
}
Loading

0 comments on commit bd33369

Please sign in to comment.