Compare commits
8 Commits
pkg/dev/ub
...
issue-33
Author | SHA1 | Date | |
---|---|---|---|
69d6753f59 | |||
94bfb77d87 | |||
5a677d2491 | |||
fbb2b3f8da | |||
44182fd1cd | |||
4e9298f5b6 | |||
9dce43fd58 | |||
3fa2b5905a |
@ -9,6 +9,7 @@
|
|||||||
### Procédure
|
### Procédure
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
cd client && npm install # Installation des dépendances client
|
||||||
make watch # Surveiller les modifications sur le sources et compiler/démarrer le serveur
|
make watch # Surveiller les modifications sur le sources et compiler/démarrer le serveur
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { GiteaUnauthorizedError } from "../../util/gitea";
|
import { GiteaUnauthorizedError } from "../../util/gitea";
|
||||||
import { put } from 'redux-saga/effects';
|
import { put } from 'redux-saga/effects';
|
||||||
import { logout } from '../actions/logout';
|
import { logout } from '../actions/logout';
|
||||||
|
import { saveReferer } from "../../util/referer";
|
||||||
|
|
||||||
export function* failuresSaga(action) {
|
export function* failuresSaga(action) {
|
||||||
const err = action.error;
|
if (action.error instanceof GiteaUnauthorizedError) {
|
||||||
if (err instanceof GiteaUnauthorizedError) {
|
saveReferer();
|
||||||
yield put(logout());
|
yield put(logout());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ export function* fetchIssuesSaga(action: any) {
|
|||||||
if (pageIssues.length === 0) {
|
if (pageIssues.length === 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
issues.push(...pageIssues);
|
issues.push(...pageIssues.filter(issue => issue.pull_request === null));
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
client/src/store/sagas/referer.ts
Normal file
9
client/src/store/sagas/referer.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { hasReferer, getReferer, clearReferer } from '../../util/referer';
|
||||||
|
|
||||||
|
export function* navigateToRefererSaga() {
|
||||||
|
if (!hasReferer()) return;
|
||||||
|
const referer = getReferer();
|
||||||
|
console.log("Redirecting to referer", referer);
|
||||||
|
clearReferer();
|
||||||
|
window.location.hash = referer;
|
||||||
|
}
|
@ -10,9 +10,11 @@ import { LOGOUT_REQUEST, LOGOUT_SUCCESS } from '../actions/logout';
|
|||||||
import { logoutSaga, logoutSuccessSaga } from './logout';
|
import { logoutSaga, logoutSuccessSaga } from './logout';
|
||||||
import { BUILD_KANBOARD_REQUEST, MOVE_CARD } from '../actions/kanboards';
|
import { BUILD_KANBOARD_REQUEST, MOVE_CARD } from '../actions/kanboards';
|
||||||
import { buildKanboardSaga, moveCardSaga, refreshKanboardSaga } from './kanboards';
|
import { buildKanboardSaga, moveCardSaga, refreshKanboardSaga } from './kanboards';
|
||||||
|
import { navigateToRefererSaga } from './referer';
|
||||||
|
|
||||||
export function* rootSaga() {
|
export function* rootSaga() {
|
||||||
yield all([
|
yield all([
|
||||||
|
navigateToRefererSaga(),
|
||||||
takeEvery(patternFromRegExp(/^.*_FAILURE/), failuresSaga),
|
takeEvery(patternFromRegExp(/^.*_FAILURE/), failuresSaga),
|
||||||
takeLatest(FETCH_BOARDS_REQUEST, fetchBoardsSaga),
|
takeLatest(FETCH_BOARDS_REQUEST, fetchBoardsSaga),
|
||||||
takeLatest(BUILD_KANBOARD_REQUEST, buildKanboardSaga),
|
takeLatest(BUILD_KANBOARD_REQUEST, buildKanboardSaga),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { createStore, applyMiddleware } from 'redux'
|
import { createStore, applyMiddleware, compose } from 'redux'
|
||||||
import createSagaMiddleware from 'redux-saga'
|
import createSagaMiddleware from 'redux-saga'
|
||||||
import { rootReducer } from './reducers/root'
|
import { rootReducer } from './reducers/root'
|
||||||
import { rootSaga } from './sagas/root'
|
import { rootSaga } from './sagas/root'
|
||||||
@ -14,6 +14,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
reduxMiddlewares.push(loggerMiddleware);
|
reduxMiddlewares.push(loggerMiddleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||||
|
|
||||||
// create the saga middleware
|
// create the saga middleware
|
||||||
const sagaMiddleware = createSagaMiddleware()
|
const sagaMiddleware = createSagaMiddleware()
|
||||||
reduxMiddlewares.push(sagaMiddleware);
|
reduxMiddlewares.push(sagaMiddleware);
|
||||||
@ -21,7 +23,7 @@ reduxMiddlewares.push(sagaMiddleware);
|
|||||||
// mount it on the Store
|
// mount it on the Store
|
||||||
export const store = createStore(
|
export const store = createStore(
|
||||||
rootReducer,
|
rootReducer,
|
||||||
applyMiddleware(...reduxMiddlewares)
|
composeEnhancers(applyMiddleware(...reduxMiddlewares)),
|
||||||
)
|
)
|
||||||
|
|
||||||
// then run the saga
|
// then run the saga
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
export class GiteaUnauthorizedError extends Error {
|
export class GiteaUnauthorizedError extends Error {
|
||||||
constructor(...args: any[]) {
|
constructor(...args: any[]) {
|
||||||
super(...args)
|
super(...args)
|
||||||
|
Object.setPrototypeOf(this, GiteaUnauthorizedError.prototype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
client/src/util/referer.ts
Normal file
19
client/src/util/referer.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
const localStorage = window.localStorage;
|
||||||
|
const refererKey = 'referer';
|
||||||
|
|
||||||
|
export function getReferer() {
|
||||||
|
return localStorage.getItem(refererKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function saveReferer() {
|
||||||
|
console.log("Saving referer", window.location.hash);
|
||||||
|
localStorage.setItem(refererKey, window.location.hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasReferer() {
|
||||||
|
return !!getReferer();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearReferer() {
|
||||||
|
localStorage.removeItem(refererKey);
|
||||||
|
}
|
@ -28,7 +28,7 @@ func getServiceContainer(conf *config.Config) (*service.Container, error) {
|
|||||||
|
|
||||||
ctn.Provide(
|
ctn.Provide(
|
||||||
session.ServiceName,
|
session.ServiceName,
|
||||||
gorilla.ServiceProvider("gitea-kan", cookieStore),
|
gorilla.ServiceProvider("gengitkan", cookieStore),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create and expose config service provider
|
// Create and expose config service provider
|
||||||
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
9
|
|
14
debian/control
vendored
14
debian/control
vendored
@ -1,14 +0,0 @@
|
|||||||
Source: gengitkan
|
|
||||||
Section: unknown
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: William Petit <wpetit@cadoles.com>
|
|
||||||
Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar
|
|
||||||
Standards-Version: 3.9.4
|
|
||||||
Homepage: http://forge.cadoles.com/wpetit/gengitkan
|
|
||||||
Vcs-Git: http://forge.cadoles.com/wpetit/gengitkan.git
|
|
||||||
Vcs-Browser: http://forge.cadoles.com/wpetit/gengitkan
|
|
||||||
|
|
||||||
Package: gengitkan
|
|
||||||
Architecture: amd64
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
|
||||||
Description: Application type "Kanboard" connectée à Gitea
|
|
1
debian/gengitkan.dirs
vendored
1
debian/gengitkan.dirs
vendored
@ -1 +0,0 @@
|
|||||||
var/lib/gengitkan
|
|
13
debian/gengitkan.service
vendored
13
debian/gengitkan.service
vendored
@ -1,13 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Application type "Kanboard" connectée à Gitea
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Environment=GENGITKAN_HTTP_PUBDIR=/usr/share/gengitkan/public
|
|
||||||
Environment=GENGITKAN_DATA_DBPATH=/var/lib/gengitkan/data.db
|
|
||||||
ExecStart=/usr/bin/gengitkan -workdir /usr/share/gengitkan -config /etc/gengitkan/server.conf
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
54
debian/rules
vendored
54
debian/rules
vendored
@ -1,54 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
|
||||||
export DH_VERBOSE=1
|
|
||||||
|
|
||||||
GO_VERSION := 1.13.5
|
|
||||||
OS := linux
|
|
||||||
ARCH := amd64
|
|
||||||
GOPATH=$(HOME)/go
|
|
||||||
|
|
||||||
ifeq (, $(shell which go 2>/dev/null))
|
|
||||||
override_dh_auto_build: install-go
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (, $(shell which node 2>/dev/null))
|
|
||||||
override_dh_auto_build: install-nodejs
|
|
||||||
endif
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@ --with systemd
|
|
||||||
|
|
||||||
override_dh_auto_build: $(GOPATH)
|
|
||||||
cd client && npm install
|
|
||||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" go mod vendor
|
|
||||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release
|
|
||||||
|
|
||||||
$(GOPATH):
|
|
||||||
mkdir -p $(GOPATH)
|
|
||||||
|
|
||||||
install-go:
|
|
||||||
wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
|
||||||
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
|
||||||
|
|
||||||
install-nodejs:
|
|
||||||
wget -O- https://deb.nodesource.com/setup_12.x | bash -
|
|
||||||
apt-get install -y nodejs
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
|
||||||
|
|
||||||
mkdir -p debian/gengitkan/usr/share/gengitkan
|
|
||||||
mkdir -p debian/gengitkan/etc/gengitkan
|
|
||||||
mkdir -p debian/gengitkan/usr/bin
|
|
||||||
|
|
||||||
cp -r release/server-$(OS)-$(ARCH)/* debian/gengitkan/usr/share/gengitkan/
|
|
||||||
|
|
||||||
mv debian/gengitkan/usr/share/gengitkan/bin/server debian/gengitkan/usr/bin/gengitkan
|
|
||||||
mv debian/gengitkan/usr/share/gengitkan/server.conf debian/gengitkan/etc/gengitkan/server.conf
|
|
||||||
|
|
||||||
install -d debian/gengitkan
|
|
||||||
|
|
||||||
override_dh_strip:
|
|
||||||
|
|
||||||
override_dh_auto_test:
|
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
|||||||
3.0 (native)
|
|
@ -20,6 +20,7 @@ type HTTPConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GiteaConfig struct {
|
type GiteaConfig struct {
|
||||||
|
BaseURL string
|
||||||
ClientID string
|
ClientID string
|
||||||
ClientSecret string
|
ClientSecret string
|
||||||
RedirectURL string
|
RedirectURL string
|
||||||
|
Reference in New Issue
Block a user