Discuss Scratch

numeraptor49
Scratcher
59 posts

Sujets Avancés

Du coup j'utilise quel logiciel ?
everwinner64
Scratcher
1000+ posts

Sujets Avancés

Bonjour, depuis quelques jours, j’ai un problème auquel je ne trouve aucune explication, ni solution « native » au problème. J’ai besoin de créer un cookie avec une date de péremption. Mon code fonctionne sur ce point, mon navigateur le reconnaît entièrement, mais quand la date de péremption est atteinte, le cookie n’est pas supprimé, que je ferme ou non le navigateur. J’ai eu beau chercher quelle sombre raison en est la cause, mais je n’ai rien trouvé. Savez-vous ce qui pourrait causer ça ?

Le code qui crée le cookie :
await cookieStore.set({
       name: "visited-page",
       value: "true",
       expires: Date.now() + 12 * 60 * 60 * 1000,
       sameSite: "strict",
       path: "/"
});

Last edited by everwinner64 (Nov. 17, 2025 18:26:36)

wilhelm43
Scratcher
1000+ posts

Sujets Avancés

Il me semble que javascript ne prend pas en compte les opérations dans un dictionnaire. Essaye en définissant une variable expire au préalable, pour voir ?
Sinon, ça peut venir aussi de ton navigateur.
Blaireau2012
Scratcher
17 posts

Sujets Avancés

Salut!
J'espère avoir choisis le bon topic parce que j'ai besoin d'aide pour un projet arduino.
J'ai un Arduino uno wifi rev2 et j'ai fait un code en m'inspirant de celui-là.
Je vous le met :
#include <WiFiNINA.h>

char ssid[] = ""; // your network SSID (name) between the " "
char pass[] = ""; // your network password between the " "
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS; //connection status
WiFiServer server(80); //server socket

WiFiClient client = server.available();

int ledPin = 2;

void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
while (!Serial);

enable_WiFi();
connect_WiFi();

server.begin();
printWifiStatus();

}

void loop() {
client = server.available();

if (client) {
printWEB();
}
}

void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");

Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
}

void enable_WiFi() {
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv < "1.0.0") {
Serial.println("Please upgrade the firmware");
}
}

void connect_WiFi() {
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);

// wait 10 seconds for connection:
delay(10000);
}
}

void printWEB() {

if (client) { // if you get a client,
Serial.println("new client"); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
if (c == '\n') { // if the byte is a newline character

// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {

// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();

//create the buttons
client.print("Click <a href=\"/H\">here</a> turn the LED on<br>");
client.print("Click <a href=\"/L\">here</a> turn the LED off<br><br>");

int randomReading = analogRead(A1);
client.print("Random reading from analog pin: ");
client.print(randomReading);




// The HTTP response ends with another blank line:
client.println();
// break out of the while loop:
break;
}
else { // if you got a newline, then clear currentLine:
currentLine = "";
}
}
else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}

if (currentLine.endsWith("GET /H")) {
digitalWrite(ledPin, HIGH);
}
if (currentLine.endsWith("GET /L")) {
digitalWrite(ledPin, LOW);
}

}
}
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
Je le téléverse sur mon arduino, il se connecte bien, puis j'ouvre mon naviguateur(firefox, window) et je n'arive pas a l'afficher, parce que la connextion n'est pas sécurisée. Pourtant, sur un ordi mac (safari) et un smartphone(androïd), la page s'affiche bien.
Comment le modifier pour qu'il marche?
Merci d'avance.
numeraptor49
Scratcher
59 posts

Sujets Avancés

Comment mettre un site (fichier HTML et un autre css) en ligne ?
wilhelm43
Scratcher
1000+ posts

Sujets Avancés

Deux possibilités :
  • soit tu passes par un fournisseur de services
  • soit tu l'héberges toi-même, ce qui requiert du matériel pour le serveur et pour la protection

Sinon, GitHub pages peut être utilisé pour ça il me semble.

Last edited by wilhelm43 (Dec. 7, 2025 10:58:46)

everwinner64
Scratcher
1000+ posts

Sujets Avancés

[Trop tard…]

Last edited by everwinner64 (Dec. 7, 2025 11:02:03)

Kalaiecx
Scratcher
100+ posts

Sujets Avancés

everwinner64 wrote:

[Trop tard…]
?
Kalaiecx
Scratcher
100+ posts

Sujets Avancés

everwinner64 wrote:

Bonjour, depuis quelques jours, j’ai un problème auquel je ne trouve aucune explication, ni solution « native » au problème. J’ai besoin de créer un cookie avec une date de péremption. Mon code fonctionne sur ce point, mon navigateur le reconnaît entièrement, mais quand la date de péremption est atteinte, le cookie n’est pas supprimé, que je ferme ou non le navigateur. J’ai eu beau chercher quelle sombre raison en est la cause, mais je n’ai rien trouvé. Savez-vous ce qui pourrait causer ça ?

Le code qui crée le cookie :
await cookieStore.set({
       name: "visited-page",
       value: "true",
       expires: Date.now() + 12 * 60 * 60 * 1000,
       sameSite: "strict",
       path: "/"
});

A prai tu pe faire une autre commande ki se ra OBLIGÉ De supprimer le coucki
Kalaiecx
Scratcher
100+ posts

Sujets Avancés

Bonjour à tous j’ai u un problème avec mon équipe ( pas sur Scratch ) il on gonfler Leila batterie du prototype du K’Phone 17 pro + comment on dégonfle une batterie svp
numeraptor49
Scratcher
59 posts

Sujets Avancés

Il n'y a que par github qu'on peut passer ? Est ce qu'il y a un moyen plus simple ?

Last edited by numeraptor49 (Dec. 10, 2025 19:10:45)

wilhelm43
Scratcher
1000+ posts

Sujets Avancés

numeraptor49 wrote:

(#251)
Il n'y a que par github qu'on peut passer ? Est ce qu'il y a un moyen plus simple ?

Il y a les autres options que j'ai proposées.
numeraptor49
Scratcher
59 posts

Sujets Avancés

Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.
Kalaiecx
Scratcher
100+ posts

Sujets Avancés

numeraptor49 wrote:

Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.

A bah demande à CHATGPT
wilhelm43
Scratcher
1000+ posts

Sujets Avancés

numeraptor49 wrote:

(#253)
Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.

Il y aura bien quelques fournisseurs gratuits mais je te les déconseille vivement. Essaye de trouver une alternative fiable à GitHub Pages si tu ne veux pas l'utiliser. Pt que GitLab (alternative logiciel libre à GitHub) en propose une.

Kalaiecx wrote:

(#254)

numeraptor49 wrote:

Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.
A bah demande à CHATGPT
Ce n'est pas une solution.

Last edited by wilhelm43 (Dec. 10, 2025 19:29:11)

numeraptor49
Scratcher
59 posts

Sujets Avancés

wilhelm43 wrote:

numeraptor49 wrote:

(#253)
Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.

Il y aura bien quelques fournisseurs gratuits mais je te les déconseille vivement. Essaye de trouver une alternative fiable à GitHub Pages si tu ne veux pas l'utiliser. Pt que GitLab (alternative logiciel libre à GitHub) en propose une.

Kalaiecx wrote:

(#254)

numeraptor49 wrote:

Le problème étant que je n'ai ni moyen de l'héberger moi même ni de passer par un fournisseur de service.
A bah demande à CHATGPT
Ce n'est pas une solution.
Je lui ai demandé, à ce système que tout le monde semble considérer comme solution ultime : comme d'habitude, cette incapable ne m'a trouvé aucune solution convenable, même avec les meilleurs instructions. Alors qu'en venant demander à d'autres gens ici, la réponse a été beaucoup plus efficace. Bref, merci d'avoir répondu, bonne nuit (ou bonne journée). J'essaierai github demain.
borislasaucissebeige
Scratcher
500+ posts

Sujets Avancés

Désolé, je me suis trompé de réponse, je croyais que vous parlez de partager un projet unity => message supprimé

Last edited by borislasaucissebeige (Dec. 11, 2025 17:57:53)

Powered by DjangoBB