Adventure Game Studio

AGS Development => Site & Forum Reports => Topic started by: Nahuel on Thu 18/05/2023 08:49:45

Title: Forbidden | Not having access to
Post by: Nahuel on Thu 18/05/2023 08:49:45
Forbidden

You don't have permission to access this resource.
Apache/2.4.57 (Ubuntu) Server at adventuregamestudio.co.uk Port 443




When clicking on profiles that contains [ ] white spaces, the url that is generated is returning a 403 Forbidden. I see there's no longer the index.php?action=profile;u={userId}, it has now the user name /forums/profile/{username} instead and when clicked it's returning a 403

Example of users:
  https://www.adventuregamestudio.co.uk/forums/profile/Crimson%20Wizard/ 
  https://www.adventuregamestudio.co.uk/forums/profile/Postmodern%20Adventures/
 
  Username (forbidden) https://www.adventuregamestudio.co.uk/forums/profile/Wavey%20Games/
  Userid (good I had it from an old message sent) https://www.adventuregamestudio.co.uk/forums/index.php?action=profile;u=17716


(https://i.ibb.co/kMk5xzH/Screenshot-2023-05-18-at-09-46-42.png)
Title: Re: Forbidden | Not having access to
Post by: Nahuel on Thu 18/05/2023 09:05:28
It is also impossible to send messages to those profiles:

(https://i.ibb.co/k6gkWgV/Untitled.png)
Title: Re: Forbidden | Not having access to
Post by: AGA on Fri 19/05/2023 18:52:52
This is a known issue with the rewrite plugin.  All the pages are still accessible via user ID rather than the rewritten name, like https://www.adventuregamestudio.co.uk/forums/pm/?sa=send;u=39 to send me a PM.

It's a bit longwinded, but if you go to https://www.adventuregamestudio.co.uk/forums/mlist/?sa=search and search for the username, the link in the Status column on the results page will include the user ID.  Then plug that into the address format from above, and you'll be able to do what you need.
Title: Re: Forbidden | Not having access to
Post by: Khris on Tue 23/05/2023 23:13:46
Here's a GreaseMonkey script that will fix this:

Code (JavaScript) Select
// ==UserScript==
// @name     AGS profile link fix
// @version  1
// @grant    none
// @match https://www.adventuregamestudio.co.uk/forums/*
// ==/UserScript==

window.addEventListener("load", function () {
  document.querySelectorAll(".poster h4 a, .postby a, .moderators a").forEach(a => {
    a.href = a.href.replace(/%20/g, "+");
  });
});

(In case you don't want to use GreaseMonkey, simply replace the spaces in the username with + symbols)
Title: Re: Forbidden | Not having access to
Post by: Snarky on Wed 24/05/2023 15:42:21
That's great, Khris. Thanks! I recently had to ban a couple of accounts with spaces, and it was a bit of a pain. This'll make it a lot easier.
Title: Re: Forbidden | Not having access to
Post by: AGA on Sat 27/05/2023 01:26:50
Quote from: Khris on Tue 23/05/2023 23:13:46Here's a GreaseMonkey script that will fix this:

Code (JavaScript) Select
// ==UserScript==
// @name     AGS profile link fix
// @version  1
// @grant    none
// @match https://www.adventuregamestudio.co.uk/forums/*
// ==/UserScript==

window.addEventListener("load", function () {
  document.querySelectorAll(".poster h4 a, .postby a, .moderators a").forEach(a => {
    a.href = a.href.replace(/%20/g, "+");
  });
});

(In case you don't want to use GreaseMonkey, simply replace the spaces in the username with + symbols)

Thanks!  I've added this to both themes' JS files, so no need for a local GreaseMonkey script.  It's not quite perfect, as there are other places profile links appear, but this is a great starting point I can use to add other classes as I find them.
Title: Re: Forbidden | Not having access to
Post by: AGA on Sat 27/05/2023 11:02:36
Quote from: AGA on Sat 27/05/2023 01:26:50Thanks!  I've added this to both themes' JS files, so no need for a local GreaseMonkey script.  It's not quite perfect, as there are other places profile links appear, but this is a great starting point I can use to add other classes as I find them.
Thanks, @Khris, I've adjusted it to the following, which is a bit more heavy handed, but should coves all eventualities.  Let's see if it slows things down at all!

Code (JavaScript) Select
window.addEventListener("load", function () {
    document.querySelectorAll('a').forEach(a => {
        if (a.href.includes('https://www.adventuregamestudio.co.uk/forums/')) {
            a.href = a.href.replace(/%20/g, "+");
        }
    });
});
Title: Re: Forbidden | Not having access to
Post by: Nahuel on Sat 27/05/2023 11:55:21
Working now, I've tested those profiles all looking good!  :cheesy:
Title: Re: Forbidden | Not having access to
Post by: Khris on Sun 28/05/2023 13:58:56
Here's an optimized version:

Code (JavaScript) Select
window.addEventListener("load", function() {
  document.querySelectorAll('a[href^="https://www.adventuregamestudio.co.uk/forums/profile/"]')
  .forEach(a => a.href = a.href.replace(/%20/g, "+"));
});
Title: Re: Forbidden | Not having access to
Post by: AGA on Sun 28/05/2023 20:59:03
Quote from: Khris on Sun 28/05/2023 13:58:56Here's an optimized version:

Code (JavaScript) Select
window.addEventListener("load", function() {
  document.querySelectorAll('a[href^="https://www.adventuregamestudio.co.uk/forums/profile/"]')
  .forEach(a => a.href = a.href.replace(/%20/g, "+"));
});

Thanks, that's implemented!