Rats icon indicating copy to clipboard operation
Rats copied to clipboard

All the Mods 9 with Rats added in. Rats won't interact with storage containers.

Open zevric opened this issue 1 year ago • 4 comments

I set up a chef rat to make confit byaldi but the rat won't take assorted veggies from the chest he is marked to take from. nor will he deposit into the chest marked for deposit. I've reload the modpack a couple times and nothing has changed. I'm using the latest version of both Rats and Citadel as of typing this. image

zevric avatar Oct 24 '23 00:10 zevric

How did you even get this imported into your application to the point where it works? See my issue.

TheEskir avatar Sep 26 '18 07:09 TheEskir

Not sure if this is still relevant, I got it to work by moving the certificate to a read/write folder (/Documents for iOS) in stead of /Application which is read-only. See my closed issue for more details.

HostenMarijn avatar Jan 22 '19 12:01 HostenMarijn

hi @HostenMarijn - are you able to provide more detail on what you mean by moving the certificate? Currently I have followed the instructions which means my .p12 file is in the www folder. I am thus getting the 'certificate file not found' error. Appreciate the help!

nickcom avatar Jun 23 '19 16:06 nickcom

@nickcom My certificate is located in the Documents folder, in a folder called "certificates" that I created myself with cordova fileSystem api. So: Documents/certificates/mecert.p12 Documents = cordova.file.applicationDirectory (if I recall correctly) It's all in the cordova file API documentation.

Hope this helps!

HostenMarijn avatar Jun 23 '19 16:06 HostenMarijn

thanks a bunch @HostenMarijn. I'm getting closer I hope, but actually still receiving the same error message. Any ideas?

window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/" + "client_cert.p12", function (fileEntry) {
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function (directory) {
    fileEntry.copyTo(directory, 'client_cert.p12', function () {
        var cert = cordova.file.dataDirectory + "client_cert.p12";
        clientCertificate.registerAuthenticationCertificate(cert, "cert_password",
            function (message) {
                alert('success');
            }, function (error) {
                alert(error);
            });
     })
});

I am copying the .p12 from the application www root to the cordova.file.dataDirectory, which according to the documents is a read/write folder named library/NoCloud.

I've confirmed the file does indeed exist at cordova.file.dataDirectory/client_cert.p12 location yet I still get the same error as if I am pointing to the application www folder as per the documentation for this plugin.

certificate file not found: file:///var/mobile/Containers/Data/Applications/93EE.../Library/NoCloud/client_cert.p12

nickcom avatar Jun 24 '19 14:06 nickcom

Hey @nickcom this is the code I use:

authenticateCertificate: (certificatePath, password) => {
    const cordova = window.cordova,
      resolveLocalFileSystemURL = window.resolveLocalFileSystemURL,
      clientCertificate = window.clientCertificate;

    const certPath = certificatePath; // ./static/media/myCert.pem <- react build path
    const certFileName = certPath.split('/')[3];
    const certFolder = 'certificates/';
    const appDir = cordova.file.applicationDirectory + 'www/';
    const docDir = cordova.file.documentsDirectory;

    resolveLocalFileSystemURL(docDir, function (DirectoryEntry) {
      // Create certFolder if doesn't exists in a r/w location
      DirectoryEntry.getDirectory(certFolder, { create: true, exclusive: false }, copyCertificateAutomate, certificateError);
    }, (err) => { console.log('Could not get directory docDir', err) });

    const copyCertificateAutomate = function (CertificatesDirectory) {

      resolveLocalFileSystemURL(appDir + certPath.slice(1, certPath.length), function (appFile) {
        resolveLocalFileSystemURL(docDir + certFolder + certFileName,
          certAuthenticate,
          () => {
            console.log('Documents/certificates/cert.xx NOT found');
            appFile.copyTo(CertificatesDirectory, certFileName, certAuthenticate, (err) => { console.log('copy failed'); console.log(err) });
          });

      }, certAuthenticate);
    }

    const certAuthenticate = function () {
      const docDir = window.cordova.file.documentsDirectory;
      const certPath = certificatePath;
      const certFolder = 'certificates/';
      const certFileName = certPath.split('/')[3]; // myCert.pem this just gets the filename out of the path, prob not index 3 for your case :)

      // Full path to the cert
      const p12path = docDir.substring(7) + certFolder + certFileName;
      const p12pass = password;

      console.log('get certificate', p12path);
      clientCertificate.registerAuthenticationCertificate(p12path, p12pass, certificateSuccess, certificateError);
    };
  }
function certificateError(err) {
  console.log('Certificate error');
  console.log(err);
}
function certificateSuccess(msg) {
  console.log('Certificate success');
  console.log(msg);
}

Then I just call the function: authenticateCertificate(certificate, 'mypassword'); // where certificate is the path. Good luck man!

HostenMarijn avatar Jun 27 '19 11:06 HostenMarijn

Hey @HostenMarijn , Do you have any idea removing the certificate after registing?

Benshakalaka avatar Jun 19 '20 09:06 Benshakalaka