From 4bb066bced567dffb597cef7c1aacc01908898c2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 13:41:53 +0200 Subject: Fixed default picture url on user register --- src/DevHive.Services/Services/UserService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index b3a4987..ae1760f 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -70,7 +70,7 @@ namespace DevHive.Services.Services User user = this._userMapper.Map(registerModel); user.PasswordHash = PasswordModifications.GeneratePasswordHash(registerModel.Password); - user.ProfilePicture = new ProfilePicture() { PictureURL = String.Empty }; + user.ProfilePicture = new ProfilePicture() { PictureURL = "/assets/images/feed/profile-pic.png" }; // Make sure the default role exists //TODO: Move when project starts -- cgit v1.2.3 From d6196d880f98e8988c2efc68486f895d4561fab1 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 13:55:34 +0200 Subject: Added the admin panel to profile settings page; moved where isAdminUser is checked in profile page --- .../components/profile-settings/profile-settings.component.html | 1 + .../app/components/profile-settings/profile-settings.component.ts | 7 +++++++ .../src/app/components/profile/profile.component.ts | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html index d87c35c..f67940b 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html @@ -3,6 +3,7 @@

diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts index 463b980..a484665 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts @@ -13,6 +13,7 @@ import { Language } from 'src/models/language'; import { Technology } from 'src/models/technology'; import { TokenService } from 'src/app/services/token.service'; import { Title } from '@angular/platform-browser'; +import { AppConstants } from 'src/app/app-constants.module'; @Component({ selector: 'app-profile-settings', @@ -24,6 +25,7 @@ export class ProfileSettingsComponent implements OnInit { @ViewChild(ErrorBarComponent) private _errorBar: ErrorBarComponent; @ViewChild(SuccessBarComponent) private _successBar: SuccessBarComponent; private _urlUsername: string; + public isAdminUser = false; public dataArrived = false; public deleteAccountConfirm = false; public showLanguages = false; @@ -51,6 +53,7 @@ export class ProfileSettingsComponent implements OnInit { this._userService.getUserByUsernameRequest(this._urlUsername).subscribe( (res: object) => { Object.assign(this.user, res); + this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); this.finishUserLoading(); }, (err: HttpErrorResponse) => { @@ -262,6 +265,10 @@ export class ProfileSettingsComponent implements OnInit { this._router.navigate([this._router.url.substring(0, this._router.url.length - 9)]); } + navigateToAdminPanel(): void { + this._router.navigate(['/admin-panel']); + } + logout(): void { this._tokenService.logoutUserFromSessionStorage(); this.goToProfile(); diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts index f364c0d..a60250c 100644 --- a/src/DevHive.Angular/src/app/components/profile/profile.component.ts +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts @@ -53,6 +53,7 @@ export class ProfileComponent implements OnInit { this._userService.getUserByUsernameRequest(this._urlUsername).subscribe( (res: object) => { Object.assign(this.user, res); + this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); this.loadLanguages(); }, (err: HttpErrorResponse) => { @@ -117,7 +118,6 @@ export class ProfileComponent implements OnInit { this.isTheLoggedInUser = true; } this.dataArrived = true; - this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); }, (err: HttpErrorResponse) => { this.logout(); -- cgit v1.2.3 From 43b3762845fc16a2bfcb50c3654180d19b1fbfb4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 14:05:36 +0200 Subject: Improved handling of creating posts in feed --- src/DevHive.Angular/src/app/components/feed/feed.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/DevHive.Angular/src/app/components/feed/feed.component.ts b/src/DevHive.Angular/src/app/components/feed/feed.component.ts index 8e9ffbc..b412b3c 100644 --- a/src/DevHive.Angular/src/app/components/feed/feed.component.ts +++ b/src/DevHive.Angular/src/app/components/feed/feed.component.ts @@ -101,10 +101,14 @@ export class FeedComponent implements OnInit { createPost(): void { const postMessage = this.createPostFormGroup.get('newPostMessage')?.value; + this.dataArrived = false; this._postService.createPostWithSessionStorageRequest(postMessage, this.files).subscribe( (result: object) => { this.goToProfile(); + }, + (err: HttpErrorResponse) => { + this.dataArrived = true; } ); } -- cgit v1.2.3 From c08af91d34665855100c969bad9fddbf2182af41 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 14:10:21 +0200 Subject: Improved handling and detection of file types in post attachments --- .../src/app/components/post-attachment/post-attachment.component.html | 4 ++-- .../src/app/components/post-attachment/post-attachment.component.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html index a8ebce7..4d381d1 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html @@ -10,8 +10,8 @@
- - Download attachment + + Download attachment
diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts index 6c468b0..1d00def 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts @@ -7,6 +7,7 @@ import { Component, Input, OnInit } from '@angular/core'; }) export class PostAttachmentComponent implements OnInit { @Input() paramURL: string; + public isImage = false; public showFull = false; public fileName: string; public fileType: string; @@ -15,7 +16,8 @@ export class PostAttachmentComponent implements OnInit { { } ngOnInit(): void { - this.fileType = this.paramURL.includes('image') ? 'img' : 'raw'; + this.isImage = this.paramURL.includes('image') && !this.paramURL.endsWith('pdf'); + this.fileType = this.isImage ? 'img' : 'raw'; this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; } -- cgit v1.2.3 From d969e5fd4055ff91113c8e00f57d58c077277414 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 14:13:52 +0200 Subject: Slightly limited file uploading in profile picture update to only images --- .../src/app/components/profile-settings/profile-settings.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html index f67940b..502697d 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html @@ -12,7 +12,7 @@
- +
-- cgit v1.2.3 From a11d023c0e6557baef6b420771e31f9ac0f4b1e2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 15:00:39 +0200 Subject: Added some XML documentation in data layer --- src/DevHive.Data/Repositories/CommentRepository.cs | 3 +++ src/DevHive.Data/Repositories/FeedRepository.cs | 18 ++++++++++++++++++ src/DevHive.Data/Repositories/LanguageRepository.cs | 3 +++ src/DevHive.Data/Repositories/PostRepository.cs | 3 +++ src/DevHive.Data/Repositories/TechnologyRepository.cs | 3 +++ 5 files changed, 30 insertions(+) diff --git a/src/DevHive.Data/Repositories/CommentRepository.cs b/src/DevHive.Data/Repositories/CommentRepository.cs index 382c666..bee7624 100644 --- a/src/DevHive.Data/Repositories/CommentRepository.cs +++ b/src/DevHive.Data/Repositories/CommentRepository.cs @@ -28,6 +28,9 @@ namespace DevHive.Data.Repositories .FirstOrDefaultAsync(x => x.Id == id); } + /// + /// This method returns the comment that is made at exactly the given time and by the given creator + /// public async Task GetCommentByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated) { return await this._context.Comments diff --git a/src/DevHive.Data/Repositories/FeedRepository.cs b/src/DevHive.Data/Repositories/FeedRepository.cs index 271c3a5..8d3e5e1 100644 --- a/src/DevHive.Data/Repositories/FeedRepository.cs +++ b/src/DevHive.Data/Repositories/FeedRepository.cs @@ -18,6 +18,15 @@ namespace DevHive.Data.Repositories this._context = context; } + /// + /// This returns a given amount of posts of all given friends, created before "firstRequestIssued", + /// ordered from latest to oldest (time created). + /// PageSize specifies how many posts to get, and pageNumber specifices how many posts to skip (pageNumber * pageSize). + /// + /// This method is used in the feed page. + /// Posts from friends are meant to be gotten in chunks, meaning you get X posts, and then get another amount of posts, + /// that are after the first X posts. + /// public async Task> GetFriendsPosts(List friendsList, DateTime firstRequestIssued, int pageNumber, int pageSize) { List friendsIds = friendsList.Select(f => f.Id).ToList(); @@ -39,6 +48,15 @@ namespace DevHive.Data.Repositories return posts; } + /// + /// This returns a given amount of posts, that a user has made, created before "firstRequestIssued", + /// ordered from latest to oldest (time created). + /// PageSize specifies how many posts to get, and pageNumber specifices how many posts to skip (pageNumber * pageSize). + /// + /// This method is used in the profile page. + /// Posts from friends are meant to be gotten in chunks, meaning you get X posts, and then get another amount of posts, + /// that are after the first X posts. + /// public async Task> GetUsersPosts(User user, DateTime firstRequestIssued, int pageNumber, int pageSize) { List posts = await this._context.Posts diff --git a/src/DevHive.Data/Repositories/LanguageRepository.cs b/src/DevHive.Data/Repositories/LanguageRepository.cs index 7f4b946..31d0b86 100644 --- a/src/DevHive.Data/Repositories/LanguageRepository.cs +++ b/src/DevHive.Data/Repositories/LanguageRepository.cs @@ -25,6 +25,9 @@ namespace DevHive.Data.Repositories .FirstOrDefaultAsync(x => x.Name == languageName); } + /// + /// Returns all technologies that exist in the database + /// public HashSet GetLanguages() { return this._context.Languages.ToHashSet(); diff --git a/src/DevHive.Data/Repositories/PostRepository.cs b/src/DevHive.Data/Repositories/PostRepository.cs index 0fec435..ed2fa1b 100644 --- a/src/DevHive.Data/Repositories/PostRepository.cs +++ b/src/DevHive.Data/Repositories/PostRepository.cs @@ -39,6 +39,9 @@ namespace DevHive.Data.Repositories .FirstOrDefaultAsync(x => x.Id == id); } + /// + /// This method returns the post that is made at exactly the given time and by the given creator + /// public async Task GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated) { return await this._context.Posts diff --git a/src/DevHive.Data/Repositories/TechnologyRepository.cs b/src/DevHive.Data/Repositories/TechnologyRepository.cs index 7bb43cc..6f0d10f 100644 --- a/src/DevHive.Data/Repositories/TechnologyRepository.cs +++ b/src/DevHive.Data/Repositories/TechnologyRepository.cs @@ -25,6 +25,9 @@ namespace DevHive.Data.Repositories .FirstOrDefaultAsync(x => x.Name == technologyName); } + /// + /// Returns all technologies that exist in the database + /// public HashSet GetTechnologies() { return this._context.Technologies.ToHashSet(); -- cgit v1.2.3 From 8e09ab34b54718af7753ba7d7e4e370ab14efa1a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 15:31:49 +0200 Subject: Added some XML documentation to Service layer (where really needed) --- src/DevHive.Services/Services/CommentService.cs | 15 +++++++++++- src/DevHive.Services/Services/FeedService.cs | 8 +++++++ src/DevHive.Services/Services/PostService.cs | 19 +++++++++++++++ src/DevHive.Services/Services/UserService.cs | 32 +++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/DevHive.Services/Services/CommentService.cs b/src/DevHive.Services/Services/CommentService.cs index e0eb88a..1ea775c 100644 --- a/src/DevHive.Services/Services/CommentService.cs +++ b/src/DevHive.Services/Services/CommentService.cs @@ -103,6 +103,9 @@ namespace DevHive.Services.Services #endregion #region Validations + /// + /// Checks whether the user Id in the token and the given user Id match + /// public async Task ValidateJwtForCreating(Guid userId, string rawTokenData) { User user = await this.GetUserForValidation(rawTokenData); @@ -110,6 +113,11 @@ namespace DevHive.Services.Services return user.Id == userId; } + /// + /// Checks whether the comment, gotten with the commentId, + /// is made by the user in the token + /// or if the user in the token is an admin + /// public async Task ValidateJwtForComment(Guid commentId, string rawTokenData) { Comment comment = await this._commentRepository.GetByIdAsync(commentId) ?? @@ -126,6 +134,9 @@ namespace DevHive.Services.Services return false; } + /// + /// Returns the user, via their Id in the token + /// private async Task GetUserForValidation(string rawTokenData) { JwtSecurityToken jwt = new JwtSecurityTokenHandler().ReadJwtToken(rawTokenData.Remove(0, 7)); @@ -139,7 +150,9 @@ namespace DevHive.Services.Services return user; } - + /// + /// Returns all values from a given claim type + /// private List GetClaimTypeValues(string type, IEnumerable claims) { List toReturn = new(); diff --git a/src/DevHive.Services/Services/FeedService.cs b/src/DevHive.Services/Services/FeedService.cs index b9d1922..671df60 100644 --- a/src/DevHive.Services/Services/FeedService.cs +++ b/src/DevHive.Services/Services/FeedService.cs @@ -24,6 +24,10 @@ namespace DevHive.Services.Services this._mapper = mapper; } + /// + /// This method is used in the feed page. + /// See the FeedRepository "GetFriendsPosts" menthod for more information on how it works. + /// public async Task GetPage(GetPageServiceModel model) { User user = null; @@ -53,6 +57,10 @@ namespace DevHive.Services.Services return readPageServiceModel; } + /// + /// This method is used in the profile pages. + /// See the FeedRepository "GetUsersPosts" menthod for more information on how it works. + /// public async Task GetUserPage(GetPageServiceModel model) { User user = null; diff --git a/src/DevHive.Services/Services/PostService.cs b/src/DevHive.Services/Services/PostService.cs index 6dbb272..16d6611 100644 --- a/src/DevHive.Services/Services/PostService.cs +++ b/src/DevHive.Services/Services/PostService.cs @@ -138,6 +138,9 @@ namespace DevHive.Services.Services #endregion #region Validations + /// + /// Checks whether the user Id in the token and the given user Id match + /// public async Task ValidateJwtForCreating(Guid userId, string rawTokenData) { User user = await this.GetUserForValidation(rawTokenData); @@ -145,6 +148,11 @@ namespace DevHive.Services.Services return user.Id == userId; } + /// + /// Checks whether the post, gotten with the postId, + /// is made by the user in the token + /// or if the user in the token is an admin + /// public async Task ValidateJwtForPost(Guid postId, string rawTokenData) { Post post = await this._postRepository.GetByIdAsync(postId) ?? @@ -161,6 +169,11 @@ namespace DevHive.Services.Services return false; } + /// + /// Checks whether the comment, gotten with the commentId, + /// is made by the user in the token + /// or if the user in the token is an admin + /// public async Task ValidateJwtForComment(Guid commentId, string rawTokenData) { Comment comment = await this._commentRepository.GetByIdAsync(commentId) ?? @@ -177,6 +190,9 @@ namespace DevHive.Services.Services return false; } + /// + /// Returns the user, via their Id in the token + /// private async Task GetUserForValidation(string rawTokenData) { JwtSecurityToken jwt = new JwtSecurityTokenHandler().ReadJwtToken(rawTokenData.Remove(0, 7)); @@ -190,6 +206,9 @@ namespace DevHive.Services.Services return user; } + /// + /// Returns all values from a given claim type + /// private List GetClaimTypeValues(string type, IEnumerable claims) { List toReturn = new(); diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index ae1760f..3feca9f 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -47,6 +47,10 @@ namespace DevHive.Services.Services } #region Authentication + /// + /// Adds a new user to the database with the values from the given model. + /// Returns a JSON Web Token (that can be used for authorization) + /// public async Task LoginUser(LoginServiceModel loginModel) { if (!await this._userRepository.DoesUsernameExistAsync(loginModel.UserName)) @@ -60,6 +64,9 @@ namespace DevHive.Services.Services return new TokenModel(WriteJWTSecurityToken(user.Id, user.UserName, user.Roles)); } + /// + /// Returns a new JSON Web Token (that can be used for authorization) for the given user + /// public async Task RegisterUser(RegisterServiceModel registerModel) { if (await this._userRepository.DoesUsernameExistAsync(registerModel.UserName)) @@ -125,6 +132,9 @@ namespace DevHive.Services.Services return this._userMapper.Map(newUser); } + /// + /// Uploads the given picture and assigns it's link to the user in the database + /// public async Task UpdateProfilePicture(UpdateProfilePictureServiceModel updateProfilePictureServiceModel) { User user = await this._userRepository.GetByIdAsync(updateProfilePictureServiceModel.UserId); @@ -162,6 +172,11 @@ namespace DevHive.Services.Services #endregion #region Validations + /// + /// Checks whether the given user, gotten by the "id" property, + /// is the same user as the one in the token (uness the user in the token has the admin role) + /// and the roles in the token are the same as those in the user, gotten by the id in the token + /// public async Task ValidJWT(Guid id, string rawTokenData) { // There is authorization name in the beginning, i.e. "Bearer eyJh..." @@ -197,6 +212,9 @@ namespace DevHive.Services.Services return true; } + /// + /// Returns all values from a given claim type + /// private List GetClaimTypeValues(string type, IEnumerable claims) { List toReturn = new(); @@ -208,6 +226,11 @@ namespace DevHive.Services.Services return toReturn; } + /// + /// Checks whether the user in the model exists + /// and whether the username in the model is already taken. + /// If the check fails (is false), it throws an exception, otherwise nothing happens + /// private async Task ValidateUserOnUpdate(UpdateUserServiceModel updateUserServiceModel) { if (!await this._userRepository.DoesUserExistAsync(updateUserServiceModel.Id)) @@ -218,6 +241,10 @@ namespace DevHive.Services.Services throw new ArgumentException("Username already exists!"); } + /// + /// Return a new JSON Web Token, containing the user id, username and roles. + /// Tokens have an expiration time of 7 days. + /// private string WriteJWTSecurityToken(Guid userId, string username, HashSet roles) { byte[] signingKey = Encoding.ASCII.GetBytes(_jwtOptions.Secret); @@ -274,6 +301,11 @@ namespace DevHive.Services.Services return new TokenModel(WriteJWTSecurityToken(newUser.Id, newUser.UserName, newUser.Roles)); } + /// + /// Returns the user with the Id in the model, adding to him the roles, languages and technologies, specified by the parameter model. + /// This practically maps HashSet to HashSet (and the equvalent HashSets for Languages and Technologies) + /// and assigns the latter to the returned user. + /// private async Task PopulateModel(UpdateUserServiceModel updateUserServiceModel) { User user = this._userMapper.Map(updateUserServiceModel); -- cgit v1.2.3 From c01cfa373f440ee8defb4b7c69f4445149a65281 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 15:39:16 +0200 Subject: Fixed user service JWT validation, that skipped role check if user is admin (meaning if a user is once an admin, their token will coninue to be valid, even if we removed their admin role) --- src/DevHive.Services/Services/UserService.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index 3feca9f..9cc4a8e 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -191,9 +191,6 @@ namespace DevHive.Services.Services /* Check if user is trying to do something to himself, unless he's an admin */ /* Check roles */ - if (jwtRoleNames.Contains(Role.AdminRole)) - return true; - if (!jwtRoleNames.Contains(Role.AdminRole)) if (user.Id != id) return false; -- cgit v1.2.3 From 5f2ba0750f5d52c18d193d0b8ec6196cc0d7e5c8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Feb 2021 17:15:55 +0200 Subject: Added screenshots to README --- README.md | 15 +++++++++++++++ screenshots/admin-panel.png | Bin 0 -> 50920 bytes screenshots/another-user-logged-in.png | Bin 0 -> 115600 bytes screenshots/comment-page.png | Bin 0 -> 21475 bytes screenshots/creating-post.png | Bin 0 -> 30921 bytes screenshots/edit.png | Bin 0 -> 32121 bytes screenshots/feed.png | Bin 0 -> 36789 bytes screenshots/login.png | Bin 0 -> 20462 bytes screenshots/post-page-with-comments.png | Bin 0 -> 53849 bytes screenshots/post-page.png | Bin 0 -> 37766 bytes screenshots/register.png | Bin 0 -> 25905 bytes screenshots/your-profile-page.png | Bin 0 -> 50603 bytes screenshots/your-settings-page.png | Bin 0 -> 41581 bytes 13 files changed, 15 insertions(+) create mode 100644 screenshots/admin-panel.png create mode 100644 screenshots/another-user-logged-in.png create mode 100644 screenshots/comment-page.png create mode 100644 screenshots/creating-post.png create mode 100644 screenshots/edit.png create mode 100644 screenshots/feed.png create mode 100644 screenshots/login.png create mode 100644 screenshots/post-page-with-comments.png create mode 100644 screenshots/post-page.png create mode 100644 screenshots/register.png create mode 100644 screenshots/your-profile-page.png create mode 100644 screenshots/your-settings-page.png diff --git a/README.md b/README.md index 6fbd5d3..0ad6b7c 100644 --- a/README.md +++ b/README.md @@ -59,3 +59,18 @@ If nothing broke, you can now access the front-end from `http://localhost:4200`. You can change on what port the API is ran, by changing the `HTTP_PORT` constant in `src/DevHive.Web/Program.cs`. If you do so, you **must** also update the front-end, because by default it will try to send requests to port 5000. Go to `src/DevHive.Angular/src/app` and edit the `app-constants.module.ts` file, on the second row you're gonna see the variable `BASE_API_URL`, change it accoring to your API modifications. You can change on what port the Front-end is ran, by issueing the serve command with the `--port` parameter: `ng serve --port 5001`. But, **don't run it with the `--ssl` parameter!** SSL isn't supported yet, so it will throw errors! As an alternative, if you need ssl, is using a [reverse proxy](https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/). + +## Screenshots + +![](./screenshots/register.png) +![](./screenshots/login.png) +![](./screenshots/feed.png) +![](./screenshots/creating-post.png) +![](./screenshots/your-profile-page.png) +![](./screenshots/your-settings-page.png) +![](./screenshots/edit.png) +![](./screenshots/post-page.png) +![](./screenshots/post-page-with-comments.png) +![](./screenshots/comment-page.png) +![](./screenshots/another-user-logged-in.png) +![](./screenshots/admin-panel.png) diff --git a/screenshots/admin-panel.png b/screenshots/admin-panel.png new file mode 100644 index 0000000..d8f1b3f Binary files /dev/null and b/screenshots/admin-panel.png differ diff --git a/screenshots/another-user-logged-in.png b/screenshots/another-user-logged-in.png new file mode 100644 index 0000000..67f34e1 Binary files /dev/null and b/screenshots/another-user-logged-in.png differ diff --git a/screenshots/comment-page.png b/screenshots/comment-page.png new file mode 100644 index 0000000..f517dc9 Binary files /dev/null and b/screenshots/comment-page.png differ diff --git a/screenshots/creating-post.png b/screenshots/creating-post.png new file mode 100644 index 0000000..58081f2 Binary files /dev/null and b/screenshots/creating-post.png differ diff --git a/screenshots/edit.png b/screenshots/edit.png new file mode 100644 index 0000000..e448af3 Binary files /dev/null and b/screenshots/edit.png differ diff --git a/screenshots/feed.png b/screenshots/feed.png new file mode 100644 index 0000000..a456e2a Binary files /dev/null and b/screenshots/feed.png differ diff --git a/screenshots/login.png b/screenshots/login.png new file mode 100644 index 0000000..378a682 Binary files /dev/null and b/screenshots/login.png differ diff --git a/screenshots/post-page-with-comments.png b/screenshots/post-page-with-comments.png new file mode 100644 index 0000000..d464053 Binary files /dev/null and b/screenshots/post-page-with-comments.png differ diff --git a/screenshots/post-page.png b/screenshots/post-page.png new file mode 100644 index 0000000..96428ef Binary files /dev/null and b/screenshots/post-page.png differ diff --git a/screenshots/register.png b/screenshots/register.png new file mode 100644 index 0000000..70448b1 Binary files /dev/null and b/screenshots/register.png differ diff --git a/screenshots/your-profile-page.png b/screenshots/your-profile-page.png new file mode 100644 index 0000000..3701ea3 Binary files /dev/null and b/screenshots/your-profile-page.png differ diff --git a/screenshots/your-settings-page.png b/screenshots/your-settings-page.png new file mode 100644 index 0000000..61e39e6 Binary files /dev/null and b/screenshots/your-settings-page.png differ -- cgit v1.2.3 From 689a32f10ccdb69bc777971c4deb134125a1a0e0 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Thu, 4 Feb 2021 17:17:31 +0200 Subject: Added contents listing to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0ad6b7c..15d14ce 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ DevHive is the social network solution for programmers. In it you can make posts It's built with ASP.NET Core as a back-end and Angular as a front-end. For more technical information, you can refer to the [Wiki](https://github.com/Team-Kaleidoscope/DevHive/wiki). +Contents: +- [Setting up locally](https://github.com/Team-Kaleidoscope/DevHive/tree/dev#setting-up-locally) +- [Screenshots](https://github.com/Team-Kaleidoscope/DevHive/tree/dev#screenshots) + ## Setting up locally DevHive can be easily self-hosted on your computer or server. There currently aren't any demo instances, so the only way to see it for yourself it to set it up. -- cgit v1.2.3 From e3826b586304b21970631949f4fdc9d7ae5bbbdb Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Thu, 4 Feb 2021 17:20:03 +0200 Subject: Improved readme contents links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15d14ce..770a572 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ DevHive is the social network solution for programmers. In it you can make posts It's built with ASP.NET Core as a back-end and Angular as a front-end. For more technical information, you can refer to the [Wiki](https://github.com/Team-Kaleidoscope/DevHive/wiki). Contents: -- [Setting up locally](https://github.com/Team-Kaleidoscope/DevHive/tree/dev#setting-up-locally) -- [Screenshots](https://github.com/Team-Kaleidoscope/DevHive/tree/dev#screenshots) +- [Setting up locally](#setting-up-locally) +- [Screenshots](#screenshots) ## Setting up locally -- cgit v1.2.3 From 35cc99b14606cda71136a6008645dd385eee6c85 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Thu, 4 Feb 2021 17:35:19 +0200 Subject: Minor improvements to README styling and wording --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 770a572..caa4cfd 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ DevHive is the social network solution for programmers. In it you can make posts to share with your friends, comment and more. -It's built with ASP.NET Core as a back-end and Angular as a front-end. For more technical information, you can refer to the [Wiki](https://github.com/Team-Kaleidoscope/DevHive/wiki). +It's built with [`ASP.NET Core`](https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-5.0) as a back-end and [`Angular`](https://angular.io/) as a front-end. For more technical information, you can refer to the [Wiki](https://github.com/Team-Kaleidoscope/DevHive/wiki). -Contents: +### Contents: - [Setting up locally](#setting-up-locally) - [Screenshots](#screenshots) ## Setting up locally -DevHive can be easily self-hosted on your computer or server. There currently aren't any demo instances, so the only way to see it for yourself it to set it up. +There currently aren't any demo instances, so the only way to try it out for yourself it to set it up locally, on a computer or server. In this section are explained the steps to do so. -This tutorial is geared towards Linux-based systems. +The steps are oriented around Linux-based systems. ### Prerequisites @@ -20,14 +20,14 @@ There are some things you need to setup before even downloading the app. Back-end (API) tools: - [`dotnet 5.0`](https://docs.microsoft.com/en-us/dotnet/core/install/linux) or later -- [`Entity Framework Core tool 5.0.2`](https://docs.microsoft.com/en-us/ef/core/cli/dotnet) or later +- [`Entity Framework Core tool 5.0.2`](https://docs.microsoft.com/en-us/ef/core/cli/dotnet) or greater - if you've already installed `dotnet`, you can just run this command `dotnet tool install dotnet-ef -g` -- [`postresql 13.1`](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04) or later (older versions might work, but haven't been tested) +- [`postresql 13.1`](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04) or greater (older versions might work, but haven't been tested) - Fedora users could also refer to [this](https://computingforgeeks.com/how-to-install-postgresql-12-on-fedora/) guide - Arch users can refer to the [ArchWiki](https://wiki.archlinux.org/index.php/PostgreSQL) Front-end tools: -- [`Angular CLI 11.0`](https://www.tecmint.com/install-angular-cli-on-linux/) or later (older versions might work, but haven't been tested) +- [`Angular CLI 11.0.6`](https://www.tecmint.com/install-angular-cli-on-linux/) or greater (older versions might work, but haven't been tested) ### Getting started with the database @@ -42,27 +42,28 @@ After installing all of the tools and setting up the database, you should have a 1. Navigate to the `src/DevHive.Web` folder 2. Edit the `appsettings.json` file, under "ConnectionStrings", type in the values, you setup in `ConnectionString.json` in `DevHive.Data` - - On the third row there is a "Secret", it's used for encryption of User password, you can change it **but it must be made up of 64 letters and number!** + - On the third row there is a "Secret" field, it's used for encryption of User passwords, you can change it **but it must be made up of 64 letters and number!** - There are also some cloud values that you can change. Currently, the project uses [Cloudinary](https://cloudinary.com/) as a place for uploading files. If you wish, you can setup your own account there, otherwise file uploading won't work. 3. Run `dotnet run` in the `DevHive.Web` folder - feel free to [run the command in background](https://linuxize.com/post/how-to-run-linux-commands-in-background/) or [create a systemd service](https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6) -If everything went well, you can now access the API on `http://localhost:5000/api` with something like [Postman](https://www.postman.com/) or the FOSS [Insomnia Designer](https://github.com/Kong/insomnia). Refer to the [API Endpoints](https://github.com/Team-Kaleidoscope/DevHive/wiki/API-Endpoints) page in the Wiki. +If everything went well, you can now access the API on `http://localhost:5000/api` with something like [Postman](https://www.postman.com/) or the FOSS alternative [Insomnia Designer](https://github.com/Kong/insomnia). On where to send requests, refer to the [API Endpoints](https://github.com/Team-Kaleidoscope/DevHive/wiki/API-Endpoints) page in the Wiki. ### Starting up the Front-end 1. Navigate to `src/DevHive.Angular` -2. Run `npm install` -3. Run `ng serve` +2. Run `npm install` to install all front-end packages +3. Run `ng serve` to start up the front-end - as with the API, you can [run the command in background](https://linuxize.com/post/how-to-run-linux-commands-in-background/) or [create a systemd service](https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6) -If nothing broke, you can now access the front-end from `http://localhost:4200`. Also, don't forget that the API needs to be running *at the same time*, otherwise you won't get beyond the login and register screens! +If everything went smoothly, you will be able to access the front-end from `http://localhost:4200`. Also, don't forget that the API needs to be running *at the same time*, otherwise you won't get beyond the Login and Register pages! -## Important notes +### Important notes -You can change on what port the API is ran, by changing the `HTTP_PORT` constant in `src/DevHive.Web/Program.cs`. If you do so, you **must** also update the front-end, because by default it will try to send requests to port 5000. Go to `src/DevHive.Angular/src/app` and edit the `app-constants.module.ts` file, on the second row you're gonna see the variable `BASE_API_URL`, change it accoring to your API modifications. +You can change on what port the API is ran, by changing the `HTTP_PORT` constant in `src/DevHive.Web/Program.cs`. If you do so, you **must** also update the front-end, because by default it will try to send requests to `http://localhost:5000`. +- Go to `src/DevHive.Angular/src/app` and edit the `app-constants.module.ts` file, on the second row you're gonna see the variable `BASE_API_URL`, change it accoring to your API modifications. -You can change on what port the Front-end is ran, by issueing the serve command with the `--port` parameter: `ng serve --port 5001`. But, **don't run it with the `--ssl` parameter!** SSL isn't supported yet, so it will throw errors! As an alternative, if you need ssl, is using a [reverse proxy](https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/). +You can change on what port the front-end is ran, by issuing the serve command with the `--port` parameter: `ng serve --port 5001`. But, **don't run it with the `--ssl` parameter!** SSL isn't supported yet and you'll have issues trying to use it! If you really need ssl, using a [reverse proxy](https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/) might be a viable alternative. ## Screenshots -- cgit v1.2.3 From ebf48cc5ad48199f0af9b8535c395b28f32b73a6 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Thu, 4 Feb 2021 17:41:01 +0200 Subject: Added contents of the "Setting up locally" section in README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index caa4cfd..c02f1e4 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,13 @@ DevHive is the social network solution for programmers. In it you can make posts It's built with [`ASP.NET Core`](https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-5.0) as a back-end and [`Angular`](https://angular.io/) as a front-end. For more technical information, you can refer to the [Wiki](https://github.com/Team-Kaleidoscope/DevHive/wiki). -### Contents: +## Contents: - [Setting up locally](#setting-up-locally) + - [Prerequisites](#prerequisites) + - [Getting started with the database](#getting-started-with-the-database) + - [Starting up the API](#starting-up-the-api) + - [Starting up the Front-end](#starting-up-the-front-end) + - [Important notes](#important-notes) - [Screenshots](#screenshots) ## Setting up locally -- cgit v1.2.3