dummy user login
This commit is contained in:
parent
54ded0a49b
commit
86c0f1419a
@ -34,6 +34,8 @@ export class ViewCanvas {
|
|||||||
private _cursory = 0;
|
private _cursory = 0;
|
||||||
private _relcursorx = 0;
|
private _relcursorx = 0;
|
||||||
private _relcursory = 0;
|
private _relcursory = 0;
|
||||||
|
private _screencursorx = 0;
|
||||||
|
private _screencursory = 0;
|
||||||
|
|
||||||
private _dragging = false;
|
private _dragging = false;
|
||||||
|
|
||||||
@ -79,11 +81,11 @@ export class ViewCanvas {
|
|||||||
this._relcursorx = Math.floor((this._cursorx - screenX) / pixelSize);
|
this._relcursorx = Math.floor((this._cursorx - screenX) / pixelSize);
|
||||||
this._relcursory = Math.floor((this._cursory - screenY) / pixelSize);
|
this._relcursory = Math.floor((this._cursory - screenY) / pixelSize);
|
||||||
|
|
||||||
const snappedX = this._relcursorx * pixelSize + screenX;
|
this._screencursorx = this._relcursorx * pixelSize + screenX;
|
||||||
const snappedY = this._relcursory * pixelSize + screenY;
|
this._screencursory = this._relcursory * pixelSize + screenY;
|
||||||
|
|
||||||
this._cursor.style.top = `${snappedY + pixelSize / 2}px`;
|
this._cursor.style.top = `${this._screencursory + pixelSize / 2}px`;
|
||||||
this._cursor.style.left = `${snappedX + pixelSize / 2}px`;
|
this._cursor.style.left = `${this._screencursorx + pixelSize / 2}px`;
|
||||||
this._cursor.style.transform = `scale(${pixelSize})`;
|
this._cursor.style.transform = `scale(${pixelSize})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,9 +111,7 @@ export class ViewCanvas {
|
|||||||
if (this._dragging) {
|
if (this._dragging) {
|
||||||
this._posx -= offsetX;
|
this._posx -= offsetX;
|
||||||
this._posy -= offsetY;
|
this._posy -= offsetY;
|
||||||
}
|
|
||||||
|
|
||||||
if (this._dragging) {
|
|
||||||
this.moveCanvas();
|
this.moveCanvas();
|
||||||
this.moveCursor();
|
this.moveCursor();
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ passport.use(
|
|||||||
profile: any,
|
profile: any,
|
||||||
done: Function,
|
done: Function,
|
||||||
) {
|
) {
|
||||||
console.log(profile);
|
|
||||||
process.nextTick(function () {
|
process.nextTick(function () {
|
||||||
return done(null, profile);
|
return done(null, profile);
|
||||||
});
|
});
|
||||||
@ -114,12 +113,23 @@ const canvas = new Canvas(config.game.boardSize);
|
|||||||
const connections: Socket[] = [];
|
const connections: Socket[] = [];
|
||||||
const changes: CanvasRecord[] = [];
|
const changes: CanvasRecord[] = [];
|
||||||
|
|
||||||
|
const dummyUser: IcyNetUser = {
|
||||||
|
id: 0,
|
||||||
|
username: 'placer',
|
||||||
|
display_name: 'placer',
|
||||||
|
uuid: 'placer',
|
||||||
|
accessToken: 'placer',
|
||||||
|
};
|
||||||
|
|
||||||
io.use((socket, next) =>
|
io.use((socket, next) =>
|
||||||
sessionMiddleware(socket.request as any, {} as any, next as any),
|
sessionMiddleware(socket.request as any, {} as any, next as any),
|
||||||
);
|
);
|
||||||
io.on('connection', (socket) => {
|
io.on('connection', (socket) => {
|
||||||
const session = (socket.request as any).session;
|
const session = (socket.request as any).session;
|
||||||
const user = session?.passport?.user as IcyNetUser;
|
const user =
|
||||||
|
process.env.SKIP_LOGIN === 'true'
|
||||||
|
? dummyUser
|
||||||
|
: (session?.passport?.user as IcyNetUser);
|
||||||
connections.push(socket);
|
connections.push(socket);
|
||||||
|
|
||||||
socket.emit(
|
socket.emit(
|
||||||
|
Loading…
Reference in New Issue
Block a user